Compare commits

...

35 Commits

Author SHA1 Message Date
Ryan C. Gordon 9b561b4799 Upped version to 2.0.2 2011-02-18 16:17:25 -05:00
Ryan C. Gordon 896b455f6b Corrected copyright dates in stable-2.0 branch's license. 2011-02-18 16:15:28 -05:00
Ryan C. Gordon 6b96ff2524 Backported zip/qpak dir fix from dev branch to stable-2.0. 2011-02-18 12:42:14 -05:00
Ryan C. Gordon b9c25d3d92 Use LIB_SUFFIX to install to lib64 instead of lib (thanks, Cristian!).
(transplanted from 079b6bf97b2332419d0768daca1df0a52fda0d32)
2011-02-17 15:02:20 -05:00
Ryan C. Gordon 57f48cb2e3 Windows byteorder test merged from 2.1 branch. 2011-01-21 03:11:48 -05:00
Ryan C. Gordon f6ec56cf59 Fixes for Haiku support, compliments of Chris Roberts. 2010-12-30 19:45:47 -05:00
Ryan C. Gordon 1c8bdd8fb4 Zero-sized destination buffers when converting to UTF-8 shouldn't overflow.
(transplanted from 12c87d886a75)
2010-08-20 02:46:14 -04:00
Ryan C. Gordon 4189377d15 Patched to compile on Solaris. 2010-04-07 12:34:31 -04:00
Ryan C. Gordon 4d961a9128 Merged changeset e2515a0fdec1 into stable-2.0: documentation fix. 2010-04-05 15:51:28 -04:00
Ryan C. Gordon d6fbaedb21 Initialize an array to quiet compiler complaining.
Some versions of GCC think this can be used uninitialized. It doesn't appear
 to be the case, but we initialize it to keep the compiler happy. It's probably
 a good idea anyhow.
