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