mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-27 11:21:02 +08:00
Ran clang-format over all .h and .cpp files.
clang-format -i $(find . -name '*.h' -or -name '*.cpp')
This commit is contained in:
parent
32009b17e4
commit
30b07c0275
@ -133,7 +133,7 @@ public:
|
||||
typedef Json::LargestUInt LargestUInt;
|
||||
typedef Json::ArrayIndex ArrayIndex;
|
||||
|
||||
static const Value& null;
|
||||
static const Value &null;
|
||||
/// Minimum signed integer value that can be stored in a Json::Value.
|
||||
static const LargestInt minLargestInt;
|
||||
/// Maximum signed integer value that can be stored in a Json::Value.
|
||||
|
@ -2,13 +2,15 @@
|
||||
// and "version.h.in" files.
|
||||
// Run CMake configure step to update it.
|
||||
#ifndef JSON_VERSION_H_INCLUDED
|
||||
# define JSON_VERSION_H_INCLUDED
|
||||
#define JSON_VERSION_H_INCLUDED
|
||||
|
||||
# define JSONCPP_VERSION_STRING "0.6.0-dev"
|
||||
# define JSONCPP_VERSION_MAJOR 0
|
||||
# define JSONCPP_VERSION_MINOR 6
|
||||
# define JSONCPP_VERSION_PATCH 0
|
||||
# define JSONCPP_VERSION_QUALIFIER -dev
|
||||
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
||||
#define JSONCPP_VERSION_STRING "0.6.0-dev"
|
||||
#define JSONCPP_VERSION_MAJOR 0
|
||||
#define JSONCPP_VERSION_MINOR 6
|
||||
#define JSONCPP_VERSION_PATCH 0
|
||||
#define JSONCPP_VERSION_QUALIFIER -dev
|
||||
#define JSONCPP_VERSION_HEXA \
|
||||
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
|
||||
(JSONCPP_VERSION_PATCH << 8))
|
||||
|
||||
#endif // JSON_VERSION_H_INCLUDED
|
||||
|
@ -781,11 +781,11 @@ std::string Reader::getLocationLineAndColumn(Location location) const {
|
||||
getLocationLineAndColumn(location, line, column);
|
||||
char buffer[18 + 16 + 16 + 1];
|
||||
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
|
||||
#if defined(WINCE)
|
||||
#if defined(WINCE)
|
||||
_snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
||||
#else
|
||||
#else
|
||||
sprintf_s(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
|
||||
#endif
|
||||
|
@ -73,7 +73,7 @@ static inline void uintToString(LargestUInt value, char *¤t) {
|
||||
* We had a sophisticated way, but it did not work in WinCE.
|
||||
* @see https://github.com/open-source-parsers/jsoncpp/pull/9
|
||||
*/
|
||||
static inline void fixNumericLocale(char* begin, char* end) {
|
||||
static inline void fixNumericLocale(char *begin, char *end) {
|
||||
while (begin < end) {
|
||||
if (*begin == ',') {
|
||||
*begin = '.';
|
||||
|
@ -33,9 +33,9 @@ namespace Json {
|
||||
#else
|
||||
#define ALIGNAS(byte_alignment)
|
||||
#endif
|
||||
static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = {0};
|
||||
const unsigned char& kNullRef = kNull[0];
|
||||
const Value& Value::null = reinterpret_cast<const Value&>(kNullRef);
|
||||
static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = { 0 };
|
||||
const unsigned char &kNullRef = kNull[0];
|
||||
const Value &Value::null = reinterpret_cast<const Value &>(kNullRef);
|
||||
|
||||
const Int Value::minInt = Int(~(UInt(-1) / 2));
|
||||
const Int Value::maxInt = Int(UInt(-1) / 2);
|
||||
@ -104,9 +104,7 @@ static inline char *duplicateStringValue(const char *value,
|
||||
|
||||
/** Free the string duplicated by duplicateStringValue().
|
||||
*/
|
||||
static inline void releaseStringValue(char *value) {
|
||||
free(value);
|
||||
}
|
||||
static inline void releaseStringValue(char *value) { free(value); }
|
||||
|
||||
} // namespace Json
|
||||
|
||||
|
@ -75,27 +75,27 @@ std::string valueToString(double value) {
|
||||
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with
|
||||
// visual studio 2005 to
|
||||
// avoid warning.
|
||||
#if defined(WINCE)
|
||||
#if defined(WINCE)
|
||||
len = _snprintf(buffer, sizeof(buffer), "%.16g", value);
|
||||
#else
|
||||
len = sprintf_s(buffer, sizeof(buffer), "%.16g", value);
|
||||
#endif
|
||||
#else
|
||||
if (isfinite( value )) {
|
||||
len = sprintf_s(buffer, sizeof(buffer), "%.16g", value);
|
||||
#endif
|
||||
#else
|
||||
if (isfinite(value)) {
|
||||
len = snprintf(buffer, sizeof(buffer), "%.16g", value);
|
||||
} else {
|
||||
// IEEE standard states that NaN values will not compare to themselves
|
||||
if ( value != value) {
|
||||
len = snprintf(buffer, sizeof(buffer), "null");
|
||||
} else if ( value < 0) {
|
||||
len = snprintf(buffer, sizeof(buffer), "-1e+9999");
|
||||
} else {
|
||||
len = snprintf(buffer, sizeof(buffer), "1e+9999");
|
||||
}
|
||||
// For those, we do not need to call fixNumLoc, but it is fast.
|
||||
// IEEE standard states that NaN values will not compare to themselves
|
||||
if (value != value) {
|
||||
len = snprintf(buffer, sizeof(buffer), "null");
|
||||
} else if (value < 0) {
|
||||
len = snprintf(buffer, sizeof(buffer), "-1e+9999");
|
||||
} else {
|
||||
len = snprintf(buffer, sizeof(buffer), "1e+9999");
|
||||
}
|
||||
// For those, we do not need to call fixNumLoc, but it is fast.
|
||||
}
|
||||
#endif
|
||||
assert(len>=0);
|
||||
assert(len >= 0);
|
||||
fixNumericLocale(buffer, buffer + len);
|
||||
return buffer;
|
||||
}
|
||||
@ -172,7 +172,8 @@ Writer::~Writer() {}
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
|
||||
FastWriter::FastWriter()
|
||||
: yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false), omitEndingLineFeed_(false) {}
|
||||
: yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false),
|
||||
omitEndingLineFeed_(false) {}
|
||||
|
||||
void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; }
|
||||
|
||||
|
@ -247,12 +247,13 @@ TestResult &checkStringEqual(TestResult &result,
|
||||
bool _threw = false; \
|
||||
try { \
|
||||
expr; \
|
||||
} catch (...) { \
|
||||
} \
|
||||
catch (...) { \
|
||||
_threw = true; \
|
||||
} \
|
||||
if (!_threw) \
|
||||
result_->addFailure(__FILE__, __LINE__, \
|
||||
"expected exception thrown: " #expr); \
|
||||
result_->addFailure( \
|
||||
__FILE__, __LINE__, "expected exception thrown: " #expr); \
|
||||
}
|
||||
|
||||
/// \brief Begin a fixture test case.
|
||||
|
Loading…
x
Reference in New Issue
Block a user