advapi32/tests: Simplify empty string check (PVS-Studio).

This commit is contained in:
Michael Stefaniuc 2014-11-03 23:06:05 +01:00 committed by Alexandre Julliard
parent 89d91168a0
commit bd6c16628f
2 changed files with 9 additions and 10 deletions

View File

@ -1546,7 +1546,7 @@ static void test_reg_query_value(void)
ret = RegQueryValueA(hkey_main, "subkey", val, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
ok(lstrlenA(val) == 0, "Expected val to be untouched, got %s\n", val);
ok(!val[0], "Expected val to be untouched, got %s\n", val);
/* try a NULL value and size */
ret = RegQueryValueA(hkey_main, "subkey", NULL, NULL);
@ -1559,7 +1559,7 @@ static void test_reg_query_value(void)
ret = RegQueryValueA(hkey_main, "subkey", val, &size);
ok(ret == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", ret);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
ok(lstrlenA(val) == 0, "Expected val to be untouched, got %s\n", val);
ok(!val[0], "Expected val to be untouched, got %s\n", val);
ok(size == 5, "Expected 5, got %d\n", size);
/* successfully read the value using 'subkey' */
@ -1588,7 +1588,7 @@ static void test_reg_query_value(void)
}
ok(ret == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", ret);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
ok(lstrlenW(valW) == 0, "Expected valW to be untouched\n");
ok(!valW[0], "Expected valW to be untouched\n");
ok(size == sizeof(expected), "Got wrong size: %d\n", size);
/* unicode - try size in WCHARS */
@ -1597,7 +1597,7 @@ static void test_reg_query_value(void)
ret = RegQueryValueW(subkey, NULL, valW, &size);
ok(ret == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", ret);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
ok(lstrlenW(valW) == 0, "Expected valW to be untouched\n");
ok(!valW[0], "Expected valW to be untouched\n");
ok(size == sizeof(expected), "Got wrong size: %d\n", size);
/* unicode - successfully read the value */
@ -1764,8 +1764,7 @@ static void test_reg_delete_tree(void)
ret = RegQueryValueA(subkey, NULL, buffer, &size);
ok(ret == ERROR_SUCCESS,
"Default value of subkey is not present\n");
ok(!lstrlenA(buffer),
"Expected length 0 got length %u(%s)\n", lstrlenA(buffer), buffer);
ok(!buffer[0], "Expected length 0 got length %u(%s)\n", lstrlenA(buffer), buffer);
size = MAX_PATH;
ok(RegQueryValueA(subkey, "value", buffer, &size),
"Value is still present\n");

View File

@ -1398,8 +1398,8 @@ static void test_enum_svc(void)
SERVICE_STATUS status = services[i].ServiceStatus;
/* lpServiceName and lpDisplayName should always be filled */
ok(lstrlenA(services[i].lpServiceName) > 0, "Expected a service name\n");
ok(lstrlenA(services[i].lpDisplayName) > 0, "Expected a display name\n");
ok(services[i].lpServiceName[0], "Expected a service name\n");
ok(services[i].lpDisplayName[0], "Expected a display name\n");
/* Decrement the counters to see if the functions calls return the same
* numbers as the contents of these structures.
@ -1701,8 +1701,8 @@ static void test_enum_svc(void)
SERVICE_STATUS_PROCESS status = exservices[i].ServiceStatusProcess;
/* lpServiceName and lpDisplayName should always be filled */
ok(lstrlenA(exservices[i].lpServiceName) > 0, "Expected a service name\n");
ok(lstrlenA(exservices[i].lpDisplayName) > 0, "Expected a display name\n");
ok(exservices[i].lpServiceName[0], "Expected a service name\n");
ok(exservices[i].lpDisplayName[0], "Expected a display name\n");
/* Decrement the counters to see if the functions calls return the
* same numbers as the contents of these structures.