forked from bblanchon/ArduinoJson
Fixed clang-tidy warnings (fixes #1574)
This commit is contained in:
@ -7,6 +7,7 @@ HEAD
|
||||
* Fixed support for `volatile float` and `volatile double` (issue #1557)
|
||||
* Fixed error `[Pe070]: incomplete type is not allowed` on IAR (issue #1560)
|
||||
* Fixed `serializeJson(doc, String)` when allocation fails (issue #1572)
|
||||
* Fixed clang-tidy warnings (issue #1574, PR #1577 by @armandas)
|
||||
|
||||
v6.18.0 (2021-05-05)
|
||||
-------
|
||||
|
@ -81,6 +81,7 @@ ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
|
||||
* [GCC 4.4, 4.6, 4.7, 4.8, 4.9, 5, 6, 7, 8, 9, 10](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22)
|
||||
* [Clang 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 5.0, 6.0, 7, 8, 9, 10](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22)
|
||||
* [Continuously fuzzed with Google OSS Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)
|
||||
* Passes all default checks of [clang-tidy](https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/clang-tidy/)
|
||||
* Well documented
|
||||
* [Tutorials](https://arduinojson.org/v6/doc/deserialization/?utm_source=github&utm_medium=readme)
|
||||
* [Examples](https://arduinojson.org/v6/example/?utm_source=github&utm_medium=readme)
|
||||
|
1
extras/tests/.clang-tidy
Normal file
1
extras/tests/.clang-tidy
Normal file
@ -0,0 +1 @@
|
||||
Checks: '-clang-analyzer-security.insecureAPI.*'
|
@ -32,7 +32,7 @@ class JsonDocument : public Visitable {
|
||||
|
||||
void clear() {
|
||||
_pool.clear();
|
||||
_data.setNull();
|
||||
_data.init();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -304,15 +304,15 @@ class JsonDocument : public Visitable {
|
||||
|
||||
protected:
|
||||
JsonDocument() : _pool(0, 0) {
|
||||
_data.setNull();
|
||||
_data.init();
|
||||
}
|
||||
|
||||
JsonDocument(MemoryPool pool) : _pool(pool) {
|
||||
_data.setNull();
|
||||
_data.init();
|
||||
}
|
||||
|
||||
JsonDocument(char* buf, size_t capa) : _pool(buf, capa) {
|
||||
_data.setNull();
|
||||
_data.init();
|
||||
}
|
||||
|
||||
~JsonDocument() {}
|
||||
|
@ -45,7 +45,8 @@ class Latch {
|
||||
}
|
||||
|
||||
TReader _reader;
|
||||
char _current;
|
||||
char _current; // NOLINT(clang-analyzer-optin.cplusplus.UninitializedObject)
|
||||
// Not initialized in constructor (+10 bytes on AVR)
|
||||
bool _loaded;
|
||||
#if ARDUINOJSON_DEBUG
|
||||
bool _ended;
|
||||
|
@ -155,7 +155,6 @@ class TextFormatter {
|
||||
|
||||
protected:
|
||||
CountingDecorator<TWriter> _writer;
|
||||
size_t _length;
|
||||
|
||||
private:
|
||||
TextFormatter &operator=(const TextFormatter &); // cannot be assigned
|
||||
|
@ -31,7 +31,7 @@ inline bool isLowSurrogate(uint16_t codeunit) {
|
||||
|
||||
class Codepoint {
|
||||
public:
|
||||
Codepoint() : _highSurrogate(0) {}
|
||||
Codepoint() : _highSurrogate(0), _codepoint(0) {}
|
||||
|
||||
bool append(uint16_t codeunit) {
|
||||
if (isHighSurrogate(codeunit)) {
|
||||
|
@ -37,7 +37,8 @@ class MemoryPool {
|
||||
}
|
||||
|
||||
void* buffer() {
|
||||
return _begin;
|
||||
return _begin; // NOLINT(clang-analyzer-unix.Malloc)
|
||||
// movePointers() alters this pointer
|
||||
}
|
||||
|
||||
// Gets the capacity of the memoryPool in bytes
|
||||
|
@ -55,8 +55,12 @@ class StringCopier {
|
||||
|
||||
private:
|
||||
MemoryPool* _pool;
|
||||
|
||||
// These fields aren't initialized by the constructor but startString()
|
||||
//
|
||||
// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.UninitializedObject)
|
||||
char* _ptr;
|
||||
size_t _size;
|
||||
size_t _capacity;
|
||||
// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.UninitializedObject)
|
||||
size_t _size, _capacity;
|
||||
};
|
||||
} // namespace ARDUINOJSON_NAMESPACE
|
||||
|
@ -33,7 +33,7 @@ class VariantData {
|
||||
// - no virtual
|
||||
// - no inheritance
|
||||
void init() {
|
||||
_flags = 0;
|
||||
_flags = VALUE_IS_NULL;
|
||||
}
|
||||
|
||||
template <typename TVisitor>
|
||||
|
Reference in New Issue
Block a user