diff options
author | Rosen Penev | 2020-06-07 22:15:52 -0700 |
---|---|---|
committer | Nikias Bassen | 2020-11-24 01:15:12 +0100 |
commit | 85ede33a2291f7aa7a7bf1cccb6f6ff6da1c046b (patch) | |
tree | 139ea960cc24fd2085f8850540b1a4fe18e86911 /src | |
parent | 9f60cdd76b6044931cc2f2b6f2fbec3deb67a425 (diff) | |
download | libplist-85ede33a2291f7aa7a7bf1cccb6f6ff6da1c046b.tar.gz libplist-85ede33a2291f7aa7a7bf1cccb6f6ff6da1c046b.tar.bz2 |
Improve code readability by using explicit != 0 compare when using strncmp
[clang-tidy] Found with bugprone-suspicious-string-compare
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/xplist.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/xplist.c b/src/xplist.c index 537d315..dc70864 100644 --- a/src/xplist.c +++ b/src/xplist.c @@ -749,7 +749,7 @@ static text_part_t* get_text_parts(parse_ctx ctx, const char* tag, size_t tag_le } } while (1); ctx->pos++; - if (ctx->pos >= ctx->end-tag_len || strncmp(ctx->pos, tag, tag_len)) { + if (ctx->pos >= ctx->end-tag_len || strncmp(ctx->pos, tag, tag_len) != 0) { PLIST_XML_ERR("EOF or end tag mismatch\n"); ctx->err++; return NULL; @@ -965,7 +965,7 @@ static void node_from_xml(parse_ctx ctx, plist_t *plist) ctx->err++; goto err_out; } - if (strncmp(ctx->pos, "?>", 2)) { + if (strncmp(ctx->pos, "?>", 2) != 0) { PLIST_XML_ERR("Couldn't find <? tag closing marker\n"); ctx->err++; goto err_out; @@ -977,7 +977,7 @@ static void node_from_xml(parse_ctx ctx, plist_t *plist) if (((ctx->end - ctx->pos) > 3) && !strncmp(ctx->pos, "!--", 3)) { ctx->pos += 3; find_str(ctx,"-->", 3, 0); - if (ctx->pos > ctx->end-3 || strncmp(ctx->pos, "-->", 3)) { + if (ctx->pos > ctx->end-3 || strncmp(ctx->pos, "-->", 3) != 0) { PLIST_XML_ERR("Couldn't find end of comment\n"); ctx->err++; goto err_out; @@ -1006,7 +1006,7 @@ static void node_from_xml(parse_ctx ctx, plist_t *plist) } if (embedded_dtd) { find_str(ctx, "]>", 2, 1); - if (ctx->pos > ctx->end-2 || strncmp(ctx->pos, "]>", 2)) { + if (ctx->pos > ctx->end-2 || strncmp(ctx->pos, "]>", 2) != 0) { PLIST_XML_ERR("Couldn't find end of DOCTYPE\n"); ctx->err++; goto err_out; |