From 5d0e3489aeba0849defa310bb48818944b60d62d Mon Sep 17 00:00:00 2001 From: Greg Zaverucha Date: Mon, 6 Mar 2017 10:24:13 -0800 Subject: [PATCH] Disable warning 4429 in test code This warning was being produced incorrectly, and causing a build break. Change-Id: Ifcd71e471fd4fa92ca080006149b1f218fcbaa71 Signed-off-by: Greg Zaverucha Reviewed-on: https://gerrit.iotivity.org/gerrit/17679 Tested-by: jenkins-iotivity Reviewed-by: Alex Kelley Reviewed-by: Kevin Kane Reviewed-by: Dave Thaler --- resource/csdk/security/unittest/SConscript | 5 +++-- resource/csdk/security/unittest/srmtestcommon.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/resource/csdk/security/unittest/SConscript b/resource/csdk/security/unittest/SConscript index cf2aa7b..4df17d6 100644 --- a/resource/csdk/security/unittest/SConscript +++ b/resource/csdk/security/unittest/SConscript @@ -107,9 +107,10 @@ unittest = srmtest_env.Program('unittest', ['aclresourcetest.cpp', Alias("test", [unittest]) unittest_src_dir = os.path.join(src_dir, 'resource', 'csdk', 'security', 'unittest') + os.sep -unittest_build_dir = os.path.join(srmtest_env.get('BUILD_DIR'), 'resource', 'csdk', 'security', 'unittest') + os.sep +unittest_build_dir = os.path.join(srmtest_env.get('BUILD_DIR'), 'resource', 'csdk', 'security', 'unittest') +unittest_build_dir = os.path.normpath(unittest_build_dir) + os.sep -srmtest_env.AppendUnique(CPPDEFINES = ['SECURITY_BUILD_UNITTEST_DIR='+unittest_build_dir.encode('string_escape')]) +srmtest_env.AppendUnique(CPPDEFINES = ['SECURITY_BUILD_UNITTEST_DIR='+unittest_build_dir.encode('string_escape').replace("\\", "\\\\")]) srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir, unittest_src_dir + 'oic_unittest.json')) diff --git a/resource/csdk/security/unittest/srmtestcommon.cpp b/resource/csdk/security/unittest/srmtestcommon.cpp index 3c9555d..ab592d0 100644 --- a/resource/csdk/security/unittest/srmtestcommon.cpp +++ b/resource/csdk/security/unittest/srmtestcommon.cpp @@ -71,6 +71,13 @@ bool ReadCBORFile(const char* filename, const char* rsrcname, uint8_t **payload, uint8_t *data = NULL; size_t size = 0; +#ifdef _MSC_VER +// The path SECURITY_BUILD_UNITTEST_DIR can contain '\u' which VS misinterprets as a universal +// character name in the STRINGIZE macro and outputs warning C4429 'possible incomplete or +// improperly formed universal-character-name' https://msdn.microsoft.com/en-us/library/z78hwa6k.aspx +#pragma warning(push) +#pragma warning(disable:4429) +#endif size_t len = strlen(STRINGIZE(SECURITY_BUILD_UNITTEST_DIR)) + strlen(filename) + 1; char *filepath = (char *)OICCalloc(1, len); if (!filepath) @@ -81,6 +88,10 @@ bool ReadCBORFile(const char* filename, const char* rsrcname, uint8_t **payload, int ret = snprintf(filepath, len, "%s%s", STRINGIZE(SECURITY_BUILD_UNITTEST_DIR), filename); printf("Root build path: %s \n", filepath); +#ifdef _MSC_VER +#pragma warning(pop) +#endif + if (ret == (int)(len - 1)) { FILE *fp = fopen(filepath, "rb"); -- 2.7.4