2010-03-25 15:58:47 -04:00
Ryan C. Gordon 70cf36b6b5 Tagging 2.0.1 release 2010-03-24 23:51:40 -04:00
Ryan C. Gordon 3388e96bce Upped version to 2.0.1 2010-03-23 16:06:49 -04:00
Ryan C. Gordon f0c9799c69 Update copyright date in stable-2.0 branch. 2010-03-23 13:39:34 -04:00
Ryan C. Gordon aadfb3b33a Backported extra CD/DVD filesystem checks to stable-2.0. 2010-03-22 11:16:12 -04:00
Ryan C. Gordon b73d4a1b3c Backing out Doxygen escaping patch on stable-2.0 branch. 2010-03-22 11:12:11 -04:00
Ryan C. Gordon c710fb637a Backported fixes for bogus homedir bug to stable-2.0 branch.
Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=553174
2010-03-21 12:29:49 -04:00
Ryan C. Gordon 0166d7302a Doxygen fixes (thanks, Patrick!). 2010-03-17 21:52:21 -04:00
Ryan C. Gordon 06c6e8806b Backport of Windows file sharing fix from default branch. 2010-03-17 17:11:21 -04:00
Ryan C. Gordon 9e7d931a08 Fix for the Hurd, from the debian project. 2010-03-15 09:44:34 -04:00
Ryan C. Gordon ff0b95c758 Added an .hgignore file to stable-2.0 branch. 2010-02-28 17:22:43 -05:00
Ryan C. Gordon 3ffdc65c6e Added Patrice to the credits.
(transplanted from 3b976828a3bc35fe5d57ecdaf3a2d0dcd68e70ee)
2010-02-03 23:19:23 -05:00
Ryan C. Gordon b45c0ce151 Catch case where we use the Unix code on a non-Unix system that lacks pthreads.
Thanks, Patrice!
(transplanted from 18ae36a7f55bcca606f7d7d5f745f4d9b95e0840)
2010-02-03 23:14:11 -05:00
Ryan C. Gordon c906916f4e Some targets need string.h here.
Thanks, Patrice!
(transplanted from 93b8ed5502a5bc476ea86a0f90211917b21a5b57)
2010-02-03 22:50:07 -05:00
Ryan C. Gordon 2276520de9 Merged 1042:dc9291957a5a from default branch: make dist fix. 2010-02-02 23:40:17 -05:00
Ryan C. Gordon 7aaa4dc6bf Fixed compiler warning on newer Linux systems.
(transplanted from 3ab4702d6313b2590f202f1475cd68976765f02f)
2010-02-01 03:02:18 -05:00
Ryan C. Gordon 0310835418 Merged 1018:23aee7da04e0 from default branch: fixed C++-style comments. 2010-01-28 02:45:10 -05:00
Ryan C. Gordon 57a04afef5 Fixed some wrong parentheses in the OS/2 code. 2010-01-28 02:38:57 -05:00
Ryan C. Gordon d4c4a06b5a Removed makedist.sh from the stable-2.0 branch ("hg archive" is the new thing.) 2010-01-28 02:36:18 -05:00
Ryan C. Gordon a259eb4efe Merged 998:974b90b56c43 from default branch: latin1-to-UTF8 fix. 2009-09-30 01:47:49 -04:00
Ryan C. Gordon 88268ab857 Fixed building of stable-2.0 branch with Mac OS X 10.6 SDK. 2009-09-06 01:06:14 -04:00
Ryan C. Gordon aa478bc5df Don't use -fvisibility=hidden on several platforms. 2009-07-12 16:46:06 -04:00
Ryan C. Gordon e4002c6950 Merged changeset 1006:139e2ab9e303 from default branch: CREDITS.txt update. 2009-07-08 18:48:30 -04:00
Ryan C. Gordon 98790d824f Merged changeset 1005:cafe3867784c from default branch: cross-compile fixes. 2009-07-08 18:47:54 -04:00
Ryan C. Gordon d9f0a87208 Merged 1001:b0c6f2f4f361 through 1003:a28d30d275e2 from default branch.
Fixes /proc/*/exe behaviour on Linux.
2009-07-08 17:59:29 -04:00
Ryan C. Gordon 8978c7dddc Merge from 2.1 branch: lzma re-open workaround. 2009-06-21 17:42:20 -04:00
24 changed files with 216 additions and 167 deletions

2
.hgignore Normal file
View File

@ -0,0 +1,2 @@
syntax:glob
cmake-build

View File

@ -6,7 +6,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
PROJECT(PhysicsFS)
SET(PHYSFS_VERSION 2.0.0)
SET(PHYSFS_VERSION 2.0.2)
# Increment this if/when we break backwards compatibility.
SET(PHYSFS_SOVERSION 1)
@ -60,7 +60,10 @@ IF(CMAKE_COMPILER_IS_GNUCC)
" PHYSFS_IS_GCC4)
IF(PHYSFS_IS_GCC4)
ADD_DEFINITIONS(-fvisibility=hidden)
# Not supported on several operating systems at this time.
IF(NOT OS2 AND NOT SOLARIS AND NOT WINDOWS)
ADD_DEFINITIONS(-fvisibility=hidden)
ENDIF(NOT OS2 AND NOT SOLARIS AND NOT WINDOWS)
ENDIF(PHYSFS_IS_GCC4)
ENDIF(CMAKE_COMPILER_IS_GNUCC)
@ -105,7 +108,9 @@ IF(BEOS)
# We add this explicitly, since we don't want CMake to think this
# is a C++ project unless we're on BeOS.
SET(PHYSFS_BEOS_SRCS platform/beos.cpp)
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} be root)
FIND_LIBRARY(BE_LIBRARY be)
FIND_LIBRARY(ROOT_LIBRARY root)
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY})
ENDIF(BEOS)
# Almost everything is "compiled" here, but things that don't apply to the
@ -159,8 +164,6 @@ IF(UNIX)
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
IF(HAVE_PTHREAD_H)
SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
ELSE(HAVE_PTHREAD_H)
ADD_DEFINITIONS(-DPHYSFS_NO_PTHREADS_SUPPORT=1)
ENDIF(HAVE_PTHREAD_H)
ENDIF(BEOS)
ENDIF(UNIX)
@ -184,6 +187,7 @@ ENDIF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
IF(PHYSFS_HAVE_THREAD_SUPPORT)
ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE)
ELSE(PHYSFS_HAVE_THREAD_SUPPORT)
ADD_DEFINITIONS(-DPHYSFS_NO_THREAD_SUPPORT=1)
MESSAGE(WARNING " ***")
MESSAGE(WARNING " *** There is no thread support in this build!")
MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!")
@ -244,26 +248,21 @@ ENDIF(PHYSFS_ARCHIVE_QPAK)
# See if some archiver required zlib, and see about using system version.
IF(PHYSFS_NEED_ZLIB)
CHECK_INCLUDE_FILE(zlib.h HAVE_ZLIB_H)
IF(HAVE_ZLIB_H)
CHECK_LIBRARY_EXISTS("z" "inflate" "" HAVE_LIBZ)
IF(HAVE_LIBZ)
SET(HAVE_SYSTEM_ZLIB TRUE)
ENDIF(HAVE_LIBZ)
ENDIF(HAVE_ZLIB_H)
FIND_PACKAGE(ZLIB)
IF(HAVE_SYSTEM_ZLIB)
IF(ZLIB_FOUND)
OPTION(PHYSFS_INTERNAL_ZLIB "Link own zlib instead of system library" FALSE)
ELSE(HAVE_SYSTEM_ZLIB)
SET(PHYSFS_INTERNAL_ZLIB TRUE)
ENDIF(HAVE_SYSTEM_ZLIB)
ENDIF(ZLIB_FOUND)
IF(PHYSFS_INTERNAL_ZLIB)
INCLUDE_DIRECTORIES(zlib123)
ADD_DEFINITIONS(-DZ_PREFIX=1)
SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${ZLIB_SRCS})
ELSE(PHYSFS_INTERNAL_ZLIB)
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} z)
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${ZLIB_LIBRARY})
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
ENDIF(PHYSFS_INTERNAL_ZLIB)
ENDIF(PHYSFS_NEED_ZLIB)
@ -298,18 +297,20 @@ ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
OPTION(PHYSFS_BUILD_TEST "Build stdio test program." TRUE)
MARK_AS_ADVANCED(PHYSFS_BUILD_TEST)
IF(PHYSFS_BUILD_TEST)
CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_H)
CHECK_INCLUDE_FILE(readline/history.h HAVE_HISTORY_H)
IF(HAVE_READLINE_H AND HAVE_HISTORY_H)
SET(CMAKE_REQUIRED_LIBRARIES curses)
CHECK_LIBRARY_EXISTS("readline" "readline" "" HAVE_LIBREADLINE)
CHECK_LIBRARY_EXISTS("readline" "history" "" HAVE_LIBHISTORY)
IF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY)
FIND_PATH(READLINE_H readline/readline.h)
FIND_PATH(HISTORY_H readline/history.h)
IF(READLINE_H AND HISTORY_H)
FIND_LIBRARY(CURSES_LIBRARY NAMES curses ncurses)
SET(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
FIND_LIBRARY(READLINE_LIBRARY readline)
FIND_LIBRARY(HISTORY_LIBRARY history)
IF(READLINE_LIBRARY AND HISTORY_LIBRARY)
SET(HAVE_SYSTEM_READLINE TRUE)
SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} " " readline curses)
SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
INCLUDE_DIRECTORIES(${READLINE_H} ${HISTORY_H})
ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1)
ENDIF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY)
ENDIF(HAVE_READLINE_H AND HAVE_HISTORY_H)
ENDIF(READLINE_LIBRARY AND HISTORY_LIBRARY)
ENDIF(READLINE_H AND HISTORY_H)
ADD_EXECUTABLE(test_physfs test/test_physfs.c)
TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
@ -335,8 +336,8 @@ ENDIF(PHYSFS_BUILD_WX_TEST)
INSTALL(TARGETS ${PHYSFS_INSTALL_TARGETS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX})
INSTALL(FILES physfs.h DESTINATION include)
FIND_PACKAGE(Doxygen)
@ -347,7 +348,13 @@ ELSE(DOXYGEN_FOUND)
ENDIF(DOXYGEN_FOUND)
IF(UNIX)
ADD_CUSTOM_TARGET(dist ./extras/makedist.sh ${PHYSFS_VERSION} COMMENT "Building source tarball")
SET(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.gz")
ADD_CUSTOM_TARGET(
dist
hg archive -t tgz "${PHYSFS_TARBALL}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Building source tarball '${PHYSFS_TARBALL}'..."
)
ENDIF(UNIX)
MACRO(MESSAGE_BOOL_OPTION _NAME _VALUE)

View File

@ -90,6 +90,12 @@ Bug fixes:
Bug fixes:
Olivier Boudeville
Bug fixes:
Henk Boom
Build system fixes:
Marc Kleine-Budde
Windows .rc file,
7zip/lzma archiver:
Dennis Schridde
@ -97,6 +103,9 @@ Windows .rc file,
OS/2 updates:
Dave Yeo
Bug fixes:
Patrice Mandin
Other stuff:
Your name here! Patches go to icculus@icculus.org ...

View File

@ -23,7 +23,7 @@ PROJECT_NAME = physfs
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 2.0.0
PROJECT_NUMBER = 2.0.2
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

View File

@ -1,5 +1,5 @@
Copyright (c) 2003-2009 Ryan C. Gordon and others.
Copyright (c) 2001-2011 Ryan C. Gordon and others.
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from

View File

@ -108,7 +108,7 @@ static void SzFreePhysicsFS(void *address)
SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
size_t *processedSize)
{
FileInputStream *s = (FileInputStream *)(object - offsetof(FileInputStream, inStream)); // HACK!
FileInputStream *s = (FileInputStream *)(object - offsetof(FileInputStream, inStream)); /* HACK! */
PHYSFS_sint64 processedSizeLoc = 0;
if (maxReqSize > BUFFER_SIZE)
@ -130,7 +130,7 @@ SZ_RESULT SzFileReadImp(void *object, void **buffer, size_t maxReqSize,
SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
size_t *processedSize)
{
FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); // HACK!
FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); /* HACK! */
size_t processedSizeLoc = __PHYSFS_platformRead(s->file, buffer, 1, size);
if (processedSize != 0)
*processedSize = processedSizeLoc;
@ -145,7 +145,7 @@ SZ_RESULT SzFileReadImp(void *object, void *buffer, size_t size,
*/
SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
{
FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); // HACK!
FileInputStream *s = (FileInputStream *)((unsigned long)object - offsetof(FileInputStream, inStream)); /* HACK! */
if (__PHYSFS_platformSeek(s->file, (PHYSFS_uint64) pos))
return SZ_OK;
return SZE_FAIL;
@ -209,7 +209,7 @@ static void lzma_file_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
*/
static LZMAfile * lzma_find_file(LZMAarchive *archive, const char *name)
{
LZMAfile *file = bsearch(name, archive->files, archive->db.Database.NumFiles, sizeof(*archive->files), lzma_file_cmp_stdlib); // FIXME: Should become __PHYSFS_search!!!
LZMAfile *file = bsearch(name, archive->files, archive->db.Database.NumFiles, sizeof(*archive->files), lzma_file_cmp_stdlib); /* FIXME: Should become __PHYSFS_search!!! */
BAIL_IF_MACRO(file == NULL, ERR_NO_SUCH_FILE, NULL);
@ -225,10 +225,10 @@ static int lzma_file_init(LZMAarchive *archive, PHYSFS_uint32 fileIndex)
LZMAfile *file = &archive->files[fileIndex];
PHYSFS_uint32 folderIndex = archive->db.FileIndexToFolderIndexMap[fileIndex];
file->index = fileIndex; // Store index into 7z array, since we sort our own.
file->index = fileIndex; /* Store index into 7z array, since we sort our own. */
file->archive = archive;
file->folder = (folderIndex != (PHYSFS_uint32)-1 ? &archive->folders[folderIndex] : NULL); // Directories don't have a folder (they contain no own data...)
file->item = &archive->db.Database.Files[fileIndex]; // Holds crucial data and is often referenced -> Store link
file->folder = (folderIndex != (PHYSFS_uint32)-1 ? &archive->folders[folderIndex] : NULL); /* Directories don't have a folder (they contain no own data...) */
file->item = &archive->db.Database.Files[fileIndex]; /* Holds crucial data and is often referenced -> Store link */
file->position = 0;
file->offset = 0; /* Offset will be set by LZMA_read() */
@ -247,7 +247,7 @@ static int lzma_files_init(LZMAarchive *archive)
{
if (!lzma_file_init(archive, fileIndex))
{
return(0); // FALSE on failure
return(0); /* FALSE on failure */
}
} /* for */
@ -450,7 +450,7 @@ static int LZMA_isArchive(const char *filename, int forWriting)
/* Read signature bytes */
if (__PHYSFS_platformRead(in, sig, k7zSignatureSize, 1) != 1)
{
__PHYSFS_platformClose(in); // Don't forget to close the file before returning...
__PHYSFS_platformClose(in); /* Don't forget to close the file before returning... */
BAIL_MACRO(NULL, 0);
}
@ -478,7 +478,7 @@ static void *LZMA_openArchive(const char *name, int forWriting)
{
__PHYSFS_platformClose(archive->stream.file);
lzma_archive_exit(archive);
return(NULL); // Error is set by platformOpenRead!
return(NULL); /* Error is set by platformOpenRead! */
}
CrcGenerateTable();
@ -491,7 +491,7 @@ static void *LZMA_openArchive(const char *name, int forWriting)
SzArDbExFree(&archive->db, SzFreePhysicsFS);
__PHYSFS_platformClose(archive->stream.file);
lzma_archive_exit(archive);
return NULL; // Error is set by lzma_err!
return NULL; /* Error is set by lzma_err! */
} /* if */
len = archive->db.Database.NumFiles * sizeof (LZMAfile);
@ -568,7 +568,7 @@ static void LZMA_enumerateFiles(dvoid *opaque, const char *dname,
if (dlen)
{
file = lzma_find_file(archive, dname);
if (file != NULL) // if 'file' is NULL it should stay so, otherwise errors will not be handled
if (file != NULL) /* if 'file' is NULL it should stay so, otherwise errors will not be handled */
file += 1;
}
else
@ -617,7 +617,7 @@ static PHYSFS_sint64 LZMA_getLastModTime(dvoid *opaque,
*fileExists = (file != NULL);
BAIL_IF_MACRO(file == NULL, NULL, -1);
BAIL_IF_MACRO(!file->item->IsLastWriteTimeDefined, NULL, -1); // write-time may not be defined for every file
BAIL_IF_MACRO(!file->item->IsLastWriteTimeDefined, NULL, -1); /* write-time may not be defined for every file */
return(lzma_filetime_to_unix_timestamp(&file->item->LastWriteTime));
} /* LZMA_getLastModTime */
@ -649,7 +649,8 @@ static fvoid *LZMA_openRead(dvoid *opaque, const char *name, int *fileExists)
BAIL_IF_MACRO(file == NULL, ERR_NO_SUCH_FILE, NULL);
BAIL_IF_MACRO(file->folder == NULL, ERR_NOT_A_FILE, NULL);
file->folder->references++; // Increase refcount for automatic cleanup...
file->position = 0;
file->folder->references++; /* Increase refcount for automatic cleanup... */
return(file);
} /* LZMA_openRead */

View File

@ -478,8 +478,11 @@ static QPAKentry *qpak_find_entry(QPAKinfo *info, const char *path, int *isDir)
if (thispath[pathlen] == '\0') /* found entry? */
return(&a[middle]);
/* adjust search params, try again. */
else if (thispath[pathlen] > '/')
hi = middle - 1;
else
hi = middle - 1; /* adjust search params, try again. */
lo = middle + 1;
} /* if */
} /* while */

