summaryrefslogtreecommitdiffstats
path: root/src/state.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-12-10 13:48:57 -0500
committerDavid Robillard <d@drobilla.net>2022-12-10 19:04:45 -0500
commit708911daa222ac5f1423a02ebc89eeaf21548f5a (patch)
tree697278b2b700d3856b52a6150c1a7da82a91d4f2 /src/state.c
parent1988db57ca8003a406e08855ab66d1891fc5ce6b (diff)
downloadlilv-708911daa222ac5f1423a02ebc89eeaf21548f5a.tar.gz
lilv-708911daa222ac5f1423a02ebc89eeaf21548f5a.tar.bz2
lilv-708911daa222ac5f1423a02ebc89eeaf21548f5a.zip
Avoid "suspicious" string comparisons
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/state.c b/src/state.c
index a662b8d..e67714d 100644
--- a/src/state.c
+++ b/src/state.c
@@ -1204,7 +1204,7 @@ lilv_state_make_links(const LilvState* state, const char* dir)
char* const path = zix_path_join(NULL, dir, pm->rel);
if (path_is_child(pm->abs, state->copy_dir) &&
- strcmp(state->copy_dir, dir)) {
+ !!strcmp(state->copy_dir, dir)) {
// Link directly to snapshot in the copy directory
maybe_symlink(pm->abs, path);
} else if (!path_is_child(pm->abs, dir)) {
@@ -1486,7 +1486,7 @@ lilv_state_equals(const LilvState* a, const LilvState* b)
{
if (!lilv_node_equals(a->plugin_uri, b->plugin_uri) ||
(a->label && !b->label) || (b->label && !a->label) ||
- (a->label && b->label && strcmp(a->label, b->label)) ||
+ (a->label && b->label && !!strcmp(a->label, b->label)) ||
a->props.n != b->props.n || a->n_values != b->n_values) {
return false;
}
@@ -1495,8 +1495,8 @@ lilv_state_equals(const LilvState* a, const LilvState* b)
PortValue* const av = &a->values[i];
PortValue* const bv = &b->values[i];
if (av->atom->size != bv->atom->size || av->atom->type != bv->atom->type ||
- strcmp(av->symbol, bv->symbol) ||
- memcmp(av->atom + 1, bv->atom + 1, av->atom->size)) {
+ !!strcmp(av->symbol, bv->symbol) ||
+ !!memcmp(av->atom + 1, bv->atom + 1, av->atom->size)) {
return false;
}
}
@@ -1514,7 +1514,8 @@ lilv_state_equals(const LilvState* a, const LilvState* b)
lilv_state_rel2abs(b, (char*)bp->value))) {
return false;
}
- } else if (ap->size != bp->size || memcmp(ap->value, bp->value, ap->size)) {
+ } else if (ap->size != bp->size ||
+ !!memcmp(ap->value, bp->value, ap->size)) {
return false;
}
}