lz32: Rename function aliases to real (ASCII) function names.

This commit is contained in:
Saulius Krasuckas 2006-06-19 23:21:20 +03:00 committed by Alexandre Julliard
parent 6c4c4e3515
commit bd2df081bd
1 changed files with 59 additions and 61 deletions

View File

@ -52,7 +52,7 @@ static const DWORD uncompressed_data_size = sizeof(uncompressed_data) - 1;
static char *buf; static char *buf;
static void test_lzopenfile(void) static void test_LZOpenFileA(void)
{ {
OFSTRUCT test; OFSTRUCT test;
DWORD retval; DWORD retval;
@ -60,41 +60,40 @@ static void test_lzopenfile(void)
char expected[MAX_PATH]; char expected[MAX_PATH];
char filled_0xA5[OFS_MAXPATHNAME]; char filled_0xA5[OFS_MAXPATHNAME];
/* Check for nonexistent file. */ /* Check for nonexistent file. */
file = LZOpenFile("badfilename_", &test, OF_READ); file = LZOpenFileA("badfilename_", &test, OF_READ);
ok(file == LZERROR_BADINHANDLE, ok(file == LZERROR_BADINHANDLE,
"LZOpenFile succeeded on nonexistent file\n"); "LZOpenFileA succeeded on nonexistent file\n");
LZClose(file); LZClose(file);
/* Create an empty file. */ /* Create an empty file. */
file = LZOpenFile(filename_, &test, OF_CREATE); file = LZOpenFileA(filename_, &test, OF_CREATE);
ok(file >= 0, "LZOpenFile failed on creation\n"); ok(file >= 0, "LZOpenFileA failed on creation\n");
LZClose(file); LZClose(file);
retval = GetFileAttributes(filename_); retval = GetFileAttributesA(filename_);
ok(retval != INVALID_FILE_ATTRIBUTES, "GetFileAttributes: error %ld\n", ok(retval != INVALID_FILE_ATTRIBUTES, "GetFileAttributesA: error %ld\n",
GetLastError()); GetLastError());
/* Check various opening options. */ /* Check various opening options. */
file = LZOpenFile(filename_, &test, OF_READ); file = LZOpenFileA(filename_, &test, OF_READ);
ok(file >= 0, "LZOpenFile failed on read\n"); ok(file >= 0, "LZOpenFileA failed on read\n");
LZClose(file); LZClose(file);
file = LZOpenFile(filename_, &test, OF_WRITE); file = LZOpenFileA(filename_, &test, OF_WRITE);
ok(file >= 0, "LZOpenFile failed on write\n"); ok(file >= 0, "LZOpenFileA failed on write\n");
LZClose(file); LZClose(file);
file = LZOpenFile(filename_, &test, OF_READWRITE); file = LZOpenFileA(filename_, &test, OF_READWRITE);
ok(file >= 0, "LZOpenFile failed on read/write\n"); ok(file >= 0, "LZOpenFileA failed on read/write\n");
LZClose(file); LZClose(file);
file = LZOpenFile(filename_, &test, OF_EXIST); file = LZOpenFileA(filename_, &test, OF_EXIST);
ok(file >= 0, "LZOpenFile failed on read/write\n"); ok(file >= 0, "LZOpenFileA failed on read/write\n");
LZClose(file); LZClose(file);
/* If the file "foo.xxx" does not exist, LZOpenFile should then /* If the file "foo.xxx" does not exist, LZOpenFileA should then
check for the file "foo.xx_" and open that -- at least on some check for the file "foo.xx_" and open that -- at least on some
operating systems. Doesn't seem to on my copy of Win98. operating systems. Doesn't seem to on my copy of Win98.
*/ */
retval = GetCurrentDirectory(MAX_PATH, expected); retval = GetCurrentDirectoryA(MAX_PATH, expected);
ok(retval > 0, "GetCurrentDirectory returned %ld, GLE=0x%lx\n", ok(retval > 0, "GetCurrentDirectoryA returned %ld, GLE=0x%lx\n",
retval, GetLastError()); retval, GetLastError());
lstrcatA(expected, "\\"); lstrcatA(expected, "\\");
lstrcatA(expected, filename); lstrcatA(expected, filename);
@ -106,38 +105,37 @@ static void test_lzopenfile(void)
SetLastError(0xfaceabee); SetLastError(0xfaceabee);
/* Try to open compressed file. */ /* Try to open compressed file. */
file = LZOpenFile(filename, &test, OF_EXIST); file = LZOpenFileA(filename, &test, OF_EXIST);
if(file != LZERROR_BADINHANDLE) { /* NT */ if(file != LZERROR_BADINHANDLE) {
ok(test.cBytes == sizeof(OFSTRUCT), ok(test.cBytes == sizeof(OFSTRUCT),
"LZOpenFile set test.cBytes to %d\n", test.cBytes); "LZOpenFileA set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == 0, ok(test.nErrCode == 0, "LZOpenFileA set test.nErrCode to %d\n",
"LZOpenFile set test.nErrCode to %d\n", test.nErrCode); test.nErrCode);
ok(lstrcmpA(test.szPathName, expected) == 0, ok(lstrcmpA(test.szPathName, expected) == 0,
"LZOpenFile returned '%s', but was expected to return '%s'\n", "LZOpenFileA returned '%s', but was expected to return '%s'\n",
test.szPathName, expected); test.szPathName, expected);
LZClose(file); LZClose(file);
} else { /* 9x */ } else {
ok(test.cBytes == 0xA5, ok(test.cBytes == 0xA5,
"LZOpenFile set test.cBytes to %d\n", test.cBytes); "LZOpenFileA set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == ERROR_FILE_NOT_FOUND, ok(test.nErrCode == ERROR_FILE_NOT_FOUND,
"LZOpenFile set test.nErrCode to %d\n", test.nErrCode); "LZOpenFileA set test.nErrCode to %d\n", test.nErrCode);
ok(strncmp(test.szPathName, filled_0xA5, OFS_MAXPATHNAME) == 0, ok(strncmp(test.szPathName, filled_0xA5, OFS_MAXPATHNAME) == 0,
"LZOpenFile returned '%s', but was expected to return '%s'\n", "LZOpenFileA returned '%s', but was expected to return '%s'\n",
test.szPathName, filled_0xA5); test.szPathName, filled_0xA5);
} }
/* Delete the file then make sure it doesn't exist anymore. */ /* Delete the file then make sure it doesn't exist anymore. */
file = LZOpenFile(filename_, &test, OF_DELETE); file = LZOpenFileA(filename_, &test, OF_DELETE);
ok(file >= 0, "LZOpenFile failed on delete\n"); ok(file >= 0, "LZOpenFileA failed on delete\n");
LZClose(file); LZClose(file);
retval = GetFileAttributes(filename_); retval = GetFileAttributesA(filename_);
ok(retval == INVALID_FILE_ATTRIBUTES, ok(retval == INVALID_FILE_ATTRIBUTES,
"GetFileAttributes succeeded on deleted file\n"); "GetFileAttributesA succeeded on deleted file\n");
} }
static void test_lzread(void) static void test_LZRead(void)
{ {
HANDLE file; HANDLE file;
DWORD ret; DWORD ret;
@ -146,15 +144,15 @@ static void test_lzread(void)
BOOL retok; BOOL retok;
/* Create the compressed file. */ /* Create the compressed file. */
file = CreateFile(filename_, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0); file = CreateFileA(filename_, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0);
ok(file != INVALID_HANDLE_VALUE, "Could not create test file\n"); ok(file != INVALID_HANDLE_VALUE, "Could not create test file\n");
retok = WriteFile(file, compressed_file, compressed_file_size, &ret, 0); retok = WriteFile(file, compressed_file, compressed_file_size, &ret, 0);
ok( retok, "WriteFile: error %ld\n", GetLastError()); ok( retok, "WriteFile: error %ld\n", GetLastError());
ok(ret == compressed_file_size, "Wrote wrong number of bytes with WriteFile?\n"); ok(ret == compressed_file_size, "Wrote wrong number of bytes with WriteFile?\n");
CloseHandle(file); CloseHandle(file);
cfile = LZOpenFile(filename_, &test, OF_READ); cfile = LZOpenFileA(filename_, &test, OF_READ);
ok(cfile > 0, "LZOpenFile failed\n"); ok(cfile > 0, "LZOpenFileA failed\n");
ret = LZRead(cfile, buf, uncompressed_data_size); ret = LZRead(cfile, buf, uncompressed_data_size);
ok(ret == uncompressed_data_size, "Read wrong number of bytes\n"); ok(ret == uncompressed_data_size, "Read wrong number of bytes\n");
@ -171,11 +169,11 @@ static void test_lzread(void)
LZClose(cfile); LZClose(cfile);
ret = DeleteFile(filename_); ret = DeleteFileA(filename_);
ok(ret, "DeleteFile: error %ld\n", GetLastError()); ok(ret, "DeleteFileA: error %ld\n", GetLastError());
} }
static void test_lzcopy(void) static void test_LZCopy(void)
{ {
HANDLE file; HANDLE file;
DWORD ret; DWORD ret;
@ -184,18 +182,18 @@ static void test_lzcopy(void)
BOOL retok; BOOL retok;
/* Create the compressed file. */ /* Create the compressed file. */
file = CreateFile(filename_, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0); file = CreateFileA(filename_, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0);
ok(file != INVALID_HANDLE_VALUE, ok(file != INVALID_HANDLE_VALUE,
"CreateFile: error %ld\n", GetLastError()); "CreateFileA: error %ld\n", GetLastError());
retok = WriteFile(file, compressed_file, compressed_file_size, &ret, 0); retok = WriteFile(file, compressed_file, compressed_file_size, &ret, 0);
ok( retok, "WriteFile error %ld\n", GetLastError()); ok( retok, "WriteFile error %ld\n", GetLastError());
ok(ret == compressed_file_size, "Wrote wrong number of bytes\n"); ok(ret == compressed_file_size, "Wrote wrong number of bytes\n");
CloseHandle(file); CloseHandle(file);
source = LZOpenFile(filename_, &stest, OF_READ); source = LZOpenFileA(filename_, &stest, OF_READ);
ok(source >= 0, "LZOpenFile failed on compressed file\n"); ok(source >= 0, "LZOpenFileA failed on compressed file\n");
dest = LZOpenFile(filename2, &dtest, OF_CREATE); dest = LZOpenFileA(filename2, &dtest, OF_CREATE);
ok(dest >= 0, "LZOpenFile failed on creating new file %d\n", dest); ok(dest >= 0, "LZOpenFileA failed on creating new file %d\n", dest);
ret = LZCopy(source, dest); ret = LZCopy(source, dest);
ok(ret > 0, "LZCopy error\n"); ok(ret > 0, "LZCopy error\n");
@ -203,10 +201,10 @@ static void test_lzcopy(void)
LZClose(source); LZClose(source);
LZClose(dest); LZClose(dest);
file = CreateFile(filename2, GENERIC_READ, 0, NULL, OPEN_EXISTING, file = CreateFileA(filename2, GENERIC_READ, 0, NULL, OPEN_EXISTING,
0, 0); 0, 0);
ok(file != INVALID_HANDLE_VALUE, ok(file != INVALID_HANDLE_VALUE,
"CreateFile: error %ld\n", GetLastError()); "CreateFileA: error %ld\n", GetLastError());
retok = ReadFile(file, buf, uncompressed_data_size*2, &ret, 0); retok = ReadFile(file, buf, uncompressed_data_size*2, &ret, 0);
ok( retok && ret == uncompressed_data_size, "ReadFile: error %ld\n", GetLastError()); ok( retok && ret == uncompressed_data_size, "ReadFile: error %ld\n", GetLastError());
@ -215,17 +213,17 @@ static void test_lzcopy(void)
"buffer contents mismatch\n"); "buffer contents mismatch\n");
CloseHandle(file); CloseHandle(file);
ret = DeleteFile(filename_); ret = DeleteFileA(filename_);
ok(ret, "DeleteFile: error %ld\n", GetLastError()); ok(ret, "DeleteFileA: error %ld\n", GetLastError());
ret = DeleteFile(filename2); ret = DeleteFileA(filename2);
ok(ret, "DeleteFile: error %ld\n", GetLastError()); ok(ret, "DeleteFileA: error %ld\n", GetLastError());
} }
START_TEST(lzexpand_main) START_TEST(lzexpand_main)
{ {
buf = malloc(uncompressed_data_size * 2); buf = malloc(uncompressed_data_size * 2);
test_lzopenfile(); test_LZOpenFileA();
test_lzread(); test_LZRead();
test_lzcopy(); test_LZCopy();
free(buf); free(buf);
} }