View File

@ -375,7 +375,7 @@ static int ZIP_fileClose(fvoid *opaque)
static PHYSFS_sint64 zip_find_end_of_central_dir(void *in, PHYSFS_sint64 *len)
{
PHYSFS_uint8 buf[256];
PHYSFS_uint8 extra[4];
PHYSFS_uint8 extra[4] = { 0, 0, 0, 0 };
PHYSFS_sint32 i = 0;
PHYSFS_sint64 filelen;
PHYSFS_sint64 filepos;
@ -544,8 +544,11 @@ static ZIPentry *zip_find_entry(ZIPinfo *info, const char *path, int *isDir)
if (thispath[pathlen] == '\0') /* found entry? */
return(&a[middle]);
/* adjust search params, try again. */
else if (thispath[pathlen] > '/')
hi = middle - 1;
else
hi = middle - 1; /* adjust search params, try again. */
lo = middle + 1;
} /* if */
} /* while */

View File

@ -1,54 +0,0 @@
#!/bin/sh
# This shell script is roughly equivalent to what "make dist" did in the
# autotools build system and is called from a custom CMake target.
# !!! FIXME: This code sort of sucks. Consider using CPack instead...
if [ ! -f ./CMakeLists.txt ]; then
echo "you are in the wrong place."
exit 1
fi
if [ -z "$1" ]; then
echo "Wrong arguments."
exit 2
fi
set -e
VERSION="$1"
BASENAME="physfs-$VERSION"
TARBALL="$BASENAME.tar.gz"
TMPCPDIR="../9sdkujy75jv932-physfstmp-$VERSION"
CPDIR="$TMPCPDIR/$BASENAME"
echo "Packing PhysicsFS $VERSION source tarball..."
echo " + Setting up scratch dir..."
rm -rf $TMPCPDIR
mkdir $TMPCPDIR
mkdir $CPDIR
echo " + Making copy of source tree in scratch dir..."
cp -R . $CPDIR/
echo " + Deleting cruft..."
pushd $CPDIR >/dev/null
rm -rf `svn propget svn:ignore .`
rm -rf `svn status |grep '?' |sed -s 's/\?//'`
popd >/dev/null
rm -rf `find $CPDIR -type d -name '.svn'`
echo " + Deleting Subversion metadata..."
rm -rf `find $CPDIR -type d -name '.svn'`
echo " + Fixing up permissions..."
chmod -R a+rw $CPDIR
chmod a+x `find $CPDIR -type d`
echo " + Building final tarball..."
rm -f $TARBALL
tar -czf $TARBALL -C $TMPCPDIR $BASENAME
echo " + Cleaning up..."
rm -rf $TMPCPDIR
echo " + All done! Packed to '$TARBALL' ..."
set +e
exit 0

