diff --git a/cfg/gtk.cfg b/cfg/gtk.cfg index 3aee2e2b1a2..e8e86043b4f 100644 --- a/cfg/gtk.cfg +++ b/cfg/gtk.cfg @@ -3285,8 +3285,7 @@ - - + @@ -3299,9 +3298,8 @@ - + - diff --git a/test/cfg/gtk.c b/test/cfg/gtk.c index b923135e2d9..f3e0f032b5e 100644 --- a/test/cfg/gtk.c +++ b/test/cfg/gtk.c @@ -655,3 +655,28 @@ int g_return_val_if_reached_test(const char *s) { return 0; } + +void g_ascii_formatd_test(double d) +{ + // g_ascii_formatd() writes the buffer and formats exactly one double + gchar buf[39]; + g_ascii_formatd(buf, sizeof(buf), "%.2f", d); + g_print("%s", buf); + + // cppcheck-suppress invalidPrintfArgType_sint + g_ascii_formatd(buf, sizeof(buf), "%d", d); + g_print("%s", buf); + + gchar small[4]; + // cppcheck-suppress bufferAccessOutOfBounds + g_ascii_formatd(small, sizeof(buf), "%.2f", d); + g_print("%s", small); +} + +void g_ascii_formatd_format_test(const gchar *format, int i) +{ + gchar buf[39]; + // cppcheck-suppress invalidFunctionArgBool + g_ascii_formatd(buf, sizeof(buf), format, i == 1); + g_print("%s", buf); +}