diff options
-rw-r--r-- | src/sratom.c | 22 | ||||
-rw-r--r-- | test/test_sratom.c | 14 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/sratom.c b/src/sratom.c index da6fae4..0c27b88 100644 --- a/src/sratom.c +++ b/src/sratom.c @@ -238,9 +238,9 @@ sratom_write(Sratom* sratom, const void* body) { const char* const type = unmap->unmap(unmap->handle, type_urid); - uint8_t idbuf[12] = "b0000000000"; + const uint8_t idbuf[12] = "b0000000000"; SerdNode id = serd_node_from_string(SERD_BLANK, idbuf); - uint8_t nodebuf[12] = "b0000000000"; + const uint8_t nodebuf[12] = "b0000000000"; SerdNode node = serd_node_from_string(SERD_BLANK, nodebuf); SerdNode object = SERD_NODE_NULL; SerdNode datatype = SERD_NODE_NULL; @@ -597,7 +597,7 @@ read_resource(Sratom* sratom, } static uint32_t -atom_size(Sratom* sratom, uint32_t type_urid) +atom_size(const Sratom* sratom, uint32_t type_urid) { if (type_urid == sratom->forge.Int || type_urid == sratom->forge.Bool) { return sizeof(int32_t); @@ -627,10 +627,10 @@ read_literal(Sratom* sratom, LV2_Atom_Forge* forge, const SordNode* node) { assert(sord_node_get_type(node) == SORD_LITERAL); - size_t len = 0; - const char* str = (const char*)sord_node_get_string_counted(node, &len); - SordNode* datatype = sord_node_get_datatype(node); - const char* language = sord_node_get_language(node); + size_t len = 0; + const char* str = (const char*)sord_node_get_string_counted(node, &len); + const SordNode* datatype = sord_node_get_datatype(node); + const char* language = sord_node_get_language(node); if (datatype) { const char* type_uri = (const char*)sord_node_get_string(datatype); if (!strcmp(type_uri, (const char*)NS_XSD "int") || @@ -873,7 +873,7 @@ sratom_forge_sink(LV2_Atom_Forge_Sink_Handle handle, LV2_Atom* sratom_forge_deref(LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref) { - SerdChunk* chunk = (SerdChunk*)handle; + const SerdChunk* chunk = (const SerdChunk*)handle; return (LV2_Atom*)(chunk->buf + ref - 1); } @@ -893,12 +893,12 @@ sratom_from_turtle(Sratom* sratom, SerdReader* reader = sord_new_reader(model, env, SERD_TURTLE, NULL); if (!serd_reader_read_string(reader, (const uint8_t*)str)) { - SordNode* s = sord_node_from_serd_node(world, env, subject, 0, 0); + const SordNode* s = sord_node_from_serd_node(world, env, subject, 0, 0); lv2_atom_forge_set_sink( &sratom->forge, sratom_forge_sink, sratom_forge_deref, &out); if (subject && predicate) { - SordNode* p = sord_node_from_serd_node(world, env, predicate, 0, 0); - SordNode* o = sord_get(model, s, p, NULL, NULL); + const SordNode* p = sord_node_from_serd_node(world, env, predicate, 0, 0); + SordNode* o = sord_get(model, s, p, NULL, NULL); if (o) { sratom_read(sratom, &sratom->forge, world, model, o); sord_node_free(world, o); diff --git a/test/test_sratom.c b/test/test_sratom.c index ba59737..6b54627 100644 --- a/test/test_sratom.c +++ b/test/test_sratom.c @@ -257,27 +257,27 @@ test(SerdEnv* env, bool top_level, bool pretty_numbers) // eg_ivector = (Vector<Int>)1,2,3,4,5 lv2_atom_forge_key(&forge, eg_ivector); - int32_t ielems[] = {1, 2, 3, 4, 5}; + const int32_t ielems[] = {1, 2, 3, 4, 5}; lv2_atom_forge_vector(&forge, sizeof(int32_t), forge.Int, 5, ielems); // eg_lvector = (Vector<Long>)1,2,3,4 lv2_atom_forge_key(&forge, eg_lvector); - int64_t lelems[] = {1, 2, 3, 4}; + const int64_t lelems[] = {1, 2, 3, 4}; lv2_atom_forge_vector(&forge, sizeof(int64_t), forge.Long, 4, lelems); // eg_fvector = (Vector<Float>)1.0,2.0,3.0,4.0,5.0 lv2_atom_forge_key(&forge, eg_fvector); - float felems[] = {1, 2, 3, 4, 5}; + const float felems[] = {1, 2, 3, 4, 5}; lv2_atom_forge_vector(&forge, sizeof(float), forge.Float, 5, felems); // eg_dvector = (Vector<Double>)1.0,2.0,3.0,4.0 lv2_atom_forge_key(&forge, eg_dvector); - double delems[] = {1, 2, 3, 4}; + const double delems[] = {1, 2, 3, 4}; lv2_atom_forge_vector(&forge, sizeof(double), forge.Double, 4, delems); // eg_bvector = (Vector<Bool>)1,0,1 lv2_atom_forge_key(&forge, eg_bvector); - int32_t belems[] = {true, false, true}; + const int32_t belems[] = {true, false, true}; lv2_atom_forge_vector(&forge, sizeof(int32_t), forge.Bool, 3, belems); // eg_fseq = (Sequence)1, 2 @@ -325,8 +325,8 @@ test(SerdEnv* env, bool top_level, bool pretty_numbers) SerdNode s = serd_node_from_string(SERD_URI, USTR("http://example.org/obj")); SerdNode p = serd_node_from_string(SERD_URI, USTR(NS_RDF "value")); - SerdNode* subj = top_level ? NULL : &s; - SerdNode* pred = top_level ? NULL : &p; + const SerdNode* subj = top_level ? NULL : &s; + const SerdNode* pred = top_level ? NULL : &p; char* outstr = sratom_to_turtle(sratom, &unmap, |