Commit 5d43ef68 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

shell32: Simplify check for empty string (PVS-Studio).

parent 0311b980
......@@ -947,7 +947,7 @@ void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
/* buffer size looks good */
ptr += 12; /* get to string */
len = bufused - (ptr-buffer); /* get length of buf remaining */
if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) {
if (ptr[0] && (lstrlenA(ptr) <= len-1)) {
/* appears to be good string */
lstrcpyA(old_lnk_name, link_dir);
PathAppendA(old_lnk_name, ptr);
......
......@@ -1381,7 +1381,7 @@ static void test_navigation(void)
ok(pSHCreateShellItem != NULL, "pSHCreateShellItem unexpectedly missing.\n");
GetCurrentDirectoryW(MAX_PATH, current_path);
if(!lstrlenW(current_path))
if(!current_path[0])
{
skip("Failed to create test-directory.\n");
return;
......
......@@ -81,7 +81,7 @@ static WCHAR *make_wstr(const char *str)
WCHAR *ret;
int len;
if(!str || strlen(str) == 0)
if (!str || !str[0])
return NULL;
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
......@@ -2203,7 +2203,7 @@ static void test_SHCreateShellItem(void)
return;
}
if (!lstrlenA(curdirA))
if (!curdirA[0])
{
win_skip("GetCurrentDirectoryA returned empty string, skipping test_SHCreateShellItem\n");
return;
......@@ -2780,7 +2780,7 @@ static void test_ShellItemCompare(void)
}
GetCurrentDirectoryW(MAX_PATH, curdirW);
if(!lstrlenW(curdirW))
if (!curdirW[0])
{
skip("Failed to get current directory, skipping.\n");
return;
......@@ -4387,7 +4387,7 @@ static void test_GetUIObject(void)
}
GetCurrentDirectoryW(MAX_PATH, path);
if(!lstrlenW(path))
if (!path[0])
{
skip("GetCurrentDirectoryW returned an empty string.\n");
return;
......@@ -4989,8 +4989,8 @@ static void test_SHChangeNotify(BOOL test_new_delivery)
exp_data->missing_events = exp_data->notify_count;
SHChangeNotify(exp_data->signal, SHCNF_PATHA | SHCNF_FLUSH,
strlen(exp_data->path_1) > 0 ? exp_data->path_1 : NULL,
strlen(exp_data->path_2) > 0 ? exp_data->path_2 : NULL);
exp_data->path_1[0] ? exp_data->path_1 : NULL,
exp_data->path_2[0] ? exp_data->path_2 : NULL);
do_events();
ok(exp_data->missing_events == 0, "%s: Expected wndproc to be called\n", exp_data->id);
......@@ -5045,7 +5045,7 @@ static void test_SHCreateDefaultContextMenu(void)
}
GetCurrentDirectoryW(MAX_PATH, path);
if(!lstrlenW(path))
if (!path[0])
{
skip("GetCurrentDirectoryW returned an empty string.\n");
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment