mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 15:29:05 +00:00
main/say: Work around gcc 9 format-truncation false positive
Version: gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Warning:
say.c:2371:24: error: ‘%d’ directive output may be truncated writing
between 1 and 11 bytes into a region of size 10
[-Werror=format-truncation=]
2371 | snprintf(buf, 10, "%d", num);
say.c:2371:23: note: directive argument in the range [-2147483648, 9]
That's not possible though, as the if() starts out checking for (num < 0),
making this Warning a false positive.
(Also replaced some else<TAB>if with else<SP>if while in the vicinity.)
Change-Id: Ic7a70120188c9aa525a6d70289385bfce878438a
This commit is contained in:
@@ -2496,7 +2496,7 @@ static int ast_say_number_full_zh(struct ast_channel *chan, int num, const char
|
||||
snprintf(fn, sizeof(fn), "digits/thousand");
|
||||
playt = 0;
|
||||
} else if (num < 10) {
|
||||
snprintf(buf, 10, "%d", num);
|
||||
snprintf(buf, 12, "%d", num);
|
||||
if (last_length - strlen(buf) > 1 && last_length != 0) {
|
||||
last_length = strlen(buf);
|
||||
playz++;
|
||||
|
||||
Reference in New Issue
Block a user