kernel32: Avoid hardcoding the Unicode string literal lengths.

This commit is contained in:
Francois Gouget 2011-12-16 13:08:23 +01:00 committed by Alexandre Julliard
parent 95577f3368
commit 632ac0b227
3 changed files with 7 additions and 8 deletions

View File

@ -2430,8 +2430,7 @@ BOOL WINAPI WriteConsoleW(HANDLE hConsoleOutput, LPCVOID lpBuffer, DWORD nNumber
break;
case '\t':
{
WCHAR tmp[8] = {' ',' ',' ',' ',' ',' ',' ',' '};
static const WCHAR tmp[] = {' ',' ',' ',' ',' ',' ',' ',' '};
if (!write_block(hConsoleOutput, &csbi, mode, tmp,
((csbi.dwCursorPosition.X + 8) & ~7) - csbi.dwCursorPosition.X))
goto the_end;

View File

@ -168,11 +168,11 @@ static void test_get_atom_name(void)
if (unicode_OS)
{
static const WCHAR sampleW[10] = {'.','.','.','.','.','.','.','.','.','.'};
static const WCHAR sampleW[] = {'.','.','.','.','.','.','.','.','.','.'};
for (i = 0; i < 10; i++) bufW[i] = '.';
ok( !GlobalGetAtomNameW( atom, bufW, 0 ), "succeeded\n" );
ok( !memcmp( bufW, sampleW, 10 * sizeof(WCHAR) ), "should not touch buffer\n" );
ok( !memcmp( bufW, sampleW, sizeof(sampleW) ), "should not touch buffer\n" );
}
/* Test integer atoms */
@ -442,11 +442,11 @@ static void test_local_get_atom_name(void)
if (unicode_OS)
{
static const WCHAR sampleW[10] = {'.','.','.','.','.','.','.','.','.','.'};
static const WCHAR sampleW[] = {'.','.','.','.','.','.','.','.','.','.'};
for (i = 0; i < 10; i++) bufW[i] = '.';
ok( !GetAtomNameW( atom, bufW, 0 ), "succeeded\n" );
ok( !memcmp( bufW, sampleW, 10 * sizeof(WCHAR) ), "should not touch buffer\n" );
ok( !memcmp( bufW, sampleW, sizeof(sampleW) ), "should not touch buffer\n" );
}
/* Test integer atoms */

View File

@ -211,8 +211,8 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar)
int ret;
WCHAR wc1 = 228; /* Western Windows-1252 character */
WCHAR wc2 = 1088; /* Russian Windows-1251 character not displayable for Windows-1252 */
WCHAR wcs[5] = {'T', 'h', 1088, 'i', 0}; /* String with ASCII characters and a Russian character */
WCHAR dbwcs[3] = {28953, 25152, 0}; /* String with Chinese (codepage 950) characters */
static const WCHAR wcs[] = {'T', 'h', 1088, 'i', 0}; /* String with ASCII characters and a Russian character */
static const WCHAR dbwcs[] = {28953, 25152, 0}; /* String with Chinese (codepage 950) characters */
SetLastError(0xdeadbeef);
ret = WideCharToMultiByte(1252, 0, &wc1, 1, &mbc, 1, NULL, bUsedDefaultChar);