summaryrefslogtreecommitdiff
path: root/plugins/JSON
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-02 20:55:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-02 20:55:18 +0000
commit78c0815c4118fe24ab78cce2dc48a6232dcd824a (patch)
tree8512c50df70b8dd80c919e88ade3419207c95956 /plugins/JSON
parentce816d83a8c75808e0eb06832592bffefe4a8dc4 (diff)
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/JSON')
-rw-r--r--plugins/JSON/Source/JSONChildren.h4
-rw-r--r--plugins/JSON/Source/JSONDebug.h4
-rw-r--r--plugins/JSON/Source/JSONIterators.cpp12
-rw-r--r--plugins/JSON/Source/JSONMemory.h6
-rw-r--r--plugins/JSON/Source/JSONNode.cpp28
-rw-r--r--plugins/JSON/Source/JSONNode.h12
-rw-r--r--plugins/JSON/Source/JSONNode_Mutex.cpp8
-rw-r--r--plugins/JSON/Source/JSONWorker.cpp44
-rw-r--r--plugins/JSON/Source/JSONWriter.cpp4
-rw-r--r--plugins/JSON/Source/JSON_Base64.cpp12
-rw-r--r--plugins/JSON/Source/NumberToString.h2
-rw-r--r--plugins/JSON/Source/internalJSONNode.cpp22
-rw-r--r--plugins/JSON/Source/internalJSONNode.h6
-rw-r--r--plugins/JSON/miminterface.cpp4
14 files changed, 84 insertions, 84 deletions
diff --git a/plugins/JSON/Source/JSONChildren.h b/plugins/JSON/Source/JSONChildren.h
index acc9a712a2..d7a38bb9dc 100644
--- a/plugins/JSON/Source/JSONChildren.h
+++ b/plugins/JSON/Source/JSONChildren.h
@@ -74,7 +74,7 @@ public:
}
//clears (and deletes) everything from the vector and sets it's size to 0
- inline void clear(){
+ inline void clear() {
if (array){ //don't bother clearing anything if there is nothing in it
JSON_ASSERT(mycapacity != 0, JSON_TEXT("mycapacity is not zero, but array is null"));
deleteAll();
@@ -204,7 +204,7 @@ public:
}
//shrinks the array to only as large as it needs to be to hold everything within it
- inline void shrink(){
+ inline void shrink() {
if (mysize == 0){ //size is zero, we should completely free the array
libjson_free<JSONNode*>(array); //free does checks for a null pointer, so don't bother checking
array = 0;
diff --git a/plugins/JSON/Source/JSONDebug.h b/plugins/JSON/Source/JSONDebug.h
index cace9b5c8e..faadd5f07a 100644
--- a/plugins/JSON/Source/JSONDebug.h
+++ b/plugins/JSON/Source/JSONDebug.h
@@ -14,7 +14,7 @@
#ifdef JSON_SAFE
#define JSON_ASSERT_SAFE(condition, msg, code)\
{\
- if (!(condition)){\
+ if (!(condition)) {\
JSON_FAIL(msg);\
code\
}\
@@ -44,7 +44,7 @@
#ifdef JSON_SAFE
#define JSON_ASSERT_SAFE(condition, msg, code)\
{\
- if (!(condition)){\
+ if (!(condition)) {\
code\
}\
}
diff --git a/plugins/JSON/Source/JSONIterators.cpp b/plugins/JSON/Source/JSONIterators.cpp
index 5b140d9b17..a22db2af71 100644
--- a/plugins/JSON/Source/JSONIterators.cpp
+++ b/plugins/JSON/Source/JSONIterators.cpp
@@ -17,7 +17,7 @@ JSONNode::json_iterator JSONNode::find(const json_string & name_t){
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE, JSON_TEXT("finding a non-iteratable node"));
makeUniqueInternal();
- if (JSONNode ** res = internal -> at(name_t)){
+ if (JSONNode ** res = internal -> at(name_t)) {
return ptr_to_json_iterator(res);
}
return end();
@@ -28,7 +28,7 @@ JSONNode::json_iterator JSONNode::find(const json_string & name_t){
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE, JSON_TEXT("finding a non-iteratable node"));
makeUniqueInternal();
- if (JSONNode ** res = internal -> at_nocase(name_t)){
+ if (JSONNode ** res = internal -> at_nocase(name_t)) {
return ptr_to_json_iterator(res);
}
return end();
@@ -71,7 +71,7 @@ JSONNode::json_iterator JSONNode::insert(json_iterator pos, const JSONNode & x){
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, JSON_TEXT("erasing a non-iteratable node"));
JSON_ASSERT_UNIQUE("insert 1");
- if (json_iterator_ptr(pos) >= internal -> Children.end()){
+ if (json_iterator_ptr(pos) >= internal -> Children.end()) {
internal -> push_back(x);
return end() - 1;
}
@@ -104,7 +104,7 @@ JSONNode::json_iterator JSONNode::insertFFF(json_iterator pos, JSONNode ** const
JSONNode::const_iterator JSONNode::find(const json_string & name_t) const {
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE, JSON_TEXT("finding a non-iteratable node"));
- if (JSONNode ** res = internal -> at(name_t)){
+ if (JSONNode ** res = internal -> at(name_t)) {
return JSONNode::const_iterator(res);
}
return JSONNode::const_iterator(internal -> end());
@@ -114,7 +114,7 @@ JSONNode::json_iterator JSONNode::insertFFF(json_iterator pos, JSONNode ** const
JSONNode::const_iterator JSONNode::find_nocase(const json_string & name_t) const {
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE, JSON_TEXT("finding a non-iteratable node"));
- if (JSONNode ** res = internal -> at_nocase(name_t)){
+ if (JSONNode ** res = internal -> at_nocase(name_t)) {
return JSONNode::const_iterator(res);
}
return JSONNode::const_iterator(internal -> end());
@@ -153,7 +153,7 @@ JSONNode::json_iterator JSONNode::insertFFF(json_iterator pos, JSONNode ** const
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE || type() == JSON_ARRAY, JSON_TEXT("erasing a non-iteratable node"));
JSON_ASSERT_UNIQUE("insert 1");
- if (pos.it < internal -> Children.begin()){
+ if (pos.it < internal -> Children.begin()) {
internal -> push_front(x);
return rend() - 1;
}
diff --git a/plugins/JSON/Source/JSONMemory.h b/plugins/JSON/Source/JSONMemory.h
index 4797bd619f..24c1eee6cf 100644
--- a/plugins/JSON/Source/JSONMemory.h
+++ b/plugins/JSON/Source/JSONMemory.h
@@ -77,7 +77,7 @@
#include <map>
class JSONNode;
struct auto_expand {
- auto_expand(void) : mymap(){}
+ auto_expand(void) : mymap() {}
~auto_expand(void){ purge(); }
void purge(void);
inline void clear(void){ purge(); mymap.clear(); }
@@ -91,7 +91,7 @@
};
struct auto_expand_node {
- auto_expand_node(void) : mymap(){}
+ auto_expand_node(void) : mymap() {}
~auto_expand_node(void){ purge(); }
void purge(void);
inline void clear(void){ purge(); mymap.clear(); }
@@ -109,7 +109,7 @@ template <typename T>
class json_auto {
public:
json_auto(void) : ptr(0){}
- json_auto(size_t count) : ptr(json_malloc<T>(count)){}
+ json_auto(size_t count) : ptr(json_malloc<T>(count)) {}
~json_auto(void){
libjson_free<T>(ptr);
}
diff --git a/plugins/JSON/Source/JSONNode.cpp b/plugins/JSON/Source/JSONNode.cpp
index f4ced9a478..ac6106b261 100644
--- a/plugins/JSON/Source/JSONNode.cpp
+++ b/plugins/JSON/Source/JSONNode.cpp
@@ -16,7 +16,7 @@
#endif
#define IMPLEMENT_CTOR(type)\
- JSONNode::JSONNode(const json_string & name_t, type value_t) : internal(internalJSONNode::newInternal()){\
+ JSONNode::JSONNode(const json_string & name_t, type value_t) : internal(internalJSONNode::newInternal()) {\
internal -> Set(value_t);\
internal -> setname(name_t);\
incAllocCount();\
@@ -24,7 +24,7 @@
IMPLEMENT_FOR_ALL_TYPES(IMPLEMENT_CTOR)
#ifndef JSON_LIBRARY
- JSONNode::JSONNode(const json_string & name_t, const json_char * value_t) : internal(internalJSONNode::newInternal()){
+ JSONNode::JSONNode(const json_string & name_t, const json_char * value_t) : internal(internalJSONNode::newInternal()) {
internal -> Set(json_string(value_t));
internal -> setname(name_t);
incAllocCount();
@@ -103,7 +103,7 @@ void JSONNode::cast(char newtype){
#ifdef JSON_REF_COUNT
void JSONNode::merge(JSONNode & other){
#else
-void JSONNode::merge(JSONNode &){
+void JSONNode::merge(JSONNode &) {
#endif
JSON_CHECK_INTERNAL();
#ifdef JSON_REF_COUNT
@@ -125,9 +125,9 @@ void JSONNode::merge(JSONNode &){
}
//different just to supress the warning
- void JSONNode::merge(unsigned int num, ...){
+ void JSONNode::merge(unsigned int num, ...) {
#else
- void JSONNode::merge(unsigned int, ...){
+ void JSONNode::merge(unsigned int, ...) {
#endif
JSON_CHECK_INTERNAL();
#ifdef JSON_REF_COUNT
@@ -153,7 +153,7 @@ JSONNode JSONNode::duplicate(void) const {
JSONNode & JSONNode::at(json_index_t pos){
JSON_CHECK_INTERNAL();
- if (pos >= internal -> size()){
+ if (pos >= internal -> size()) {
JSON_FAIL(JSON_TEXT("at() out of bounds"));
throw std::out_of_range(EMPTY_STRING2);
}
@@ -162,7 +162,7 @@ JSONNode & JSONNode::at(json_index_t pos){
const JSONNode & JSONNode::at(json_index_t pos) const {
JSON_CHECK_INTERNAL();
- if (pos >= internal -> size()){
+ if (pos >= internal -> size()) {
JSON_FAIL(JSON_TEXT("at() const out of bounds"));
throw std::out_of_range(EMPTY_STRING2);
}
@@ -186,7 +186,7 @@ JSONNode & JSONNode::at(const json_string & name_t){
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE, JSON_TEXT("at a non-iteratable node"));
makeUniqueInternal();
- if (JSONNode ** res = internal -> at(name_t)){
+ if (JSONNode ** res = internal -> at(name_t)) {
return *(*res);
}
JSON_FAIL(json_string(JSON_TEXT("at could not find child by name: ")) + name_t);
@@ -196,7 +196,7 @@ JSONNode & JSONNode::at(const json_string & name_t){
const JSONNode & JSONNode::at(const json_string & name_t) const {
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE, JSON_TEXT("at a non-iteratable node"));
- if (JSONNode ** res = internal -> at(name_t)){
+ if (JSONNode ** res = internal -> at(name_t)) {
return *(*res);
}
JSON_FAIL(json_string(JSON_TEXT("at const could not find child by name: ")) + name_t);
@@ -208,7 +208,7 @@ const JSONNode & JSONNode::at(const json_string & name_t) const {
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE, JSON_TEXT("at a non-iteratable node"));
makeUniqueInternal();
- if (JSONNode ** res = internal -> at_nocase(name_t)){
+ if (JSONNode ** res = internal -> at_nocase(name_t)) {
return *(*res);
}
JSON_FAIL(json_string(JSON_TEXT("at_nocase could not find child by name: ")) + name_t);
@@ -218,7 +218,7 @@ const JSONNode & JSONNode::at(const json_string & name_t) const {
const JSONNode & JSONNode::at_nocase(const json_string & name_t) const {
JSON_CHECK_INTERNAL();
JSON_ASSERT(type() == JSON_NODE, JSON_TEXT("at a non-iteratable node"));
- if (JSONNode ** res = internal -> at_nocase(name_t)){
+ if (JSONNode ** res = internal -> at_nocase(name_t)) {
return *(*res);
}
JSON_FAIL(json_string(JSON_TEXT("at_nocase const could not find child by name: ")) + name_t);
@@ -240,7 +240,7 @@ const JSONNode & JSONNode::at(const json_string & name_t) const {
JSONNode JSON_PTR_LIB JSONNode::pop_back(json_index_t pos){
JSON_CHECK_INTERNAL();
- if (pos >= internal -> size()){
+ if (pos >= internal -> size()) {
JSON_FAIL(JSON_TEXT("pop_back out of bounds"));
throw std::out_of_range(EMPTY_STRING2);
}
@@ -259,7 +259,7 @@ JSONNode JSON_PTR_LIB JSONNode::pop_back(const json_string & name_t){
#ifdef JSON_LIBRARY
return internal -> pop_back(name_t);
#else
- if (JSONNode * res = internal -> pop_back(name_t)){
+ if (JSONNode * res = internal -> pop_back(name_t)) {
auto_delete temp(res);
return *(temp.mynode);
}
@@ -275,7 +275,7 @@ JSONNode JSON_PTR_LIB JSONNode::pop_back(const json_string & name_t){
#ifdef JSON_LIBRARY
return internal -> pop_back_nocase(name_t);
#else
- if (JSONNode * res = internal -> pop_back_nocase(name_t)){
+ if (JSONNode * res = internal -> pop_back_nocase(name_t)) {
auto_delete temp(res);
return *(temp.mynode);
}
diff --git a/plugins/JSON/Source/JSONNode.h b/plugins/JSON/Source/JSONNode.h
index b4fad7573c..36ebcd6145 100644
--- a/plugins/JSON/Source/JSONNode.h
+++ b/plugins/JSON/Source/JSONNode.h
@@ -443,7 +443,7 @@ JSON_PRIVATE
static JSONNode * newJSONNode(const JSONNode & orig JSON_MUTEX_COPY_DECL2);
static JSONNode * newJSONNode(internalJSONNode * internal_t);
//used by JSONWorker
- JSONNode(const json_string & unparsed) : internal(internalJSONNode::newInternal(unparsed)){ //root, specialized because it can only be array or node
+ JSONNode(const json_string & unparsed) : internal(internalJSONNode::newInternal(unparsed)) { //root, specialized because it can only be array or node
incAllocCount();
}
JSONNode(internalJSONNode * internal_t) : internal(internal_t){ //do not increment anything, this is only used in one case and it's already taken care of
@@ -484,7 +484,7 @@ JSON_PRIVATE
file because they are inlined.
*/
-inline JSONNode::JSONNode(char mytype) : internal(internalJSONNode::newInternal(mytype)){
+inline JSONNode::JSONNode(char mytype) : internal(internalJSONNode::newInternal(mytype)) {
JSON_ASSERT((mytype == JSON_NULL) ||
(mytype == JSON_STRING) ||
(mytype == JSON_NUMBER) ||
@@ -494,7 +494,7 @@ inline JSONNode::JSONNode(char mytype) : internal(internalJSONNode::newInternal(
incAllocCount();
}
-inline JSONNode::JSONNode(const JSONNode & orig): internal(orig.internal -> incRef()){
+inline JSONNode::JSONNode(const JSONNode & orig): internal(orig.internal -> incRef()) {
incAllocCount();
}
@@ -521,7 +521,7 @@ inline bool JSONNode::empty(void) const {
inline void JSONNode::clear(void){
JSON_CHECK_INTERNAL();
- if (!empty()){
+ if (!empty()) {
makeUniqueInternal();
internal -> Children.clear();
}
@@ -713,7 +713,7 @@ inline void JSONNode::decRef(void){ //decrements internal's counter, deletes it
JSON_CHECK_INTERNAL();
#ifdef JSON_REF_COUNT
internal -> decRef();
- if (internal -> hasNoReferences()){
+ if (internal -> hasNoReferences()) {
internalJSONNode::deleteInternal(internal);
}
#else
@@ -722,7 +722,7 @@ inline void JSONNode::decRef(void){ //decrements internal's counter, deletes it
}
#ifdef JSON_REF_COUNT
- inline void JSONNode::makeUniqueInternal(){ //makes internal it's own
+ inline void JSONNode::makeUniqueInternal() { //makes internal it's own
JSON_CHECK_INTERNAL();
internal = internal -> makeUnique(); //might return itself or a new one that's exactly the same
}
diff --git a/plugins/JSON/Source/JSONNode_Mutex.cpp b/plugins/JSON/Source/JSONNode_Mutex.cpp
index 0f0dbe5d7b..f047f58403 100644
--- a/plugins/JSON/Source/JSONNode_Mutex.cpp
+++ b/plugins/JSON/Source/JSONNode_Mutex.cpp
@@ -73,14 +73,14 @@ void JSONNode::lock(int thread){
//make sure that the same thread isn't locking it more than once (possible due to complex ref counting)
std::map<int, std::map<void *, unsigned int> >::iterator it = threadlocks.find(thread);
- if (it == threadlocks.end()){
+ if (it == threadlocks.end()) {
std::map<void *, unsigned int> newthread;
newthread[thislock] = 1;
threadlocks.insert(std::pair<int, std::map<void *, unsigned int> >(thread, newthread));
} else { //this thread already has some things locked, check if the current mutex is
std::map<void *, unsigned int> & newthread = it -> second;
std::map<void *, unsigned int>::iterator locker = newthread.find(thislock);
- if (locker == newthread.end()){ //current mutex is not locked, set it to locked
+ if (locker == newthread.end()) { //current mutex is not locked, set it to locked
newthread.insert(std::pair<void *, unsigned int>(thislock, 1));
} else { //it's already locked, don't relock it
++(locker -> second);
@@ -133,7 +133,7 @@ void internalJSONNode::_set_mutex(void * mutex, bool unset){
if (mutex){
#ifdef JSON_MUTEX_MANAGE
std::map<void *, unsigned int>::iterator it = mutex_manager.find(mutex);
- if (it == mutex_manager.end()){
+ if (it == mutex_manager.end()) {
mutex_manager.insert(std::pair<void *, unsigned int>(mutex, 1));
} else {
++it -> second;
@@ -168,7 +168,7 @@ void internalJSONNode::_unset_mutex(void){
if (mylock){
mut.push_back(JSON_NEW(JSONNode(JSON_TEXT("this"), (long)mylock)));
std::map<void *, unsigned int>::iterator it = mutex_manager.find(mylock);
- if (it == mutex_manager.end()){
+ if (it == mutex_manager.end()) {
mut.push_back(JSON_NEW(JSONNode(JSON_TEXT("references"), JSON_TEXT("error"))));
} else {
mut.push_back(JSON_NEW(JSONNode(JSON_TEXT("references"), it -> second)));
diff --git a/plugins/JSON/Source/JSONWorker.cpp b/plugins/JSON/Source/JSONWorker.cpp
index 093d9a75b2..245e1568dc 100644
--- a/plugins/JSON/Source/JSONWorker.cpp
+++ b/plugins/JSON/Source/JSONWorker.cpp
@@ -3,7 +3,7 @@
#ifdef JSON_VALIDATE
JSONNode JSONWorker::validate(const json_string & json){
JSONNode res = parse(json);
- if (!res.validate()){
+ if (!res.validate()) {
throw std::invalid_argument(EMPTY_STRING2);
}
return JSONNode(true, res); //forces it to simply return the original interal, even with ref counting off
@@ -23,14 +23,14 @@ JSONNode JSONWorker::parse(const json_string & json){
json_char firstchar = s.ptr[0];
json_string _comment;
json_char * runner = s.ptr;
- if (firstchar == '\5'){ //multiple comments will be consolidated into one
+ if (firstchar == '\5') { //multiple comments will be consolidated into one
newcomment:
- while(*(++runner) != '\5'){
+ while(*(++runner) != '\5') {
JSON_ASSERT(*runner, JSON_TEXT("Removing white space failed"));
_comment += *runner;
}
firstchar = *(++runner); //step past the trailing tag
- if (firstchar == '\5'){
+ if (firstchar == '\5') {
_comment += '\n';
goto newcomment;
}
@@ -43,13 +43,13 @@ JSONNode JSONWorker::parse(const json_string & json){
case '{':
case '[':
#if defined JSON_DEBUG || defined JSON_SAFE
- if (firstchar == '['){
- if (lastchar != ']'){
+ if (firstchar == '[') {
+ if (lastchar != ']') {
JSON_FAIL(JSON_TEXT("Missing final ]"));
break;
}
} else {
- if (lastchar != '}'){
+ if (lastchar != '}') {
JSON_FAIL(JSON_TEXT("Missing final }"));
break;
}
@@ -70,7 +70,7 @@ JSONNode JSONWorker::parse(const json_string & json){
#define QUOTECASE()\
case JSON_TEXT('\"'):\
- while (*(++p) != JSON_TEXT('\"')){\
+ while (*(++p) != JSON_TEXT('\"')) {\
JSON_ASSERT_SAFE(*p, JSON_TEXT("Null terminator inside of a quotation"), return json_string::npos;);\
}\
break;
@@ -88,7 +88,7 @@ JSONNode JSONWorker::parse(const json_string & json){
case left: {\
size_t brac = 1;\
while (brac){\
- switch (*(++p)){\
+ switch (*(++p)) {\
case right:\
--brac;\
break;\
@@ -122,7 +122,7 @@ size_t JSONWorker::FindNextRelevant(json_char ch, const json_string & value_t, c
#define AND_RUNNER ,runner
inline void SingleLineComment(const json_char * & p, json_char * & runner){
COMMENT_DELIMITER();
- while((*(++p)) && (*p != JSON_TEXT('\n'))){
+ while((*(++p)) && (*p != JSON_TEXT('\n'))) {
*runner++ = *p;
}
COMMENT_DELIMITER();
@@ -154,9 +154,9 @@ inline void SingleLineComment(const json_char * & p){
case JSON_TEXT('\r'): //defined as white space
break;
case JSON_TEXT('/'): //a C comment
- if (*(++p) == JSON_TEXT('*')){ //a multiline comment
+ if (*(++p) == JSON_TEXT('*')) { //a multiline comment
COMMENT_DELIMITER();
- while ((*(++p) != JSON_TEXT('*')) || (*(p + 1) != JSON_TEXT('/'))){
+ while ((*(++p) != JSON_TEXT('*')) || (*(p + 1) != JSON_TEXT('/'))) {
JSON_ASSERT_SAFE(*p, JSON_TEXT("Null terminator inside of a multiline quote"), COMMENT_DELIMITER(); goto endofloop;);
*runner++ = *p;
}
@@ -171,7 +171,7 @@ inline void SingleLineComment(const json_char * & p){
break;
case JSON_TEXT('\"'): //a quote
*runner++ = JSON_TEXT('\"');
- while(*(++p) != JSON_TEXT('\"')){ //find the end of the quotation, as white space is preserved within it
+ while(*(++p) != JSON_TEXT('\"')) { //find the end of the quotation, as white space is preserved within it
JSON_ASSERT_SAFE(*p, JSON_TEXT("Null terminator inside of a quotation"), goto endofloop;);
switch(*p){
case JSON_TEXT('\\'):
@@ -214,8 +214,8 @@ json_string JSONWorker::RemoveWhiteSpaceAndComments(const json_string & value_t)
case JSON_TEXT('\r'): //defined as white space
break;
case JSON_TEXT('/'): //a C comment
- if (*(++p) == JSON_TEXT('*')){ //a multiline comment
- while ((*(++p) != JSON_TEXT('*')) || (*(p + 1) != JSON_TEXT('/'))){
+ if (*(++p) == JSON_TEXT('*')) { //a multiline comment
+ while ((*(++p) != JSON_TEXT('*')) || (*(p + 1) != JSON_TEXT('/'))) {
JSON_ASSERT_SAFE(*p, JSON_TEXT("Null terminator inside of a multiline quote"), goto endofloop;);
}
++p;
@@ -228,7 +228,7 @@ json_string JSONWorker::RemoveWhiteSpaceAndComments(const json_string & value_t)
break;
case JSON_TEXT('\"'): //a quote
result += JSON_TEXT('\"');
- while(*(++p) != JSON_TEXT('\"')){ //find the end of the quotation, as white space is preserved within it
+ while(*(++p) != JSON_TEXT('\"')) { //find the end of the quotation, as white space is preserved within it
JSON_ASSERT(*p, JSON_TEXT("Null terminator inside of a quotation"));
switch(*p){
case JSON_TEXT('\\'):
@@ -269,11 +269,11 @@ json_string JSONWorker::RemoveWhiteSpaceAndComments(const json_string & value_t)
json_string JSONWorker::UTF(const json_char * & pos){
json_string result;
unsigned json_char first = UTF8(pos);
- if ((*(pos + 1) == '\\') && (*(pos + 2) == 'u')){
+ if ((*(pos + 1) == '\\') && (*(pos + 2) == 'u')) {
pos += 2;
unsigned json_char second = UTF8(pos);
//surrogate pair, not two characters
- if ((first > 0xD800) && (first < 0xDBFF) && (second > 0xDC00) && (second < 0xDFFF)){
+ if ((first > 0xD800) && (first < 0xDBFF) && (second > 0xDC00) && (second < 0xDFFF)) {
result += SurrogatePair(first, second);
} else {
result += first;
@@ -564,7 +564,7 @@ json_string JSONWorker::UnfixString(const json_string & value_t, bool flag){
res += JSON_TEXT("\\\'");
break;
default:
- /*if (((unsigned json_char)(*p) < 32) || ((unsigned json_char)(*p) > 126)){
+ /*if (((unsigned json_char)(*p) < 32) || ((unsigned json_char)(*p) > 126)) {
//res += toUTF8((unsigned json_char)(*p));
} else*/ {
res += *p;
@@ -587,13 +587,13 @@ inline void JSONWorker::NewNode(const internalJSONNode * parent, const json_stri
#ifdef JSON_COMMENTS
const json_char * runner = (array) ? value.c_str() : name.c_str();
json_string _comment;
- if (*runner == '\5'){ //multiple comments will be consolidated into one
+ if (*runner == '\5') { //multiple comments will be consolidated into one
newcomment:
- while(*(++runner) != '\5'){
+ while(*(++runner) != '\5') {
JSON_ASSERT(*runner, JSON_TEXT("Removing white space failed"));
_comment += *runner;
}
- if (*(++runner) == '\5'){ //step past the trailing tag
+ if (*(++runner) == '\5') { //step past the trailing tag
_comment += '\n';
goto newcomment;
}
diff --git a/plugins/JSON/Source/JSONWriter.cpp b/plugins/JSON/Source/JSONWriter.cpp
index 9b53689002..ce040f57f3 100644
--- a/plugins/JSON/Source/JSONWriter.cpp
+++ b/plugins/JSON/Source/JSONWriter.cpp
@@ -117,13 +117,13 @@ json_string internalJSONNode::Write(unsigned int indent, bool arrayChild){
const bool formatted = indent != 0xFFFFFFFF;
#ifndef JSON_PREPARSE
- if (!(formatted || fetched)){ //It's not formatted or fetched, just do a raw dump
+ if (!(formatted || fetched)) { //It's not formatted or fetched, just do a raw dump
return WriteComment(indent) + WriteName(false, arrayChild) + _string;
}
#endif
//It's either formatted or fetched
- switch (type()){
+ switch (type()) {
case JSON_NODE: //got members, write the members
Fetch();
return WriteComment(indent) + WriteName(formatted, arrayChild) + JSON_TEXT("{") + WriteChildren(indent) + JSON_TEXT("}");
diff --git a/plugins/JSON/Source/JSON_Base64.cpp b/plugins/JSON/Source/JSON_Base64.cpp
index fcde330b1a..fdf7930208 100644
--- a/plugins/JSON/Source/JSON_Base64.cpp
+++ b/plugins/JSON/Source/JSON_Base64.cpp
@@ -50,13 +50,13 @@ json_string JSONBase64::json_encode64(const unsigned char * binary, size_t bytes
}
inline json_char toBinary(json_char c){
- if (c == JSON_TEXT('+')){
+ if (c == JSON_TEXT('+')) {
return JSON_TEXT('>');
- } else if (c == JSON_TEXT('/')){
+ } else if (c == JSON_TEXT('/')) {
return JSON_TEXT('?');
- } else if (c < JSON_TEXT(':')){
+ } else if (c < JSON_TEXT(':')) {
return c + JSON_TEXT('\x04');
- } else if (c < JSON_TEXT('[')){
+ } else if (c < JSON_TEXT('[')) {
return c - JSON_TEXT('\x41');
}
return c - 71;
@@ -97,10 +97,10 @@ std::string JSONBase64::json_decode64(const json_string & encoded){
//now do the ones that might have padding, the first two characters can not be padding, so do them quickly
const char second = toBinary(runner[1]);
result += (toBinary(runner[0]) << 2) + ((second & 0x30) >> 4);
- if (runner[2] != '='){ //not two = pads
+ if (runner[2] != '=') { //not two = pads
const char third = toBinary(runner[2]);
result += ((second & 0xf) << 4) + ((third & 0x3c) >> 2);
- if (runner[3] != '='){ //no padding
+ if (runner[3] != '=') { //no padding
result += ((third & 0x3) << 6) + toBinary(runner[3]);
}
}
diff --git a/plugins/JSON/Source/NumberToString.h b/plugins/JSON/Source/NumberToString.h
index a1ea2d4d3c..a5e93d4302 100644
--- a/plugins/JSON/Source/NumberToString.h
+++ b/plugins/JSON/Source/NumberToString.h
@@ -84,7 +84,7 @@ public:
#endif
//strip the trailing zeros
for(json_char * pos = &result[0]; *pos; ++pos){
- if (*pos == '.'){ //only care about after the decimal
+ if (*pos == '.') { //only care about after the decimal
for(json_char * runner = pos + 1; *runner; ++runner){
if (*runner != JSON_TEXT('0')) pos = runner + 1;
}
diff --git a/plugins/JSON/Source/internalJSONNode.cpp b/plugins/JSON/Source/internalJSONNode.cpp
index 2651394a8a..626546586c 100644
--- a/plugins/JSON/Source/internalJSONNode.cpp
+++ b/plugins/JSON/Source/internalJSONNode.cpp
@@ -32,7 +32,7 @@ internalJSONNode::internalJSONNode(const internalJSONNode & orig) :
#ifdef JSON_MUTEX_CALLBACKS
_set_mutex(orig.mylock, false);
#endif
- if (!orig.Children.empty()){
+ if (!orig.Children.empty()) {
Children.reserve(orig.Children.size());
json_foreach(orig.Children, myrunner){
Children.push_back(JSONNode::newJSONNode((*myrunner) -> duplicate()));
@@ -61,7 +61,7 @@ internalJSONNode::internalJSONNode(const json_string & unparsed) : _type(), _nam
initializeValid(0){
incinternalAllocCount();
- switch (unparsed[0]){
+ switch (unparsed[0]) {
case JSON_TEXT('{'): //node
_type = JSON_NODE;
#ifdef JSON_PREPARSE
@@ -89,7 +89,7 @@ internalJSONNode::internalJSONNode(const json_string & name_t, const json_string
incinternalAllocCount();
- if (value_t.empty()){
+ if (value_t.empty()) {
_type = JSON_NULL;
#ifdef JSON_VALIDATE
isValid = true;
@@ -196,7 +196,7 @@ void internalJSONNode::FetchNumber(void) const {
#ifndef JSON_PREPARSE
void internalJSONNode::Fetch(void) const {
if (fetched) return;
- switch (type()){
+ switch (type()) {
case JSON_STRING:
FetchString();
break;
@@ -288,7 +288,7 @@ bool internalJSONNode::IsEqualTo(const internalJSONNode * val) const {
Fetch();
val -> Fetch();
#endif
- switch (type()){
+ switch (type()) {
case JSON_STRING:
return val -> _string == _string;
case JSON_NUMBER:
@@ -358,7 +358,7 @@ JSONNode * internalJSONNode::pop_back(json_index_t pos){
}
JSONNode * internalJSONNode::pop_back(const json_string & name_t){
- if (JSONNode ** res = at(name_t)){
+ if (JSONNode ** res = at(name_t)) {
JSONNode * result = *res;
Children.erase(res);
return result;
@@ -368,7 +368,7 @@ JSONNode * internalJSONNode::pop_back(const json_string & name_t){
#ifdef JSON_CASE_INSENSITIVE_FUNCTIONS
JSONNode * internalJSONNode::pop_back_nocase(const json_string & name_t){
- if (JSONNode ** res = at_nocase(name_t)){
+ if (JSONNode ** res = at_nocase(name_t)) {
JSONNode * result = *res;
Children.erase(res);
return result;
@@ -392,9 +392,9 @@ JSONNode ** internalJSONNode::at(const json_string & name_t){
const json_char c_one = *ch_one;
const json_char c_two = *ch_two;
if (c_one != c_two){
- if ((c_two > 64) && (c_two < 91)){ //A - Z
+ if ((c_two > 64) && (c_two < 91)) { //A - Z
if (c_one != (json_char)(c_two + 32)) return false;
- } else if ((c_two > 96) && (c_two < 123)){ //a - z
+ } else if ((c_two > 96) && (c_two < 123)) { //a - z
if (c_one != (json_char)(c_two - 32)) return false;
} else { //not a letter, so return false
return false;
@@ -434,7 +434,7 @@ JSONNode ** internalJSONNode::at(const json_string & name_t){
(*myrunner) -> internal -> Fetch();
#endif
if ((*myrunner) -> type() == JSON_NULL) return false;
- } else if (!((*myrunner) -> internal -> isValid)){
+ } else if (!((*myrunner) -> internal -> isValid)) {
JSON_FAIL(_name + JSON_TEXT(" is null and not valid"));
return false;
}
@@ -477,7 +477,7 @@ JSONNode ** internalJSONNode::at(const json_string & name_t){
dumpage.push_back(JSON_NEW(JSONNode(JSON_TEXT("_type"), JSON_TEXT(#ty))));\
break;
- switch(type()){
+ switch(type()) {
DUMPCASE(JSON_NULL)
DUMPCASE(JSON_STRING)
DUMPCASE(JSON_NUMBER)
diff --git a/plugins/JSON/Source/internalJSONNode.h b/plugins/JSON/Source/internalJSONNode.h
index 8667e3fbbb..9e9f9de983 100644
--- a/plugins/JSON/Source/internalJSONNode.h
+++ b/plugins/JSON/Source/internalJSONNode.h
@@ -290,7 +290,7 @@ inline json_string internalJSONNode::as_string(void) const {
inline long internalJSONNode::as_int(void) const {
Fetch();
- switch(type()){
+ switch(type()) {
case JSON_NULL:
return 0;
case JSON_BOOL:
@@ -305,7 +305,7 @@ inline long internalJSONNode::as_int(void) const {
inline json_number internalJSONNode::as_float(void) const {
Fetch();
- switch(type()){
+ switch(type()) {
case JSON_NULL:
return (json_number)0.0;
case JSON_BOOL:
@@ -317,7 +317,7 @@ inline json_number internalJSONNode::as_float(void) const {
inline bool internalJSONNode::as_bool(void) const {
Fetch();
- switch(type()){
+ switch(type()) {
case JSON_NUMBER:
return _value._number != 0.0f;
case JSON_NULL:
diff --git a/plugins/JSON/miminterface.cpp b/plugins/JSON/miminterface.cpp
index 30ccb9a69c..b6fbf4ce88 100644
--- a/plugins/JSON/miminterface.cpp
+++ b/plugins/JSON/miminterface.cpp
@@ -55,7 +55,7 @@ extern "C" {
return 0;
}
- int GetInterface(WPARAM wParam, LPARAM lParam) {
+ INT_PTR GetInterface(WPARAM wParam, LPARAM lParam) {
LPJSONSERVICEINTERFACE lpJSI=(LPJSONSERVICEINTERFACE)wParam;
memset(lpJSI,0,sizeof(JSONSERVICEINTERFACE));
@@ -247,7 +247,7 @@ WRAPPER_21(EQUAL,json_equal,JSONNODE*,JSONNODE*);
pluginLink=link;
mir_getMMI(&mmi);
- s_services[ciServices++]=CreateServiceFunction(MS_JSON_GETINTERFACE,GetInterface);
+ s_services[ciServices++] = CreateServiceFunction(MS_JSON_GETINTERFACE,GetInterface);
CSF(FREE);
CSF(DELETE);