vim_vsnprintf: fix conversion error #6311

This looks mostly like a case where the compiler that ships with Ubuntu
12.04 has gone a little too far: `fmt_spec` is actually a char, as are
the literals, so there's really no issue.
This commit is contained in:
John Szakmeister 2017-03-18 06:54:08 -04:00 committed by Justin M. Keyes
parent 9abef7ded9
commit c6b3975774

View File

@ -1228,7 +1228,7 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap,
l += snprintf(format + 1, sizeof(format) - 1, ".%d", l += snprintf(format + 1, sizeof(format) - 1, ".%d",
(int)precision); (int)precision);
} }
format[l] = fmt_spec == 'F' ? 'f' : fmt_spec; format[l] = (char)(fmt_spec == 'F' ? 'f' : fmt_spec);
format[l + 1] = NUL; format[l + 1] = NUL;
assert(l + 1 < (int)sizeof(format)); assert(l + 1 < (int)sizeof(format));
str_arg_l = (size_t)snprintf(tmp, sizeof(tmp), format, f); str_arg_l = (size_t)snprintf(tmp, sizeof(tmp), format, f);