Merge branch 'save_ext' into jgrpp
# Conflicts: # Makefile.src.in # findversion.sh # projects/determineversion.vbs # src/lang/dutch.txt # src/lang/korean.txt # src/network/network.cpp # src/network/network_client.cpp # src/rail.cpp # src/rail_cmd.cpp # src/saveload/afterload.cpp # src/ship_cmd.cpp # src/toolbar_gui.cpp # src/vehicle.cpp
This commit is contained in:
@@ -410,10 +410,14 @@ static bool GunzipFile(const ContentInfo *ci)
|
||||
{
|
||||
#if defined(WITH_ZLIB)
|
||||
bool ret = true;
|
||||
|
||||
/* Need to open the file with fopen() to support non-ASCII on Windows. */
|
||||
FILE *ftmp = fopen(GetFullFilename(ci, true), "rb");
|
||||
if (ftmp == NULL) return false;
|
||||
/* Duplicate the handle, and close the FILE*, to avoid double-closing the handle later. */
|
||||
gzFile fin = gzdopen(dup(fileno(ftmp)), "rb");
|
||||
fclose(ftmp);
|
||||
|
||||
gzFile fin = gzdopen(fileno(ftmp), "rb");
|
||||
FILE *fout = fopen(GetFullFilename(ci, false), "wb");
|
||||
|
||||
if (fin == NULL || fout == NULL) {
|
||||
@@ -450,14 +454,7 @@ static bool GunzipFile(const ContentInfo *ci)
|
||||
}
|
||||
}
|
||||
|
||||
if (fin != NULL) {
|
||||
/* Closes ftmp too! */
|
||||
gzclose(fin);
|
||||
} else if (ftmp != NULL) {
|
||||
/* In case the gz stream was opened correctly this will
|
||||
* be closed by gzclose. */
|
||||
fclose(ftmp);
|
||||
}
|
||||
if (fin != NULL) gzclose(fin);
|
||||
if (fout != NULL) fclose(fout);
|
||||
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user