aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2021-07-07 10:28:40 -0500
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-07-08 04:12:45 +0000
commit6dfa2cb0ae4f15d171da8cf77f2a6e11d35d0d86 (patch)
tree6f0515053aeac0763913af6b562da33422c3b089
parent73087d6fb486a61e8eb0886a02e6c6403534fa36 (diff)
Win32: Fix a string length check.
Check the length of a string directly. Fixes Coverity CID 1487026.
-rw-r--r--ui/win32/file_dlg_win32.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/ui/win32/file_dlg_win32.cpp b/ui/win32/file_dlg_win32.cpp
index 187ecf06e9..dc168a272a 100644
--- a/ui/win32/file_dlg_win32.cpp
+++ b/ui/win32/file_dlg_win32.cpp
@@ -887,7 +887,6 @@ filter_tb_get(HWND hwnd) {
static void
filter_tb_syntax_check(HWND hwnd, const TCHAR *filter_text) {
std::wstring strval;
- gint len;
dfilter_t *dfp;
/* If filter_text is non-NULL, use it. Otherwise, grab the text from
@@ -895,7 +894,7 @@ filter_tb_syntax_check(HWND hwnd, const TCHAR *filter_text) {
if (filter_text) {
strval = filter_text;
} else {
- len = GetWindowTextLength(hwnd);
+ int len = GetWindowTextLength(hwnd);
if (len > 0) {
len++;
strval.resize(len);
@@ -904,7 +903,7 @@ filter_tb_syntax_check(HWND hwnd, const TCHAR *filter_text) {
}
}
- if (len == 0) {
+ if (strval.empty()) {
/* Default window background */
SendMessage(hwnd, EM_SETBKGNDCOLOR, (WPARAM) 1, COLOR_WINDOW);
return;