[CRTDLL_APITEST] Oops. Fix that other compiler. CORE-16933

This commit is contained in:
Thomas Faber 2024-01-12 12:58:27 -05:00
parent c8aba5a172
commit 286d460b45
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
2 changed files with 34 additions and 34 deletions

View file

@ -33,38 +33,38 @@ START_TEST(_mbsncmp)
ret = _mbsncmp(NULL, NULL, 0); ret = _mbsncmp(NULL, NULL, 0);
ok(ret == 0, "ret = %d\n", ret); ok(ret == 0, "ret = %d\n", ret);
ret = _mbsncmp("a", "c", 0); ret = _mbsncmp((const unsigned char *)"a", (const unsigned char *)"c", 0);
ok(ret == 0, "ret = %d\n", ret); ok(ret == 0, "ret = %d\n", ret);
/* No null checks - length 1 crashes */ /* No null checks - length 1 crashes */
StartSeh() StartSeh()
(void)_mbsncmp("a", NULL, 1); (void)_mbsncmp((const unsigned char *)"a", NULL, 1);
EndSeh(STATUS_ACCESS_VIOLATION); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() StartSeh()
(void)_mbsncmp(NULL, "c", 1); (void)_mbsncmp(NULL, (const unsigned char *)"c", 1);
EndSeh(STATUS_ACCESS_VIOLATION); EndSeh(STATUS_ACCESS_VIOLATION);
/* Strings longer than or equal to length */ /* Strings longer than or equal to length */
ret = _mbsncmp("a", "c", 1); ret = _mbsncmp((const unsigned char *)"a", (const unsigned char *)"c", 1);
ok(ret == DIFF_RETURN(-, 2), "ret = %d\n", ret); ok(ret == DIFF_RETURN(-, 2), "ret = %d\n", ret);
ret = _mbsncmp("a", "a", 1); ret = _mbsncmp((const unsigned char *)"a", (const unsigned char *)"a", 1);
ok(ret == 0, "ret = %d\n", ret); ok(ret == 0, "ret = %d\n", ret);
ret = _mbsncmp("ab", "aB", 1); ret = _mbsncmp((const unsigned char *)"ab", (const unsigned char *)"aB", 1);
ok(ret == 0, "ret = %d\n", ret); ok(ret == 0, "ret = %d\n", ret);
ret = _mbsncmp("aa", "ac", 2); ret = _mbsncmp((const unsigned char *)"aa", (const unsigned char *)"ac", 2);
ok(ret == DIFF_RETURN(-, 2), "ret = %d\n", ret); ok(ret == DIFF_RETURN(-, 2), "ret = %d\n", ret);
/* Length longer than one of the strings */ /* Length longer than one of the strings */
ret = _mbsncmp("a", "ac", 2); ret = _mbsncmp((const unsigned char *)"a", (const unsigned char *)"ac", 2);
ok(ret == DIFF_RETURN(-, 'c'), "ret = %d\n", ret); ok(ret == DIFF_RETURN(-, 'c'), "ret = %d\n", ret);
ret = _mbsncmp("aa", "a", 2); ret = _mbsncmp((const unsigned char *)"aa", (const unsigned char *)"a", 2);
ok(ret == DIFF_RETURN(+, 'a'), "ret = %d\n", ret); ok(ret == DIFF_RETURN(+, 'a'), "ret = %d\n", ret);
ret = _mbsncmp("ab", "ab", 100); ret = _mbsncmp((const unsigned char *)"ab", (const unsigned char *)"ab", 100);
ok(ret == 0, "ret = %d\n", ret); ok(ret == 0, "ret = %d\n", ret);
} }

View file

@ -22,27 +22,27 @@ START_TEST(_mbsstr)
EndSeh(STATUS_ACCESS_VIOLATION); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() StartSeh()
haystack = "hello"; haystack = (unsigned char *)"hello";
(void)_mbsstr(haystack, NULL); (void)_mbsstr(haystack, NULL);
EndSeh(STATUS_ACCESS_VIOLATION); EndSeh(STATUS_ACCESS_VIOLATION);
StartSeh() StartSeh()
haystack = ""; haystack = (unsigned char *)"";
(void)_mbsstr(haystack, NULL); (void)_mbsstr(haystack, NULL);
EndSeh(STATUS_ACCESS_VIOLATION); EndSeh(STATUS_ACCESS_VIOLATION);
/* Empty needle returns haystack, empty haystack returns NULL... */ /* Empty needle returns haystack, empty haystack returns NULL... */
haystack = "hello"; haystack = (unsigned char *)"hello";
ret = _mbsstr(haystack, ""); ret = _mbsstr(haystack, (const unsigned char *)"");
ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack);
haystack = ""; haystack = (unsigned char *)"";
ret = _mbsstr(haystack, "a"); ret = _mbsstr(haystack, (const unsigned char *)"a");
ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack);
/* ... but if both are empty, behavior differs */ /* ... but if both are empty, behavior differs */
haystack = ""; haystack = (unsigned char *)"";
ret = _mbsstr(haystack, ""); ret = _mbsstr(haystack, (const unsigned char *)"");
#ifdef TEST_CRTDLL #ifdef TEST_CRTDLL
ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack);
#else #else
@ -50,38 +50,38 @@ START_TEST(_mbsstr)
#endif #endif
/* Simple "found" cases */ /* Simple "found" cases */
haystack = "abcdefg"; haystack = (unsigned char *)"abcdefg";
ret = _mbsstr(haystack, "abc"); ret = _mbsstr(haystack, (const unsigned char *)"abc");
ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack);
haystack = "abcdefg"; haystack = (unsigned char *)"abcdefg";
ret = _mbsstr(haystack, "g"); ret = _mbsstr(haystack, (const unsigned char *)"g");
ok(ret == haystack + 6, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == haystack + 6, "ret = %p, haystack = %p\n", ret, haystack);
haystack = "abcdefg"; haystack = (unsigned char *)"abcdefg";
ret = _mbsstr(haystack, "abcdefg"); ret = _mbsstr(haystack, (const unsigned char *)"abcdefg");
ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == haystack, "ret = %p, haystack = %p\n", ret, haystack);
/* Simple "not found" cases */ /* Simple "not found" cases */
haystack = "abcdefg"; haystack = (unsigned char *)"abcdefg";
ret = _mbsstr(haystack, "h"); ret = _mbsstr(haystack, (const unsigned char *)"h");
ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack);
haystack = "abcdefg"; haystack = (unsigned char *)"abcdefg";
ret = _mbsstr(haystack, "gh"); ret = _mbsstr(haystack, (const unsigned char *)"gh");
ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack);
haystack = "abcdefg"; haystack = (unsigned char *)"abcdefg";
ret = _mbsstr(haystack, "abcD"); ret = _mbsstr(haystack, (const unsigned char *)"abcD");
ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack);
/* Needle longer than haystack */ /* Needle longer than haystack */
haystack = "abcdefg"; haystack = (unsigned char *)"abcdefg";
ret = _mbsstr(haystack, "abcdefgh"); ret = _mbsstr(haystack, (const unsigned char *)"abcdefgh");
ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack);
haystack = "abcdefg"; haystack = (unsigned char *)"abcdefg";
ret = _mbsstr(haystack, "xxxxxxxx"); ret = _mbsstr(haystack, (const unsigned char *)"xxxxxxxx");
ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack); ok(ret == NULL, "ret = %p, haystack = %p\n", ret, haystack);
} }