aboutsummaryrefslogtreecommitdiffstats
path: root/src/node.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-08 23:42:54 +0000
committerDavid Robillard <d@drobilla.net>2012-08-08 23:42:54 +0000
commitc283edd147ac0785dadf57e2d7a681905b9b229f (patch)
tree1f49739df1f2c1eacc52801fdde999a5115e24b0 /src/node.c
parent1461865085504ba8cb41d1fb9c8738266c6537f7 (diff)
downloadserd-c283edd147ac0785dadf57e2d7a681905b9b229f.tar.gz
serd-c283edd147ac0785dadf57e2d7a681905b9b229f.tar.bz2
serd-c283edd147ac0785dadf57e2d7a681905b9b229f.zip
Fix warnings: -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wmissing-prototypes.
git-svn-id: http://svn.drobilla.net/serd/trunk@374 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/node.c')
-rw-r--r--src/node.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/node.c b/src/node.c
index 575b2ff0..7f6e9863 100644
--- a/src/node.c
+++ b/src/node.c
@@ -165,9 +165,9 @@ serd_node_new_file_uri(const uint8_t* path,
} else if (!escape || is_uri_path_char(path[i])) {
serd_chunk_sink(path + i, 1, &chunk);
} else {
- char escape[4] = { '%', 0, 0, 0 };
- snprintf(escape + 1, sizeof(escape) - 1, "%X", path[i]);
- serd_chunk_sink(escape, 3, &chunk);
+ char escape_str[4] = { '%', 0, 0, 0 };
+ snprintf(escape_str + 1, sizeof(escape_str) - 1, "%X", path[i]);
+ serd_chunk_sink(escape_str, 3, &chunk);
}
}
serd_chunk_sink_finish(&chunk);
@@ -310,19 +310,19 @@ SerdNode
serd_node_new_blob(const void* buf, size_t size, bool wrap_lines)
{
const size_t len = ((size + 2) / 3) * 4 + (wrap_lines ? (size / 57) : 0);
- SerdNode node = { (uint8_t*)calloc(1, len + 2),
- len, len, 0, SERD_LITERAL };
+ uint8_t* str = (uint8_t*)calloc(1, len + 2);
+ SerdNode node = { str, len, len, 0, SERD_LITERAL };
for (size_t i = 0, j = 0; i < size; i += 3, j += 4) {
uint8_t in[4] = { 0, 0, 0, 0 };
size_t n_in = MIN(3, size - i);
memcpy(in, (const uint8_t*)buf + i, n_in);
if (wrap_lines && i > 0 && (i % 57) == 0) {
- ((uint8_t*)node.buf)[j++] = '\n';
+ str[j++] = '\n';
node.flags |= SERD_HAS_NEWLINE;
}
- encode_chunk((uint8_t*)node.buf + j, in, n_in);
+ encode_chunk(str + j, in, n_in);
}
return node;
}