mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Clang-Format: set AllowShortLoopsOnASingleLine to false
				
					
				
			This commit is contained in:
		| @@ -9,3 +9,4 @@ DerivePointerAlignment: false | ||||
|  | ||||
| # Always break after if to get accurate coverage | ||||
| AllowShortIfStatementsOnASingleLine: false | ||||
| AllowShortLoopsOnASingleLine: false | ||||
|   | ||||
| @@ -7,7 +7,8 @@ | ||||
|  | ||||
| static void eraseString(std::string& str) { | ||||
|   char* p = const_cast<char*>(str.c_str()); | ||||
|   while (*p) *p++ = '*'; | ||||
|   while (*p) | ||||
|     *p++ = '*'; | ||||
| } | ||||
|  | ||||
| TEST_CASE("std::string") { | ||||
|   | ||||
| @@ -7,7 +7,8 @@ | ||||
|  | ||||
| static void eraseString(std::string& str) { | ||||
|   char* p = const_cast<char*>(str.c_str()); | ||||
|   while (*p) *p++ = '*'; | ||||
|   while (*p) | ||||
|     *p++ = '*'; | ||||
| } | ||||
|  | ||||
| TEST_CASE("std::string") { | ||||
|   | ||||
| @@ -25,7 +25,8 @@ TEST_CASE("MemoryPool::size()") { | ||||
|   SECTION("Doesn't grow when memory pool is full") { | ||||
|     const size_t variantCount = sizeof(buffer) / sizeof(VariantSlot); | ||||
|  | ||||
|     for (size_t i = 0; i < variantCount; i++) pool.allocVariant(); | ||||
|     for (size_t i = 0; i < variantCount; i++) | ||||
|       pool.allocVariant(); | ||||
|     size_t size = pool.size(); | ||||
|  | ||||
|     pool.allocVariant(); | ||||
|   | ||||
| @@ -41,7 +41,8 @@ TEST_CASE("serialize MsgPack array") { | ||||
|   } | ||||
|  | ||||
|   SECTION("array 16") { | ||||
|     for (int i = 0; i < 16; i++) array.add(i); | ||||
|     for (int i = 0; i < 16; i++) | ||||
|       array.add(i); | ||||
|  | ||||
|     check(array, | ||||
|           "\xDC\x00\x10\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D" | ||||
| @@ -50,7 +51,8 @@ TEST_CASE("serialize MsgPack array") { | ||||
|  | ||||
|   SECTION("array 32") { | ||||
|     const char* nil = 0; | ||||
|     for (int i = 0; i < 65536; i++) array.add(nil); | ||||
|     for (int i = 0; i < 65536; i++) | ||||
|       array.add(nil); | ||||
|  | ||||
|     check(array, | ||||
|           std::string("\xDD\x00\x01\x00\x00", 5) + std::string(65536, '\xc0')); | ||||
|   | ||||
| @@ -23,7 +23,8 @@ class IteratorReader { | ||||
|  | ||||
|   size_t readBytes(char* buffer, size_t length) { | ||||
|     size_t i = 0; | ||||
|     while (i < length && _ptr < _end) buffer[i++] = *_ptr++; | ||||
|     while (i < length && _ptr < _end) | ||||
|       buffer[i++] = *_ptr++; | ||||
|     return i; | ||||
|   } | ||||
| }; | ||||
|   | ||||
| @@ -32,7 +32,8 @@ struct Reader<TSource*, | ||||
|   } | ||||
|  | ||||
|   size_t readBytes(char* buffer, size_t length) { | ||||
|     for (size_t i = 0; i < length; i++) buffer[i] = *_ptr++; | ||||
|     for (size_t i = 0; i < length; i++) | ||||
|       buffer[i] = *_ptr++; | ||||
|     return length; | ||||
|   } | ||||
| }; | ||||
|   | ||||
| @@ -64,7 +64,8 @@ class PrettyJsonSerializer : public JsonSerializer<TWriter> { | ||||
|  | ||||
|  private: | ||||
|   void indent() { | ||||
|     for (uint8_t i = 0; i < _nesting; i++) base::write(ARDUINOJSON_TAB); | ||||
|     for (uint8_t i = 0; i < _nesting; i++) | ||||
|       base::write(ARDUINOJSON_TAB); | ||||
|   } | ||||
|  | ||||
|   uint8_t _nesting; | ||||
|   | ||||
| @@ -37,14 +37,16 @@ class TextFormatter { | ||||
|   void writeString(const char* value) { | ||||
|     ARDUINOJSON_ASSERT(value != NULL); | ||||
|     writeRaw('\"'); | ||||
|     while (*value) writeChar(*value++); | ||||
|     while (*value) | ||||
|       writeChar(*value++); | ||||
|     writeRaw('\"'); | ||||
|   } | ||||
|  | ||||
|   void writeString(const char* value, size_t n) { | ||||
|     ARDUINOJSON_ASSERT(value != NULL); | ||||
|     writeRaw('\"'); | ||||
|     while (n--) writeChar(*value++); | ||||
|     while (n--) | ||||
|       writeChar(*value++); | ||||
|     writeRaw('\"'); | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -183,7 +183,8 @@ class MemoryPool { | ||||
|         return next; | ||||
|  | ||||
|       // jump to next terminator | ||||
|       while (*next) ++next; | ||||
|       while (*next) | ||||
|         ++next; | ||||
|     } | ||||
|     return 0; | ||||
|   } | ||||
|   | ||||
| @@ -23,7 +23,8 @@ struct pgm_p { | ||||
| inline size_t strlen_P(ARDUINOJSON_NAMESPACE::pgm_p s) { | ||||
|   const char* p = s.address; | ||||
|   ARDUINOJSON_ASSERT(p != NULL); | ||||
|   while (pgm_read_byte(p)) p++; | ||||
|   while (pgm_read_byte(p)) | ||||
|     p++; | ||||
|   return size_t(p - s.address); | ||||
| } | ||||
| #endif | ||||
|   | ||||
| @@ -27,11 +27,13 @@ class StringCopier { | ||||
|   } | ||||
|  | ||||
|   void append(const char* s) { | ||||
|     while (*s) append(*s++); | ||||
|     while (*s) | ||||
|       append(*s++); | ||||
|   } | ||||
|  | ||||
|   void append(const char* s, size_t n) { | ||||
|     while (n-- > 0) append(*s++); | ||||
|     while (n-- > 0) | ||||
|       append(*s++); | ||||
|   } | ||||
|  | ||||
|   void append(char c) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user