ntdll/tests: Don't use sizeof in ok() to avoid printf format warnings.

This commit is contained in:
Alexandre Julliard 2006-06-13 14:03:19 +02:00
parent 65459cb344
commit cba2c84741
4 changed files with 41 additions and 46 deletions

View File

@ -105,8 +105,8 @@ static void testQuery(void)
{
case STATUS_SUCCESS:
pRtlMultiByteToUnicodeN( bn, sizeof(bn), NULL, test->val, strlen(test->val)+1 );
ok( value.Length == strlen(test->val) * sizeof(WCHAR), "Wrong length %d/%d for %s\n",
value.Length, strlen(test->val) * sizeof(WCHAR), test->var );
ok( value.Length == strlen(test->val) * sizeof(WCHAR), "Wrong length %d for %s\n",
value.Length, test->var );
ok((value.Length == strlen(test->val) * sizeof(WCHAR) && memcmp(bv, bn, test->len*sizeof(WCHAR)) == 0) ||
lstrcmpW(bv, bn) == 0,
"Wrong result for %s/%d\n", test->var, test->len);
@ -114,8 +114,7 @@ static void testQuery(void)
break;
case STATUS_BUFFER_TOO_SMALL:
ok( value.Length == strlen(test->val) * sizeof(WCHAR),
"Wrong returned length %d/%d (too small buffer) for %s\n",
value.Length, strlen(test->val) * sizeof(WCHAR), test->var );
"Wrong returned length %d (too small buffer) for %s\n", value.Length, test->var );
break;
}
}
@ -241,8 +240,7 @@ static void testExpand(void)
nts = pRtlExpandEnvironmentStrings_U(small_env, &us_src, &us_dst, &ul);
ok(ul == strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR),
"Wrong returned length for %s: %lu <> %u\n",
test->src, ul, strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR));
"Wrong returned length for %s: %lu\n", test->src, ul );
us_dst.Length = 0;
us_dst.MaximumLength = sizeof(dst);
@ -251,11 +249,9 @@ static void testExpand(void)
nts = pRtlExpandEnvironmentStrings_U(small_env, &us_src, &us_dst, &ul);
ok(nts == STATUS_SUCCESS, "Call failed (%lu)\n", nts);
ok(ul == us_dst.Length + sizeof(WCHAR),
"Wrong returned length for %s: %lu <> %u\n",
test->src, ul, us_dst.Length + sizeof(WCHAR));
"Wrong returned length for %s: %lu\n", test->src, ul);
ok(ul == strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR),
"Wrong returned length for %s: %lu <> %u\n",
test->src, ul, strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR));
"Wrong returned length for %s: %lu\n", test->src, ul);
ok(lstrcmpW(dst, rst) == 0, "Wrong result for %s: expecting %s\n",
test->src, test->dst);
@ -266,8 +262,7 @@ static void testExpand(void)
nts = pRtlExpandEnvironmentStrings_U(small_env, &us_src, &us_dst, &ul);
ok(nts == STATUS_BUFFER_TOO_SMALL, "Call failed (%lu)\n", nts);
ok(ul == strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR),
"Wrong returned length for %s (with buffer too small): %lu <> %u\n",
test->src, ul, strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR));
"Wrong returned length for %s (with buffer too small): %lu\n", test->src, ul);
ok(memcmp(dst, rst, 8*sizeof(WCHAR)) == 0,
"Wrong result for %s (with buffer too small): expecting %s\n",
test->src, test->dst);

View File

