diff options
author | Martin Mathieson <martin.r.mathieson@googlemail.com> | 2024-03-10 19:23:20 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2024-03-10 19:23:20 +0000 |
commit | 6307233ec947311124189f442ee030dbe27c432f (patch) | |
tree | 11165f229a052e30ead8788fdd25919670f5e62b /extcap | |
parent | 128c298122e71147f7fa3d7b6df2d7f0fde4eb7a (diff) |
Fix some cppcheck warnings
Diffstat (limited to 'extcap')
-rw-r--r-- | extcap/etw_ndiscap.c | 12 | ||||
-rw-r--r-- | extcap/falcodump.cpp | 20 |
2 files changed, 16 insertions, 16 deletions
diff --git a/extcap/etw_ndiscap.c b/extcap/etw_ndiscap.c index d7aab65d00..9e24f31b5c 100644 --- a/extcap/etw_ndiscap.c +++ b/extcap/etw_ndiscap.c @@ -316,7 +316,7 @@ struct INTERFACE* AddInterface(PEVENT_RECORD ev, unsigned long LowerIfIndex, uns switch (NewIface->PktEncapType) { case WTAP_ENCAP_ETHERNET: if (NewIface->IsVMNic) { - printf("IF: medium=%s\tID=%u\tIfIndex=%u\tVlanID=%i", + printf("IF: medium=%s\tID=%lu\tIfIndex=%lu\tVlanID=%i", NewIface->VMNic.SourceNicType, NewIface->PcapNgIfIndex, NewIface->VMNic.SourcePortId, @@ -338,18 +338,18 @@ struct INTERFACE* AddInterface(PEVENT_RECORD ev, unsigned long LowerIfIndex, uns } break; case WTAP_ENCAP_IEEE_802_11: - printf("IF: medium=wifi ID=%u\tIfIndex=%u", NewIface->PcapNgIfIndex, NewIface->LowerIfIndex); + printf("IF: medium=wifi ID=%lu\tIfIndex=%lu", NewIface->PcapNgIfIndex, NewIface->LowerIfIndex); StringCchPrintfA(IfName, IF_STRING_MAX_SIZE, "wifi:%lu", NewIface->LowerIfIndex); break; case WTAP_ENCAP_RAW_IP: - printf("IF: medium=mbb ID=%u\tIfIndex=%u", NewIface->PcapNgIfIndex, NewIface->LowerIfIndex); + printf("IF: medium=mbb ID=%lu\tIfIndex=%lu", NewIface->PcapNgIfIndex, NewIface->LowerIfIndex); StringCchPrintfA(IfName, IF_STRING_MAX_SIZE, "mbb:%lu", NewIface->LowerIfIndex); break; } StringCchLengthA(IfName, IF_STRING_MAX_SIZE, &IfNameLength); if (NewIface->LowerIfIndex != NewIface->MiniportIfIndex) { - printf("\t(LWF over IfIndex %u)", NewIface->MiniportIfIndex); + printf("\t(LWF over IfIndex %lu)", NewIface->MiniportIfIndex); StringCchPrintfA(IfDesc, IF_STRING_MAX_SIZE, "LWF over IfIndex %lu", NewIface->MiniportIfIndex); StringCchLengthA(IfDesc, IF_STRING_MAX_SIZE, &IfDescLength); } @@ -635,12 +635,12 @@ void etw_dump_write_ndiscap_event(PEVENT_RECORD ev, ULARGE_INTEGER timestamp) } if (Err != NO_ERROR) { - printf("Failed converting comment to string with error: %u\n", Err); + printf("Failed converting comment to string with error: %d\n", Err); } else { Err = StringCchLengthA(Comment, COMMENT_MAX_SIZE, &CommentLength); if (Err != NO_ERROR) { - printf("Failed getting length of comment string with error: %u\n", Err); + printf("Failed getting length of comment string with error: %d\n", Err); CommentLength = 0; memset(Comment, 0, COMMENT_MAX_SIZE); } diff --git a/extcap/falcodump.cpp b/extcap/falcodump.cpp index bd6c71f696..f2f64c8cb6 100644 --- a/extcap/falcodump.cpp +++ b/extcap/falcodump.cpp @@ -135,7 +135,7 @@ fgetline(char *buf, int size, FILE *fp) static const size_t MAX_AWS_LINELEN = 2048; void print_cloudtrail_aws_profile_config(int arg_num, const char *display, const char *description) { char buf[MAX_AWS_LINELEN]; - char profile[MAX_AWS_LINELEN]; + char profile_name[MAX_AWS_LINELEN]; FILE *aws_fp; std::set<std::string>profiles; @@ -150,11 +150,11 @@ void print_cloudtrail_aws_profile_config(int arg_num, const char *display, const if (aws_fp != NULL) { while (fgetline(buf, sizeof(buf), aws_fp) >= 0) { - if (sscanf(buf, "[%2047[^]]s]", profile) == 1) { - if (strcmp(profile, "default") == 0) { + if (sscanf(buf, "[%2047[^]]s]", profile_name) == 1) { + if (strcmp(profile_name, "default") == 0) { continue; } - profiles.insert(profile); + profiles.insert(profile_name); } } fclose(aws_fp); @@ -712,8 +712,8 @@ static const std::vector<ws_option> get_longopts(const std::map<std::string, str longopts.push_back(base_longopts[idx]); } for (const auto &it : plugin_configs) { - const struct plugin_configuration plugin_configs = it.second; - for (const auto &prop : plugin_configs.property_list) { + const struct plugin_configuration plugin_config = it.second; + for (const auto &prop : plugin_config.property_list) { ws_option option = { g_strdup(prop.option.c_str()), ws_required_argument, NULL, prop.option_index }; longopts.push_back(option); } @@ -759,7 +759,7 @@ static int show_plugin_config(const std::string &interface, const struct plugin_ print_cloudtrail_aws_region_config(arg_num, properties.display.c_str(), properties.description.c_str()); } else { printf( - "arg {number=%d}" + "arg {number=%u}" "{call=--%s}" "{display=%s}" "{type=%s}" @@ -771,7 +771,7 @@ static int show_plugin_config(const std::string &interface, const struct plugin_ if (properties.enum_values.size() > 0) { for (const auto &enum_val : properties.enum_values) { printf( - "value {arg=%d}" + "value {arg=%u}" "{value=%s}" "{display=%s}" "%s" @@ -877,8 +877,8 @@ int main(int argc, char **argv) extcap_help_add_option(extcap_conf, "--plugin-source", "plugin source URL"); for (const auto &it : plugin_configs) { - const struct plugin_configuration plugin_configs = it.second; - for (const auto &prop : plugin_configs.property_list) { + const struct plugin_configuration plugin_config = it.second; + for (const auto &prop : plugin_config.property_list) { if (prop.option_index < OPT_SCHEMA_PROPERTIES_START) { continue; } |