Enable -Wconversion: indent.c.

Note: Clint was failing because of recommending not to use long. But
converting to long is the proper refactoring here, in as far as other
longs exist. We could, then, disable clint rule, or remove this file
from checking. We choose the former, as it's being discussed what to do
with longs, but a decision has not been taken. So, it seems most
reasonable to allow longs for now, to enable proper refactorings, and
then, when a decision is taken, refactor all longs to some other thing.
This commit is contained in:
Eliseo Martínez 2015-02-12 16:11:04 +01:00 committed by Justin M. Keyes
parent 7dd48d7af0
commit 94db26edbd
3 changed files with 9 additions and 6 deletions

View File

@ -2776,7 +2776,7 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
# TODO(unknown): figure out if they're using default arguments in fn proto.
# Check if people are using the verboten C basic types.
match = Search(r'\b(short|long(?! +double)|long long)\b', line)
match = Search(r'\b(short|long long)\b', line)
if match:
error(filename, linenum, 'runtime/int', 4,
'Use int16_t/int64_t/etc, rather than the C type %s'

View File

@ -63,7 +63,6 @@ set(CONV_SOURCES
fold.c
getchar.c
if_cscope.c
indent.c
keymap.c
mbyte.c
memline.c

View File

@ -1,3 +1,4 @@
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
@ -198,7 +199,8 @@ int set_indent(int size, int flags)
// characters and allocate accordingly. We will fill the rest with spaces
// after the if (!curbuf->b_p_et) below.
if (orig_char_len != -1) {
newline = xmalloc(orig_char_len + size - ind_done + line_len);
assert(orig_char_len + size - ind_done + line_len >= 0);
newline = xmalloc((size_t)(orig_char_len + size - ind_done + line_len));
todo = size - ind_done;
// Set total length of indent in characters, which may have been
@ -219,7 +221,8 @@ int set_indent(int size, int flags)
}
} else {
todo = size;
newline = xmalloc(ind_len + line_len);
assert(ind_len + line_len >= 0);
newline = xmalloc((size_t)(ind_len + line_len));
s = newline;
}
@ -384,7 +387,8 @@ int copy_indent(int size, char_u *src)
// Allocate memory for the result: the copied indent, new indent
// and the rest of the line.
line_len = (int)STRLEN(get_cursor_line_ptr()) + 1;
line = xmalloc(ind_len + line_len);
assert(ind_len + line_len >= 0);
line = xmalloc((size_t)(ind_len + line_len));
p = line;
}
}
@ -449,7 +453,7 @@ int get_number_indent(linenr_T lnum)
*/
int get_breakindent_win(win_T *wp, char_u *line) {
static int prev_indent = 0; /* cached indent value */
static int prev_ts = 0L; /* cached tabstop value */
static long prev_ts = 0; /* cached tabstop value */
static char_u *prev_line = NULL; /* cached pointer to line */
static int prev_tick = 0; // changedtick of cached value
int bri = 0;