Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package sratom for openSUSE:Factory checked in at 2025-12-11 18:34:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sratom (Old) and /work/SRC/openSUSE:Factory/.sratom.new.1939 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sratom" Thu Dec 11 18:34:45 2025 rev:21 rq:1321947 version:0.6.20 Changes: -------- --- /work/SRC/openSUSE:Factory/sratom/sratom.changes 2025-03-11 20:42:22.850835492 +0100 +++ /work/SRC/openSUSE:Factory/.sratom.new.1939/sratom.changes 2025-12-11 18:35:07.305796493 +0100 @@ -1,0 +2,10 @@ +Wed Dec 10 08:32:12 UTC 2025 - Konstantin Voinov <[email protected]> + +- update to 0.6.20 + * Avoid over-use of yielding meson options + * Avoid use of scanf when reading MIDI events + * Fix lint checks + * Fix potential memory error when writing ambiguous relative paths + * Improve code quality + +------------------------------------------------------------------- Old: ---- sratom-0.6.18.tar.xz New: ---- sratom-0.6.20.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sratom.spec ++++++ --- /var/tmp/diff_new_pack.7zyUb6/_old 2025-12-11 18:35:07.981824838 +0100 +++ /var/tmp/diff_new_pack.7zyUb6/_new 2025-12-11 18:35:07.981824838 +0100 @@ -1,7 +1,7 @@ # # spec file for package sratom # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # Copyright (c) 2025 Andreas Stieger <[email protected]> # # All modifications and additions to the file contributed by third parties @@ -19,7 +19,7 @@ %define sover 0 Name: sratom -Version: 0.6.18 +Version: 0.6.20 Release: 0 Summary: A library for serialising LV2 atoms to/from RDF License: ISC ++++++ sratom-0.6.18.tar.xz -> sratom-0.6.20.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/.clang-tidy new/sratom-0.6.20/.clang-tidy --- old/sratom-0.6.18/.clang-tidy 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/.clang-tidy 2025-11-12 20:27:17.000000000 +0100 @@ -4,7 +4,6 @@ Checks: > *, -altera-*, - -clang-diagnostic-unused-macros, -llvmlibc-*, -misc-include-cleaner, CheckOptions: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/.git-blame-ignore-revs new/sratom-0.6.20/.git-blame-ignore-revs --- old/sratom-0.6.18/.git-blame-ignore-revs 1970-01-01 01:00:00.000000000 +0100 +++ new/sratom-0.6.20/.git-blame-ignore-revs 2025-11-12 20:27:17.000000000 +0100 @@ -0,0 +1,5 @@ +# Copyright 2025 David Robillard <[email protected]> +# SPDX-License-Identifier: 0BSD OR ISC + +# Format all code with clang-format +6b1a4297f8114b8833bf5f9c838130bdfa37b234 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/.gitignore new/sratom-0.6.20/.gitignore --- old/sratom-0.6.18/.gitignore 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/.gitignore 2025-11-12 20:27:17.000000000 +0100 @@ -1,9 +1,11 @@ -# Copyright 2019-2022 David Robillard <[email protected]> +# Copyright 2019-2025 David Robillard <[email protected]> # SPDX-License-Identifier: 0BSD OR ISC -.meson-subproject-wrap-hash.txt -__pycache__ -build/** -subprojects/packagecache/ -subprojects/sphinxygen-1.0.4/ -subprojects/sphinxygen/ +/.meson-subproject-wrap-hash.txt +/build/ +/subprojects/packagecache/ +/subprojects/sphinxygen-1.0.10/ +/subprojects/sphinxygen/ + +*.pyc +__pycache__/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/.reuse/dep5 new/sratom-0.6.20/.reuse/dep5 --- old/sratom-0.6.18/.reuse/dep5 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/.reuse/dep5 2025-11-12 20:27:17.000000000 +0100 @@ -7,3 +7,8 @@ Copyright: 2012-2025 David Robillard <[email protected]> Comment: Contributed to the Commons as a representation of simple facts License: 0BSD OR ISC + +Files: .suppress.cppcheck +Copyright: 2025 David Robillard <[email protected]> +Comment: Contributed to the Commons as a tool configuration +License: 0BSD OR ISC diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/.suppress.cppcheck new/sratom-0.6.20/.suppress.cppcheck --- old/sratom-0.6.18/.suppress.cppcheck 1970-01-01 01:00:00.000000000 +0100 +++ new/sratom-0.6.20/.suppress.cppcheck 2025-11-12 20:27:17.000000000 +0100 @@ -0,0 +1,3 @@ +normalCheckLevelMaxBranches +nullPointerArithmeticOutOfMemory +nullPointerOutOfMemory diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/COPYING new/sratom-0.6.20/COPYING --- old/sratom-0.6.18/COPYING 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/COPYING 2025-11-12 20:27:17.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright 2012-2022 David Robillard <[email protected]> +Copyright 2012-2025 David Robillard <[email protected]> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/LICENSES/ISC.txt new/sratom-0.6.20/LICENSES/ISC.txt --- old/sratom-0.6.18/LICENSES/ISC.txt 2025-12-11 18:35:08.125830875 +0100 +++ new/sratom-0.6.20/LICENSES/ISC.txt 2025-11-12 20:27:17.000000000 +0100 @@ -1 +1,13 @@ -symbolic link to ../COPYING +Copyright 2012-2025 David Robillard <[email protected]> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/NEWS new/sratom-0.6.20/NEWS --- old/sratom-0.6.18/NEWS 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/NEWS 2025-11-12 20:27:17.000000000 +0100 @@ -1,3 +1,13 @@ +sratom (0.6.20) stable; urgency=medium + + * Avoid over-use of yielding meson options + * Avoid use of scanf when reading MIDI events + * Fix lint checks + * Fix potential memory error when writing ambiguous relative paths + * Improve code quality + + -- David Robillard <[email protected]> Wed, 12 Nov 2025 19:26:04 +0000 + sratom (0.6.18) stable; urgency=medium * Add lint option with project metadata and code formatting tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/meson.build new/sratom-0.6.20/meson.build --- old/sratom-0.6.18/meson.build 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/meson.build 2025-11-12 20:27:17.000000000 +0100 @@ -1,4 +1,4 @@ -# Copyright 2021-2024 David Robillard <[email protected]> +# Copyright 2021-2025 David Robillard <[email protected]> # SPDX-License-Identifier: 0BSD OR ISC project( @@ -8,10 +8,11 @@ 'b_ndebug=if-release', 'buildtype=release', 'c_std=c99', + 'c_winlibs=', ], license: 'ISC', meson_version: '>= 0.56.0', - version: '0.6.18', + version: '0.6.20', ) sratom_src_root = meson.current_source_dir() @@ -119,23 +120,9 @@ m_dep = cc.find_library('m', required: false) -serd_dep = dependency( - 'serd-0', - fallback: 'serd', - version: '>= 0.30.10', -) - -sord_dep = dependency( - 'sord-0', - fallback: 'sord', - version: '>= 0.16.16', -) - -lv2_dep = dependency( - 'lv2', - fallback: 'lv2', - version: '>= 1.18.4', -) +serd_dep = dependency('serd-0', include_type: 'system', version: '>= 0.30.10') +sord_dep = dependency('sord-0', include_type: 'system', version: '>= 0.16.16') +lv2_dep = dependency('lv2', include_type: 'system', version: '>= 1.18.4') ########################## # Platform Configuration # @@ -173,6 +160,7 @@ darwin_versions: [major_version + '.0.0', meson.project_version()], dependencies: [m_dep, lv2_dep, serd_dep, sord_dep], gnu_symbol_visibility: 'hidden', + implicit_include_directories: false, include_directories: include_dirs, install: true, soversion: soversion, @@ -187,7 +175,7 @@ link_with: libsratom, ) -# Generage pkg-config file for external dependants +# Generate pkg-config file for external dependants pkg.generate( libsratom, description: 'Small library for serializing LV2 atoms', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/meson_options.txt new/sratom-0.6.20/meson_options.txt --- old/sratom-0.6.18/meson_options.txt 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/meson_options.txt 2025-11-12 20:27:17.000000000 +0100 @@ -1,19 +1,19 @@ -# Copyright 2021-2023 David Robillard <[email protected]> +# Copyright 2021-2025 David Robillard <[email protected]> # SPDX-License-Identifier: 0BSD OR ISC -option('docs', type: 'feature', yield: true, +option('docs', type: 'feature', description: 'Build documentation') -option('html', type: 'feature', yield: true, +option('html', type: 'feature', description: 'Build paginated HTML documentation') -option('lint', type: 'boolean', value: false, yield: true, +option('lint', type: 'boolean', value: false, description: 'Run code quality checks') -option('singlehtml', type: 'feature', yield: true, +option('singlehtml', type: 'feature', description: 'Build single-page HTML documentation') -option('tests', type: 'feature', yield: true, +option('tests', type: 'feature', description: 'Build tests') option('title', type: 'string', value: 'Sratom', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/src/.clang-tidy new/sratom-0.6.20/src/.clang-tidy --- old/sratom-0.6.18/src/.clang-tidy 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/src/.clang-tidy 2025-11-12 20:27:17.000000000 +0100 @@ -2,17 +2,14 @@ # SPDX-License-Identifier: 0BSD OR ISC Checks: > - -*-macro-to-enum, -*-magic-numbers, -*-narrowing-conversions, -bugprone-easily-swappable-parameters, -cert-err33-c, - -cert-err34-c, - -clang-analyzer-unix.Malloc, -hicpp-signed-bitwise, -misc-no-recursion, - -performance-no-int-to-ptr, - -readability-function-cognitive-complexity, -readability-identifier-length, - -readability-redundant-casting, +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: '21' InheritParentConfig: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/src/sratom.c new/sratom-0.6.20/src/sratom.c --- old/sratom-0.6.18/src/sratom.c 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/src/sratom.c 2025-11-12 20:27:17.000000000 +0100 @@ -27,6 +27,17 @@ typedef enum { MODE_SUBJECT, MODE_BODY, MODE_SEQUENCE } ReadMode; +typedef struct { + Sratom* sratom; + const SerdNode* subject; + const SerdNode* predicate; + SerdStatementFlags flags; + uint8_t idbuf[12]; + uint8_t nodebuf[12]; + SerdNode id; + SerdNode node; +} WriteContext; + struct SratomImpl { LV2_URID_Map* map; LV2_Atom_Forge forge; @@ -106,8 +117,7 @@ if (base_uri) { serd_node_free(&sratom->base_uri); sratom->base_uri = - serd_node_new_uri_from_string(USTR(base_uri), NULL, NULL); - serd_uri_parse((const uint8_t*)sratom->base_uri.buf, &sratom->base); + serd_node_new_uri_from_string(USTR(base_uri), NULL, &sratom->base); } sratom->write_statement = sink; sratom->end_anon = end_sink; @@ -227,6 +237,356 @@ return serd_node_from_string(SERD_URI, type); } +static SerdStatus +write_node(const WriteContext* const ctx, + const SerdNode object, + const SerdNode datatype, + const SerdNode language) +{ + const SerdNode def_s = serd_node_from_string(SERD_BLANK, USTR("atom")); + const SerdNode def_p = serd_node_from_string(SERD_URI, USTR(NS_RDF "value")); + return ctx->sratom->write_statement(ctx->sratom->handle, + ctx->flags, + NULL, + ctx->subject ? ctx->subject : &def_s, + ctx->predicate ? ctx->predicate : &def_p, + &object, + &datatype, + &language); +} + +static SerdStatus +write_free_node(const WriteContext* const ctx, + SerdNode object, + const SerdNode datatype, + const SerdNode language) +{ + const SerdStatus st = write_node(ctx, object, datatype, language); + serd_node_free(&object); + return st; +} + +static const char* +unmap_uri(LV2_URID_Unmap* const unmap, const LV2_URID urid) +{ + return unmap->unmap(unmap->handle, urid); +} + +static SerdStatus +write_literal(const WriteContext* const ctx, + LV2_URID_Unmap* const unmap, + const LV2_Atom_Literal_Body* const lit) +{ + const uint8_t* const str = USTR(lit + 1); + + const SerdNode object = serd_node_from_string(SERD_LITERAL, str); + if (lit->datatype) { + return write_node( + ctx, + object, + serd_node_from_string(SERD_URI, USTR(unmap_uri(unmap, lit->datatype))), + SERD_NODE_NULL); + } + + if (lit->lang) { + const char* const lang = unmap_uri(unmap, lit->lang); + const char* const prefix = "http://lexvo.org/id/iso639-3/"; + const size_t prefix_len = strlen(prefix); + if (!lang || !!strncmp(lang, prefix, prefix_len)) { + fprintf(stderr, "Unknown language URID %u\n", lit->lang); + return SERD_ERR_BAD_ARG; + } + + return write_node( + ctx, + object, + SERD_NODE_NULL, + serd_node_from_string(SERD_LITERAL, USTR(lang + prefix_len))); + } + + return write_node(ctx, object, SERD_NODE_NULL, SERD_NODE_NULL); +} + +static SerdStatus +write_path(const WriteContext* const ctx, const uint8_t* const str) +{ + SerdNode object = SERD_NODE_NULL; + SerdNode datatype = SERD_NODE_NULL; + if (path_is_absolute((const char*)str)) { + object = serd_node_new_file_uri(str, NULL, NULL, true); + } else if (!ctx->sratom->base_uri.buf || + !!strncmp((const char*)ctx->sratom->base_uri.buf, "file://", 7)) { + fprintf(stderr, "warning: Relative path but base is not a file URI.\n"); + fprintf(stderr, "warning: Writing ambiguous atom:Path literal.\n"); + SerdNode string = serd_node_from_string(SERD_LITERAL, str); + object = serd_node_copy(&string); + datatype = serd_node_from_string(SERD_URI, USTR(LV2_ATOM__Path)); + } else { + SerdNode rel = serd_node_new_file_uri(str, NULL, NULL, true); + object = serd_node_new_uri_from_node(&rel, &ctx->sratom->base, NULL); + serd_node_free(&rel); + } + + return write_free_node(ctx, object, datatype, SERD_NODE_NULL); +} + +static SerdStatus +write_midi_event(const WriteContext* const ctx, + const uint32_t size, + const void* const body) +{ + static const char hex_chars[] = "0123456789ABCDEF"; + + const size_t len = (size_t)size * 2U; + char* const str = (char*)calloc(len + 1, 1); + for (size_t i = 0U; i < size; ++i) { + const uint8_t byte = ((const uint8_t*)body)[i]; + str[2U * i] = hex_chars[byte >> 4U]; + str[(2U * i) + 1U] = hex_chars[byte & 0x0FU]; + } + + const SerdStatus st = + write_node(ctx, + serd_node_from_string(SERD_LITERAL, USTR(str)), + serd_node_from_string(SERD_URI, USTR(LV2_MIDI__MidiEvent)), + SERD_NODE_NULL); + free(str); + return st; +} + +static SerdStatus +write_event(WriteContext* const ctx, + LV2_URID_Unmap* const unmap, + const LV2_Atom_Event* const ev) +{ + gensym(&ctx->id, 'e', ctx->sratom->next_id++); + start_object( + ctx->sratom, &ctx->flags, ctx->subject, ctx->predicate, &ctx->id, NULL); + + SerdNode time = SERD_NODE_NULL; + SerdNode p = SERD_NODE_NULL; + SerdNode datatype = SERD_NODE_NULL; + SerdNode language = SERD_NODE_NULL; + if (ctx->sratom->seq_unit == ctx->sratom->atom_beatTime) { + time = serd_node_new_decimal(ev->time.beats, 16); + p = serd_node_from_string(SERD_URI, USTR(LV2_ATOM__beatTime)); + datatype = number_type(ctx->sratom, NS_XSD "double"); + } else { + time = serd_node_new_integer(ev->time.frames); + p = serd_node_from_string(SERD_URI, USTR(LV2_ATOM__frameTime)); + datatype = number_type(ctx->sratom, NS_XSD "long"); + } + + ctx->sratom->write_statement(ctx->sratom->handle, + SERD_ANON_CONT, + NULL, + &ctx->id, + &p, + &time, + &datatype, + &language); + serd_node_free(&time); + + p = serd_node_from_string(SERD_URI, NS_RDF "value"); + sratom_write(ctx->sratom, + unmap, + SERD_ANON_CONT, + &ctx->id, + &p, + ev->body.type, + ev->body.size, + LV2_ATOM_BODY(&ev->body)); + + return ctx->sratom->end_anon + ? ctx->sratom->end_anon(ctx->sratom->handle, &ctx->id) + : SERD_SUCCESS; +} + +static SerdStatus +write_tuple(WriteContext* const ctx, + LV2_URID_Unmap* const unmap, + const char* const type_uri, + const uint32_t size, + const void* body) +{ + gensym(&ctx->id, 't', ctx->sratom->next_id++); + start_object( + ctx->sratom, &ctx->flags, ctx->subject, ctx->predicate, &ctx->id, type_uri); + + SerdNode p = serd_node_from_string(SERD_URI, NS_RDF "value"); + ctx->flags |= SERD_LIST_O_BEGIN; + LV2_ATOM_TUPLE_BODY_FOREACH (body, size, i) { + list_append(ctx->sratom, + unmap, + &ctx->flags, + &ctx->id, + &p, + &ctx->node, + i->size, + i->type, + LV2_ATOM_BODY(i)); + } + list_end(ctx->sratom->write_statement, + ctx->sratom->handle, + ctx->flags, + &ctx->id, + &p); + + return ctx->sratom->end_anon + ? ctx->sratom->end_anon(ctx->sratom->handle, &ctx->id) + : SERD_SUCCESS; +} + +static SerdStatus +write_vector(WriteContext* const ctx, + LV2_URID_Unmap* const unmap, + const char* const type_uri, + const uint32_t size, + const void* body) +{ + const LV2_Atom_Vector_Body* vec = (const LV2_Atom_Vector_Body*)body; + gensym(&ctx->id, 'v', ctx->sratom->next_id++); + start_object( + ctx->sratom, &ctx->flags, ctx->subject, ctx->predicate, &ctx->id, type_uri); + SerdNode p = serd_node_from_string(SERD_URI, USTR(LV2_ATOM__childType)); + SerdNode child_type = + serd_node_from_string(SERD_URI, USTR(unmap_uri(unmap, vec->child_type))); + ctx->sratom->write_statement(ctx->sratom->handle, + ctx->flags, + NULL, + &ctx->id, + &p, + &child_type, + NULL, + NULL); + p = serd_node_from_string(SERD_URI, NS_RDF "value"); + ctx->flags |= SERD_LIST_O_BEGIN; + for (const char* i = (const char*)(vec + 1); i < (const char*)vec + size; + i += vec->child_size) { + list_append(ctx->sratom, + unmap, + &ctx->flags, + &ctx->id, + &p, + &ctx->node, + vec->child_size, + vec->child_type, + i); + } + list_end(ctx->sratom->write_statement, + ctx->sratom->handle, + ctx->flags, + &ctx->id, + &p); + + return ctx->sratom->end_anon + ? ctx->sratom->end_anon(ctx->sratom->handle, &ctx->id) + : SERD_SUCCESS; +} + +static SerdStatus +write_atom_object(WriteContext* const ctx, + LV2_URID_Unmap* const unmap, + const uint32_t type_urid, + const uint32_t size, + const void* body) +{ + const LV2_Atom_Object_Body* const obj = (const LV2_Atom_Object_Body*)body; + const char* const otype = unmap_uri(unmap, obj->otype); + + if (lv2_atom_forge_is_blank(&ctx->sratom->forge, type_urid, obj)) { + gensym(&ctx->id, 'b', ctx->sratom->next_id++); + start_object( + ctx->sratom, &ctx->flags, ctx->subject, ctx->predicate, &ctx->id, otype); + } else { + ctx->id = serd_node_from_string(SERD_URI, USTR(unmap_uri(unmap, obj->id))); + ctx->flags = 0U; + start_object(ctx->sratom, &ctx->flags, NULL, NULL, &ctx->id, otype); + } + + LV2_ATOM_OBJECT_BODY_FOREACH (obj, size, prop) { + const char* const key = unmap_uri(unmap, prop->key); + SerdNode pred = serd_node_from_string(SERD_URI, USTR(key)); + sratom_write(ctx->sratom, + unmap, + ctx->flags, + &ctx->id, + &pred, + prop->value.type, + prop->value.size, + LV2_ATOM_BODY(&prop->value)); + } + + if (ctx->sratom->end_anon && (ctx->flags & SERD_ANON_CONT)) { + return ctx->sratom->end_anon(ctx->sratom->handle, &ctx->id); + } + + return SERD_SUCCESS; +} + +static SerdStatus +write_sequence(WriteContext* const ctx, + LV2_URID_Unmap* const unmap, + const char* const type_uri, + const uint32_t size, + const void* const body) +{ + const LV2_Atom_Sequence_Body* seq = (const LV2_Atom_Sequence_Body*)body; + gensym(&ctx->id, 'v', ctx->sratom->next_id++); + start_object( + ctx->sratom, &ctx->flags, ctx->subject, ctx->predicate, &ctx->id, type_uri); + SerdNode p = serd_node_from_string(SERD_URI, NS_RDF "value"); + ctx->flags |= SERD_LIST_O_BEGIN; + for (const LV2_Atom_Event* ev = lv2_atom_sequence_begin(seq); + !lv2_atom_sequence_is_end(seq, size, ev); + ev = lv2_atom_sequence_next(ev)) { + ctx->sratom->seq_unit = seq->unit; + list_append(ctx->sratom, + unmap, + &ctx->flags, + &ctx->id, + &p, + &ctx->node, + sizeof(LV2_Atom_Event) + ev->body.size, + ctx->sratom->atom_Event, + ev); + } + list_end(ctx->sratom->write_statement, + ctx->sratom->handle, + ctx->flags, + &ctx->id, + &p); + + if (ctx->sratom->end_anon && ctx->subject && ctx->predicate) { + return ctx->sratom->end_anon(ctx->sratom->handle, &ctx->id); + } + + return SERD_SUCCESS; +} + +static SerdStatus +write_value_object(WriteContext* const ctx, + const char* const type_uri, + const uint32_t size, + const void* const body) +{ + gensym(&ctx->id, 'b', ctx->sratom->next_id++); + start_object( + ctx->sratom, &ctx->flags, ctx->subject, ctx->predicate, &ctx->id, type_uri); + SerdNode p = serd_node_from_string(SERD_URI, NS_RDF "value"); + SerdNode o = serd_node_new_blob(body, size, true); + SerdNode datatype = serd_node_from_string(SERD_URI, NS_XSD "base64Binary"); + + ctx->sratom->write_statement( + ctx->sratom->handle, ctx->flags, NULL, &ctx->id, &p, &o, &datatype, NULL); + + if (ctx->sratom->end_anon && ctx->subject && ctx->predicate) { + ctx->sratom->end_anon(ctx->sratom->handle, &ctx->id); + } + serd_node_free(&o); + return SERD_SUCCESS; // FIXME +} + int sratom_write(Sratom* sratom, LV2_URID_Unmap* unmap, @@ -237,281 +597,128 @@ uint32_t size, const void* body) { - static const char hex_chars[] = "0123456789ABCDEF"; + WriteContext ctx = { + sratom, + subject, + predicate, + flags, + {'b', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '\0'}, + {'b', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '\0'}, + SERD_NODE_NULL, + SERD_NODE_NULL}; - const char* const type = unmap->unmap(unmap->handle, type_urid); - const uint8_t idbuf[12] = "b0000000000"; - SerdNode id = serd_node_from_string(SERD_BLANK, idbuf); - 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; - SerdNode language = SERD_NODE_NULL; - bool new_node = false; + ctx.id = serd_node_from_string(SERD_BLANK, ctx.idbuf); + ctx.node = serd_node_from_string(SERD_BLANK, ctx.nodebuf); + + const char* const type = unmap_uri(unmap, type_urid); if (type_urid == 0 && size == 0) { - object = serd_node_from_string(SERD_URI, USTR(NS_RDF "nil")); - } else if (type_urid == sratom->forge.String) { - object = serd_node_from_string(SERD_LITERAL, (const uint8_t*)body); - } else if (type_urid == sratom->forge.Chunk) { - datatype = serd_node_from_string(SERD_URI, NS_XSD "base64Binary"); - object = serd_node_new_blob(body, size, true); - new_node = true; - } else if (type_urid == sratom->forge.Literal) { - const LV2_Atom_Literal_Body* lit = (const LV2_Atom_Literal_Body*)body; - const uint8_t* str = USTR(lit + 1); - - object = serd_node_from_string(SERD_LITERAL, str); - if (lit->datatype) { - datatype = serd_node_from_string( - SERD_URI, USTR(unmap->unmap(unmap->handle, lit->datatype))); - } else if (lit->lang) { - const char* lang = unmap->unmap(unmap->handle, lit->lang); - const char* prefix = "http://lexvo.org/id/iso639-3/"; - const size_t prefix_len = strlen(prefix); - if (lang && !strncmp(lang, prefix, prefix_len)) { - language = serd_node_from_string(SERD_LITERAL, USTR(lang + prefix_len)); - } else { - fprintf(stderr, "Unknown language URID %u\n", lit->lang); - } - } - } else if (type_urid == sratom->forge.URID) { - const uint32_t urid = *(const uint32_t*)body; - const uint8_t* str = USTR(unmap->unmap(unmap->handle, urid)); - - object = serd_node_from_string(SERD_URI, str); - } else if (type_urid == sratom->forge.Path) { - const uint8_t* str = USTR(body); - if (path_is_absolute((const char*)str)) { - new_node = true; - object = serd_node_new_file_uri(str, NULL, NULL, true); - } else { - if (!sratom->base_uri.buf || - !!strncmp((const char*)sratom->base_uri.buf, "file://", 7)) { - fprintf(stderr, "warning: Relative path but base is not a file URI.\n"); - fprintf(stderr, "warning: Writing ambiguous atom:Path literal.\n"); - object = serd_node_from_string(SERD_LITERAL, str); - datatype = serd_node_from_string(SERD_URI, USTR(LV2_ATOM__Path)); - } else { - new_node = true; - SerdNode rel = serd_node_new_file_uri(str, NULL, NULL, true); - object = serd_node_new_uri_from_node(&rel, &sratom->base, NULL); - serd_node_free(&rel); - } - } - } else if (type_urid == sratom->forge.URI) { - object = serd_node_from_string(SERD_URI, USTR(body)); - } else if (type_urid == sratom->forge.Int) { - new_node = true; - object = serd_node_new_integer(*(const int32_t*)body); - datatype = number_type(sratom, NS_XSD "int"); - } else if (type_urid == sratom->forge.Long) { - new_node = true; - object = serd_node_new_integer(*(const int64_t*)body); - datatype = number_type(sratom, NS_XSD "long"); - } else if (type_urid == sratom->forge.Float) { - new_node = true; - object = serd_node_new_decimal(*(const float*)body, 8); - datatype = number_type(sratom, NS_XSD "float"); - } else if (type_urid == sratom->forge.Double) { - new_node = true; - object = serd_node_new_decimal(*(const double*)body, 16); - datatype = number_type(sratom, NS_XSD "double"); - } else if (type_urid == sratom->forge.Bool) { - const int32_t val = *(const int32_t*)body; - - datatype = serd_node_from_string(SERD_URI, NS_XSD "boolean"); - object = serd_node_from_string(SERD_LITERAL, USTR(val ? "true" : "false")); - } else if (type_urid == sratom->midi_MidiEvent) { - new_node = true; - datatype = serd_node_from_string(SERD_URI, USTR(LV2_MIDI__MidiEvent)); - - const size_t len = (size_t)size * 2U; - char* const str = (char*)calloc(len + 1, 1); - for (size_t i = 0U; i < size; ++i) { - const uint8_t byte = ((const uint8_t*)body)[i]; - str[2U * i] = hex_chars[byte >> 4U]; - str[2U * i + 1U] = hex_chars[byte & 0x0FU]; - } + return write_node(&ctx, + serd_node_from_string(SERD_URI, USTR(NS_RDF "nil")), + SERD_NODE_NULL, + SERD_NODE_NULL); + } - object = serd_node_from_string(SERD_LITERAL, USTR(str)); - } else if (type_urid == sratom->atom_Event) { - const LV2_Atom_Event* ev = (const LV2_Atom_Event*)body; - gensym(&id, 'e', sratom->next_id++); - start_object(sratom, &flags, subject, predicate, &id, NULL); - SerdNode time; - SerdNode p; - if (sratom->seq_unit == sratom->atom_beatTime) { - time = serd_node_new_decimal(ev->time.beats, 16); - p = serd_node_from_string(SERD_URI, USTR(LV2_ATOM__beatTime)); - datatype = number_type(sratom, NS_XSD "double"); - } else { - time = serd_node_new_integer(ev->time.frames); - p = serd_node_from_string(SERD_URI, USTR(LV2_ATOM__frameTime)); - datatype = number_type(sratom, NS_XSD "long"); - } - sratom->write_statement(sratom->handle, - SERD_ANON_CONT, - NULL, - &id, - &p, - &time, - &datatype, - &language); - serd_node_free(&time); + if (type_urid == sratom->forge.String) { + return write_node(&ctx, + serd_node_from_string(SERD_LITERAL, USTR(body)), + SERD_NODE_NULL, + SERD_NODE_NULL); + } - p = serd_node_from_string(SERD_URI, NS_RDF "value"); - sratom_write(sratom, - unmap, - SERD_ANON_CONT, - &id, - &p, - ev->body.type, - ev->body.size, - LV2_ATOM_BODY(&ev->body)); - if (sratom->end_anon) { - sratom->end_anon(sratom->handle, &id); - } - } else if (type_urid == sratom->forge.Tuple) { - gensym(&id, 't', sratom->next_id++); - start_object(sratom, &flags, subject, predicate, &id, type); - SerdNode p = serd_node_from_string(SERD_URI, NS_RDF "value"); - flags |= SERD_LIST_O_BEGIN; - LV2_ATOM_TUPLE_BODY_FOREACH (body, size, i) { - list_append(sratom, - unmap, - &flags, - &id, - &p, - &node, - i->size, - i->type, - LV2_ATOM_BODY(i)); - } - list_end(sratom->write_statement, sratom->handle, flags, &id, &p); - if (sratom->end_anon) { - sratom->end_anon(sratom->handle, &id); - } - } else if (type_urid == sratom->forge.Vector) { - const LV2_Atom_Vector_Body* vec = (const LV2_Atom_Vector_Body*)body; - gensym(&id, 'v', sratom->next_id++); - start_object(sratom, &flags, subject, predicate, &id, type); - SerdNode p = - serd_node_from_string(SERD_URI, (const uint8_t*)LV2_ATOM__childType); - SerdNode child_type = serd_node_from_string( - SERD_URI, (const uint8_t*)unmap->unmap(unmap->handle, vec->child_type)); - sratom->write_statement( - sratom->handle, flags, NULL, &id, &p, &child_type, NULL, NULL); - p = serd_node_from_string(SERD_URI, NS_RDF "value"); - flags |= SERD_LIST_O_BEGIN; - for (const char* i = (const char*)(vec + 1); i < (const char*)vec + size; - i += vec->child_size) { - list_append(sratom, - unmap, - &flags, - &id, - &p, - &node, - vec->child_size, - vec->child_type, - i); - } - list_end(sratom->write_statement, sratom->handle, flags, &id, &p); - if (sratom->end_anon) { - sratom->end_anon(sratom->handle, &id); - } - } else if (lv2_atom_forge_is_object_type(&sratom->forge, type_urid)) { - const LV2_Atom_Object_Body* obj = (const LV2_Atom_Object_Body*)body; - const char* otype = unmap->unmap(unmap->handle, obj->otype); - - if (lv2_atom_forge_is_blank(&sratom->forge, type_urid, obj)) { - gensym(&id, 'b', sratom->next_id++); - start_object(sratom, &flags, subject, predicate, &id, otype); - } else { - id = serd_node_from_string( - SERD_URI, (const uint8_t*)unmap->unmap(unmap->handle, obj->id)); - flags = 0; - start_object(sratom, &flags, NULL, NULL, &id, otype); - } - LV2_ATOM_OBJECT_BODY_FOREACH (obj, size, prop) { - const char* const key = unmap->unmap(unmap->handle, prop->key); - SerdNode pred = serd_node_from_string(SERD_URI, USTR(key)); - sratom_write(sratom, - unmap, - flags, - &id, - &pred, - prop->value.type, - prop->value.size, - LV2_ATOM_BODY(&prop->value)); - } - if (sratom->end_anon && (flags & SERD_ANON_CONT)) { - sratom->end_anon(sratom->handle, &id); - } - } else if (type_urid == sratom->forge.Sequence) { - const LV2_Atom_Sequence_Body* seq = (const LV2_Atom_Sequence_Body*)body; - gensym(&id, 'v', sratom->next_id++); - start_object(sratom, &flags, subject, predicate, &id, type); - SerdNode p = serd_node_from_string(SERD_URI, NS_RDF "value"); - flags |= SERD_LIST_O_BEGIN; - for (const LV2_Atom_Event* ev = lv2_atom_sequence_begin(seq); - !lv2_atom_sequence_is_end(seq, size, ev); - ev = lv2_atom_sequence_next(ev)) { - sratom->seq_unit = seq->unit; - list_append(sratom, - unmap, - &flags, - &id, - &p, - &node, - sizeof(LV2_Atom_Event) + ev->body.size, - sratom->atom_Event, - ev); - } - list_end(sratom->write_statement, sratom->handle, flags, &id, &p); - if (sratom->end_anon && subject && predicate) { - sratom->end_anon(sratom->handle, &id); - } - } else { - gensym(&id, 'b', sratom->next_id++); - start_object(sratom, &flags, subject, predicate, &id, type); - SerdNode p = serd_node_from_string(SERD_URI, NS_RDF "value"); - SerdNode o = serd_node_new_blob(body, size, true); - datatype = serd_node_from_string(SERD_URI, NS_XSD "base64Binary"); - sratom->write_statement( - sratom->handle, flags, NULL, &id, &p, &o, &datatype, NULL); - if (sratom->end_anon && subject && predicate) { - sratom->end_anon(sratom->handle, &id); - } - serd_node_free(&o); + if (type_urid == sratom->forge.Chunk) { + return write_free_node( + &ctx, + serd_node_new_blob(body, size, true), + serd_node_from_string(SERD_URI, NS_XSD "base64Binary"), + SERD_NODE_NULL); } - if (object.buf) { - SerdNode def_s = serd_node_from_string(SERD_BLANK, USTR("atom")); - SerdNode def_p = serd_node_from_string(SERD_URI, USTR(NS_RDF "value")); + if (type_urid == sratom->forge.Literal) { + return write_literal(&ctx, unmap, (const LV2_Atom_Literal_Body*)body); + } - if (!subject) { - subject = &def_s; - } + if (type_urid == sratom->forge.URID) { + return write_node( + &ctx, + serd_node_from_string(SERD_URI, + USTR(unmap_uri(unmap, *(const uint32_t*)body))), + SERD_NODE_NULL, + SERD_NODE_NULL); + } + + if (type_urid == sratom->forge.Path) { + return write_path(&ctx, USTR(body)); + } + + if (type_urid == sratom->forge.URI) { + return write_node(&ctx, + serd_node_from_string(SERD_URI, USTR(body)), + SERD_NODE_NULL, + SERD_NODE_NULL); + } + + if (type_urid == sratom->forge.Int) { + return write_free_node(&ctx, + serd_node_new_integer(*(const int32_t*)body), + number_type(sratom, NS_XSD "int"), + SERD_NODE_NULL); + } - if (!predicate) { - predicate = &def_p; - } + if (type_urid == sratom->forge.Long) { + return write_free_node(&ctx, + serd_node_new_integer(*(const int64_t*)body), + number_type(sratom, NS_XSD "long"), + SERD_NODE_NULL); + } - sratom->write_statement(sratom->handle, - flags, - NULL, - subject, - predicate, - &object, - &datatype, - &language); + if (type_urid == sratom->forge.Float) { + return write_free_node(&ctx, + serd_node_new_decimal(*(const float*)body, 8), + number_type(sratom, NS_XSD "float"), + SERD_NODE_NULL); + } + + if (type_urid == sratom->forge.Double) { + return write_free_node(&ctx, + serd_node_new_decimal(*(const double*)body, 16), + number_type(sratom, NS_XSD "double"), + SERD_NODE_NULL); } - if (new_node) { - serd_node_free(&object); + if (type_urid == sratom->forge.Bool) { + return write_node( + &ctx, + serd_node_from_string(SERD_LITERAL, + USTR(*(const int32_t*)body ? "true" : "false")), + serd_node_from_string(SERD_URI, NS_XSD "boolean"), + SERD_NODE_NULL); } - return 0; + if (type_urid == sratom->midi_MidiEvent) { + return write_midi_event(&ctx, size, body); + } + + if (type_urid == sratom->atom_Event) { + return write_event(&ctx, unmap, (const LV2_Atom_Event*)body); + } + + if (type_urid == sratom->forge.Tuple) { + return write_tuple(&ctx, unmap, type, size, body); + } + + if (type_urid == sratom->forge.Vector) { + return write_vector(&ctx, unmap, type, size, body); + } + + if (lv2_atom_forge_is_object_type(&sratom->forge, type_urid)) { + return write_atom_object(&ctx, unmap, type_urid, size, body); + } + + if (type_urid == sratom->forge.Sequence) { + return write_sequence(&ctx, unmap, type, size, body); + } + + return write_value_object(&ctx, type, size, body); } char* @@ -625,6 +832,12 @@ return 0; } +static inline uint8_t +hex_digit_value(const uint8_t c) +{ + return (uint8_t)((c > '9') ? ((c & ~0x20) - 'A' + 10) : (c - '0')); +} + static void read_literal(Sratom* sratom, LV2_Atom_Forge* forge, const SordNode* node) { @@ -659,9 +872,9 @@ } else if (!strcmp(type_uri, LV2_MIDI__MidiEvent)) { lv2_atom_forge_atom(forge, len / 2, sratom->midi_MidiEvent); for (const char* s = str; s < str + len; s += 2) { - unsigned num = 0U; - sscanf(s, "%2X", &num); - const uint8_t c = num; + const uint8_t hi = hex_digit_value(s[0]); + const uint8_t lo = hex_digit_value(s[1]); + const uint8_t c = (uint8_t)(((unsigned)hi << 4U) | lo); lv2_atom_forge_raw(forge, &c, 1); } lv2_atom_forge_pad(forge, len / 2); @@ -800,12 +1013,12 @@ lv2_atom_forge_atom(forge, 0, 0); } else if (!strncmp(str, "file://", 7)) { SerdURI uri; - serd_uri_parse((const uint8_t*)str, &uri); + serd_uri_parse(USTR(str), &uri); SerdNode rel = serd_node_new_relative_uri(&uri, &sratom->base, &sratom->base, NULL); - uint8_t* const path = serd_file_uri_parse((const uint8_t*)rel.buf, NULL); + uint8_t* const path = serd_file_uri_parse(USTR(rel.buf), NULL); if (path) { lv2_atom_forge_path( @@ -895,7 +1108,7 @@ SerdEnv* env = sratom->env ? sratom->env : serd_env_new(&base); SerdReader* reader = sord_new_reader(model, env, SERD_TURTLE, NULL); - if (!serd_reader_read_string(reader, (const uint8_t*)str)) { + if (!serd_reader_read_string(reader, USTR(str))) { 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); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/subprojects/sphinxygen.wrap new/sratom-0.6.20/subprojects/sphinxygen.wrap --- old/sratom-0.6.18/subprojects/sphinxygen.wrap 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/subprojects/sphinxygen.wrap 2025-11-12 20:27:17.000000000 +0100 @@ -2,13 +2,13 @@ # SPDX-License-Identifier: 0BSD OR ISC [wrap-file] -directory = sphinxygen-1.0.6 -source_url = https://download.drobilla.net/sphinxygen-1.0.6.tar.gz -source_filename = sphinxygen-1.0.6.tar.gz -source_hash = 8e55ac0af7b184c3c50f656c8a0f62398fc79a353067d51e7bf4f6ac25194aff +directory = sphinxygen-1.0.12 +source_url = https://download.drobilla.net/sphinxygen-1.0.12.tar.gz +source_filename = sphinxygen-1.0.12.tar.gz +source_hash = 4dfc9cd1c89448f1c98c59a3ec63e0c5df2dafcc631ce48de793692b244451b9 # [wrap-git] # url = https://gitlab.com/drobilla/sphinxygen.git # push-url = ssh://[email protected]:drobilla/sphinxygen.git -# revision = v1.0.4 +# revision = v1.0.12 # depth = 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/test/.clang-tidy new/sratom-0.6.20/test/.clang-tidy --- old/sratom-0.6.18/test/.clang-tidy 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/test/.clang-tidy 2025-11-12 20:27:17.000000000 +0100 @@ -2,11 +2,12 @@ # SPDX-License-Identifier: 0BSD OR ISC Checks: > - -*-macro-to-enum, -*-magic-numbers, -bugprone-multi-level-implicit-pointer-conversion, -bugprone-suspicious-realloc-usage, -cert-err33-c, - -performance-no-int-to-ptr, -readability-identifier-length, +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: '13' InheritParentConfig: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/test/headers/.clang-tidy new/sratom-0.6.20/test/headers/.clang-tidy --- old/sratom-0.6.18/test/headers/.clang-tidy 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/test/headers/.clang-tidy 2025-11-12 20:27:17.000000000 +0100 @@ -3,11 +3,11 @@ Checks: > *, - -*-macro-to-enum, -altera-*, -llvmlibc-*, - -performance-no-int-to-ptr, - -readability-identifier-length, +CheckOptions: + - key: readability-function-cognitive-complexity.Threshold + value: '0' WarningsAsErrors: '*' -HeaderFilterRegex: '.*/sratom/[^/]+.h' +HeaderFilterRegex: '.*' FormatStyle: file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/test/headers/meson.build new/sratom-0.6.20/test/headers/meson.build --- old/sratom-0.6.18/test/headers/meson.build 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/test/headers/meson.build 2025-11-12 20:27:17.000000000 +0100 @@ -5,23 +5,10 @@ if get_option('warning_level') == 'everything' if cc.get_id() == 'clang' - header_c_suppressions += [ - '-Wno-cast-align', # LV2 - '-Wno-cast-qual', # LV2 - '-Wno-declaration-after-statement', # LV2 - '-Wno-documentation-unknown-command', # LV2 - '-Wno-padded', # LV2, serd - '-Wno-poison-system-directories', - '-Wno-unsafe-buffer-usage', # LV2 - ] - elif cc.get_id() == 'gcc' - header_c_suppressions += [ - '-Wno-cast-align', # LV2 - '-Wno-cast-qual', # LV2 - '-Wno-padded', # Serd - '-Wno-sign-conversion', # LV2 - '-Wno-unused-const-variable', # Serd - ] + if not meson.is_cross_build() + header_c_suppressions += ['-Wno-poison-system-directories'] + endif + header_c_suppressions += ['-Wno-poison-system-directories'] elif cc.get_id() == 'msvc' header_c_suppressions += [ '/wd4820', # padding added after construct @@ -29,23 +16,16 @@ endif endif -if cc.get_id() == 'clang' - header_c_suppressions += [ - '-Wno-nullability-extension', - ] -endif - header_c_suppressions = cc.get_supported_arguments(header_c_suppressions) -test_headers_source = files('test_headers.c') - test( 'headers', executable( 'test_headers', - test_headers_source, + files('test_headers.c'), c_args: header_c_suppressions, dependencies: [sratom_dep], + implicit_include_directories: false, ), suite: 'unit', ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/test/lint/meson.build new/sratom-0.6.20/test/lint/meson.build --- old/sratom-0.6.18/test/lint/meson.build 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/test/lint/meson.build 2025-11-12 20:27:17.000000000 +0100 @@ -1,7 +1,7 @@ # Copyright 2021-2024 David Robillard <[email protected]> # SPDX-License-Identifier: 0BSD OR ISC -all_sources = sources + test_sratom_source + test_headers_source +all_sources = sources + test_sratom_source # Check licensing metadata reuse = find_program('reuse', required: false) @@ -28,11 +28,12 @@ cppcheck = find_program('cppcheck', required: false) if cppcheck.found() compdb_path = join_paths(sratom_build_root, 'compile_commands.json') + suppress_path = join_paths(sratom_src_root, '.suppress.cppcheck') cppcheck_args = [ '--enable=warning,style,performance,portability', '--error-exitcode=1', '--project=' + compdb_path, - '--suppress=normalCheckLevelMaxBranches', + '--suppressions-list=' + suppress_path, '-q', ] test('cppcheck', cppcheck, args: cppcheck_args, suite: 'code') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/test/meson.build new/sratom-0.6.20/test/meson.build --- old/sratom-0.6.18/test/meson.build 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/test/meson.build 2025-11-12 20:27:17.000000000 +0100 @@ -20,6 +20,7 @@ test_sratom_source, c_args: c_suppressions, dependencies: [sratom_dep, serd_dep, sord_dep], + implicit_include_directories: false, ), suite: 'unit', ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sratom-0.6.18/test/test_sratom.c new/sratom-0.6.20/test/test_sratom.c --- old/sratom-0.6.18/test/test_sratom.c 2025-01-19 14:50:29.000000000 +0100 +++ new/sratom-0.6.20/test/test_sratom.c 2025-11-12 20:27:17.000000000 +0100 @@ -9,6 +9,7 @@ #include <serd/serd.h> #include <sratom/sratom.h> +#include <assert.h> #include <stdarg.h> #include <stdbool.h> #include <stdint.h> @@ -37,6 +38,7 @@ { const size_t len = strlen(str); char* dup = (char*)malloc(len + 1); + assert(dup); memcpy(dup, str, len + 1); return dup; } @@ -81,7 +83,7 @@ } static int -test(SerdEnv* env, bool top_level, bool pretty_numbers) +test(SerdEnv* env, const char* base_uri, bool top_level, bool pretty_numbers) { Uris uris = {NULL, 0}; LV2_URID_Map map = {&uris, urid_map}; @@ -319,8 +321,6 @@ lv2_atom_forge_pop(&forge, &obj_frame); - const char* base_uri = "file:///tmp/base/"; - 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")); @@ -384,10 +384,11 @@ static int test_env(SerdEnv* env) { - if (test(env, false, false) || // - test(env, true, false) || // - test(env, false, true) || // - test(env, true, true)) { + if (test(env, "file:///tmp/base/", false, false) || // + test(env, "file:///tmp/base/", true, false) || // + test(env, "file:///tmp/base/", false, true) || // + test(env, "file:///tmp/base/", true, true) || // + test(env, "http://example.org/", true, true)) { return 1; }
