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

This commit is contained in:
Michael Stefaniuc 2014-11-05 10:53:56 +01:00 committed by Alexandre Julliard
parent e2eb760ffc
commit 481ff775ca
6 changed files with 8 additions and 8 deletions

View File

@ -2171,7 +2171,7 @@ static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control
/* FIXME: test when this should fail */
static BOOL msi_dialog_verify_path( LPWSTR path )
{
if ( !lstrlenW( path ) )
if ( !path[0] )
return FALSE;
if ( PathIsRelativeW( path ) )

View File

@ -356,7 +356,7 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function
if (FAILED(hr)) goto done;
/* 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));
hr = IActiveScript_GetScriptDispatch(pActiveScript, NULL, &pDispatch);

View File

@ -2715,7 +2715,7 @@ static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase
}
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
{
if (bcase)

View File

@ -4534,7 +4534,7 @@ static void test_update(void)
size = MAX_PATH;
r = MsiRecordGetStringA(rec, 1, result, &size);
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);
@ -4580,7 +4580,7 @@ static void test_update(void)
size = MAX_PATH;
r = MsiRecordGetStringA(rec, 1, result, &size);
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);

View File

@ -2194,7 +2194,7 @@ static void test_props(void)
sz = 6;
r = MsiGetPropertyA(hpkg, "property", buffer, &sz);
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 );
DeleteFileA(msifile);
@ -2347,7 +2347,7 @@ static void test_property_table(void)
lstrcpyA(buffer, "aaa");
r = MsiGetPropertyA(hpkg, "dantes", buffer, &sz);
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");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);

View File

@ -176,7 +176,7 @@ static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase
}
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
{
if (bcase)