Alexandre Julliard : cabinet: Fix the remaining todo_wine tests in fdi.c.
Alexandre Julliard
julliard at winehq.org
Mon Feb 21 10:56:56 CST 2011
Module: wine
Branch: master
Commit: 3dc669ffb5a2005f5cb47a1ddac66227ae63f678
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3dc669ffb5a2005f5cb47a1ddac66227ae63f678
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sat Feb 19 12:50:09 2011 +0100
cabinet: Fix the remaining todo_wine tests in fdi.c.
---
dlls/cabinet/fci.c | 2 +-
dlls/cabinet/fdi.c | 35 ++++++-----------------------------
dlls/cabinet/tests/fdi.c | 20 ++++++--------------
3 files changed, 13 insertions(+), 44 deletions(-)
diff --git a/dlls/cabinet/fci.c b/dlls/cabinet/fci.c
index 997760a..9ec1bdd 100644
--- a/dlls/cabinet/fci.c
+++ b/dlls/cabinet/fci.c
@@ -672,7 +672,7 @@ static BOOL write_cabinet( FCI_Int *fci, PFNFCISTATUS status_callback )
cfheader->cFiles = fci_endian_uword( fci->cFiles );
cfheader->flags = fci_endian_uword( flags );
cfheader->setID = fci_endian_uword( fci->ccab.setID );
- cfheader->iCabinet = fci_endian_uword( fci->ccab.iCab - 1 );
+ cfheader->iCabinet = fci_endian_uword( fci->ccab.iCab );
ptr = (char *)(cfheader + 1);
if (flags & cfheadRESERVE_PRESENT)
diff --git a/dlls/cabinet/fdi.c b/dlls/cabinet/fdi.c
index b5dc29d..27a969b 100644
--- a/dlls/cabinet/fdi.c
+++ b/dlls/cabinet/fdi.c
@@ -436,10 +436,8 @@ HFDI __cdecl FDICreate(
if (!((fdi = pfnalloc(sizeof(FDI_Int))))) {
perf->erfOper = FDIERROR_ALLOC_FAIL;
- perf->erfType = ERROR_NOT_ENOUGH_MEMORY;
+ perf->erfType = 0;
perf->fError = TRUE;
-
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return NULL;
}
@@ -603,21 +601,9 @@ static BOOL FDI_read_entries(
/* get the number of folders */
num_folders = EndGetI16(buf+cfhead_NumFolders);
- if (num_folders == 0) {
- /* PONDERME: is this really invalid? */
- WARN("weird cabinet detect failure: no folders in cabinet\n");
- if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 );
- return FALSE;
- }
/* get the number of files */
num_files = EndGetI16(buf+cfhead_NumFiles);
- if (num_files == 0) {
- /* PONDERME: is this really invalid? */
- WARN("weird cabinet detect failure: no files in cabinet\n");
- if (pmii) set_error( fdi, FDIERROR_NOT_A_CABINET, 0 );
- return FALSE;
- }
/* setid */
setid = EndGetI16(buf+cfhead_SetID);
@@ -2284,8 +2270,7 @@ static void free_decompression_temps(FDI_Int *fdi, const struct fdi_folder *fol,
}
}
-static void free_decompression_mem(FDI_Int *fdi,
- fdi_decomp_state *decomp_state, struct fdi_file *file)
+static void free_decompression_mem(FDI_Int *fdi, fdi_decomp_state *decomp_state)
{
struct fdi_folder *fol;
while (decomp_state) {
@@ -2305,7 +2290,7 @@ static void free_decompression_mem(FDI_Int *fdi,
fdi->free(fol);
}
while (CAB(firstfile)) {
- file = CAB(firstfile);
+ struct fdi_file *file = CAB(firstfile);
if (file->filename) fdi->free(file->filename);
CAB(firstfile) = CAB(firstfile)->next;
fdi->free(file);
@@ -2531,7 +2516,6 @@ BOOL __cdecl FDICopy(
idx = 0;
if (pathlen) {
for (i = 0; i < pathlen; i++) fullpath[idx++] = pszCabPath[i];
- if (fullpath[idx - 1] != '\\') fullpath[idx++] = '\\';
}
if (filenamelen) for (i = 0; i < filenamelen; i++) fullpath[idx++] = pszCabinet[i];
fullpath[idx] = '\0';
@@ -2547,13 +2531,6 @@ BOOL __cdecl FDICopy(
return FALSE;
}
- if (cabhf == 0) {
- ERR("PFDI_OPEN returned zero for %s.\n", fullpath);
- fdi->free(decomp_state);
- set_error( fdi, FDIERROR_CABINET_NOT_FOUND, ERROR_FILE_NOT_FOUND );
- return FALSE;
- }
-
/* check if it's really a cabfile. Note that this doesn't implement the bug */
if (!FDI_read_entries(fdi, cabhf, &fdici, &(CAB(mii)))) {
ERR("FDIIsCabinet failed.\n");
@@ -2859,8 +2836,8 @@ BOOL __cdecl FDICopy(
}
}
- free_decompression_temps(fdi, fol, decomp_state);
- free_decompression_mem(fdi, decomp_state, file);
+ if (fol) free_decompression_temps(fdi, fol, decomp_state);
+ free_decompression_mem(fdi, decomp_state);
return TRUE;
@@ -2870,7 +2847,7 @@ BOOL __cdecl FDICopy(
if (filehf) fdi->close(filehf);
- free_decompression_mem(fdi, decomp_state, file);
+ free_decompression_mem(fdi, decomp_state);
return FALSE;
}
diff --git a/dlls/cabinet/tests/fdi.c b/dlls/cabinet/tests/fdi.c
index b3f70bf..4e1c9e0 100644
--- a/dlls/cabinet/tests/fdi.c
+++ b/dlls/cabinet/tests/fdi.c
@@ -239,12 +239,9 @@ static void test_FDICreate(void)
ok(erf.erfOper == FDIERROR_ALLOC_FAIL,
"Expected FDIERROR_ALLOC_FAIL, got %d\n", erf.erfOper);
ok(erf.fError == TRUE, "Expected TRUE, got %d\n", erf.fError);
- todo_wine
- {
- ok(GetLastError() == 0xdeadbeef,
- "Expected 0xdeadbeef, got %d\n", GetLastError());
- ok(erf.erfType == 0, "Expected 0, got %d\n", erf.erfType);
- }
+ ok(GetLastError() == 0xdeadbeef,
+ "Expected 0xdeadbeef, got %d\n", GetLastError());
+ ok(erf.erfType == 0, "Expected 0, got %d\n", erf.erfType);
}
static void test_FDIDestroy(void)
@@ -582,8 +579,7 @@ static void test_FDIIsCabinet(void)
ok(cabinfo.cFolders == 1, "Expected 1, got %d\n", cabinfo.cFolders);
ok(cabinfo.setID == 0xbeef, "Expected 0xbeef, got %d\n", cabinfo.setID);
ok(cabinfo.cbCabinet == 182, "Expected 182, got %d\n", cabinfo.cbCabinet);
- todo_wine
- ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
+ ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
fdi_close(fd);
FDIDestroy(hfdi);
@@ -629,11 +625,8 @@ static void test_FDICopy(void)
SetLastError(0xdeadbeef);
ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
- todo_wine
- {
- ok(GetLastError() == ERROR_INVALID_HANDLE,
- "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
- }
+ ok(GetLastError() == ERROR_INVALID_HANDLE,
+ "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
FDIDestroy(hfdi);
}
@@ -649,7 +642,6 @@ static void test_FDICopy(void)
/* cabinet with no files or folders */
SetLastError(0xdeadbeef);
ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
- todo_wine
ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
ok(GetLastError() == 0, "Expected 0f, got %d\n", GetLastError());
More information about the wine-cvs
mailing list