File tree 4 files changed +10
-5
lines changed 4 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ endif()
103
103
104
104
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
105
105
# 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 " )
107
107
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
108
108
# using GCC
109
109
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 114
114
#define JSONCPP_DEPRECATED (message )
115
115
#endif // if !defined(JSONCPP_DEPRECATED)
116
116
117
+ #if __GNUC__ >= 6
118
+ # define JSON_USE_INT64_DOUBLE_CONVERSION 1
119
+ #endif
120
+
117
121
namespace Json {
118
122
typedef int Int;
119
123
typedef unsigned int UInt;
Original file line number Diff line number Diff line change @@ -231,7 +231,7 @@ Value::CZString::CZString(const CZString& other)
231
231
: cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0
232
232
? duplicateStringValue(other.cstr_, other.storage_.length_)
233
233
: other.cstr_) {
234
- storage_.policy_ = (other.cstr_
234
+ storage_.policy_ = static_cast < unsigned > (other.cstr_
235
235
? (static_cast <DuplicationPolicy>(other.storage_ .policy_ ) == noDuplication
236
236
? noDuplication : duplicate)
237
237
: static_cast <DuplicationPolicy>(other.storage_ .policy_ ));
@@ -784,7 +784,8 @@ float Value::asFloat() const {
784
784
#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
785
785
return static_cast <float >(value_.uint_ );
786
786
#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_ ));
788
789
#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
789
790
case realValue:
790
791
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) {
560
560
void StyledWriter::indent () { indentString_ += std::string (indentSize_, ' ' ); }
561
561
562
562
void StyledWriter::unindent () {
563
- assert (int ( indentString_.size () ) >= indentSize_);
563
+ assert (indentString_.size () >= indentSize_);
564
564
indentString_.resize (indentString_.size () - indentSize_);
565
565
}
566
566
@@ -857,7 +857,7 @@ struct BuiltStyledStreamWriter : public StreamWriter
857
857
858
858
ChildValues childValues_;
859
859
std::string indentString_;
860
- int rightMargin_;
860
+ unsigned int rightMargin_;
861
861
std::string indentation_;
862
862
CommentStyle::Enum cs_;
863
863
std::string colonSymbol_;
You can’t perform that action at this time.
0 commit comments