build fixes for mac

This commit is contained in:
Ian Curtis 2020-07-27 10:28:48 +00:00
parent 858b84f424
commit 5e434e2644
19 changed files with 538 additions and 319 deletions

View file

@ -1,13 +1,8 @@
#
# TODO: MacOS port is probably broken. Someone with MacOS needs to figure out
# how to compile with SDL2.
#
##
## Supermodel
## A Sega Model 3 Arcade Emulator.
## Copyright 2011-2017 Bart Trzynadlowski, Nik Henson, Ian Curtis
## Copyright 2011-2020 Bart Trzynadlowski, Nik Henson, Ian Curtis,
## Harry Tuttle, and Spindizzi
##
## This file is part of Supermodel.
##
@ -28,7 +23,7 @@
#
# Makefile.OSX
#
# Makefile for Mac OS X systems using gcc.
# Makefile for Mac OS X systems using clang.
#
@ -45,12 +40,17 @@ DELETE = rm -d -r -f
# Edit library and include paths as needed.
###############################################################################
#
# Must be included first
#
include Makefiles/Options.inc
#
# Toolchain
#
CC = gcc
CXX = g++
LD = gcc
CC = clang
CXX = clang
LD = clang
#
# SDL
@ -58,12 +58,15 @@ LD = gcc
SDL_CFLAGS =
SDL_LIBS = -framework SDL2 -framework AGL -framework OpenGL -framework GLUT -framework Cocoa
ifeq ($(strip $(NET_BOARD)),1)
SDL_LIBS += -framework SDL2_net
endif
#
# OSX-specific
#
PLATFORM_CFLAGS = $(SDL_CFLAGS) -DSUPERMODEL_OSX -DUSE_FILE32API -F/Library/Frameworks/
PLATFORM_CFLAGS = $(SDL_CFLAGS) -DSUPERMODEL_OSX -F/Library/Frameworks/
PLATFORM_LDFLAGS = $(SDL_LIBS) -lz -lm -lstdc++ -F/Library/Frameworks/
@ -71,7 +74,7 @@ PLATFORM_LDFLAGS = $(SDL_LIBS) -lz -lm -lstdc++ -F/Library/Frameworks/
# Core Makefile
###############################################################################
include Makefiles/Makefile.inc
include Makefiles/Rules.inc
clean:
$(SILENT)echo Cleaning up \"$(BIN_DIR)\" and \"$(OBJ_DIR)\"...

View file

@ -1,7 +1,8 @@
##
## Supermodel
## A Sega Model 3 Arcade Emulator.
## Copyright 2011-2017 Bart Trzynadlowski, Nik Henson, Ian Curtis
## Copyright 2011-2020 Bart Trzynadlowski, Nik Henson, Ian Curtis,
## Harry Tuttle, and Spindizzi
##
## This file is part of Supermodel.
##
@ -39,6 +40,11 @@ DELETE = rm -d -r -f
# Edit library and include paths as needed.
###############################################################################
#
# Must be included first
#
include Makefiles/Options.inc
#
# Toolchain
#
@ -65,7 +71,7 @@ PLATFORM_LDFLAGS = $(SDL2_LIBS) -lGL -lGLU -lz -lm -lstdc++ -lpthread -lSDL2_net
# Core Makefile
###############################################################################
include Makefiles/Makefile.inc
include Makefiles/Rules.inc
clean:
$(SILENT)echo Cleaning up \"$(BIN_DIR)\" and \"$(OBJ_DIR)\"...

View file

