forked from arduino-libraries/Arduino_CloudUtils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatch.diff
407 lines (375 loc) · 13.3 KB
/
patch.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
Solo in src/: cbor.dox
diff --unified --recursive --no-dereference src/cborencoder.c /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborencoder.c
--- src/cborencoder.c 2024-12-03 11:54:08.834581955 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborencoder.c 2024-12-03 11:32:10.786552470 +0100
@@ -39,6 +39,9 @@
#include <stdlib.h>
#include <string.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+
/**
* \defgroup CborEncoding Encoding to CBOR
* \brief Group of functions used to encode data to CBOR.
@@ -642,4 +645,6 @@
* \sa cbor_encoder_init(), cbor_encoder_get_buffer_size(), CborEncoding
*/
+#pragma GCC diagnostic pop
+
/** @} */
diff --unified --recursive --no-dereference src/cborencoder_close_container_checked.c /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborencoder_close_container_checked.c
--- src/cborencoder_close_container_checked.c 2024-12-03 11:54:08.834581955 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborencoder_close_container_checked.c 2024-12-03 11:32:10.786552470 +0100
@@ -30,6 +30,9 @@
#include "cbor.h"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+
/**
* \addtogroup CborEncoding
* @{
@@ -54,4 +57,6 @@
return cbor_encoder_close_container(encoder, containerEncoder);
}
+#pragma GCC diagnostic pop
+
/** @} */
diff --unified --recursive --no-dereference src/cborerrorstrings.c /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborerrorstrings.c
--- src/cborerrorstrings.c 2024-12-03 11:54:08.834581955 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborerrorstrings.c 2024-12-03 11:32:10.786552470 +0100
@@ -28,6 +28,9 @@
# define _(msg) msg
#endif
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+
/**
* \enum CborError
* \ingroup CborGlobals
@@ -160,6 +163,9 @@
case CborErrorTooFewItems:
return _("too few items added to encoder");
+ case CborErrorSplitItems:
+ return _("splitted item added to encoder");
+
case CborErrorDataTooLarge:
return _("internal error: data too large");
@@ -180,3 +186,5 @@
}
return cbor_error_string(CborUnknownError);
}
+
+#pragma GCC diagnostic pop
diff --unified --recursive --no-dereference src/cbor.h /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cbor.h
--- src/cbor.h 2024-12-03 11:54:08.834581955 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cbor.h 2024-12-03 11:32:10.786552470 +0100
@@ -184,6 +184,7 @@
/* encoder errors */
CborErrorTooManyItems = 768,
CborErrorTooFewItems,
+ CborErrorSplitItems,
/* internal implementation errors */
CborErrorDataTooLarge = 1024,
@@ -329,7 +330,9 @@
{ return value->type == CborBooleanType; }
CBOR_INLINE_API CborError cbor_value_get_boolean(const CborValue *value, bool *result)
{
+#ifdef HOST
assert(cbor_value_is_boolean(value));
+#endif
*result = !!value->extra;
return CborNoError;
}
@@ -339,7 +342,9 @@
{ return value->type == CborSimpleType; }
CBOR_INLINE_API CborError cbor_value_get_simple_type(const CborValue *value, uint8_t *result)
{
+#ifdef HOST
assert(cbor_value_is_simple_type(value));
+#endif
*result = (uint8_t)value->extra;
return CborNoError;
}
@@ -354,21 +359,27 @@
CBOR_INLINE_API CborError cbor_value_get_raw_integer(const CborValue *value, uint64_t *result)
{
+#ifdef HOST
assert(cbor_value_is_integer(value));
+#endif
*result = _cbor_value_extract_int64_helper(value);
return CborNoError;
}
CBOR_INLINE_API CborError cbor_value_get_uint64(const CborValue *value, uint64_t *result)
{
+#ifdef HOST
assert(cbor_value_is_unsigned_integer(value));
+#endif
*result = _cbor_value_extract_int64_helper(value);
return CborNoError;
}
CBOR_INLINE_API CborError cbor_value_get_int64(const CborValue *value, int64_t *result)
{
+#ifdef HOST
assert(cbor_value_is_integer(value));
+#endif
*result = (int64_t) _cbor_value_extract_int64_helper(value);
if (value->flags & CborIteratorFlag_NegativeInteger)
*result = -*result - 1;
@@ -377,7 +388,9 @@
CBOR_INLINE_API CborError cbor_value_get_int(const CborValue *value, int *result)
{
+#ifdef HOST
assert(cbor_value_is_integer(value));
+#endif
*result = (int) _cbor_value_extract_int64_helper(value);
if (value->flags & CborIteratorFlag_NegativeInteger)
*result = -*result - 1;
@@ -395,7 +408,9 @@
{ return value->type == CborTagType; }
CBOR_INLINE_API CborError cbor_value_get_tag(const CborValue *value, CborTag *result)
{
+#ifdef HOST
assert(cbor_value_is_tag(value));
+#endif
*result = _cbor_value_extract_int64_helper(value);
return CborNoError;
}
@@ -410,7 +425,9 @@
CBOR_INLINE_API CborError cbor_value_get_string_length(const CborValue *value, size_t *length)
{
uint64_t v;
+#ifdef HOST
assert(cbor_value_is_byte_string(value) || cbor_value_is_text_string(value));
+#endif
if (!cbor_value_is_length_known(value))
return CborErrorUnknownLength;
v = _cbor_value_extract_int64_helper(value);
@@ -430,26 +447,34 @@
CBOR_INLINE_API CborError cbor_value_copy_text_string(const CborValue *value, char *buffer,
size_t *buflen, CborValue *next)
{
+#ifdef HOST
assert(cbor_value_is_text_string(value));
+#endif
return _cbor_value_copy_string(value, buffer, buflen, next);
}
CBOR_INLINE_API CborError cbor_value_copy_byte_string(const CborValue *value, uint8_t *buffer,
size_t *buflen, CborValue *next)
{
+#ifdef HOST
assert(cbor_value_is_byte_string(value));
+#endif
return _cbor_value_copy_string(value, buffer, buflen, next);
}
CBOR_INLINE_API CborError cbor_value_dup_text_string(const CborValue *value, char **buffer,
size_t *buflen, CborValue *next)
{
+#ifdef HOST
assert(cbor_value_is_text_string(value));
+#endif
return _cbor_value_dup_string(value, (void **)buffer, buflen, next);
}
CBOR_INLINE_API CborError cbor_value_dup_byte_string(const CborValue *value, uint8_t **buffer,
size_t *buflen, CborValue *next)
{
+#ifdef HOST
assert(cbor_value_is_byte_string(value));
+#endif
return _cbor_value_dup_string(value, (void **)buffer, buflen, next);
}
@@ -464,7 +489,9 @@
CBOR_INLINE_API CborError cbor_value_get_array_length(const CborValue *value, size_t *length)
{
uint64_t v;
+#ifdef HOST
assert(cbor_value_is_array(value));
+#endif
if (!cbor_value_is_length_known(value))
return CborErrorUnknownLength;
v = _cbor_value_extract_int64_helper(value);
@@ -477,7 +504,9 @@
CBOR_INLINE_API CborError cbor_value_get_map_length(const CborValue *value, size_t *length)
{
uint64_t v;
+#ifdef HOST
assert(cbor_value_is_map(value));
+#endif
if (!cbor_value_is_length_known(value))
return CborErrorUnknownLength;
v = _cbor_value_extract_int64_helper(value);
@@ -499,8 +528,10 @@
CBOR_INLINE_API CborError cbor_value_get_float(const CborValue *value, float *result)
{
uint32_t data;
+#ifdef HOST
assert(cbor_value_is_float(value));
assert(value->flags & CborIteratorFlag_IntegerValueTooLarge);
+#endif
data = (uint32_t)_cbor_value_decode_int64_internal(value);
memcpy(result, &data, sizeof(*result));
return CborNoError;
@@ -511,8 +542,10 @@
CBOR_INLINE_API CborError cbor_value_get_double(const CborValue *value, double *result)
{
uint64_t data;
+#ifdef HOST
assert(cbor_value_is_double(value));
assert(value->flags & CborIteratorFlag_IntegerValueTooLarge);
+#endif
data = _cbor_value_decode_int64_internal(value);
memcpy(result, &data, sizeof(*result));
return CborNoError;
diff --unified --recursive --no-dereference src/cborparser.c /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborparser.c
--- src/cborparser.c 2024-12-03 11:54:08.834581955 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborparser.c 2024-12-03 11:32:10.790552470 +0100
@@ -38,6 +38,9 @@
#include <string.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+
/**
* \defgroup CborParsing Parsing CBOR streams
* \brief Group of functions used to parse CBOR streams.
@@ -1427,4 +1430,6 @@
return CborNoError;
}
+#pragma GCC diagnostic pop
+
/** @} */
diff --unified --recursive --no-dereference src/cborparser_dup_string.c /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborparser_dup_string.c
--- src/cborparser_dup_string.c 2024-12-03 11:54:08.834581955 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborparser_dup_string.c 2024-12-03 11:32:10.790552470 +0100
@@ -36,6 +36,9 @@
#include "compilersupport_p.h"
#include <stdlib.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+
/**
* \fn CborError cbor_value_dup_text_string(const CborValue *value, char **buffer, size_t *buflen, CborValue *next)
*
@@ -117,3 +120,5 @@
}
return CborNoError;
}
+
+#pragma GCC diagnostic pop
diff --unified --recursive --no-dereference src/cborpretty.c /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborpretty.c
--- src/cborpretty.c 2024-12-03 11:54:08.834581955 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborpretty.c 2024-12-03 11:32:10.790552470 +0100
@@ -36,6 +36,9 @@
#include <inttypes.h>
#include <string.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+
/**
* \defgroup CborPretty Converting CBOR to text
* \brief Group of functions used to convert CBOR to text form.
@@ -575,4 +578,6 @@
return value_to_pretty(streamFunction, token, value, flags, CBOR_PARSER_MAX_RECURSIONS);
}
+#pragma GCC diagnostic pop
+
/** @} */
diff --unified --recursive --no-dereference src/cborpretty_stdio.c /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborpretty_stdio.c
--- src/cborpretty_stdio.c 2024-12-03 11:50:28.290577022 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborpretty_stdio.c 2024-12-03 11:32:10.790552470 +0100
@@ -26,6 +26,9 @@
#include <stdarg.h>
#include <stdio.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+
static CborError cbor_fprintf(void *out, const char *fmt, ...)
{
int n;
@@ -85,3 +88,4 @@
return cbor_value_to_pretty_stream(cbor_fprintf, out, value, flags);
}
+#pragma GCC diagnostic pop
diff --unified --recursive --no-dereference src/cbortojson.c /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cbortojson.c
--- src/cbortojson.c 2024-12-03 11:54:08.834581955 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cbortojson.c 2024-12-03 11:32:10.790552470 +0100
@@ -40,6 +40,9 @@
#include <stdlib.h>
#include <string.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+
/**
* \defgroup CborToJson Converting CBOR to JSON
* \brief Group of functions used to convert CBOR to JSON.
@@ -696,4 +699,6 @@
return value_to_json(out, value, flags, cbor_value_get_type(value), &status);
}
+#pragma GCC diagnostic pop
+
/** @} */
diff --unified --recursive --no-dereference src/cborvalidation.c /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborvalidation.c
--- src/cborvalidation.c 2024-12-03 11:54:08.834581955 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/cborvalidation.c 2024-12-03 11:32:10.790552470 +0100
@@ -45,6 +45,9 @@
# define CBOR_PARSER_MAX_RECURSIONS 1024
#endif
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+
/**
* \addtogroup CborParsing
* @{
@@ -661,6 +664,8 @@
return CborNoError;
}
+#pragma GCC diagnostic pop
+
/**
* @}
*/
diff --unified --recursive --no-dereference src/open_memstream.c /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/open_memstream.c
--- src/open_memstream.c 2024-12-03 11:54:08.834581955 +0100
+++ /home/pennam/Arduino/libraries/Arduino_CloudUtils/src/tinycbor/src/open_memstream.c 2024-12-03 11:32:10.790552470 +0100
@@ -32,21 +32,18 @@
#include <stdlib.h>
#include <string.h>
-#if defined(__unix__) || defined(__APPLE__)
-# include <unistd.h>
-#endif
-#ifdef __APPLE__
-typedef int RetType;
-typedef int LenType;
-#elif __GLIBC__
+#include <unistd.h>
+
typedef ssize_t RetType;
typedef size_t LenType;
-#else
-# error "Cannot implement open_memstream!"
-#endif
#include "compilersupport_p.h"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wpedantic"
+#pragma GCC diagnostic ignored "-Wreturn-type"
+#pragma GCC diagnostic ignored "-Wunused-function"
+
struct Buffer
{
char **ptr;
@@ -65,8 +62,8 @@
return -1;
if (newsize > b->alloc) {
- // make room
- size_t newalloc = newsize + newsize / 2 + 1; // give 50% more room
+ /* make room */
+ size_t newalloc = newsize + newsize / 2 + 1; /* give 50% more room */
ptr = realloc(ptr, newalloc);
if (ptr == NULL)
return -1;
@@ -112,3 +109,4 @@
#endif
}
+#pragma GCC diagnostic pop
Solo in src/: parsetags.pl
Solo in src/: src.pri
Solo in src/: tags.txt
Solo in src/: tinycbor.pro