Skip to content

Commit f945701

Browse files
rzrthiagomacieira
authored andcommitted
json2cbor: Initialize index before "for scope"
Observed issue on earlier version: json2cbor.c:157:5: error: for loop initial declarations are only allowed in C99 mode Note, it's not mandatory for current master branch since build script already sets the c99 flag, but it won't cause any harm. Signed-off-by: Philippe Coval <[email protected]>
1 parent 3369dd1 commit f945701

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/json2cbor/json2cbor.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,13 @@ uint8_t *decode_base64url(const char *string, size_t *len)
149149

150150
uint8_t *decode_base16(const char *string, size_t *len)
151151
{
152+
size_t i;
152153
*len = strlen(string) / 2;
153154
uint8_t *buffer = malloc(*len);
154155
if (buffer == NULL)
155156
return NULL;
156157

157-
for (size_t i = 0; i < *len; ++i) {
158+
for (i = 0; i < *len; ++i) {
158159
char c = string[i * 2];
159160
if (c >= '0' && c <= '9') {
160161
buffer[i] = (c - '0') << 4;

0 commit comments

Comments
 (0)