File tree Expand file tree Collapse file tree 4 files changed +10
-5
lines changed
Expand file tree Collapse file tree 4 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ endif()
103103
104104if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
105105 # using regular Clang or AppleClang
106- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wno-sign- conversion -Werror=conversion " )
106+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Werror= conversion -Werror=sign-compare " )
107107elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
108108 # using GCC
109109 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra -Werror=conversion" )
Original file line number Diff line number Diff line change 114114#define JSONCPP_DEPRECATED (message )
115115#endif // if !defined(JSONCPP_DEPRECATED)
116116
117+ #if __GNUC__ >= 6
118+ # define JSON_USE_INT64_DOUBLE_CONVERSION 1
119+ #endif
120+
117121namespace Json {
118122typedef int Int;
119123typedef unsigned int UInt;
Original file line number Diff line number Diff line change @@ -231,7 +231,7 @@ Value::CZString::CZString(const CZString& other)
231231 : cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0
232232 ? duplicateStringValue(other.cstr_, other.storage_.length_)
233233 : other.cstr_) {
234- storage_.policy_ = (other.cstr_
234+ storage_.policy_ = static_cast < unsigned > (other.cstr_
235235 ? (static_cast <DuplicationPolicy>(other.storage_ .policy_ ) == noDuplication
236236 ? noDuplication : duplicate)
237237 : static_cast <DuplicationPolicy>(other.storage_ .policy_ ));
@@ -784,7 +784,8 @@ float Value::asFloat() const {
784784#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
785785 return static_cast <float >(value_.uint_ );
786786#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
787- return integerToDouble (value_.uint_ );
787+ // This can fail (silently?) if the value is bigger than MAX_FLOAT.
788+ return static_cast <float >(integerToDouble (value_.uint_ ));
788789#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
789790 case realValue:
790791 return static_cast <float >(value_.real_ );
Original file line number Diff line number Diff line change @@ -560,7 +560,7 @@ void StyledWriter::writeWithIndent(const std::string& value) {
560560void StyledWriter::indent () { indentString_ += std::string (indentSize_, ' ' ); }
561561
562562void StyledWriter::unindent () {
563- assert (int ( indentString_.size () ) >= indentSize_);
563+ assert (indentString_.size () >= indentSize_);
564564 indentString_.resize (indentString_.size () - indentSize_);
565565}
566566
@@ -857,7 +857,7 @@ struct BuiltStyledStreamWriter : public StreamWriter
857857
858858 ChildValues childValues_;
859859 std::string indentString_;
860- int rightMargin_;
860+ unsigned int rightMargin_;
861861 std::string indentation_;
862862 CommentStyle::Enum cs_;
863863 std::string colonSymbol_;
You can’t perform that action at this time.
0 commit comments