diff options
Diffstat (limited to 'expat/tests/chardata.c')
-rw-r--r-- | expat/tests/chardata.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/expat/tests/chardata.c b/expat/tests/chardata.c index d1989a84..2adb2c54 100644 --- a/expat/tests/chardata.c +++ b/expat/tests/chardata.c @@ -9,9 +9,10 @@ Copyright (c) 2002-2004 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> Copyright (c) 2003 Greg Stein <gstein@users.sourceforge.net> Copyright (c) 2016 Gilles Espinasse <g.esp@free.fr> - Copyright (c) 2016-2021 Sebastian Pipping <sebastian@pipping.org> + Copyright (c) 2016-2023 Sebastian Pipping <sebastian@pipping.org> Copyright (c) 2017 Joe Orton <jorton@redhat.com> Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk> + Copyright (c) 2022 Sean McBride <sean@rogue-research.com> Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -34,7 +35,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include <expat_config.h> +#if defined(NDEBUG) +# undef NDEBUG /* because test suite relies on assert(...) at the moment */ +#endif + +#include "expat_config.h" #include "minicheck.h" #include <assert.h> @@ -80,15 +85,16 @@ CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len) { int CharData_CheckXMLChars(CharData *storage, const XML_Char *expected) { - char buffer[1024]; int len = xmlstrlen(expected); int count; assert(storage != NULL); count = (storage->count < 0) ? 0 : storage->count; if (len != count) { - sprintf(buffer, "wrong number of data characters: got %d, expected %d", - count, len); + char buffer[1024]; + snprintf(buffer, sizeof(buffer), + "wrong number of data characters: got %d, expected %d", count, + len); fail(buffer); return 0; } |