@ -1,7 +1,8 @@
##
## Supermodel
## A Sega Model 3 Arcade Emulator.
## Copyright 2011-2017 Bart Trzynadlowski, Nik Henson, Ian Curtis
## Copyright 2011-2020 Bart Trzynadlowski, Nik Henson, Ian Curtis,
## Harry Tuttle, and Spindizzi
##
## This file is part of Supermodel.
##
@ -36,6 +37,11 @@
# section as well, namely SDL2_LIBS and PLATFORM_LIBS.
###############################################################################
#
# Must be included first
#
include Makefiles/Options.inc
#
# Bitness of build ('32' or '64')
#
@ -44,15 +50,12 @@ BITS = 64
#
# Path to SDL2
#
SDL2_INCLUDE_DIR = c:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/SDL2
SDL2_LIB_DIR = c:/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/lib
#SDL2_INCLUDE_DIR = $(MINGW)/include/SDL2
#SDL2_LIB_DIR = $(MINGW)/lib
SDL2_INCLUDE_DIR = C:\TDM-GCC-64\x86_64-w64-mingw32\include\SDL2
SDL2_LIB_DIR = C:\TDM-GCC-64\x86_64-w64-mingw32\lib
#
# Toolchain
#
CC = gcc
CXX = g++
LD = g++
@ -78,8 +81,11 @@ endif
#
# SDL2
#
SDL2_LIBS = -lmingw32 -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm -limm32 -lversion -lsetupapi -lsdl2_net -liphlpapi
SDL2_LIBS = -lmingw32 -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm -limm32 -lversion -lsetupapi -liphlpapi
SDL2_CFLAGS =
ifeq ($(strip $(NET_BOARD)),1)
SDL2_LIBS += -lSDL2_net
endif
#
# MinGW/Windows-specific
@ -100,7 +106,7 @@ PLATFORM_SRC_FILES = \
Src/OSD/Windows/DirectInputSystem.cpp \
Src/OSD/Windows/WinOutputs.cpp
include Makefiles/Makefile.inc
include Makefiles/Rules.inc
clean:
$(SILENT)echo Cleaning up $(BIN_DIR) and $(OBJ_DIR)...

76
Makefiles/Options.inc Normal file
View file

@ -0,0 +1,76 @@
##
## Supermodel
## A Sega Model 3 Arcade Emulator.
## Copyright 2011-2020 Bart Trzynadlowski, Nik Henson, Ian Curtis,
## Harry Tuttle, and Spindizzi
##
## This file is part of Supermodel.
##
## Supermodel is free software: you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation, either version 3 of the License, or (at your option)
## any later version.
##
## Supermodel is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
## more details.
##
## You should have received a copy of the GNU General Public License along
## with Supermodel. If not, see <http://www.gnu.org/licenses/>.
##
#
# Options.inc
#
# Build options.
#
###############################################################################
# Build Options
###############################################################################
#
# Verbose progression
#
VERBOSE =
ifneq ($(filter $(strip $(VERBOSE)),0 1),$(strip $(VERBOSE)))
override VERBOSE =
endif
SILENT = @
ifeq ($(strip $(VERBOSE)),1)
SILENT =
endif
#
# Enable render state analyser for the legacy 3D engine (will slow down emulation!)
#
DEBUG =
ifneq ($(filter $(strip $(DEBUG)),0 1),$(strip $(DEBUG)))
override DEBUG =
endif
#
# Enable support for Model3 Net Board emulation
#
NET_BOARD =
ifneq ($(filter $(strip $(NET_BOARD)),0 1),$(strip $(NET_BOARD)))
override NET_BOARD =
endif
#
# Enable Bart's new (experimental) Real3D frame timing
#
NEW_FRAME_TIMING =
ifneq ($(filter $(strip $(NEW_FRAME_TIMING)),0 1),$(strip $(NEW_FRAME_TIMING)))
override NEW_FRAME_TIMING =
endif
#
# Include console-based debugger in emulator ('yes' or 'no')
#
ENABLE_DEBUGGER =
ifneq ($(filter $(strip $(ENABLE_DEBUGGER)),0 1),$(strip $(ENABLE_DEBUGGER)))
override ENABLE_DEBUGGER =
endif

View file

