Ran clang-format over all .h and .cpp files.

clang-format -i $(find . -name '*.h' -or -name '*.cpp')
This commit is contained in:
Aaron Jacobs 2014-09-15 10:14:48 +10:00
parent 32009b17e4
commit 30b07c0275
7 changed files with 39 additions and 37 deletions

View File

@ -133,7 +133,7 @@ public:
typedef Json::LargestUInt LargestUInt; typedef Json::LargestUInt LargestUInt;
typedef Json::ArrayIndex ArrayIndex; typedef Json::ArrayIndex ArrayIndex;
static const Value& null; static const Value &null;
/// Minimum signed integer value that can be stored in a Json::Value. /// Minimum signed integer value that can be stored in a Json::Value.
static const LargestInt minLargestInt; static const LargestInt minLargestInt;
/// Maximum signed integer value that can be stored in a Json::Value. /// Maximum signed integer value that can be stored in a Json::Value.

View File

@ -2,13 +2,15 @@
// and "version.h.in" files. // and "version.h.in" files.
// Run CMake configure step to update it. // Run CMake configure step to update it.
#ifndef JSON_VERSION_H_INCLUDED #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_STRING "0.6.0-dev"
# define JSONCPP_VERSION_MAJOR 0 #define JSONCPP_VERSION_MAJOR 0
# define JSONCPP_VERSION_MINOR 6 #define JSONCPP_VERSION_MINOR 6
# define JSONCPP_VERSION_PATCH 0 #define JSONCPP_VERSION_PATCH 0
# define JSONCPP_VERSION_QUALIFIER -dev #define JSONCPP_VERSION_QUALIFIER -dev
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8)) #define JSONCPP_VERSION_HEXA \
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
(JSONCPP_VERSION_PATCH << 8))
#endif // JSON_VERSION_H_INCLUDED #endif // JSON_VERSION_H_INCLUDED

View File

@ -781,11 +781,11 @@ std::string Reader::getLocationLineAndColumn(Location location) const {
getLocationLineAndColumn(location, line, column); getLocationLineAndColumn(location, line, column);
char buffer[18 + 16 + 16 + 1]; char buffer[18 + 16 + 16 + 1];
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) #if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
#if defined(WINCE) #if defined(WINCE)
_snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); _snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
#else #else
sprintf_s(buffer, sizeof(buffer), "Line %d, Column %d", line, column); sprintf_s(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
#endif #endif
#else #else
snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
#endif #endif

View File

@ -73,7 +73,7 @@ static inline void uintToString(LargestUInt value, char *&current) {
* We had a sophisticated way, but it did not work in WinCE. * We had a sophisticated way, but it did not work in WinCE.
* @see https://github.com/open-source-parsers/jsoncpp/pull/9 * @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) { while (begin < end) {
if (*begin == ',') { if (*begin == ',') {
*begin = '.'; *begin = '.';

View File

@ -33,9 +33,9 @@ namespace Json {
#else #else
#define ALIGNAS(byte_alignment) #define ALIGNAS(byte_alignment)
#endif #endif
static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = {0}; static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = { 0 };
const unsigned char& kNullRef = kNull[0]; const unsigned char &kNullRef = kNull[0];
const Value& Value::null = reinterpret_cast<const Value&>(kNullRef); const Value &Value::null = reinterpret_cast<const Value &>(kNullRef);
const Int Value::minInt = Int(~(UInt(-1) / 2)); const Int Value::minInt = Int(~(UInt(-1) / 2));
const Int Value::maxInt = 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(). /** Free the string duplicated by duplicateStringValue().
*/ */
static inline void releaseStringValue(char *value) { static inline void releaseStringValue(char *value) { free(value); }
free(value);
}
} // namespace Json } // namespace Json

View File

@ -75,27 +75,27 @@ std::string valueToString(double value) {
#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with #if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with
// visual studio 2005 to // visual studio 2005 to
// avoid warning. // avoid warning.
#if defined(WINCE) #if defined(WINCE)
len = _snprintf(buffer, sizeof(buffer), "%.16g", value); len = _snprintf(buffer, sizeof(buffer), "%.16g", value);
#else
len = sprintf_s(buffer, sizeof(buffer), "%.16g", value);
#endif
#else #else
if (isfinite( value )) { len = sprintf_s(buffer, sizeof(buffer), "%.16g", value);
#endif
#else
if (isfinite(value)) {
len = snprintf(buffer, sizeof(buffer), "%.16g", value); len = snprintf(buffer, sizeof(buffer), "%.16g", value);
} else { } else {
// IEEE standard states that NaN values will not compare to themselves // IEEE standard states that NaN values will not compare to themselves
if ( value != value) { if (value != value) {
len = snprintf(buffer, sizeof(buffer), "null"); len = snprintf(buffer, sizeof(buffer), "null");
} else if ( value < 0) { } else if (value < 0) {
len = snprintf(buffer, sizeof(buffer), "-1e+9999"); len = snprintf(buffer, sizeof(buffer), "-1e+9999");
} else { } else {
len = snprintf(buffer, sizeof(buffer), "1e+9999"); len = snprintf(buffer, sizeof(buffer), "1e+9999");
} }
// For those, we do not need to call fixNumLoc, but it is fast. // For those, we do not need to call fixNumLoc, but it is fast.
} }
#endif #endif
assert(len>=0); assert(len >= 0);
fixNumericLocale(buffer, buffer + len); fixNumericLocale(buffer, buffer + len);
return buffer; return buffer;
} }
@ -172,7 +172,8 @@ Writer::~Writer() {}
// ////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////
FastWriter::FastWriter() FastWriter::FastWriter()
: yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false), omitEndingLineFeed_(false) {} : yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false),
omitEndingLineFeed_(false) {}
void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; } void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; }

View File

@ -247,12 +247,13 @@ TestResult &checkStringEqual(TestResult &result,
bool _threw = false; \ bool _threw = false; \
try { \ try { \
expr; \ expr; \
} catch (...) { \ } \
catch (...) { \
_threw = true; \ _threw = true; \
} \ } \
if (!_threw) \ if (!_threw) \
result_->addFailure(__FILE__, __LINE__, \ result_->addFailure( \
"expected exception thrown: " #expr); \ __FILE__, __LINE__, "expected exception thrown: " #expr); \
} }
/// \brief Begin a fixture test case. /// \brief Begin a fixture test case.