Commit 481ff775 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

parent e2eb760f
...@@ -2171,7 +2171,7 @@ static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control ...@@ -2171,7 +2171,7 @@ static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control
/* FIXME: test when this should fail */ /* FIXME: test when this should fail */
static BOOL msi_dialog_verify_path( LPWSTR path ) static BOOL msi_dialog_verify_path( LPWSTR path )
{ {
if ( !lstrlenW( path ) ) if ( !path[0] )
return FALSE; return FALSE;
if ( PathIsRelativeW( path ) ) if ( PathIsRelativeW( path ) )
......
...@@ -356,7 +356,7 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function ...@@ -356,7 +356,7 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function
if (FAILED(hr)) goto done; if (FAILED(hr)) goto done;
/* Call a function if necessary through the IDispatch interface */ /* Call a function if necessary through the IDispatch interface */
if (function != NULL && strlenW(function) > 0) { if (function && function[0]) {
TRACE("Calling function %s\n", debugstr_w(function)); TRACE("Calling function %s\n", debugstr_w(function));
hr = IActiveScript_GetScriptDispatch(pActiveScript, NULL, &pDispatch); hr = IActiveScript_GetScriptDispatch(pActiveScript, NULL, &pDispatch);
......
...@@ -2715,7 +2715,7 @@ static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase ...@@ -2715,7 +2715,7 @@ static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase
} }
if (!expected) if (!expected)
ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val); ok_(__FILE__, line)(!val[0], "Expected empty string, got %s\n", val);
else else
{ {
if (bcase) if (bcase)
......
...@@ -4534,7 +4534,7 @@ static void test_update(void) ...@@ -4534,7 +4534,7 @@ static void test_update(void)
size = MAX_PATH; size = MAX_PATH;
r = MsiRecordGetStringA(rec, 1, result, &size); r = MsiRecordGetStringA(rec, 1, result, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrlenA(result), "Expected an empty string, got %s\n", result); ok(!result[0], "Expected an empty string, got %s\n", result);
MsiCloseHandle(rec); MsiCloseHandle(rec);
...@@ -4580,7 +4580,7 @@ static void test_update(void) ...@@ -4580,7 +4580,7 @@ static void test_update(void)
size = MAX_PATH; size = MAX_PATH;
r = MsiRecordGetStringA(rec, 1, result, &size); r = MsiRecordGetStringA(rec, 1, result, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrlenA(result), "Expected an empty string, got %s\n", result); ok(!result[0], "Expected an empty string, got %s\n", result);
MsiCloseHandle(rec); MsiCloseHandle(rec);
......
...@@ -2194,7 +2194,7 @@ static void test_props(void) ...@@ -2194,7 +2194,7 @@ static void test_props(void)
sz = 6; sz = 6;
r = MsiGetPropertyA(hpkg, "property", buffer, &sz); r = MsiGetPropertyA(hpkg, "property", buffer, &sz);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok( !strlen(buffer), "Expected empty string, got %s\n", buffer); ok(!buffer[0], "Expected empty string, got %s\n", buffer);
MsiCloseHandle( hpkg ); MsiCloseHandle( hpkg );
DeleteFileA(msifile); DeleteFileA(msifile);
...@@ -2347,7 +2347,7 @@ static void test_property_table(void) ...@@ -2347,7 +2347,7 @@ static void test_property_table(void)
lstrcpyA(buffer, "aaa"); lstrcpyA(buffer, "aaa");
r = MsiGetPropertyA(hpkg, "dantes", buffer, &sz); r = MsiGetPropertyA(hpkg, "dantes", buffer, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer); ok(!buffer[0], "Expected empty string, got %s\n", buffer);
r = MsiSetPropertyA(hpkg, "dantes", "mercedes"); r = MsiSetPropertyA(hpkg, "dantes", "mercedes");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
......
...@@ -176,7 +176,7 @@ static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase ...@@ -176,7 +176,7 @@ static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase
} }
if (!expected) if (!expected)
ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val); ok_(__FILE__, line)(!val[0], "Expected empty string, got %s\n", val);
else else
{ {
if (bcase) if (bcase)
......
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