Use strlen or lstrlenA as appropriate to avoid signed/unsigned
warnings.
This commit is contained in:
parent
95217843d5
commit
45d261374c
|
@ -106,7 +106,8 @@ static void test_get_atom_name(void)
|
|||
{
|
||||
char buf[10];
|
||||
WCHAR bufW[10];
|
||||
int i, len;
|
||||
int i;
|
||||
UINT len;
|
||||
static const WCHAR resultW[] = {'f','o','o','b','a','r',0,'.','.','.'};
|
||||
|
||||
ATOM atom = GlobalAddAtomA( "foobar" );
|
||||
|
|
|
@ -46,7 +46,7 @@ static void test_GetWindowsDirectoryA(void)
|
|||
lstrcpyA(buf, "foo");
|
||||
len = GetWindowsDirectoryA(buf, len_with_null);
|
||||
ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer");
|
||||
ok(len == lstrlenA(buf), "returned length should be equal to the length of string");
|
||||
ok(len == strlen(buf), "returned length should be equal to the length of string");
|
||||
ok(len == len_with_null-1, "GetWindowsDirectoryA returned %d, expected %d",
|
||||
len, len_with_null-1);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ static void test_GetSystemDirectoryA(void)
|
|||
lstrcpyA(buf, "foo");
|
||||
len = GetSystemDirectoryA(buf, len_with_null);
|
||||
ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer");
|
||||
ok(len == lstrlenA(buf), "returned length should be equal to the length of string");
|
||||
ok(len == strlen(buf), "returned length should be equal to the length of string");
|
||||
ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d",
|
||||
len, len_with_null-1);
|
||||
}
|
||||
|
|
|
@ -38,25 +38,25 @@ static void test_GetSetEnvironmentVariableA(void)
|
|||
|
||||
/* Try to retrieve the environment variable we just set */
|
||||
ret_size = GetEnvironmentVariableA(name, NULL, 0);
|
||||
ok(ret_size == lstrlenA(value) + 1,
|
||||
ok(ret_size == strlen(value) + 1,
|
||||
"should return length with terminating 0 ret_size=%ld", ret_size);
|
||||
|
||||
lstrcpyA(buf, "foo");
|
||||
ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value));
|
||||
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer");
|
||||
ok(ret_size == lstrlenA(value) + 1,
|
||||
ok(ret_size == strlen(value) + 1,
|
||||
"should return length with terminating 0 ret_size=%ld", ret_size);
|
||||
|
||||
lstrcpyA(buf, "foo");
|
||||
ret_size = GetEnvironmentVariableA(name, buf, lstrlenA(value) + 1);
|
||||
ok(lstrcmpA(buf, value) == 0, "should touch the buffer");
|
||||
ok(ret_size == lstrlenA(value),
|
||||
ok(ret_size == strlen(value),
|
||||
"should return length without terminating 0 ret_size=%ld", ret_size);
|
||||
|
||||
lstrcpyA(buf, "foo");
|
||||
ret_size = GetEnvironmentVariableA(name_cased, buf, lstrlenA(value) + 1);
|
||||
ok(lstrcmpA(buf, value) == 0, "should touch the buffer");
|
||||
ok(ret_size == lstrlenA(value),
|
||||
ok(ret_size == strlen(value),
|
||||
"should return length without terminating 0 ret_size=%ld", ret_size);
|
||||
|
||||
/* Remove that environment variable */
|
||||
|
@ -79,7 +79,7 @@ static void test_GetSetEnvironmentVariableA(void)
|
|||
lstrcpyA(buf, "foo");
|
||||
ret_size = GetEnvironmentVariableA(name_cased, buf, lstrlenA(value) + 1);
|
||||
ok(lstrcmpA(buf, value) == 0, "should touch the buffer");
|
||||
ok(ret_size == lstrlenA(value),
|
||||
ok(ret_size == strlen(value),
|
||||
"should return length without terminating 0 ret_size=%ld", ret_size);
|
||||
|
||||
ret = SetEnvironmentVariableA(name_cased, "");
|
||||
|
|
|
@ -47,7 +47,7 @@ static void test__hread( void )
|
|||
char buffer[10000];
|
||||
long bytes_read;
|
||||
long bytes_wanted;
|
||||
UINT i;
|
||||
long i;
|
||||
|
||||
SetFileAttributesA(filename,FILE_ATTRIBUTE_NORMAL); /* be sure to remove stale files */
|
||||
DeleteFileA( filename );
|
||||
|
@ -68,9 +68,9 @@ static void test__hread( void )
|
|||
|
||||
bytes_read = _hread( filehandle, buffer, 2 * strlen( sillytext ) );
|
||||
|
||||
ok( strlen( sillytext ) == bytes_read, "file read size error" );
|
||||
ok( lstrlenA( sillytext ) == bytes_read, "file read size error" );
|
||||
|
||||
for (bytes_wanted = 0; bytes_wanted < strlen( sillytext ); bytes_wanted++)
|
||||
for (bytes_wanted = 0; bytes_wanted < lstrlenA( sillytext ); bytes_wanted++)
|
||||
{
|
||||
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains" );
|
||||
ok( _hread( filehandle, buffer, bytes_wanted ) == bytes_wanted, "erratic _hread return value" );
|
||||
|
@ -91,9 +91,9 @@ static void test__hwrite( void )
|
|||
HFILE filehandle;
|
||||
char buffer[10000];
|
||||
long bytes_read;
|
||||
UINT bytes_written;
|
||||
UINT blocks;
|
||||
UINT i;
|
||||
long bytes_written;
|
||||
long blocks;
|
||||
long i;
|
||||
char *contents;
|
||||
HLOCAL memory_object;
|
||||
char checksum[1];
|
||||
|
@ -205,7 +205,7 @@ static void test__lcreat( void )
|
|||
|
||||
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains" );
|
||||
|
||||
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == strlen( sillytext ), "erratic _hread return value" );
|
||||
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value" );
|
||||
|
||||
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
|
||||
|
||||
|
@ -235,7 +235,7 @@ static void test__lcreat( void )
|
|||
|
||||
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains" );
|
||||
|
||||
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == strlen( sillytext ), "erratic _hread return value" );
|
||||
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value" );
|
||||
|
||||
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
|
||||
|
||||
|
@ -250,7 +250,7 @@ static void test__lcreat( void )
|
|||
|
||||
ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains" );
|
||||
|
||||
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == strlen( sillytext ), "erratic _hread return value" );
|
||||
ok( _hread( filehandle, buffer, strlen( sillytext ) ) == lstrlenA( sillytext ), "erratic _hread return value" );
|
||||
|
||||
ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains" );
|
||||
|
||||
|
@ -359,7 +359,7 @@ static void test__lread( void )
|
|||
|
||||
bytes_read = _lread( filehandle, buffer, 2 * strlen( sillytext ) );
|
||||
|
||||
ok( strlen( sillytext ) == bytes_read, "file read size error" );
|
||||
ok( lstrlenA( sillytext ) == bytes_read, "file read size error" );
|
||||
|
||||
for (bytes_wanted = 0; bytes_wanted < strlen( sillytext ); bytes_wanted++)
|
||||
{
|
||||
|
@ -382,9 +382,9 @@ static void test__lwrite( void )
|
|||
HFILE filehandle;
|
||||
char buffer[10000];
|
||||
long bytes_read;
|
||||
UINT bytes_written;
|
||||
UINT blocks;
|
||||
UINT i;
|
||||
long bytes_written;
|
||||
long blocks;
|
||||
long i;
|
||||
char *contents;
|
||||
HLOCAL memory_object;
|
||||
char checksum[1];
|
||||
|
|
|
@ -178,9 +178,9 @@ static void test_ValidPathA(CHAR *curdir, CHAR *subdir, CHAR *filename,
|
|||
|
||||
/* split path into leading directory, and 8.3 filename */
|
||||
static void test_SplitShortPathA(CHAR *path,CHAR *dir,CHAR *eight,CHAR *three) {
|
||||
DWORD len,done,error;
|
||||
DWORD ext,fil;
|
||||
INT i;
|
||||
int done,error;
|
||||
int ext,fil;
|
||||
int len,i;
|
||||
len=lstrlenA(path);
|
||||
ext=len; fil=len; done=0; error=0;
|
||||
/* walk backwards over path looking for '.' or '\\' seperators */
|
||||
|
@ -813,7 +813,7 @@ static void test_GetTempPathA(char* tmp_dir)
|
|||
len = GetTempPathA(MAX_PATH, buf);
|
||||
ok(len <= MAX_PATH, "should fit into MAX_PATH");
|
||||
ok(lstrcmpiA(buf, tmp_dir) == 0, "expected [%s], got [%s]",tmp_dir,buf);
|
||||
ok(len == lstrlenA(buf), "returned length should be equal to the length of string");
|
||||
ok(len == strlen(buf), "returned length should be equal to the length of string");
|
||||
|
||||
/* Some versions of Windows touch the buffer, some don't so we don't
|
||||
* test that. Also, NT sometimes exagerates the required buffer size
|
||||
|
@ -834,7 +834,7 @@ static void test_GetTempPathA(char* tmp_dir)
|
|||
lstrcpyA(buf, "foo");
|
||||
len = GetTempPathA(len, buf);
|
||||
ok(lstrcmpiA(buf, tmp_dir) == 0, "expected [%s], got [%s]",tmp_dir,buf);
|
||||
ok(len == lstrlenA(buf), "returned length should be equal to the length of string");
|
||||
ok(len == strlen(buf), "returned length should be equal to the length of string");
|
||||
}
|
||||
|
||||
static void test_GetTempPathW(char* tmp_dir)
|
||||
|
|
|
@ -57,9 +57,8 @@ static void release_memory(void)
|
|||
|
||||
static char* encodeA(const char* str)
|
||||
{
|
||||
size_t len;
|
||||
char* ptr;
|
||||
int i;
|
||||
size_t len,i;
|
||||
|
||||
if (!str) return "";
|
||||
len = strlen(str) + 1;
|
||||
|
@ -72,9 +71,8 @@ static char* encodeA(const char* str)
|
|||
|
||||
static char* encodeW(const WCHAR* str)
|
||||
{
|
||||
size_t len;
|
||||
char* ptr;
|
||||
int i;
|
||||
size_t len,i;
|
||||
|
||||
if (!str) return "";
|
||||
len = lstrlenW(str) + 1;
|
||||
|
@ -96,9 +94,8 @@ static unsigned decode_char(char c)
|
|||
|
||||
static char* decodeA(const char* str)
|
||||
{
|
||||
size_t len;
|
||||
char* ptr;
|
||||
int i;
|
||||
size_t len,i;
|
||||
|
||||
len = strlen(str) / 2;
|
||||
if (!len--) return NULL;
|
||||
|
@ -346,7 +343,7 @@ static int strCmp(const char* s1, const char* s2, BOOL sensitive)
|
|||
*/
|
||||
#define okChildInt(sect, key, expect) \
|
||||
do { \
|
||||
int result = GetPrivateProfileIntA((sect), (key), !(expect), resfile); \
|
||||
UINT result = GetPrivateProfileIntA((sect), (key), !(expect), resfile); \
|
||||
ok(result == expect, "%s:%s expected %d, but got %d\n", (sect), (key), (int)(expect), result); \
|
||||
} while (0)
|
||||
|
||||
|
|
Loading…
Reference in New Issue