From 985de211af3a46a261a05ca8a784141c44b33bd0 Mon Sep 17 00:00:00 2001 From: Jason Sanmiya Date: Thu, 8 Sep 2016 10:47:50 -0700 Subject: [PATCH] Fix Windows warnings. Cmake issued a warning when the variable is in quotation marks in an if statement. Visual Studio upgrades constants to int and issues a truncation warning, so inserted a cast. Change-Id: I60cdcb5c2565cd5e97f80b9c2ff1e6abc32b1deb Tested: Builds without warning on VS2015. --- CMakeLists.txt | 2 +- src/idl_gen_text.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1af3d3334..b3fa774ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,7 +119,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char") -elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") +elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -stdlib=libc++ -Wall -pedantic -Werror \ -Wextra") diff --git a/src/idl_gen_text.cpp b/src/idl_gen_text.cpp index 4ff13c8a9..17cd987dd 100644 --- a/src/idl_gen_text.cpp +++ b/src/idl_gen_text.cpp @@ -148,12 +148,12 @@ static bool EscapeString(const String &s, std::string *_text, const IDLOptions& } else if (ucc <= 0x10FFFF) { // Encode Unicode SMP values to a surrogate pair using two \u escapes. uint32_t base = ucc - 0x10000; - uint16_t highSurrogate = (base >> 10) + 0xD800; - uint16_t lowSurrogate = (base & 0x03FF) + 0xDC00; + auto high_surrogate = (base >> 10) + 0xD800; + auto low_surrogate = (base & 0x03FF) + 0xDC00; text += "\\u"; - text += IntToStringHex(highSurrogate, 4); + text += IntToStringHex(high_surrogate, 4); text += "\\u"; - text += IntToStringHex(lowSurrogate, 4); + text += IntToStringHex(low_surrogate, 4); } // Skip past characters recognized. i = static_cast(utf8 - s.c_str() - 1);