@ -1,7 +1,8 @@
##
## Supermodel
## A Sega Model 3 Arcade Emulator.
## Copyright 2011-2017 Bart Trzynadlowski, Nik Henson, Ian Curtis
## Copyright 2011-2020 Bart Trzynadlowski, Nik Henson, Ian Curtis,
## Harry Tuttle, and Spindizzi
##
## This file is part of Supermodel.
##
@ -20,61 +21,12 @@
##
#
# Makefile.inc
# Rules.inc
#
# Core GNU Makefile, included by all (platform-specific) top-level Makefiles.
# Build rules, included by all (platform-specific) top-level Makefiles.
#
###############################################################################
# Build Options
###############################################################################
#
# Verbose progression
#
VERBOSE =
ifneq ($(filter $(strip $(VERBOSE)),0 1),$(strip $(VERBOSE)))
override VERBOSE =
endif
SILENT = @
ifeq ($(strip $(VERBOSE)),1)
SILENT =
endif
#
# Enable render state analyser for the legacy 3D engine (will slow down emulation!)
#
DEBUG =
ifneq ($(filter $(strip $(DEBUG)),0 1),$(strip $(DEBUG)))
override DEBUG =
endif
#
# Enable support for Model3 Net Board emulation
#
NET_BOARD =
ifneq ($(filter $(strip $(NET_BOARD)),0 1),$(strip $(NET_BOARD)))
override NET_BOARD =
endif
#
# Enable Bart's new (experimental) Real3D frame timing
#
NEW_FRAME_TIMING =
ifneq ($(filter $(strip $(NEW_FRAME_TIMING)),0 1),$(strip $(NEW_FRAME_TIMING)))
override NEW_FRAME_TIMING =
endif
#
# Include console-based debugger in emulator ('yes' or 'no')
#
ENABLE_DEBUGGER =
ifneq ($(filter $(strip $(ENABLE_DEBUGGER)),0 1),$(strip $(ENABLE_DEBUGGER)))
override ENABLE_DEBUGGER =
endif
###############################################################################
# Source Files
###############################################################################

View file

