summaryrefslogtreecommitdiffstats
path: root/src/cindent.c
AgeCommit message (Collapse)Author
2024-01-12patch 9.1.0022: Coverity complains about improper use of negative valuev9.1.0022Christian Brabandt
Problem: Coverity complains about improper use of negative value Solution: Add a condition to validate that keytyped is larger or equal to 0 Apparently patch 9.1.0006 made it more explicit for Coverity, that the TOLOWER_LOC() macros do not handle negative values properly. However, that condition has always been there even before that, so add a condition to verify that keytyped is indeed at least 0 closes: #13824 Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-30patch 9.0.2138: Overflow logic requires long longv9.0.2138Ernie Rael
Problem: Overflow logic requires long long Solution: Define vimlong_T data type to make life easier for porters closes: #13598 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-23patch 9.0.2124: INT overflow detection logic can be simplifiedv9.0.2124Ernie Rael
Problem: INT overflow logic can be simplified Solution: introduce trim_to_int() function closes: #13556 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-22patch 9.0.2122: [security]: prevent overflow in indentingv9.0.2122Christian Brabandt
Problem: [security]: prevent overflow in indenting Solution: use long long and remove cast to (int) The shiftwidth option values are defined as being long. However, when calculating the actual amount of indent, we cast down to (int), which may cause the shiftwidth value to become negative and later it may even cause Vim to try to allocate a huge amount of memory. We already use long and long long variable types to calculate the indent (and detect possible overflows), so the cast to (int) seems superfluous and can be safely removed. So let's just remove the (int) cast and calculate the indent using longs. Additionally, the 'shiftwidth' option value is also used when determining the actual 'cino' options. There it can again cause another overflow, so make sure it is safe in parse_cino() as well. fixes: #13554 closes: #13555 Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-05-09patch 9.0.1529: code style test doesn't check for space after "if"v9.0.1529Bram Moolenaar
Problem: Code style test doesn't check for space after "if". Solution: Add a test for space.
2023-03-24patch 9.0.1426: indent wrong after "export namespace" in C++v9.0.1426Virginia Senioria
Problem: Indent wrong after "export namespace" in C++. Solution: Skip over "inline" and "export" in any order. (Virginia Senioria, closes #12134, closes #12133)
2023-01-22patch 9.0.1234: the code style has to be checked manuallyv9.0.1234Bram Moolenaar
Problem: The code style has to be checked manually. Solution: Add basic code style checks in a test. Fix or avoid uncovered problems.
2023-01-09patch 9.0.1166: code is indented more than necessaryv9.0.1166Yegappan Lakshmanan
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11792)
2022-11-14patch 9.0.0880: preprocessor indenting is offv9.0.0880K.Takata
Problem: Preprocessor indenting is off. Solution: Adjust preprocessor indentation. (Ken Takata, closes #11546)
2022-07-27patch 9.0.0095: conditions are always truev9.0.0095zeertzjq
Problem: Conditions are always true. Solution: Remove useless conditions. (closes #10802)
2022-06-30patch 9.0.0013: reproducing memory access errors can be difficultv9.0.0013Bram Moolenaar
Problem: Reproducing memory access errors can be difficult. Solution: When testing, copy each line to allocated memory, so that valgrind can detect accessing memory before and/or after it. Fix uncovered problems.
2022-05-21patch 8.2.4993: smart/C/lisp indenting is optionalv8.2.4993Bram Moolenaar
Problem: smart/C/lisp indenting is optional, which makes the code more complex, while it only reduces the executable size a bit. Solution: Graduate FEAT_CINDENT, FEAT_SMARTINDENT and FEAT_LISP.
2022-05-16patch 8.2.4968: reading past end of the line when C-indentingv8.2.4968Bram Moolenaar
Problem: Reading past end of the line when C-indenting. Solution: Check for NUL.
2022-05-09patch 8.2.4928: various white space and cosmetic mistakesv8.2.4928Bram Moolenaar
Problem: Various white space and cosmetic mistakes. Solution: Change spaces to tabs, improve comments.
2022-05-07patch 8.2.4911: the mode #defines are not clearly namedv8.2.4911Bram Moolenaar
Problem: The mode #defines are not clearly named. Solution: Prepend MODE_. Renumber them to put the mapped modes first.
2022-04-17patch 8.2.4773: build failure without the +eval featurev8.2.4773Bram Moolenaar
Problem: Build failure without the +eval feature. Solution: Use other error message. Avoid warnings.
2022-04-07patch 8.2.4703: memory leak in handling 'cinscopedecls'v8.2.4703Bram Moolenaar
Problem: Memory leak in handling 'cinscopedecls'. Solution: Free the memory before returning.
2022-04-07patch 8.2.4702: C++ scope labels are hard-codedv8.2.4702Tom Praschan
Problem: C++ scope labels are hard-coded. Solution: Add 'cinscopedecls' to define the labels. (Rom Praschan, closes #10109)
2022-01-31patch 8.2.4273: the EBCDIC support is outdatedv8.2.4273Bram Moolenaar
Problem: The EBCDIC support is outdated. Solution: Remove the EBCDIC support.
2021-12-29patch 8.2.3938: line comment start is also found in a stringv8.2.3938Bram Moolenaar
Problem: Line comment start is also found in a string. Solution: Skip line comments in a string.
2021-12-27patch 8.2.3914: various spelling mistakes in commentsv8.2.3914Dominique Pelle
Problem: Various spelling mistakes in comments. Solution: Fix the mistakes. (Dominique Pellé, closes #9416)
2021-12-22patch 8.2.3876: 'cindent' does not recognize inline namespacev8.2.3876zeertzjq
Problem: 'cindent' does not recognize inline namespace. Solution: Skip over "inline" to find "namespace". (closes #9383)
2021-12-12patch 8.2.3787: no proper formatting of a C line comment after a statementv8.2.3787Bram Moolenaar
Problem: No proper formatting of a C line comment after a statement. Solution: Find the start of the line comment, insert the comment leader and indent the comment properly.
2021-11-19patch 8.2.3625: illegal memory access when C-indentingv8.2.3625Bram Moolenaar
Problem: Illegal memory access when C-indenting. Solution: Also set the cursor column.
2021-10-05patch 8.2.3482: reading beyond end of line ending in quote and backslashv8.2.3482Bram Moolenaar
Problem: Reading beyond end of line ending in quote and backslash. Solution: Check for non-NUL after backslash. (closes #8964)
2021-07-27patch 8.2.3229: Vim9: runtime and compile time type checks are not the samev8.2.3229Yegappan Lakshmanan
Problem: Vim9: runtime and compile time type checks are not the same. Solution: Add more runtime type checks for builtin functions. (Yegappan Lakshmanan, closes #8646)
2021-06-02patch 8.2.2922: computing array length is done in various waysv8.2.2922K.Takata
Problem: Computing array length is done in various ways. Solution: Use ARRAY_LENGTH everywhere. (Ken Takata, closes #8305)
2020-12-18patch 8.2.2160: various typosv8.2.2160Bram Moolenaar
Problem: Various typos. Solution: Fix spelling mistakes. (closes #7494)
2020-05-31patch 8.2.0864: pragmas are indented all the way to the leftv8.2.0864Bram Moolenaar
Problem: Pragmas are indented all the way to the left. Solution: Add an option to indent progmas like normal code. (Max Rumpf, closes #5468)
2020-01-12patch 8.2.0112: illegal memory access when using 'cindent'v8.2.0112Bram Moolenaar
Problem: Illegal memory access when using 'cindent'. Solution: Check for NUL byte. (Dominique Pelle, closes #5470)
2019-11-30patch 8.1.2368: using old C style commentsv8.1.2368Bram Moolenaar
Problem: Using old C style comments. Solution: Use // comments where appropriate.
2019-11-02patch 8.1.2243: typos in commentsv8.1.2243Bram Moolenaar
Problem: Typos in comments. Solution: Fix the typos. (Dominique Pelle, closes #5160) Also adjust formatting a bit.
2019-10-09patch 8.1.2127: the indent.c file is a bit bigv8.1.2127Bram Moolenaar
Problem: The indent.c file is a bit big. Solution: Move C-indent code a a new cindent.c file. Move other indent-related code to indent.c. (Yegappan Lakshmanan, closes #5031)