From bd6c16628f480b6a9acbb9068b59d441ae733db2 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Mon, 3 Nov 2014 23:06:05 +0100 Subject: [PATCH] advapi32/tests: Simplify empty string check (PVS-Studio). --- dlls/advapi32/tests/registry.c | 11 +++++------ dlls/advapi32/tests/service.c | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 1445f6f11b3..382d8cc9f83 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -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"); diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c index beb589dce09..ad81a252184 100644 --- a/dlls/advapi32/tests/service.c +++ b/dlls/advapi32/tests/service.c @@ -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. -- 2.11.4.GIT