@ -109,7 +109,7 @@ bool GameLoader::LoadZippedFile(std::shared_ptr<uint8_t> *buffer, size_t *file_s
}
*file_size = zipped_file->uncompressed_size;
buffer->reset(new uint8_t[*file_size], std::default_delete<uint8_t[]>());
ZPOS64_T bytes_read = unzReadCurrentFile(zipped_file->zf, buffer->get(), *file_size);
size_t bytes_read = (size_t) unzReadCurrentFile(zipped_file->zf, buffer->get(), *file_size);
if (bytes_read != *file_size)
{
ErrorLog("Unable to read '%s' from '%s'. Is zip file corrupt?", zipped_file->filename.c_str(), zipped_file->zipfilename.c_str());

View file

@ -4,7 +4,7 @@
#include <thread>
#include <atomic>
#include <vector>
#include "SDL_net.h"
#include "SDLIncludes.h"
class TCPReceive
{

View file

@ -2,7 +2,7 @@
#define _TCPSEND_H_
#include <string>
#include "SDL_net.h"
#include "SDLIncludes.h"
class TCPSend
{

View file

@ -26,14 +26,7 @@
*/
#include "Supermodel.h"
#ifdef SUPERMODEL_OSX
#include <SDL/SDL.h>
#include <SDL/SDL_audio.h>
#else
#include <SDL.h>
#include <SDL_audio.h>
#endif
#include "SDLIncludes.h"
#include <cmath>
#include <algorithm>

View file

@ -1,7 +1,7 @@
/**
** Supermodel
** A Sega Model 3 Arcade Emulator.
** Copyright 2011-2019 Bart Trzynadlowski, Nik Henson, Ian Curtis,
** Copyright 2011-2020 Bart Trzynadlowski, Nik Henson, Ian Curtis,
** Harry Tuttle, and Spindizzi
**
** This file is part of Supermodel.
@ -57,11 +57,6 @@
#include <vector>
#include <algorithm>
#include "Pkgs/glew.h"
#ifdef SUPERMODEL_OSX
#include <SDL/SDL.h>
#else
#include <SDL.h>
#endif
#include "Supermodel.h"
#include "Util/Format.h"
@ -73,6 +68,7 @@
#include "DirectInputSystem.h"
#include "WinOutputs.h"
#endif
#include "SDLIncludes.h"
#include <iostream>
@ -1418,7 +1414,7 @@ static Util::Config::Node DefaultConfig()
static void Title(void)
{
puts("Supermodel: A Sega Model 3 Arcade Emulator (Version " SUPERMODEL_VERSION ")");
puts("Copyright 2011-2019 by Bart Trzynadlowski, Nik Henson, Ian Curtis,");
puts("Copyright 2011-2020 by Bart Trzynadlowski, Nik Henson, Ian Curtis,");
puts(" Harry Tuttle, and Spindizzi\n");
}

48
Src/OSD/SDL/SDLIncludes.h Normal file
View file

@ -0,0 +1,48 @@
/**
** Supermodel
** A Sega Model 3 Arcade Emulator.
** Copyright 2011-2019 Bart Trzynadlowski, Nik Henson, Ian Curtis,
** Harry Tuttle, and Spindizzi
**
** This file is part of Supermodel.
**
** Supermodel is free software: you can redistribute it and/or modify it under
** the terms of the GNU General Public License as published by the Free
** Software Foundation, either version 3 of the License, or (at your option)
** any later version.
**
** Supermodel is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
** more details.
**
** You should have received a copy of the GNU General Public License along
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* SDLIncludes.h
*
* Header file for SDL library.
*/
#ifndef INCLUDED_SDLINCLUDES_H
#define INCLUDED_SDLINCLUDES_H
#ifdef SUPERMODEL_OSX
#include <SDL2/SDL.h>
#include <SDL2/SDL_audio.h>
#else
#include <SDL.h>
#include <SDL_audio.h>
#endif
#ifdef NET_BOARD
#ifdef SUPERMODEL_OSX
#include <SDL2_net/SDL_net.h>
#else
#include <SDL_net.h>
#endif
#endif
#endif // INCLUDED_SDLINCLUDES_H

View file

@ -29,8 +29,8 @@
* - Implement multiple keyboard and mouse support.
*/
#include "SDLInputSystem.h"
#include "Supermodel.h"
#include "SDLInputSystem.h"
#include <vector>
using namespace std;

View file

@ -31,12 +31,7 @@
#include "Types.h"
#include "Inputs/InputSource.h"
#include "Inputs/InputSystem.h"
#ifdef SUPERMODEL_OSX
#include <SDL/SDL.h>
#else
#include <SDL.h>
#endif
#include "SDLIncludes.h"
#include <vector>
using namespace std;

View file

@ -26,14 +26,7 @@
*/
#include "Supermodel.h"
#ifdef SUPERMODEL_OSX
#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>
#else
#include <SDL.h>
#include <SDL_thread.h>
#endif
#include "SDLIncludes.h"
void CThread::Sleep(UINT32 ms)
{
@ -95,7 +88,7 @@ CThread::~CThread()
// User should have called Wait() before thread object is destroyed
if (nullptr != m_impl)
{
ErrorLog("Runaway thread error. A thread was not properly halted: %s\n", GetName());
ErrorLog("Runaway thread error. A thread was not properly halted: %s\n", GetName().c_str());
}
}

131
Src/Pkgs/crypt.h Normal file
View file

@ -0,0 +1,131 @@
/* crypt.h -- base code for crypt/uncrypt ZIPfile
Version 1.01e, February 12th, 2005
Copyright (C) 1998-2005 Gilles Vollant
This code is a modified version of crypting code in Infozip distribution
The encryption/decryption parts of this source code (as opposed to the
non-echoing password parts) were originally written in Europe. The
whole source package can be freely distributed, including from the USA.
(Prior to January 2000, re-export from the US was a violation of US law.)
This encryption code is a direct transcription of the algorithm from
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
file (appnote.txt) is distributed with the PKZIP program (even in the
version without encryption capabilities).
If you don't need crypting in your application, just define symbols
NOCRYPT and NOUNCRYPT.
This code support the "Traditional PKWARE Encryption".
The new AES encryption added on Zip format by Winzip (see the page
http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
Encryption is not supported.
*/
#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
/***********************************************************************
* Return the next byte in the pseudo-random sequence
*/
static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
{
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}
/***********************************************************************
* Update the encryption keys with the next byte of plain text
*/
static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
{
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
{
register int keyshift = (int)((*(pkeys+1)) >> 24);
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
}
return c;
}
/***********************************************************************
* Initialize the encryption keys and the random header according to
* the given password.
*/
static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab)
{
*(pkeys+0) = 305419896L;
*(pkeys+1) = 591751049L;
*(pkeys+2) = 878082192L;
while (*passwd != '\0') {
update_keys(pkeys,pcrc_32_tab,(int)*passwd);
passwd++;
}
}
#define zdecode(pkeys,pcrc_32_tab,c) \
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
#define zencode(pkeys,pcrc_32_tab,c,t) \
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
#define RAND_HEAD_LEN 12
/* "last resort" source for second part of crypt seed pattern */
# ifndef ZCR_SEED2
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# endif
static int crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */
int bufSize,
unsigned long* pkeys,
const z_crc_t* pcrc_32_tab,
unsigned long crcForCrypting)
{
int n; /* index in random header */
int t; /* temporary */
int c; /* random byte */
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
static unsigned calls = 0; /* ensure different random header each time */
if (bufSize<RAND_HEAD_LEN)
return 0;
/* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
* output of rand() to get less predictability, since rand() is
* often poorly implemented.
*/
if (++calls == 1)
{
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
}
init_keys(passwd, pkeys, pcrc_32_tab);
for (n = 0; n < RAND_HEAD_LEN-2; n++)
{
c = (rand() >> 7) & 0xff;
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
}
/* Encrypt random header (last two bytes is high word of crc) */
init_keys(passwd, pkeys, pcrc_32_tab);
for (n = 0; n < RAND_HEAD_LEN-2; n++)
{
buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
}
buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
return n;
}
#endif

View file

@ -10,10 +10,22 @@
*/
#if (defined(_WIN32))
#if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS)))
#define _CRT_SECURE_NO_WARNINGS
#endif
#if defined(__APPLE__) || defined(IOAPI_NO_64)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream)
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
#else
#define FOPEN_FUNC(filename, mode) fopen64(filename, mode)
#define FTELLO_FUNC(stream) ftello64(stream)
#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin)
#endif
#include "ioapi.h"
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)
@ -47,7 +59,7 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
else
{
uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
if ((tell_uLong) == ((uLong)-1))
if ((tell_uLong) == MAXU32)
return (ZPOS64_T)-1;
else
return tell_uLong;
@ -112,7 +124,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
mode_fopen = "wb";
if ((filename!=NULL) && (mode_fopen != NULL))
file = fopen64((const char*)filename, mode_fopen);
file = FOPEN_FUNC((const char*)filename, mode_fopen);
return file;
}
@ -142,7 +154,7 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
{
ZPOS64_T ret;
ret = ftello64((FILE *)stream);
ret = FTELLO_FUNC((FILE *)stream);
return ret;
}
@ -188,7 +200,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
}
ret = 0;
if(fseeko64((FILE *)stream, offset, fseek_origin) != 0)
if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
ret = -1;
return ret;

