mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-04-27 18:30:50 +02:00
commit
da0c50f7b2
@ -103,7 +103,7 @@ endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# using regular Clang or AppleClang
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wno-sign-conversion -Werror=conversion")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare")
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# using GCC
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra -Werror=conversion")
|
||||
|
@ -114,6 +114,10 @@
|
||||
#define JSONCPP_DEPRECATED(message)
|
||||
#endif // if !defined(JSONCPP_DEPRECATED)
|
||||
|
||||
#if __GNUC__ >= 6
|
||||
# define JSON_USE_INT64_DOUBLE_CONVERSION 1
|
||||
#endif
|
||||
|
||||
namespace Json {
|
||||
typedef int Int;
|
||||
typedef unsigned int UInt;
|
||||
|
@ -231,7 +231,7 @@ Value::CZString::CZString(const CZString& other)
|
||||
: cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0
|
||||
? duplicateStringValue(other.cstr_, other.storage_.length_)
|
||||
: other.cstr_) {
|
||||
storage_.policy_ = (other.cstr_
|
||||
storage_.policy_ = static_cast<unsigned>(other.cstr_
|
||||
? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
|
||||
? noDuplication : duplicate)
|
||||
: static_cast<DuplicationPolicy>(other.storage_.policy_));
|
||||
@ -784,7 +784,8 @@ float Value::asFloat() const {
|
||||
#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
||||
return static_cast<float>(value_.uint_);
|
||||
#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
||||
return integerToDouble(value_.uint_);
|
||||
// This can fail (silently?) if the value is bigger than MAX_FLOAT.
|
||||
return static_cast<float>(integerToDouble(value_.uint_));
|
||||
#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
|
||||
case realValue:
|
||||
return static_cast<float>(value_.real_);
|
||||
|
@ -560,7 +560,7 @@ void StyledWriter::writeWithIndent(const std::string& value) {
|
||||
void StyledWriter::indent() { indentString_ += std::string(indentSize_, ' '); }
|
||||
|
||||
void StyledWriter::unindent() {
|
||||
assert(int(indentString_.size()) >= indentSize_);
|
||||
assert(indentString_.size() >= indentSize_);
|
||||
indentString_.resize(indentString_.size() - indentSize_);
|
||||
}
|
||||
|
||||
@ -857,7 +857,7 @@ private:
|
||||
|
||||
ChildValues childValues_;
|
||||
std::string indentString_;
|
||||
int rightMargin_;
|
||||
unsigned int rightMargin_;
|
||||
std::string indentation_;
|
||||
CommentStyle::Enum cs_;
|
||||
std::string colonSymbol_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user