View File

@ -156,14 +156,14 @@ static void serve_http_request(int sock, struct sockaddr *addr,
{
printf("out of memory.\n");
return;
} // if
} /* if */
args->addr = (struct sockaddr *) malloc(addrlen);
if (args->addr == NULL)
{
free(args);
printf("out of memory.\n");
return;
} // if
} /* if */
args->sock = sock;
args->addrlen = addrlen;

View File

@ -2,6 +2,10 @@
#include <memory.h>
/* BEGIN PHYSFS CHANGE */
#include <string.h>
/* END PHYSFS CHANGE */
#include "7zDecode.h"
#ifdef _SZ_ONE_DIRECTORY
#include "LzmaDecode.h"

View File

@ -605,18 +605,21 @@ static int freeDirHandle(DirHandle *dh, FileHandle *openList)
static char *calculateUserDir(void)
{
char *retval = NULL;
const char *str = NULL;
char *retval = __PHYSFS_platformGetUserDir();
if (retval != NULL)
{
/* make sure it really exists and is normalized. */
char *ptr = __PHYSFS_platformRealPath(retval);
allocator.Free(retval);
retval = ptr;
} /* if */
str = __PHYSFS_platformGetUserDir();
if (str != NULL)
retval = (char *) str;
else
if (retval == NULL)
{
const char *dirsep = PHYSFS_getDirSeparator();
const char *uname = __PHYSFS_platformGetUserName();
const char *str = (uname != NULL) ? uname : "default";
str = (uname != NULL) ? uname : "default";
retval = (char *) allocator.Malloc(strlen(baseDir) + strlen(str) +
strlen(dirsep) + 6);
@ -754,13 +757,6 @@ int PHYSFS_init(const char *argv0)
BAIL_IF_MACRO(!appendDirSep(&baseDir), NULL, 0);
userDir = calculateUserDir();
if (userDir != NULL)
{
ptr = __PHYSFS_platformRealPath(userDir);
allocator.Free(userDir);
userDir = ptr;
} /* if */
if ((userDir == NULL) || (!appendDirSep(&userDir)))
{
allocator.Free(baseDir);

View File

@ -1,4 +1,8 @@
/** \file physfs.h */
/**
* \file physfs.h
*
* Main header file for PhysicsFS.
*/
/**
* \mainpage PhysicsFS
@ -401,7 +405,7 @@ typedef struct PHYSFS_Version
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#define PHYSFS_VER_MAJOR 2
#define PHYSFS_VER_MINOR 0
#define PHYSFS_VER_PATCH 0
#define PHYSFS_VER_PATCH 2
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
@ -986,7 +990,7 @@ __EXPORT__ const char *PHYSFS_getRealDir(const char *filename);
* PHYSFS_freeList(rc);
* \endcode
*
* ...will print:
* \...will print:
*
* \verbatim
* We've got [x.sav].
@ -1211,9 +1215,9 @@ __EXPORT__ PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle,
* The file must be opened for writing.
*
* \param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend().
* \param buffer buffer to store read data into.
* \param objSize size in bytes of objects being read from (handle).
* \param objCount number of (objSize) objects to read from (handle).
* \param buffer buffer of bytes to write to (handle).
* \param objSize size in bytes of objects being written to (handle).
* \param objCount number of (objSize) objects to write to (handle).
* \return number of objects written. PHYSFS_getLastError() can shed light on
* the reason this might be < (objCount). -1 if complete failure.
*/
@ -2268,7 +2272,7 @@ __EXPORT__ void PHYSFS_enumerateFilesCallback(const char *dir,
*
* Strings that don't fit in the destination buffer will be truncated, but
* will always be null-terminated and never have an incomplete UTF-8
* sequence at the end.
* sequence at the end. If the buffer length is 0, this function does nothing.
*
* \param src Null-terminated source string in UCS-4 format.
* \param dst Buffer to store converted UTF-8 string.
@ -2290,7 +2294,7 @@ __EXPORT__ void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst,
*
* Strings that don't fit in the destination buffer will be truncated, but
* will always be null-terminated and never have an incomplete UCS-4
* sequence at the end.
* sequence at the end. If the buffer length is 0, this function does nothing.
*
* \param src Null-terminated source string in UTF-8 format.
* \param dst Buffer to store converted UCS-4 string.
@ -2313,7 +2317,7 @@ __EXPORT__ void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst,
*
* Strings that don't fit in the destination buffer will be truncated, but
* will always be null-terminated and never have an incomplete UTF-8
* sequence at the end.
* sequence at the end. If the buffer length is 0, this function does nothing.
*
* Please note that UCS-2 is not UTF-16; we do not support the "surrogate"
* values at this time.
@ -2339,7 +2343,7 @@ __EXPORT__ void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst,
*
* Strings that don't fit in the destination buffer will be truncated, but
* will always be null-terminated and never have an incomplete UCS-2
* sequence at the end.
* sequence at the end. If the buffer length is 0, this function does nothing.
*
* Please note that UCS-2 is not UTF-16; we do not support the "surrogate"
* values at this time.
@ -2365,7 +2369,7 @@ __EXPORT__ void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst,
*
* Strings that don't fit in the destination buffer will be truncated, but
* will always be null-terminated and never have an incomplete UTF-8
* sequence at the end.
* sequence at the end. If the buffer length is 0, this function does nothing.
*
* Please note that we do not supply a UTF-8 to Latin1 converter, since Latin1
* can't express most Unicode codepoints. It's a legacy encoding; you should

View File

@ -29,6 +29,10 @@
#include <malloc.h>
#endif
#if defined(__sun) || defined(sun)
#include <alloca.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -966,7 +970,7 @@ char *__PHYSFS_convertToDependent(const char *prepend,
#define PHYSFS_LIL_ENDIAN 1234
#define PHYSFS_BIG_ENDIAN 4321
#if defined(__i386__) || defined(__ia64__) || defined(WIN32) || \
#if defined(__i386__) || defined(__ia64__) || defined(_M_IX86) || defined(_M_IA64) || \
(defined(__alpha__) || defined(__alpha)) || \
defined(__arm__) || defined(ARM) || \
(defined(__mips__) && defined(__MIPSEL__)) || \

View File

@ -28,7 +28,7 @@
#elif ((defined __MACH__) && (defined __APPLE__))
/* To check if iphone or not, we need to include this file */
# include <TargetConditionals.h>
# if (defined(TARGET_IPHONE_SIMULATOR) || (defined TARGET_OS_IPHONE))
# if ((TARGET_IPHONE_SIMULATOR) || (TARGET_OS_IPHONE))
# define PHYSFS_PLATFORM_UNIX
# define PHYSFS_PLATFORM_POSIX
# define PHYSFS_NO_CDROM_SUPPORT

View File

@ -305,10 +305,11 @@ static void utf8fromcodepoint(PHYSFS_uint32 cp, char **_dst, PHYSFS_uint64 *_len
} /* utf8fromcodepoint */
#define UTF8FROMTYPE(typ, src, dst, len) \
if (len == 0) return; \
len--; \
while (len) \
{ \
const PHYSFS_uint32 cp = (PHYSFS_uint32) *(src++); \
const PHYSFS_uint32 cp = (PHYSFS_uint32) ((typ) (*(src++))); \
if (cp == 0) break; \
utf8fromcodepoint(cp, &dst, &len); \
} \

View File

@ -174,14 +174,17 @@ static team_id getTeamID(void)
char *__PHYSFS_platformCalcBaseDir(const char *argv0)
{
/* in case there isn't a BApplication yet, we'll construct a roster. */
BRoster roster;
app_info info;
status_t rc = roster.GetRunningAppInfo(getTeamID(), &info);
BAIL_IF_MACRO(rc < B_OK, strerror(rc), NULL);
BEntry entry(&(info.ref), true);
image_info info;
int32 cookie = 0;
while (get_next_image_info(0, &cookie, &info) == B_OK) {
if (info.type == B_APP_IMAGE)
break;
}
BEntry entry(info.name, true);
BPath path;
rc = entry.GetPath(&path); /* (path) now has binary's path. */
status_t rc = entry.GetPath(&path); /* (path) now has binary's path. */
assert(rc == B_OK);
rc = path.GetParent(&path); /* chop filename, keep directory. */
assert(rc == B_OK);

View File

@ -604,13 +604,13 @@ int __PHYSFS_platformEOF(void *opaque)
int __PHYSFS_platformFlush(void *opaque)
{
return(os2err(DosResetBuffer((HFILE) opaque) == NO_ERROR));
return(os2err(DosResetBuffer((HFILE) opaque)) == NO_ERROR);
} /* __PHYSFS_platformFlush */
int __PHYSFS_platformClose(void *opaque)
{
return(os2err(DosClose((HFILE) opaque) == NO_ERROR));
return(os2err(DosClose((HFILE) opaque)) == NO_ERROR);
} /* __PHYSFS_platformClose */
@ -619,7 +619,7 @@ int __PHYSFS_platformDelete(const char *path)
if (__PHYSFS_platformIsDirectory(path))
return(os2err(DosDeleteDir(path)) == NO_ERROR);
return(os2err(DosDelete(path) == NO_ERROR));
return(os2err(DosDelete(path)) == NO_ERROR);
} /* __PHYSFS_platformDelete */

View File

@ -331,8 +331,8 @@ static void *doOpen(const char *fname, DWORD mode, DWORD creation, int rdonly)
wchar_t *w_fname = NULL;
UTF8_TO_UNICODE_STACK_MACRO(w_fname, fname);
fileHandle = CreateFile(w_fname, mode, FILE_SHARE_READ, NULL,
creation, FILE_ATTRIBUTE_NORMAL, NULL);
fileHandle = CreateFile(w_fname, mode, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL);
__PHYSFS_smallFree(w_fname);
BAIL_IF_MACRO(fileHandle == INVALID_HANDLE_VALUE, win32strerror(), NULL);

View File

@ -97,8 +97,21 @@ char *__PHYSFS_platformGetUserName(void)
char *__PHYSFS_platformGetUserDir(void)
{
char *retval = __PHYSFS_platformCopyEnvironmentVariable("HOME");
/* if the environment variable was set, make sure it's really a dir. */
if (retval != NULL)
{
struct stat statbuf;
if ((stat(retval, &statbuf) == -1) || (S_ISDIR(statbuf.st_mode) == 0))
{
allocator.Free(retval);
retval = NULL;
} /* if */
} /* if */
if (retval == NULL)
retval = getUserDirByUID();
return(retval);
} /* __PHYSFS_platformGetUserDir */

View File

@ -23,9 +23,8 @@
#include <dirent.h>
#include <time.h>
#include <errno.h>
#include <sys/mount.h>
#if (!defined PHYSFS_NO_PTHREADS_SUPPORT)
#if (!defined PHYSFS_NO_THREAD_SUPPORT)
#include <pthread.h>
#endif
@ -34,6 +33,7 @@
# undef PHYSFS_HAVE_MNTENT_H /* don't do both... */
# endif
# include <sys/ucred.h>
# include <sys/mount.h>
#endif
#ifdef PHYSFS_HAVE_MNTENT_H
@ -42,6 +42,9 @@
#include "physfs_internal.h"
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
int __PHYSFS_platformInit(void)
{
@ -101,6 +104,14 @@ void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data)
int add_it = 0;
if (strcmp(ent->mnt_type, "iso9660") == 0)
add_it = 1;
else if (strcmp(ent->mnt_type, "udf") == 0)
add_it = 1;
/* !!! FIXME: these might pick up floppy drives, right? */
else if (strcmp(ent->mnt_type, "auto") == 0)
add_it = 1;
else if (strcmp(ent->mnt_type, "supermount") == 0)
add_it = 1;
/* add other mount types here */
@ -182,12 +193,42 @@ static char *findBinaryInPath(const char *bin, char *envr)
} /* findBinaryInPath */
static char *readSymLink(const char *path)
{
ssize_t len = 64;
ssize_t rc = -1;
char *retval = NULL;
while (1)
{
char *ptr = (char *) allocator.Realloc(retval, (size_t) len);
if (ptr == NULL)
break; /* out of memory. */
retval = ptr;
rc = readlink(path, retval, len);
if (rc == -1)
break; /* not a symlink, i/o error, etc. */
else if (rc < len)
{
retval[rc] = '\0'; /* readlink doesn't null-terminate. */
return retval; /* we're good to go. */
} /* else if */
len *= 2; /* grow buffer, try again. */
} /* while */
if (retval != NULL)
allocator.Free(retval);
return NULL;
} /* readSymLink */
char *__PHYSFS_platformCalcBaseDir(const char *argv0)
{
const char *PROC_SELF_EXE = "/proc/self/exe";
char *retval = NULL;
char *envr = NULL;
struct stat stbuf;
/* fast path: default behaviour can handle this. */
if ( (argv0 != NULL) && (strchr(argv0, '/') != NULL) )
@ -198,20 +239,22 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
* /proc filesystem, you can get the full path to the current process from
* the /proc/self/exe symlink.
*/
if ((lstat(PROC_SELF_EXE, &stbuf) != -1) && (S_ISLNK(stbuf.st_mode)))
retval = readSymLink("/proc/self/exe");
if (retval == NULL)
{
const size_t len = stbuf.st_size;
char *buf = (char *) allocator.Malloc(len+1);
if (buf != NULL) /* if NULL, maybe you'll get lucky later. */
{
if (readlink(PROC_SELF_EXE, buf, len) != len)
allocator.Free(buf);
else
{
buf[len] = '\0'; /* readlink doesn't null-terminate. */
retval = buf; /* we're good to go. */
} /* else */
} /* if */
/* older kernels don't have /proc/self ... try PID version... */
const unsigned long long pid = (unsigned long long) getpid();
char path[64];
const int rc = (int) snprintf(path,sizeof(path),"/proc/%llu/exe",pid);
if ( (rc > 0) && (rc < sizeof(path)) )
retval = readSymLink(path);
} /* if */
if (retval != NULL) /* chop off filename. */
{
char *ptr = strrchr(retval, '/');
if (ptr != NULL)
*ptr = '\0';
} /* if */
if ((retval == NULL) && (argv0 != NULL))
@ -223,6 +266,14 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
allocator.Free(envr);
} /* if */
if (retval != NULL)
{
/* try to shrink buffer... */
char *ptr = (char *) allocator.Realloc(retval, strlen(retval) + 1);
if (ptr != NULL)
retval = ptr; /* oh well if it failed. */
} /* if */
return(retval);
} /* __PHYSFS_platformCalcBaseDir */
@ -289,7 +340,7 @@ int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a)
} /* __PHYSFS_platformSetDefaultAllocator */
#if (defined PHYSFS_NO_PTHREADS_SUPPORT)
#if (defined PHYSFS_NO_THREAD_SUPPORT)
PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) { return(0x0001); }
void *__PHYSFS_platformCreateMutex(void) { return((void *) 0x0001); }
@ -387,7 +438,7 @@ void __PHYSFS_platformReleaseMutex(void *mutex)
} /* if */
} /* __PHYSFS_platformReleaseMutex */
#endif /* !PHYSFS_NO_PTHREADS_SUPPORT */
#endif /* !PHYSFS_NO_THREAD_SUPPORT */
#endif /* PHYSFS_PLATFORM_UNIX */