@ -92,7 +92,7 @@ static void test_query_basic(void)
trace("Check with correct parameters\n");
status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(sbi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(sbi), ReturnLength);
ok( sizeof(sbi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
/* Check if we have some return values */
trace("Number of Processors : %d\n", sbi.NumberOfProcessors);
@ -107,7 +107,7 @@ static void test_query_cpu(void)
status = pNtQuerySystemInformation(SystemCpuInformation, &sci, sizeof(sci), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(sci) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(sci), ReturnLength);
ok( sizeof(sci) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
/* Check if we have some return values */
trace("Processor FeatureSet : %08lx\n", sci.FeatureSet);
@ -125,11 +125,11 @@ static void test_query_performance(void)
status = pNtQuerySystemInformation(SystemPerformanceInformation, &spi, sizeof(spi), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(spi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(spi), ReturnLength);
ok( sizeof(spi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
status = pNtQuerySystemInformation(SystemPerformanceInformation, &spi, sizeof(spi) + 2, &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(spi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(spi), ReturnLength);
ok( sizeof(spi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
/* Not return values yet, as struct members are unknown */
}
@ -204,7 +204,7 @@ static void test_query_timeofday(void)
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, sizeof(sti), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(sti) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(sti), ReturnLength);
ok( sizeof(sti) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
}
/* Check if we have some return values */
@ -343,7 +343,7 @@ static void test_query_procperf(void)
sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) == ReturnLength,
"Inconsistent length (%d) <-> (%ld)\n", sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION), ReturnLength);
"Inconsistent length %ld\n", ReturnLength);
/* Try it for all processors */
status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, NeededLength, &ReturnLength);
@ -440,11 +440,11 @@ static void test_query_cache(void)
status = pNtQuerySystemInformation(SystemCacheInformation, &sci, sizeof(sci), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(sci) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(sci), ReturnLength);
ok( sizeof(sci) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
status = pNtQuerySystemInformation(SystemCacheInformation, &sci, sizeof(sci) + 2, &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(sci) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(sci), ReturnLength);
ok( sizeof(sci) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
}
static void test_query_interrupt(void)
@ -486,11 +486,11 @@ static void test_query_kerndebug(void)
status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, sizeof(skdi), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(skdi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(skdi), ReturnLength);
ok( sizeof(skdi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, sizeof(skdi) + 2, &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(skdi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(skdi), ReturnLength);
ok( sizeof(skdi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
}
static void test_query_regquota(void)
@ -504,11 +504,11 @@ static void test_query_regquota(void)
status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, sizeof(srqi), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(srqi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(srqi), ReturnLength);
ok( sizeof(srqi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, sizeof(srqi) + 2, &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(srqi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(srqi), ReturnLength);
ok( sizeof(srqi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
}
static void test_query_process_basic(void)
@ -566,13 +566,13 @@ static void test_query_process_basic(void)
trace("Check with correct parameters\n");
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(pbi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(pbi), ReturnLength);
ok( sizeof(pbi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
/* Everything is correct except a too large buffersize */
trace("Too large buffersize\n");
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi) * 2, &ReturnLength);
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
ok( sizeof(pbi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(pbi), ReturnLength);
ok( sizeof(pbi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
/* Check if we have some return values */
trace("ProcessID : %ld\n", pbi.UniqueProcessId);
@ -603,11 +603,11 @@ static void test_query_process_vm(void)
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessVmCounters, &pvi, sizeof(pvi), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(pvi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(pvi), ReturnLength);
ok( sizeof(pvi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessVmCounters, &pvi, 46, &ReturnLength);
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
ok( sizeof(pvi) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(pvi), ReturnLength);
ok( sizeof(pvi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
/* Check if we have some return values */
trace("WorkingSetSize : %ld\n", pvi.WorkingSetSize);
@ -643,11 +643,11 @@ static void test_query_process_io(void)
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessIoCounters, &pii, sizeof(pii), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(pii) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(pii), ReturnLength);
ok( sizeof(pii) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessIoCounters, &pii, sizeof(pii) * 2, &ReturnLength);
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
ok( sizeof(pii) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(pii), ReturnLength);
ok( sizeof(pii) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
/* Check if we have some return values */
trace("OtherOperationCount : %lld\n", pii.OtherOperationCount);
@ -687,7 +687,7 @@ static void test_query_process_times(void)
status = pNtQueryInformationProcess( process, ProcessTimes, &spti, sizeof(spti), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(spti) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(spti), ReturnLength);
ok( sizeof(spti) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
CloseHandle(process);
FileTimeToSystemTime((const FILETIME *)&spti.CreateTime, &UTC);
@ -708,7 +708,7 @@ static void test_query_process_times(void)
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessTimes, &spti, sizeof(spti) * 2, &ReturnLength);
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
ok( sizeof(spti) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(spti), ReturnLength);
ok( sizeof(spti) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
}
static void test_query_process_handlecount(void)
@ -740,12 +740,12 @@ static void test_query_process_handlecount(void)
status = pNtQueryInformationProcess( process, ProcessHandleCount, &handlecount, sizeof(handlecount), &ReturnLength);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
ok( sizeof(handlecount) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(handlecount), ReturnLength);
ok( sizeof(handlecount) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
CloseHandle(process);
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessHandleCount, &handlecount, sizeof(handlecount) * 2, &ReturnLength);
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
ok( sizeof(handlecount) == ReturnLength, "Inconsistent length (%d) <-> (%ld)\n", sizeof(handlecount), ReturnLength);
ok( sizeof(handlecount) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
/* Check if we have some return values */
trace("HandleCount : %ld\n", handlecount);

View File

@ -786,7 +786,7 @@ static const all_accesses_t all_accesses[] = {
static void test_RtlAreAllAccessesGranted(void)
{
size_t test_num;
unsigned int test_num;
BOOLEAN result;
for (test_num = 0; test_num < NB_ALL_ACCESSES; test_num++) {
@ -823,7 +823,7 @@ static const any_accesses_t any_accesses[] = {
static void test_RtlAreAnyAccessesGranted(void)
{
size_t test_num;
unsigned int test_num;
BOOLEAN result;
for (test_num = 0; test_num < NB_ANY_ACCESSES; test_num++) {

View File

@ -397,7 +397,7 @@ static void test_RtlDuplicateUnicodeString(void)
CHAR dest_ansi_buf[257];
STRING dest_ansi_str;
NTSTATUS result;
size_t test_num;
unsigned int test_num;
for (test_num = 0; test_num < NB_DUPL_USTR; test_num++) {
source_str.Length = dupl_ustr[test_num].source_Length;
@ -754,7 +754,7 @@ static void test_RtlUnicodeStringToAnsiString(void)
STRING ansi_str;
UNICODE_STRING uni_str;
NTSTATUS result;
size_t test_num;
unsigned int test_num;
for (test_num = 0; test_num < NB_USTR2ASTR; test_num++) {
ansi_str.Length = ustr2astr[test_num].ansi_Length;
@ -825,7 +825,7 @@ static void test_RtlAppendAsciizToString(void)
CHAR dest_buf[257];
STRING dest_str;
NTSTATUS result;
size_t test_num;
unsigned int test_num;
for (test_num = 0; test_num < NB_APP_ASC2STR; test_num++) {
dest_str.Length = app_asc2str[test_num].dest_Length;
@ -897,7 +897,7 @@ static void test_RtlAppendStringToString(void)
STRING dest_str;
STRING src_str;
NTSTATUS result;
size_t test_num;
unsigned int test_num;
for (test_num = 0; test_num < NB_APP_STR2STR; test_num++) {
dest_str.Length = app_str2str[test_num].dest_Length;
@ -978,7 +978,7 @@ static void test_RtlAppendUnicodeToString(void)
WCHAR dest_buf[257];
UNICODE_STRING dest_str;
NTSTATUS result;
size_t test_num;
unsigned int test_num;
for (test_num = 0; test_num < NB_APP_UNI2STR; test_num++) {
dest_str.Length = app_uni2str[test_num].dest_Length;
@ -1054,7 +1054,7 @@ static void test_RtlAppendUnicodeStringToString(void)
UNICODE_STRING dest_str;
UNICODE_STRING src_str;
NTSTATUS result;
size_t test_num;
unsigned int test_num;
for (test_num = 0; test_num < NB_APP_USTR2STR; test_num++) {
dest_str.Length = app_ustr2str[test_num].dest_Length;
@ -1165,8 +1165,8 @@ static void test_RtlFindCharInUnicodeString(void)
UNICODE_STRING search_chars;
USHORT pos;
NTSTATUS result;
size_t idx;
size_t test_num;
unsigned int idx;
unsigned int test_num;
for (test_num = 0; test_num < NB_FIND_CH_IN_USTR; test_num++) {
if (find_ch_in_ustr[test_num].main_str != NULL) {
@ -1335,7 +1335,7 @@ static const str2int_t str2int[] = {
static void test_RtlUnicodeStringToInteger(void)
{
size_t test_num;
unsigned int test_num;
int value;
NTSTATUS result;
WCHAR *wstr;
@ -1399,7 +1399,7 @@ static void test_RtlUnicodeStringToInteger(void)
static void test_RtlCharToInteger(void)
{
size_t test_num;
unsigned int test_num;
int value;
NTSTATUS result;