View file

@ -21,7 +21,7 @@
#ifndef _ZLIBIOAPI64_H
#define _ZLIBIOAPI64_H
#if (!defined(_WIN32)) && (!defined(WIN32))
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
// Linux needs this to support file operation on files larger then 4+GB
// But might need better if/def to select just the platforms that needs them.
@ -38,6 +38,7 @@
#ifndef _FILE_OFFSET_BIT
#define _FILE_OFFSET_BIT 64
#endif
#endif
#include <stdio.h>
@ -49,6 +50,11 @@
#define ftello64 ftell
#define fseeko64 fseek
#else
#ifdef __FreeBSD__
#define fopen64 fopen
#define ftello64 ftello
#define fseeko64 fseeko
#endif
#ifdef _MSC_VER
#define fopen64 fopen
#if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
@ -85,6 +91,8 @@ typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
typedef uint64_t ZPOS64_T;
#else
/* Maximum unsigned 32-bit value used as placeholder for zip64 */
#define MAXU32 0xffffffff
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ZPOS64_T;

View file

@ -188,7 +188,7 @@ typedef struct
# ifndef NOUNCRYPT
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
const unsigned long* pcrc_32_tab;
const z_crc_t* pcrc_32_tab;
# endif
} unz64_s;
@ -200,7 +200,7 @@ typedef struct
/* ===========================================================================
Read a byte from a gz_stream; update next_in and avail_in. Return EOF
for end of file.
IN assertion: the stream s has been sucessfully opened for reading.
IN assertion: the stream s has been successfully opened for reading.
*/
@ -801,9 +801,9 @@ extern unzFile ZEXPORT unzOpen64 (const void *path)
}
/*
Close a ZipFile opened with unzipOpen.
If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
Close a ZipFile opened with unzOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
these files MUST be closed with unzCloseCurrentFile before call unzClose.
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzClose (unzFile file)
{
@ -1040,26 +1040,26 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
{
uLong uL;
if(file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1)
if(file_info.uncompressed_size == MAXU32)
{
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
err=UNZ_ERRNO;
}
if(file_info.compressed_size == (ZPOS64_T)(unsigned long)-1)
if(file_info.compressed_size == MAXU32)
{
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
err=UNZ_ERRNO;
}
if(file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1)
if(file_info_internal.offset_curfile == MAXU32)
{
/* Relative Header offset */
if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
err=UNZ_ERRNO;
}
if(file_info.disk_num_start == (unsigned long)-1)
if(file_info.disk_num_start == MAXU32)
{
/* Disk Start Number */
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
@ -1145,7 +1145,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
szFileName,fileNameBufferSize,
extraField,extraFieldBufferSize,
szComment,commentBufferSize);
if (err==UNZ_OK)
if ((err==UNZ_OK) && (pfile_info != NULL))
{
pfile_info->version = file_info64.version;
pfile_info->version_needed = file_info64.version_needed;
@ -1223,7 +1223,7 @@ extern int ZEXPORT unzGoToNextFile (unzFile file)
/*
Try locate the file szFileName in the zipfile.
For the iCaseSensitivity signification, see unzipStringFileNameCompare
For the iCaseSensitivity signification, see unzStringFileNameCompare
return value :
UNZ_OK if the file is found. It becomes the current file.
@ -1696,7 +1696,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
return UNZ_PARAMERROR;
if ((pfile_in_zip_read_info->read_buffer == NULL))
if (pfile_in_zip_read_info->read_buffer == NULL)
return UNZ_END_OF_LIST_OF_FILE;
if (len==0)
return 0;
@ -1998,7 +1998,7 @@ extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
}
/*
Close the file in zip opened with unzipOpenCurrentFile
Close the file in zip opened with unzOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/
extern int ZEXPORT unzCloseCurrentFile (unzFile file)

View file

@ -197,9 +197,9 @@ extern unzFile ZEXPORT unzOpen2_64 OF((const void *path,
extern int ZEXPORT unzClose OF((unzFile file));
/*
Close a ZipFile opened with unzipOpen.
Close a ZipFile opened with unzOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
these files MUST be closed with unzCloseCurrentFile before call unzClose.
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,