summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-12-10 12:56:44 -0500
committerDavid Robillard <d@drobilla.net>2022-12-11 13:09:54 -0500
commit2eca3218ca1ac8fa582f86ab5f055474ad369d7d (patch)
treedc0df0310875b147ff87bd32d33e28b36d86c310
parent270a81d5cb27c363c9ee2b78bcb7d14565d121d0 (diff)
downloadsratom-2eca3218ca1ac8fa582f86ab5f055474ad369d7d.tar.gz
sratom-2eca3218ca1ac8fa582f86ab5f055474ad369d7d.tar.bz2
sratom-2eca3218ca1ac8fa582f86ab5f055474ad369d7d.zip
Fix "suspicious" string comparisons
-rw-r--r--NEWS1
-rw-r--r--src/.clang-tidy1
-rw-r--r--src/sratom.c2
-rw-r--r--test/.clang-tidy1
-rw-r--r--test/test_sratom.c2
5 files changed, 3 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index bf20196..5c4a8e1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
sratom (0.6.15) unstable; urgency=medium
+ * Clean up code
* Fix dependencies in pkg-config file
* Override pkg-config dependency within meson
* Replace duplicated dox_to_sphinx script with sphinxygen dependency
diff --git a/src/.clang-tidy b/src/.clang-tidy
index 1b4b226..c50cd8a 100644
--- a/src/.clang-tidy
+++ b/src/.clang-tidy
@@ -5,7 +5,6 @@ Checks: >
-*-magic-numbers,
-*-narrowing-conversions,
-bugprone-easily-swappable-parameters,
- -bugprone-suspicious-string-compare,
-cert-err33-c,
-cert-err34-c,
-clang-analyzer-unix.Malloc,
diff --git a/src/sratom.c b/src/sratom.c
index fd984d0..2222dd4 100644
--- a/src/sratom.c
+++ b/src/sratom.c
@@ -282,7 +282,7 @@ sratom_write(Sratom* sratom,
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)) {
+ !!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);
diff --git a/test/.clang-tidy b/test/.clang-tidy
index e4b41e4..d335ce8 100644
--- a/test/.clang-tidy
+++ b/test/.clang-tidy
@@ -3,7 +3,6 @@
Checks: >
-*-magic-numbers,
- -bugprone-suspicious-string-compare,
-cert-err33-c,
-readability-identifier-length,
InheritParentConfig: true
diff --git a/test/test_sratom.c b/test/test_sratom.c
index 246b5c5..3fa2db6 100644
--- a/test/test_sratom.c
+++ b/test/test_sratom.c
@@ -362,7 +362,7 @@ test(SerdEnv* env, bool top_level, bool pretty_numbers)
LV2_ATOM_BODY(parsed));
printf("# Turtle => Atom\n\n%s", instr);
- if (strcmp(outstr, instr)) {
+ if (!!strcmp(outstr, instr)) {
return test_fail("Re-serialized string differs from original\n");
}
free(instr);