View File

@ -989,8 +989,8 @@ static void *doOpen(const char *fname, DWORD mode, DWORD creation, int rdonly)
UTF8_TO_UNICODE_STACK_MACRO(wfname, fname);
BAIL_IF_MACRO(wfname == NULL, ERR_OUT_OF_MEMORY, NULL);
fileHandle = pCreateFileW(wfname, mode, FILE_SHARE_READ, NULL,
creation, FILE_ATTRIBUTE_NORMAL, NULL);
fileHandle = pCreateFileW(wfname, mode, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL);
__PHYSFS_smallFree(wfname);
BAIL_IF_MACRO

View File

@ -27,7 +27,7 @@
#define TEST_VERSION_MAJOR 2
#define TEST_VERSION_MINOR 0
#define TEST_VERSION_PATCH 0
#define TEST_VERSION_PATCH 2
static FILE *history_file = NULL;
static PHYSFS_uint32 do_buffer_size = 0;
@ -1116,7 +1116,9 @@ static void open_history_file(void)
do
{
fgets(buf, sizeof (buf), f);
if (fgets(buf, sizeof (buf), f) == NULL)
break;
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';
add_history(buf);

View File

@ -24,7 +24,7 @@
#define TEST_VER_MAJOR 2
#define TEST_VER_MINOR 0
#define TEST_VER_PATCH 0
#define TEST_VER_PATCH 2
//static PHYSFS_uint32 do_buffer_size = 0;