diff options
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r-- | lib/vsprintf.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 7a40c8ae2d190..a49bb6eb24350 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -3137,17 +3137,9 @@ int vbin_printf(u32 *bin_buf, size_t size, const char *fmt_str, va_list args) break; case FORMAT_STATE_NUM: - switch (fmt.size) { - case 8: + if (fmt.size > sizeof(int)) { save_arg(long long); - break; - case 1: - save_arg(char); - break; - case 2: - save_arg(short); - break; - default: + } else { save_arg(int); } } @@ -3318,23 +3310,14 @@ int bstr_printf(char *buf, size_t size, const char *fmt_str, const u32 *bin_buf) goto out; case FORMAT_STATE_NUM: - switch (fmt.size) { - case 8: + if (fmt.size > sizeof(int)) { num = get_arg(long long); - break; - case 1: - num = convert_num_spec(get_arg(char), fmt.size, spec); - break; - case 2: - num = convert_num_spec(get_arg(short), fmt.size, spec); - break; - default: + } else { num = convert_num_spec(get_arg(int), fmt.size, spec); - break; } + str = number(str, end, num, spec); + continue; } - - str = number(str, end, num, spec); } /* while(*fmt.str) */ out: |