From 2c1f579b3b21a3fdeae77dc5958cbe99811e4cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 21 Nov 2013 16:32:53 +0100 Subject: [PATCH] Library: Fixed formatstr handling --- lib/library.cpp | 4 ++-- test/testlibrary.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lib/library.cpp b/lib/library.cpp index a69d1fcae..1fece701b 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -115,9 +115,9 @@ bool Library::load(const tinyxml2::XMLDocument &doc) else if (strcmp(argnode->Name(), "not-uninit") == 0) notuninit = true; else if (strcmp(argnode->Name(), "formatstr") == 0) - notuninit = true; + formatstr = true; else if (strcmp(argnode->Name(), "strz") == 0) - notuninit = true; + strz = true; else return false; } diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index 9b742f689..74f958245 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -28,6 +28,7 @@ private: void run() { TEST_CASE(empty); TEST_CASE(function); + TEST_CASE(function_arg); TEST_CASE(memory); } @@ -61,6 +62,35 @@ private: ASSERT(library.isnotnoreturn("foo")); } + void function_arg() { + const char xmldata[] = "\n" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + ""; + tinyxml2::XMLDocument doc; + doc.Parse(xmldata, sizeof(xmldata)); + + Library library; + library.load(doc); + ASSERT_EQUALS(true, library.argumentChecks["foo"][1].notuninit); + ASSERT_EQUALS(true, library.argumentChecks["foo"][2].notnull); + ASSERT_EQUALS(true, library.argumentChecks["foo"][3].formatstr); + ASSERT_EQUALS(true, library.argumentChecks["foo"][4].strz); + } + void memory() { const char xmldata[] = "\n" "\n"