From 3b5e1879b1def5644c898498c443e54501e2c6d7 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Fri, 2 Feb 2024 14:33:35 +0000 Subject: [PATCH] clang-tidy; -bugprone-suspicious-string-compare, misc-unused-parameters - Fix warnings identified by this flag - Remove the exclude from .clang-tidy file --- .clang-tidy | 2 -- src/ui-tabcomp.cc | 2 +- src/zonedetect.cc | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 2e576602..cf322294 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -37,12 +37,10 @@ Checks: > -bugprone-reserved-identifier, -bugprone-sizeof-expression, -bugprone-suspicious-missing-comma, - -bugprone-suspicious-string-compare, -misc-const-correctness, -misc-no-recursion, -misc-non-private-member-variables-in-classes, -misc-redundant-expression, - -misc-unused-parameters, -misc-use-anonymous-namespace, -modernize-avoid-c-arrays, -modernize-macro-to-enum, diff --git a/src/ui-tabcomp.cc b/src/ui-tabcomp.cc index a652d22d..0196cd5b 100644 --- a/src/ui-tabcomp.cc +++ b/src/ui-tabcomp.cc @@ -208,7 +208,7 @@ void tab_completion_iter_menu_items(GtkWidget *widget, gpointer data) const gchar *prefix = filename_from_path(entry_text); guint prefix_len = strlen(prefix); - if (strlen(text) < prefix_len || strncmp(text, prefix, prefix_len)) + if (strlen(text) < prefix_len || strncmp(text, prefix, prefix_len) != 0) { /* Hide menu items not matching */ gtk_widget_hide(widget); diff --git a/src/zonedetect.cc b/src/zonedetect.cc index 2763e2d1..6ec9808d 100644 --- a/src/zonedetect.cc +++ b/src/zonedetect.cc @@ -265,7 +265,7 @@ static int ZDParseHeader(ZoneDetect *library) #if defined(_MSC_VER) __try { #endif - if(memcmp(library->mapping, "PLB", 3)) { + if(memcmp(library->mapping, "PLB", 3) != 0) { return -1; } -- 2.20.1