From DONOTREPLY at icculus.org Thu Mar 8 16:31:35 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 8 Mar 2007 16:31:35 -0500 Subject: r801 - trunk Message-ID: <20070308213135.23310.qmail@icculus.org> Author: icculus Date: 2007-03-08 16:31:35 -0500 (Thu, 08 Mar 2007) New Revision: 801 Modified: trunk/CHANGELOG trunk/physfs.h Log: Fixed a comment in physfs.h. Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2006-11-05 19:06:23 UTC (rev 800) +++ trunk/CHANGELOG 2007-03-08 21:31:35 UTC (rev 801) @@ -2,6 +2,7 @@ * CHANGELOG. */ +03082007 - Fixed a comment in physfs.h. 11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work. Minor BeOS realpath tweak. 09272006 - Reworked 7zip archiver (thanks, Dennis!). Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2006-11-05 19:06:23 UTC (rev 800) +++ trunk/physfs.h 2007-03-08 21:31:35 UTC (rev 801) @@ -162,13 +162,14 @@ * should convert them to UTF-8 before handing them to PhysicsFS with * PHYSFS_utf8fromucs2(). If you're using Unix or Mac OS X, your wchar_t * strings are four bytes per character ("UCS-4 encoding"). Use - * PHYSFS_utf8fromucs2(). Mac OS X can gie you UTF-8 directly from a CFString, - * and many Unixes generally give you C strings in UTF-8 format everywhere. - * If you have a single-byte high ASCII charset, like so-many European - * "codepages" you may be out of luck. We'll convert from "Latin1" to UTF-8 - * only, and never back to Latin1. If you're above ASCII 127, all bets are - * off: move to Unicode or use your platform's facilities. Passing a C string - * with high-ASCII data that isn't UTF-8 encoded will NOT do what you expect! + * PHYSFS_utf8fromucs4(). Mac OS X can give you UTF-8 directly from a + * CFString, and many Unixes generally give you C strings in UTF-8 format + * everywhere. If you have a single-byte high ASCII charset, like so-many + * European "codepages" you may be out of luck. We'll convert from "Latin1" + * to UTF-8 only, and never back to Latin1. If you're above ASCII 127, all + * bets are off: move to Unicode or use your platform's facilities. Passing a + * C string with high-ASCII data that isn't UTF-8 encoded will NOT do what + * you expect! * * Naturally, there's also PHYSFS_utf8toucs2() and PHYSFS_utf8toucs4() to get * data back into a format you like. Behind the scenes, PhysicsFS will use From DONOTREPLY at icculus.org Thu Mar 8 16:31:59 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 8 Mar 2007 16:31:59 -0500 Subject: r802 - trunk Message-ID: <20070308213159.23689.qmail@icculus.org> Author: icculus Date: 2007-03-08 16:31:59 -0500 (Thu, 08 Mar 2007) New Revision: 802 Modified: trunk/TODO Log: Outlined TODOs for Unicode support. Modified: trunk/TODO =================================================================== --- trunk/TODO 2007-03-08 21:31:35 UTC (rev 801) +++ trunk/TODO 2007-03-08 21:31:59 UTC (rev 802) @@ -3,6 +3,33 @@ These are in no particular order. Some might be dupes, some might be done already. +UNICODE: +- BeOS: uses UTF-8 internally in the OS, so that's already done. +- PocketPC: uses UCS-2 internally in the OS, and we're currently converting to + and from ASCII. Need to change this out. +- Windows: Can use Unicode, but might only allow "codepages" ... Use + GetProcAddress() to find Unicode entry points on WinNT-based + systems, otherwise try to use a sane codepage. +- Mac Classic: apparently supports _something_, but I might just write it off + as a loss. +- OS/2: Codepages. No full Unicode in the filesystem, but we can probably make + a conversion effort. +- Linux: uses UTF-8 internally, so that's already done. +- Mac OS X: uses UTF-8 in the Unix layer, and is smart enough to convert + internally when needed. +- DIR: just pass UTF-8 strings through to platform layer. +- GRP: No Unicode (only 12 bytes for filename, 8.3 format). Legacy format. +- HOG: No Unicode (only 12 bytes for filename, 8.3 format). Legacy format. +- LZMA: Uses UTF-8 internally, so we're good to go. +- MIX: only stores filename HASHES...this driver is going away. +- MVL: No Unicode (only 12 bytes for filename, 8.3 format). Legacy format. +- QPAK: Only has 56 bytes for a path, but we can just treat these as + UTF-8 and be done with it. +- WAD: No Unicode (only 8 bytes for filename). Legacy format. +- ZIP: Uses UTF-8 internally, so it's good to go. + +Stuff: +- Rename win32.c to windows.c ... it should work on Win64. - Other archivers: perhaps tar(.gz|.bz2), RPM, ARJ, etc. These are less important, since streaming archives aren't of much value to games (which is why zipfiles are king: random access), but it could have uses for, say, From DONOTREPLY at icculus.org Thu Mar 8 17:22:24 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 8 Mar 2007 17:22:24 -0500 Subject: r803 - in trunk: . platform Message-ID: <20070308222224.25009.qmail@icculus.org> Author: icculus Date: 2007-03-08 17:22:24 -0500 (Thu, 08 Mar 2007) New Revision: 803 Added: trunk/platform/windows.c Removed: trunk/platform/win32.c Modified: trunk/CHANGELOG trunk/TODO trunk/physfs.dsp trunk/physfs.vcproj trunk/physfs_static.dsp trunk/platform/Makefile.am trunk/platform/unix.c Log: Renamed win32.c to windows.c (since it would be used for Win64, too.) Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-08 21:31:59 UTC (rev 802) +++ trunk/CHANGELOG 2007-03-08 22:22:24 UTC (rev 803) @@ -2,7 +2,7 @@ * CHANGELOG. */ -03082007 - Fixed a comment in physfs.h. +03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. 11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work. Minor BeOS realpath tweak. 09272006 - Reworked 7zip archiver (thanks, Dennis!). Modified: trunk/TODO =================================================================== --- trunk/TODO 2007-03-08 21:31:59 UTC (rev 802) +++ trunk/TODO 2007-03-08 22:22:24 UTC (rev 803) @@ -29,7 +29,6 @@ - ZIP: Uses UTF-8 internally, so it's good to go. Stuff: -- Rename win32.c to windows.c ... it should work on Win64. - Other archivers: perhaps tar(.gz|.bz2), RPM, ARJ, etc. These are less important, since streaming archives aren't of much value to games (which is why zipfiles are king: random access), but it could have uses for, say, Modified: trunk/physfs.dsp =================================================================== --- trunk/physfs.dsp 2007-03-08 21:31:59 UTC (rev 802) +++ trunk/physfs.dsp 2007-03-08 22:22:24 UTC (rev 803) @@ -169,7 +169,7 @@ # End Source File # Begin Source File -SOURCE=.\platform\win32.c +SOURCE=.\platform\windows.c # End Source File # Begin Source File Modified: trunk/physfs.vcproj =================================================================== --- trunk/physfs.vcproj 2007-03-08 21:31:59 UTC (rev 802) +++ trunk/physfs.vcproj 2007-03-08 22:22:24 UTC (rev 803) @@ -209,7 +209,7 @@ RelativePath=".\archivers\wad.c"> + RelativePath=".\platform\windows.c"> Modified: trunk/physfs_static.dsp =================================================================== --- trunk/physfs_static.dsp 2007-03-08 21:31:59 UTC (rev 802) +++ trunk/physfs_static.dsp 2007-03-08 22:22:24 UTC (rev 803) @@ -171,7 +171,7 @@ # End Source File # Begin Source File -SOURCE=.\platform\win32.c +SOURCE=.\platform\windows.c # End Source File # Begin Source File Modified: trunk/platform/Makefile.am =================================================================== --- trunk/platform/Makefile.am 2007-03-08 21:31:59 UTC (rev 802) +++ trunk/platform/Makefile.am 2007-03-08 22:22:24 UTC (rev 803) @@ -9,7 +9,7 @@ else libplatform_la_SOURCES = \ unix.c \ - win32.c \ + windows.c \ posix.c \ os2.c endif @@ -18,7 +18,7 @@ EXTRA_DIST = \ skeleton.c \ macclassic.c \ - win32.c \ + windows.c \ pocketpc.c \ unix.c \ os2.c \ Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-08 21:31:59 UTC (rev 802) +++ trunk/platform/unix.c 2007-03-08 22:22:24 UTC (rev 803) @@ -10,7 +10,7 @@ # include #endif -/* BeOS uses beos.cpp and posix.c ... Cygwin and such use win32.c ... */ +/* BeOS uses beos.cpp and posix.c ... Cygwin and such use windows.c ... */ #if ((!defined __BEOS__) && (!defined WIN32)) #include Deleted: trunk/platform/win32.c =================================================================== --- trunk/platform/win32.c 2007-03-08 21:31:59 UTC (rev 802) +++ trunk/platform/win32.c 2007-03-08 22:22:24 UTC (rev 803) @@ -1,1151 +0,0 @@ -/* - * Win32 support routines for PhysicsFS. - * - * Please see the file LICENSE in the source's root directory. - * - * This file written by Ryan C. Gordon, and made sane by Gregory S. Read. - */ - -#if HAVE_CONFIG_H -# include -#endif - -#ifdef WIN32 - -#include -#include -#include -#include -#include -#include -#include - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -#if (defined _MSC_VER) - #define alloca(x) _alloca(x) -#elif (defined __MINGW32__) /* scary...hopefully this is okay. */ - #define alloca(x) __builtin_alloca(x) -#endif - -#define LOWORDER_UINT64(pos) (PHYSFS_uint32) \ - (pos & 0x00000000FFFFFFFF) -#define HIGHORDER_UINT64(pos) (PHYSFS_uint32) \ - (((pos & 0xFFFFFFFF00000000) >> 32) & 0x00000000FFFFFFFF) - -/* GetUserProfileDirectory() is only available on >= NT4 (no 9x/ME systems!) */ -typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETUSERPROFILEDIR) ( - HANDLE hToken, - LPTSTR lpProfileDir, - LPDWORD lpcchSize); - -/* GetFileAttributesEx() is only available on >= Win98 or WinNT4 ... */ -typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETFILEATTRIBUTESEX) ( - LPCTSTR lpFileName, - GET_FILEEX_INFO_LEVELS fInfoLevelId, - LPVOID lpFileInformation); - -typedef struct -{ - HANDLE handle; - int readonly; -} win32file; - -const char *__PHYSFS_platformDirSeparator = "\\"; -static LPFNGETFILEATTRIBUTESEX pGetFileAttributesEx = NULL; -static HANDLE libKernel32 = NULL; -static char *userDir = NULL; - -/* - * Users without the platform SDK don't have this defined. The original docs - * for SetFilePointer() just said to compare with 0xFFFFFFFF, so this should - * work as desired. - */ -#define PHYSFS_INVALID_SET_FILE_POINTER 0xFFFFFFFF - -/* just in case... */ -#define PHYSFS_INVALID_FILE_ATTRIBUTES 0xFFFFFFFF - - - -/* - * Figure out what the last failing Win32 API call was, and - * generate a human-readable string for the error message. - * - * The return value is a static buffer that is overwritten with - * each call to this function. - */ -static const char *win32strerror(void) -{ - static TCHAR msgbuf[255]; - TCHAR *ptr = msgbuf; - - FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ - msgbuf, - sizeof (msgbuf) / sizeof (TCHAR), - NULL - ); - - /* chop off newlines. */ - for (ptr = msgbuf; *ptr; ptr++) - { - if ((*ptr == '\n') || (*ptr == '\r')) - { - *ptr = ' '; - break; - } /* if */ - } /* for */ - - return((const char *) msgbuf); -} /* win32strerror */ - - -static char *getExePath(const char *argv0) -{ - DWORD buflen; - int success = 0; - char *ptr = NULL; - char *retval = (char *) allocator.Malloc(sizeof (TCHAR) * (MAX_PATH + 1)); - - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - - retval[0] = '\0'; - buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1); - if (buflen <= 0) - __PHYSFS_setError(win32strerror()); - else - { - retval[buflen] = '\0'; /* does API always null-terminate this? */ - - /* make sure the string was not truncated. */ - if (__PHYSFS_platformStricmp(&retval[buflen - 4], ".exe") != 0) - __PHYSFS_setError(ERR_GETMODFN_TRUNC); - else - { - ptr = strrchr(retval, '\\'); - if (ptr == NULL) - __PHYSFS_setError(ERR_GETMODFN_NO_DIR); - else - { - *(ptr + 1) = '\0'; /* chop off filename. */ - success = 1; - } /* else */ - } /* else */ - } /* else */ - - /* if any part of the previous approach failed, try SearchPath()... */ - - if (!success) - { - if (argv0 == NULL) - __PHYSFS_setError(ERR_ARGV0_IS_NULL); - else - { - buflen = SearchPath(NULL, argv0, NULL, MAX_PATH+1, retval, &ptr); - if (buflen == 0) - __PHYSFS_setError(win32strerror()); - else if (buflen > MAX_PATH) - __PHYSFS_setError(ERR_SEARCHPATH_TRUNC); - else - success = 1; - } /* else */ - } /* if */ - - if (!success) - { - allocator.Free(retval); - return(NULL); /* physfs error message will be set, above. */ - } /* if */ - - /* free up the bytes we didn't actually use. */ - ptr = (char *) allocator.Realloc(retval, strlen(retval) + 1); - if (ptr != NULL) - retval = ptr; - - return(retval); /* w00t. */ -} /* getExePath */ - - -/* - * Try to make use of GetUserProfileDirectory(), which isn't available on - * some common variants of Win32. If we can't use this, we just punt and - * use the physfs base dir for the user dir, too. - * - * On success, module-scope variable (userDir) will have a pointer to - * a malloc()'d string of the user's profile dir, and a non-zero value is - * returned. If we can't determine the profile dir, (userDir) will - * be NULL, and zero is returned. - */ -static int determineUserDir(void) -{ - DWORD psize = 0; - char dummy[1]; - BOOL rc = 0; - HANDLE processHandle; /* Current process handle */ - HANDLE accessToken = NULL; /* Security handle to process */ - LPFNGETUSERPROFILEDIR GetUserProfileDirectory; - HMODULE lib; - - assert(userDir == NULL); - - /* - * GetUserProfileDirectory() is only available on NT 4.0 and later. - * This means Win95/98/ME (and CE?) users have to do without, so for - * them, we'll default to the base directory when we can't get the - * function pointer. - */ - - lib = LoadLibrary("userenv.dll"); - if (lib) - { - /* !!! FIXME: Handle Unicode? */ - GetUserProfileDirectory = (LPFNGETUSERPROFILEDIR) - GetProcAddress(lib, "GetUserProfileDirectoryA"); - if (GetUserProfileDirectory) - { - processHandle = GetCurrentProcess(); - if (OpenProcessToken(processHandle, TOKEN_QUERY, &accessToken)) - { - /* - * Should fail. Will write the size of the profile path in - * psize. Also note that the second parameter can't be - * NULL or the function fails. - */ - rc = GetUserProfileDirectory(accessToken, dummy, &psize); - assert(!rc); /* success?! */ - - /* Allocate memory for the profile directory */ - userDir = (char *) allocator.Malloc(psize); - if (userDir != NULL) - { - if (!GetUserProfileDirectory(accessToken, userDir, &psize)) - { - allocator.Free(userDir); - userDir = NULL; - } /* if */ - } /* else */ - } /* if */ - - CloseHandle(accessToken); - } /* if */ - - FreeLibrary(lib); - } /* if */ - - if (userDir == NULL) /* couldn't get profile for some reason. */ - { - /* Might just be a non-NT system; resort to the basedir. */ - userDir = getExePath(NULL); - BAIL_IF_MACRO(userDir == NULL, NULL, 0); /* STILL failed?! */ - } /* if */ - - return(1); /* We made it: hit the showers. */ -} /* determineUserDir */ - - -static BOOL mediaInDrive(const char *drive) -{ - UINT oldErrorMode; - DWORD tmp; - BOOL retval; - - /* Prevent windows warning message appearing when checking media size */ - oldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); - - /* If this function succeeds, there's media in the drive */ - retval = GetVolumeInformation(drive, NULL, 0, NULL, NULL, &tmp, NULL, 0); - - /* Revert back to old windows error handler */ - SetErrorMode(oldErrorMode); - - return(retval); -} /* mediaInDrive */ - - -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ - char drive_str[4] = "x:\\"; - char ch; - for (ch = 'A'; ch <= 'Z'; ch++) - { - drive_str[0] = ch; - if (GetDriveType(drive_str) == DRIVE_CDROM && mediaInDrive(drive_str)) - cb(data, drive_str); - } /* for */ -} /* __PHYSFS_platformDetectAvailableCDs */ - - -char *__PHYSFS_platformCalcBaseDir(const char *argv0) -{ - if ((argv0 != NULL) && (strchr(argv0, '\\') != NULL)) - return(NULL); /* default behaviour can handle this. */ - - return(getExePath(argv0)); -} /* __PHYSFS_platformCalcBaseDir */ - - -char *__PHYSFS_platformGetUserName(void) -{ - DWORD bufsize = 0; - LPTSTR retval = NULL; - - if (GetUserName(NULL, &bufsize) == 0) /* This SHOULD fail. */ - { - retval = (LPTSTR) allocator.Malloc(bufsize); - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - if (GetUserName(retval, &bufsize) == 0) /* ?! */ - { - __PHYSFS_setError(win32strerror()); - allocator.Free(retval); - retval = NULL; - } /* if */ - } /* if */ - - return((char *) retval); -} /* __PHYSFS_platformGetUserName */ - - -char *__PHYSFS_platformGetUserDir(void) -{ - char *retval = (char *) allocator.Malloc(strlen(userDir) + 1); - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - strcpy(retval, userDir); /* calculated at init time. */ - return(retval); -} /* __PHYSFS_platformGetUserDir */ - - -PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) -{ - return((PHYSFS_uint64) GetCurrentThreadId()); -} /* __PHYSFS_platformGetThreadID */ - - -/* ...make this Cygwin AND Visual C friendly... */ -int __PHYSFS_platformStricmp(const char *x, const char *y) -{ -#if (defined _MSC_VER) - return(stricmp(x, y)); -#else - int ux, uy; - - do - { - ux = toupper((int) *x); - uy = toupper((int) *y); - if (ux > uy) - return(1); - else if (ux < uy) - return(-1); - x++; - y++; - } while ((ux) && (uy)); - - return(0); -#endif -} /* __PHYSFS_platformStricmp */ - - -int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 len) -{ -#if (defined _MSC_VER) - return(strnicmp(x, y, (int) len)); -#else - int ux, uy; - - if (!len) - return(0); - - do - { - ux = toupper((int) *x); - uy = toupper((int) *y); - if (ux > uy) - return(1); - else if (ux < uy) - return(-1); - x++; - y++; - len--; - } while ((ux) && (uy) && (len)); - - return(0); -#endif -} /* __PHYSFS_platformStricmp */ - - -int __PHYSFS_platformExists(const char *fname) -{ - BAIL_IF_MACRO - ( - GetFileAttributes(fname) == PHYSFS_INVALID_FILE_ATTRIBUTES, - win32strerror(), 0 - ); - return(1); -} /* __PHYSFS_platformExists */ - - -int __PHYSFS_platformIsSymLink(const char *fname) -{ - return(0); /* no symlinks on win32. */ -} /* __PHYSFS_platformIsSymlink */ - - -int __PHYSFS_platformIsDirectory(const char *fname) -{ - return((GetFileAttributes(fname) & FILE_ATTRIBUTE_DIRECTORY) != 0); -} /* __PHYSFS_platformIsDirectory */ - - -char *__PHYSFS_platformCvtToDependent(const char *prepend, - const char *dirName, - const char *append) -{ - int len = ((prepend) ? strlen(prepend) : 0) + - ((append) ? strlen(append) : 0) + - strlen(dirName) + 1; - char *retval = (char *) allocator.Malloc(len); - char *p; - - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - - if (prepend) - strcpy(retval, prepend); - else - retval[0] = '\0'; - - strcat(retval, dirName); - - if (append) - strcat(retval, append); - - for (p = strchr(retval, '/'); p != NULL; p = strchr(p + 1, '/')) - *p = '\\'; - - return(retval); -} /* __PHYSFS_platformCvtToDependent */ - - -/* Much like my college days, try to sleep for 10 milliseconds at a time... */ -void __PHYSFS_platformTimeslice(void) -{ - Sleep(10); -} /* __PHYSFS_platformTimeslice */ - - -void __PHYSFS_platformEnumerateFiles(const char *dirname, - int omitSymLinks, - PHYSFS_EnumFilesCallback callback, - const char *origdir, - void *callbackdata) -{ - HANDLE dir; - WIN32_FIND_DATA ent; - size_t len = strlen(dirname); - char *SearchPath; - - /* Allocate a new string for path, maybe '\\', "*", and NULL terminator */ - SearchPath = (char *) alloca(len + 3); - if (SearchPath == NULL) - return; - - /* Copy current dirname */ - strcpy(SearchPath, dirname); - - /* if there's no '\\' at the end of the path, stick one in there. */ - if (SearchPath[len - 1] != '\\') - { - SearchPath[len++] = '\\'; - SearchPath[len] = '\0'; - } /* if */ - - /* Append the "*" to the end of the string */ - strcat(SearchPath, "*"); - - dir = FindFirstFile(SearchPath, &ent); - if (dir == INVALID_HANDLE_VALUE) - return; - - do - { - if (strcmp(ent.cFileName, ".") == 0) - continue; - - if (strcmp(ent.cFileName, "..") == 0) - continue; - - callback(callbackdata, origdir, ent.cFileName); - } while (FindNextFile(dir, &ent) != 0); - - FindClose(dir); -} /* __PHYSFS_platformEnumerateFiles */ - - -char *__PHYSFS_platformCurrentDir(void) -{ - LPTSTR retval; - DWORD buflen = 0; - - buflen = GetCurrentDirectory(buflen, NULL); - retval = (LPTSTR) allocator.Malloc(sizeof (TCHAR) * (buflen + 2)); - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - GetCurrentDirectory(buflen, retval); - - if (retval[buflen - 2] != '\\') - strcat(retval, "\\"); - - return((char *) retval); -} /* __PHYSFS_platformCurrentDir */ - - -/* this could probably use a cleanup. */ -char *__PHYSFS_platformRealPath(const char *path) -{ - char *retval = NULL; - char *p = NULL; - - BAIL_IF_MACRO(path == NULL, ERR_INVALID_ARGUMENT, NULL); - BAIL_IF_MACRO(*path == '\0', ERR_INVALID_ARGUMENT, NULL); - - retval = (char *) allocator.Malloc(MAX_PATH); - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - - /* - * If in \\server\path format, it's already an absolute path. - * We'll need to check for "." and ".." dirs, though, just in case. - */ - if ((path[0] == '\\') && (path[1] == '\\')) - strcpy(retval, path); - - else - { - char *currentDir = __PHYSFS_platformCurrentDir(); - if (currentDir == NULL) - { - allocator.Free(retval); - BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); - } /* if */ - - if (path[1] == ':') /* drive letter specified? */ - { - /* - * Apparently, "D:mypath" is the same as "D:\\mypath" if - * D: is not the current drive. However, if D: is the - * current drive, then "D:mypath" is a relative path. Ugh. - */ - if (path[2] == '\\') /* maybe an absolute path? */ - strcpy(retval, path); - else /* definitely an absolute path. */ - { - if (path[0] == currentDir[0]) /* current drive; relative. */ - { - strcpy(retval, currentDir); - strcat(retval, path + 2); - } /* if */ - - else /* not current drive; absolute. */ - { - retval[0] = path[0]; - retval[1] = ':'; - retval[2] = '\\'; - strcpy(retval + 3, path + 2); - } /* else */ - } /* else */ - } /* if */ - - else /* no drive letter specified. */ - { - if (path[0] == '\\') /* absolute path. */ - { - retval[0] = currentDir[0]; - retval[1] = ':'; - strcpy(retval + 2, path); - } /* if */ - else - { - strcpy(retval, currentDir); - strcat(retval, path); - } /* else */ - } /* else */ - - allocator.Free(currentDir); - } /* else */ - - /* (whew.) Ok, now take out "." and ".." path entries... */ - - p = retval; - while ( (p = strstr(p, "\\.")) != NULL) - { - /* it's a "." entry that doesn't end the string. */ - if (p[2] == '\\') - memmove(p + 1, p + 3, strlen(p + 3) + 1); - - /* it's a "." entry that ends the string. */ - else if (p[2] == '\0') - p[0] = '\0'; - - /* it's a ".." entry. */ - else if (p[2] == '.') - { - char *prevEntry = p - 1; - while ((prevEntry != retval) && (*prevEntry != '\\')) - prevEntry--; - - if (prevEntry == retval) /* make it look like a "." entry. */ - memmove(p + 1, p + 2, strlen(p + 2) + 1); - else - { - if (p[3] != '\0') /* doesn't end string. */ - *prevEntry = '\0'; - else /* ends string. */ - memmove(prevEntry + 1, p + 4, strlen(p + 4) + 1); - - p = prevEntry; - } /* else */ - } /* else if */ - - else - { - p++; /* look past current char. */ - } /* else */ - } /* while */ - - /* shrink the retval's memory block if possible... */ - p = (char *) allocator.Realloc(retval, strlen(retval) + 1); - if (p != NULL) - retval = p; - - return(retval); -} /* __PHYSFS_platformRealPath */ - - -int __PHYSFS_platformMkDir(const char *path) -{ - DWORD rc = CreateDirectory(path, NULL); - BAIL_IF_MACRO(rc == 0, win32strerror(), 0); - return(1); -} /* __PHYSFS_platformMkDir */ - - -/* - * Get OS info and save the important parts. - * - * Returns non-zero if successful, otherwise it returns zero on failure. - */ -static int getOSInfo(void) -{ -#if 0 /* we don't actually use this at the moment, but may in the future. */ - OSVERSIONINFO OSVersionInfo; /* Information about the OS */ - OSVersionInfo.dwOSVersionInfoSize = sizeof(OSVersionInfo); - BAIL_IF_MACRO(!GetVersionEx(&OSVersionInfo), win32strerror(), 0); - - /* Set to TRUE if we are runnign a WinNT based OS 4.0 or greater */ - runningNT = ((OSVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) && - (OSVersionInfo.dwMajorVersion >= 4)); -#endif - - return(1); -} /* getOSInfo */ - - -/* - * Some things we want/need are in external DLLs that may or may not be - * available, based on the operating system, etc. This function loads those - * libraries and hunts down the needed pointers. - * - * Libraries that are one-shot deals, or better loaded as needed, are loaded - * elsewhere (see determineUserDir()). - * - * Returns zero if a needed library couldn't load, non-zero if we have enough - * to go on (which means some useful but non-crucial libraries may _NOT_ be - * loaded; check the related module-scope variables). - */ -static int loadLibraries(void) -{ - /* If this get unwieldy, make it table driven. */ - - int allNeededLibrariesLoaded = 1; /* flip to zero as needed. */ - - libKernel32 = LoadLibrary("kernel32.dll"); - if (libKernel32) - { - pGetFileAttributesEx = (LPFNGETFILEATTRIBUTESEX) - GetProcAddress(libKernel32, "GetFileAttributesExA"); - } /* if */ - - /* add other DLLs here... */ - - - /* see if there's any reason to keep kernel32.dll around... */ - if (libKernel32) - { - if ((pGetFileAttributesEx == NULL) /* && (somethingElse == NULL) */ ) - { - FreeLibrary(libKernel32); - libKernel32 = NULL; - } /* if */ - } /* if */ - - return(allNeededLibrariesLoaded); -} /* loadLibraries */ - - -int __PHYSFS_platformInit(void) -{ - BAIL_IF_MACRO(!getOSInfo(), NULL, 0); - BAIL_IF_MACRO(!loadLibraries(), NULL, 0); - BAIL_IF_MACRO(!determineUserDir(), NULL, 0); - - return(1); /* It's all good */ -} /* __PHYSFS_platformInit */ - - -int __PHYSFS_platformDeinit(void) -{ - if (userDir != NULL) - { - allocator.Free(userDir); - userDir = NULL; - } /* if */ - - if (libKernel32) - { - FreeLibrary(libKernel32); - libKernel32 = NULL; - } /* if */ - - return(1); /* It's all good */ -} /* __PHYSFS_platformDeinit */ - - -static void *doOpen(const char *fname, DWORD mode, DWORD creation, int rdonly) -{ - HANDLE fileHandle; - win32file *retval; - - fileHandle = CreateFile(fname, mode, FILE_SHARE_READ, NULL, - creation, FILE_ATTRIBUTE_NORMAL, NULL); - - BAIL_IF_MACRO - ( - fileHandle == INVALID_HANDLE_VALUE, - win32strerror(), NULL - ); - - retval = (win32file *) allocator.Malloc(sizeof (win32file)); - if (retval == NULL) - { - CloseHandle(fileHandle); - BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); - } /* if */ - - retval->readonly = rdonly; - retval->handle = fileHandle; - return(retval); -} /* doOpen */ - - -void *__PHYSFS_platformOpenRead(const char *filename) -{ - return(doOpen(filename, GENERIC_READ, OPEN_EXISTING, 1)); -} /* __PHYSFS_platformOpenRead */ - - -void *__PHYSFS_platformOpenWrite(const char *filename) -{ - return(doOpen(filename, GENERIC_WRITE, CREATE_ALWAYS, 0)); -} /* __PHYSFS_platformOpenWrite */ - - -void *__PHYSFS_platformOpenAppend(const char *filename) -{ - void *retval = doOpen(filename, GENERIC_WRITE, OPEN_ALWAYS, 0); - if (retval != NULL) - { - HANDLE h = ((win32file *) retval)->handle; - DWORD rc = SetFilePointer(h, 0, NULL, FILE_END); - if (rc == PHYSFS_INVALID_SET_FILE_POINTER) - { - const char *err = win32strerror(); - CloseHandle(h); - allocator.Free(retval); - BAIL_MACRO(err, NULL); - } /* if */ - } /* if */ - - return(retval); -} /* __PHYSFS_platformOpenAppend */ - - -PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer, - PHYSFS_uint32 size, PHYSFS_uint32 count) -{ - HANDLE Handle = ((win32file *) opaque)->handle; - DWORD CountOfBytesRead; - PHYSFS_sint64 retval; - - /* Read data from the file */ - /* !!! FIXME: uint32 might be a greater # than DWORD */ - if(!ReadFile(Handle, buffer, count * size, &CountOfBytesRead, NULL)) - { - BAIL_MACRO(win32strerror(), -1); - } /* if */ - else - { - /* Return the number of "objects" read. */ - /* !!! FIXME: What if not the right amount of bytes was read to make an object? */ - retval = CountOfBytesRead / size; - } /* else */ - - return(retval); -} /* __PHYSFS_platformRead */ - - -PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer, - PHYSFS_uint32 size, PHYSFS_uint32 count) -{ - HANDLE Handle = ((win32file *) opaque)->handle; - DWORD CountOfBytesWritten; - PHYSFS_sint64 retval; - - /* Read data from the file */ - /* !!! FIXME: uint32 might be a greater # than DWORD */ - if(!WriteFile(Handle, buffer, count * size, &CountOfBytesWritten, NULL)) - { - BAIL_MACRO(win32strerror(), -1); - } /* if */ - else - { - /* Return the number of "objects" read. */ - /* !!! FIXME: What if not the right number of bytes was written? */ - retval = CountOfBytesWritten / size; - } /* else */ - - return(retval); -} /* __PHYSFS_platformWrite */ - - -int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos) -{ - HANDLE Handle = ((win32file *) opaque)->handle; - DWORD HighOrderPos; - DWORD *pHighOrderPos; - DWORD rc; - - /* Get the high order 32-bits of the position */ - HighOrderPos = HIGHORDER_UINT64(pos); - - /* - * MSDN: "If you do not need the high-order 32 bits, this - * pointer must be set to NULL." - */ - pHighOrderPos = (HighOrderPos) ? &HighOrderPos : NULL; - - /* - * !!! FIXME: MSDN: "Windows Me/98/95: If the pointer - * !!! FIXME: lpDistanceToMoveHigh is not NULL, then it must - * !!! FIXME: point to either 0, INVALID_SET_FILE_POINTER, or - * !!! FIXME: the sign extension of the value of lDistanceToMove. - * !!! FIXME: Any other value will be rejected." - */ - - /* Move pointer "pos" count from start of file */ - rc = SetFilePointer(Handle, LOWORDER_UINT64(pos), - pHighOrderPos, FILE_BEGIN); - - if ( (rc == PHYSFS_INVALID_SET_FILE_POINTER) && - (GetLastError() != NO_ERROR) ) - { - BAIL_MACRO(win32strerror(), 0); - } /* if */ - - return(1); /* No error occured */ -} /* __PHYSFS_platformSeek */ - - -PHYSFS_sint64 __PHYSFS_platformTell(void *opaque) -{ - HANDLE Handle = ((win32file *) opaque)->handle; - DWORD HighPos = 0; - DWORD LowPos; - PHYSFS_sint64 retval; - - /* Get current position */ - LowPos = SetFilePointer(Handle, 0, &HighPos, FILE_CURRENT); - if ( (LowPos == PHYSFS_INVALID_SET_FILE_POINTER) && - (GetLastError() != NO_ERROR) ) - { - BAIL_MACRO(win32strerror(), 0); - } /* if */ - else - { - /* Combine the high/low order to create the 64-bit position value */ - retval = (((PHYSFS_uint64) HighPos) << 32) | LowPos; - assert(retval >= 0); - } /* else */ - - return(retval); -} /* __PHYSFS_platformTell */ - - -PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) -{ - HANDLE Handle = ((win32file *) opaque)->handle; - DWORD SizeHigh; - DWORD SizeLow; - PHYSFS_sint64 retval; - - SizeLow = GetFileSize(Handle, &SizeHigh); - if ( (SizeLow == PHYSFS_INVALID_SET_FILE_POINTER) && - (GetLastError() != NO_ERROR) ) - { - BAIL_MACRO(win32strerror(), -1); - } /* if */ - else - { - /* Combine the high/low order to create the 64-bit position value */ - retval = (((PHYSFS_uint64) SizeHigh) << 32) | SizeLow; - assert(retval >= 0); - } /* else */ - - return(retval); -} /* __PHYSFS_platformFileLength */ - - -int __PHYSFS_platformEOF(void *opaque) -{ - PHYSFS_sint64 FilePosition; - int retval = 0; - - /* Get the current position in the file */ - if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0) - { - /* Non-zero if EOF is equal to the file length */ - retval = FilePosition == __PHYSFS_platformFileLength(opaque); - } /* if */ - - return(retval); -} /* __PHYSFS_platformEOF */ - - -int __PHYSFS_platformFlush(void *opaque) -{ - win32file *fh = ((win32file *) opaque); - if (!fh->readonly) - BAIL_IF_MACRO(!FlushFileBuffers(fh->handle), win32strerror(), 0); - - return(1); -} /* __PHYSFS_platformFlush */ - - -int __PHYSFS_platformClose(void *opaque) -{ - HANDLE Handle = ((win32file *) opaque)->handle; - BAIL_IF_MACRO(!CloseHandle(Handle), win32strerror(), 0); - allocator.Free(opaque); - return(1); -} /* __PHYSFS_platformClose */ - - -int __PHYSFS_platformDelete(const char *path) -{ - /* If filename is a folder */ - if (GetFileAttributes(path) == FILE_ATTRIBUTE_DIRECTORY) - { - BAIL_IF_MACRO(!RemoveDirectory(path), win32strerror(), 0); - } /* if */ - else - { - BAIL_IF_MACRO(!DeleteFile(path), win32strerror(), 0); - } /* else */ - - return(1); /* if you got here, it worked. */ -} /* __PHYSFS_platformDelete */ - - -void *__PHYSFS_platformCreateMutex(void) -{ - return((void *) CreateMutex(NULL, FALSE, NULL)); -} /* __PHYSFS_platformCreateMutex */ - - -void __PHYSFS_platformDestroyMutex(void *mutex) -{ - CloseHandle((HANDLE) mutex); -} /* __PHYSFS_platformDestroyMutex */ - - -int __PHYSFS_platformGrabMutex(void *mutex) -{ - return(WaitForSingleObject((HANDLE) mutex, INFINITE) != WAIT_FAILED); -} /* __PHYSFS_platformGrabMutex */ - - -void __PHYSFS_platformReleaseMutex(void *mutex) -{ - ReleaseMutex((HANDLE) mutex); -} /* __PHYSFS_platformReleaseMutex */ - - -static PHYSFS_sint64 FileTimeToPhysfsTime(const FILETIME *ft) -{ - SYSTEMTIME st_utc; - SYSTEMTIME st_localtz; - TIME_ZONE_INFORMATION tzi; - DWORD tzid; - PHYSFS_sint64 retval; - struct tm tm; - - BAIL_IF_MACRO(!FileTimeToSystemTime(ft, &st_utc), win32strerror(), -1); - tzid = GetTimeZoneInformation(&tzi); - BAIL_IF_MACRO(tzid == TIME_ZONE_ID_INVALID, win32strerror(), -1); - - /* (This API is unsupported and fails on non-NT systems. */ - if (!SystemTimeToTzSpecificLocalTime(&tzi, &st_utc, &st_localtz)) - { - /* do it by hand. Grumble... */ - ULARGE_INTEGER ui64; - FILETIME new_ft; - ui64.LowPart = ft->dwLowDateTime; - ui64.HighPart = ft->dwHighDateTime; - - if (tzid == TIME_ZONE_ID_STANDARD) - tzi.Bias += tzi.StandardBias; - else if (tzid == TIME_ZONE_ID_DAYLIGHT) - tzi.Bias += tzi.DaylightBias; - - /* convert from minutes to 100-nanosecond increments... */ - #if 0 /* For compilers that puke on 64-bit math. */ - /* goddamn this is inefficient... */ - while (tzi.Bias > 0) - { - DWORD tmp = ui64.LowPart - 60000000; - if ((ui64.LowPart < tmp) && (tmp > 60000000)) - ui64.HighPart--; - ui64.LowPart = tmp; - tzi.Bias--; - } /* while */ - - while (tzi.Bias < 0) - { - DWORD tmp = ui64.LowPart + 60000000; - if ((ui64.LowPart > tmp) && (tmp < 60000000)) - ui64.HighPart++; - ui64.LowPart = tmp; - tzi.Bias++; - } /* while */ - #else - ui64.QuadPart -= (((LONGLONG) tzi.Bias) * (600000000)); - #endif - - /* Move it back into a FILETIME structure... */ - new_ft.dwLowDateTime = ui64.LowPart; - new_ft.dwHighDateTime = ui64.HighPart; - - /* Convert to something human-readable... */ - if (!FileTimeToSystemTime(&new_ft, &st_localtz)) - BAIL_MACRO(win32strerror(), -1); - } /* if */ - - /* Convert to a format that mktime() can grok... */ - tm.tm_sec = st_localtz.wSecond; - tm.tm_min = st_localtz.wMinute; - tm.tm_hour = st_localtz.wHour; - tm.tm_mday = st_localtz.wDay; - tm.tm_mon = st_localtz.wMonth - 1; - tm.tm_year = st_localtz.wYear - 1900; - tm.tm_wday = -1 /*st_localtz.wDayOfWeek*/; - tm.tm_yday = -1; - tm.tm_isdst = -1; - - /* Convert to a format PhysicsFS can grok... */ - retval = (PHYSFS_sint64) mktime(&tm); - BAIL_IF_MACRO(retval == -1, strerror(errno), -1); - return(retval); -} /* FileTimeToPhysfsTime */ - - -PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname) -{ - PHYSFS_sint64 retval = -1; - WIN32_FILE_ATTRIBUTE_DATA attrData; - memset(&attrData, '\0', sizeof (attrData)); - - /* GetFileAttributesEx didn't show up until Win98 and NT4. */ - if (pGetFileAttributesEx != NULL) - { - if (pGetFileAttributesEx(fname, GetFileExInfoStandard, &attrData)) - { - /* 0 return value indicates an error or not supported */ - if ( (attrData.ftLastWriteTime.dwHighDateTime != 0) || - (attrData.ftLastWriteTime.dwLowDateTime != 0) ) - { - retval = FileTimeToPhysfsTime(&attrData.ftLastWriteTime); - } /* if */ - } /* if */ - } /* if */ - - /* GetFileTime() has been in the Win32 API since the start. */ - if (retval == -1) /* try a fallback... */ - { - FILETIME ft; - BOOL rc; - const char *err; - win32file *f = (win32file *) __PHYSFS_platformOpenRead(fname); - BAIL_IF_MACRO(f == NULL, NULL, -1) - rc = GetFileTime(f->handle, NULL, NULL, &ft); - err = win32strerror(); - CloseHandle(f->handle); - allocator.Free(f); - BAIL_IF_MACRO(!rc, err, -1); - retval = FileTimeToPhysfsTime(&ft); - } /* if */ - - return(retval); -} /* __PHYSFS_platformGetLastModTime */ - - -/* !!! FIXME: Don't use C runtime for allocators? */ -int __PHYSFS_platformAllocatorInit(void) -{ - return(1); /* always succeeds. */ -} /* __PHYSFS_platformAllocatorInit */ - - -void __PHYSFS_platformAllocatorDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformAllocatorInit */ - - -void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef malloc - return(malloc((size_t) s)); -} /* __PHYSFS_platformMalloc */ - - -void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef realloc - return(realloc(ptr, (size_t) s)); -} /* __PHYSFS_platformRealloc */ - - -void __PHYSFS_platformAllocatorFree(void *ptr) -{ - #undef free - free(ptr); -} /* __PHYSFS_platformAllocatorFree */ - -#endif - -/* end of win32.c ... */ - Copied: trunk/platform/windows.c (from rev 800, trunk/platform/win32.c) =================================================================== --- trunk/platform/windows.c (rev 0) +++ trunk/platform/windows.c 2007-03-08 22:22:24 UTC (rev 803) @@ -0,0 +1,1151 @@ +/* + * Win32 support routines for PhysicsFS. + * + * Please see the file LICENSE in the source's root directory. + * + * This file written by Ryan C. Gordon, and made sane by Gregory S. Read. + */ + +#if HAVE_CONFIG_H +# include +#endif + +#ifdef WIN32 + +#include +#include +#include +#include +#include +#include +#include + +#define __PHYSICSFS_INTERNAL__ +#include "physfs_internal.h" + +#if (defined _MSC_VER) + #define alloca(x) _alloca(x) +#elif (defined __MINGW32__) /* scary...hopefully this is okay. */ + #define alloca(x) __builtin_alloca(x) +#endif + +#define LOWORDER_UINT64(pos) (PHYSFS_uint32) \ + (pos & 0x00000000FFFFFFFF) +#define HIGHORDER_UINT64(pos) (PHYSFS_uint32) \ + (((pos & 0xFFFFFFFF00000000) >> 32) & 0x00000000FFFFFFFF) + +/* GetUserProfileDirectory() is only available on >= NT4 (no 9x/ME systems!) */ +typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETUSERPROFILEDIR) ( + HANDLE hToken, + LPTSTR lpProfileDir, + LPDWORD lpcchSize); + +/* GetFileAttributesEx() is only available on >= Win98 or WinNT4 ... */ +typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETFILEATTRIBUTESEX) ( + LPCTSTR lpFileName, + GET_FILEEX_INFO_LEVELS fInfoLevelId, + LPVOID lpFileInformation); + +typedef struct +{ + HANDLE handle; + int readonly; +} win32file; + +const char *__PHYSFS_platformDirSeparator = "\\"; +static LPFNGETFILEATTRIBUTESEX pGetFileAttributesEx = NULL; +static HANDLE libKernel32 = NULL; +static char *userDir = NULL; + +/* + * Users without the platform SDK don't have this defined. The original docs + * for SetFilePointer() just said to compare with 0xFFFFFFFF, so this should + * work as desired. + */ +#define PHYSFS_INVALID_SET_FILE_POINTER 0xFFFFFFFF + +/* just in case... */ +#define PHYSFS_INVALID_FILE_ATTRIBUTES 0xFFFFFFFF + + + +/* + * Figure out what the last failing Win32 API call was, and + * generate a human-readable string for the error message. + * + * The return value is a static buffer that is overwritten with + * each call to this function. + */ +static const char *win32strerror(void) +{ + static TCHAR msgbuf[255]; + TCHAR *ptr = msgbuf; + + FormatMessage( + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ + msgbuf, + sizeof (msgbuf) / sizeof (TCHAR), + NULL + ); + + /* chop off newlines. */ + for (ptr = msgbuf; *ptr; ptr++) + { + if ((*ptr == '\n') || (*ptr == '\r')) + { + *ptr = ' '; + break; + } /* if */ + } /* for */ + + return((const char *) msgbuf); +} /* win32strerror */ + + +static char *getExePath(const char *argv0) +{ + DWORD buflen; + int success = 0; + char *ptr = NULL; + char *retval = (char *) allocator.Malloc(sizeof (TCHAR) * (MAX_PATH + 1)); + + BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); + + retval[0] = '\0'; + buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1); + if (buflen <= 0) + __PHYSFS_setError(win32strerror()); + else + { + retval[buflen] = '\0'; /* does API always null-terminate this? */ + + /* make sure the string was not truncated. */ + if (__PHYSFS_platformStricmp(&retval[buflen - 4], ".exe") != 0) + __PHYSFS_setError(ERR_GETMODFN_TRUNC); + else + { + ptr = strrchr(retval, '\\'); + if (ptr == NULL) + __PHYSFS_setError(ERR_GETMODFN_NO_DIR); + else + { + *(ptr + 1) = '\0'; /* chop off filename. */ + success = 1; + } /* else */ + } /* else */ + } /* else */ + + /* if any part of the previous approach failed, try SearchPath()... */ + + if (!success) + { + if (argv0 == NULL) + __PHYSFS_setError(ERR_ARGV0_IS_NULL); + else + { + buflen = SearchPath(NULL, argv0, NULL, MAX_PATH+1, retval, &ptr); + if (buflen == 0) + __PHYSFS_setError(win32strerror()); + else if (buflen > MAX_PATH) + __PHYSFS_setError(ERR_SEARCHPATH_TRUNC); + else + success = 1; + } /* else */ + } /* if */ + + if (!success) + { + allocator.Free(retval); + return(NULL); /* physfs error message will be set, above. */ + } /* if */ + + /* free up the bytes we didn't actually use. */ + ptr = (char *) allocator.Realloc(retval, strlen(retval) + 1); + if (ptr != NULL) + retval = ptr; + + return(retval); /* w00t. */ +} /* getExePath */ + + +/* + * Try to make use of GetUserProfileDirectory(), which isn't available on + * some common variants of Win32. If we can't use this, we just punt and + * use the physfs base dir for the user dir, too. + * + * On success, module-scope variable (userDir) will have a pointer to + * a malloc()'d string of the user's profile dir, and a non-zero value is + * returned. If we can't determine the profile dir, (userDir) will + * be NULL, and zero is returned. + */ +static int determineUserDir(void) +{ + DWORD psize = 0; + char dummy[1]; + BOOL rc = 0; + HANDLE processHandle; /* Current process handle */ + HANDLE accessToken = NULL; /* Security handle to process */ + LPFNGETUSERPROFILEDIR GetUserProfileDirectory; + HMODULE lib; + + assert(userDir == NULL); + + /* + * GetUserProfileDirectory() is only available on NT 4.0 and later. + * This means Win95/98/ME (and CE?) users have to do without, so for + * them, we'll default to the base directory when we can't get the + * function pointer. + */ + + lib = LoadLibrary("userenv.dll"); + if (lib) + { + /* !!! FIXME: Handle Unicode? */ + GetUserProfileDirectory = (LPFNGETUSERPROFILEDIR) + GetProcAddress(lib, "GetUserProfileDirectoryA"); + if (GetUserProfileDirectory) + { + processHandle = GetCurrentProcess(); + if (OpenProcessToken(processHandle, TOKEN_QUERY, &accessToken)) + { + /* + * Should fail. Will write the size of the profile path in + * psize. Also note that the second parameter can't be + * NULL or the function fails. + */ + rc = GetUserProfileDirectory(accessToken, dummy, &psize); + assert(!rc); /* success?! */ + + /* Allocate memory for the profile directory */ + userDir = (char *) allocator.Malloc(psize); + if (userDir != NULL) + { + if (!GetUserProfileDirectory(accessToken, userDir, &psize)) + { + allocator.Free(userDir); + userDir = NULL; + } /* if */ + } /* else */ + } /* if */ + + CloseHandle(accessToken); + } /* if */ + + FreeLibrary(lib); + } /* if */ + + if (userDir == NULL) /* couldn't get profile for some reason. */ + { + /* Might just be a non-NT system; resort to the basedir. */ + userDir = getExePath(NULL); + BAIL_IF_MACRO(userDir == NULL, NULL, 0); /* STILL failed?! */ + } /* if */ + + return(1); /* We made it: hit the showers. */ +} /* determineUserDir */ + + +static BOOL mediaInDrive(const char *drive) +{ + UINT oldErrorMode; + DWORD tmp; + BOOL retval; + + /* Prevent windows warning message appearing when checking media size */ + oldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); + + /* If this function succeeds, there's media in the drive */ + retval = GetVolumeInformation(drive, NULL, 0, NULL, NULL, &tmp, NULL, 0); + + /* Revert back to old windows error handler */ + SetErrorMode(oldErrorMode); + + return(retval); +} /* mediaInDrive */ + + +void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) +{ + char drive_str[4] = "x:\\"; + char ch; + for (ch = 'A'; ch <= 'Z'; ch++) + { + drive_str[0] = ch; + if (GetDriveType(drive_str) == DRIVE_CDROM && mediaInDrive(drive_str)) + cb(data, drive_str); + } /* for */ +} /* __PHYSFS_platformDetectAvailableCDs */ + + +char *__PHYSFS_platformCalcBaseDir(const char *argv0) +{ + if ((argv0 != NULL) && (strchr(argv0, '\\') != NULL)) + return(NULL); /* default behaviour can handle this. */ + + return(getExePath(argv0)); +} /* __PHYSFS_platformCalcBaseDir */ + + +char *__PHYSFS_platformGetUserName(void) +{ + DWORD bufsize = 0; + LPTSTR retval = NULL; + + if (GetUserName(NULL, &bufsize) == 0) /* This SHOULD fail. */ + { + retval = (LPTSTR) allocator.Malloc(bufsize); + BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); + if (GetUserName(retval, &bufsize) == 0) /* ?! */ + { + __PHYSFS_setError(win32strerror()); + allocator.Free(retval); + retval = NULL; + } /* if */ + } /* if */ + + return((char *) retval); +} /* __PHYSFS_platformGetUserName */ + + +char *__PHYSFS_platformGetUserDir(void) +{ + char *retval = (char *) allocator.Malloc(strlen(userDir) + 1); + BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); + strcpy(retval, userDir); /* calculated at init time. */ + return(retval); +} /* __PHYSFS_platformGetUserDir */ + + +PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) +{ + return((PHYSFS_uint64) GetCurrentThreadId()); +} /* __PHYSFS_platformGetThreadID */ + + +/* ...make this Cygwin AND Visual C friendly... */ +int __PHYSFS_platformStricmp(const char *x, const char *y) +{ +#if (defined _MSC_VER) + return(stricmp(x, y)); +#else + int ux, uy; + + do + { + ux = toupper((int) *x); + uy = toupper((int) *y); + if (ux > uy) + return(1); + else if (ux < uy) + return(-1); + x++; + y++; + } while ((ux) && (uy)); + + return(0); +#endif +} /* __PHYSFS_platformStricmp */ + + +int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 len) +{ +#if (defined _MSC_VER) + return(strnicmp(x, y, (int) len)); +#else + int ux, uy; + + if (!len) + return(0); + + do + { + ux = toupper((int) *x); + uy = toupper((int) *y); + if (ux > uy) + return(1); + else if (ux < uy) + return(-1); + x++; + y++; + len--; + } while ((ux) && (uy) && (len)); + + return(0); +#endif +} /* __PHYSFS_platformStricmp */ + + +int __PHYSFS_platformExists(const char *fname) +{ + BAIL_IF_MACRO + ( + GetFileAttributes(fname) == PHYSFS_INVALID_FILE_ATTRIBUTES, + win32strerror(), 0 + ); + return(1); +} /* __PHYSFS_platformExists */ + + +int __PHYSFS_platformIsSymLink(const char *fname) +{ + return(0); /* no symlinks on win32. */ +} /* __PHYSFS_platformIsSymlink */ + + +int __PHYSFS_platformIsDirectory(const char *fname) +{ + return((GetFileAttributes(fname) & FILE_ATTRIBUTE_DIRECTORY) != 0); +} /* __PHYSFS_platformIsDirectory */ + + +char *__PHYSFS_platformCvtToDependent(const char *prepend, + const char *dirName, + const char *append) +{ + int len = ((prepend) ? strlen(prepend) : 0) + + ((append) ? strlen(append) : 0) + + strlen(dirName) + 1; + char *retval = (char *) allocator.Malloc(len); + char *p; + + BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); + + if (prepend) + strcpy(retval, prepend); + else + retval[0] = '\0'; + + strcat(retval, dirName); + + if (append) + strcat(retval, append); + + for (p = strchr(retval, '/'); p != NULL; p = strchr(p + 1, '/')) + *p = '\\'; + + return(retval); +} /* __PHYSFS_platformCvtToDependent */ + + +/* Much like my college days, try to sleep for 10 milliseconds at a time... */ +void __PHYSFS_platformTimeslice(void) +{ + Sleep(10); +} /* __PHYSFS_platformTimeslice */ + + +void __PHYSFS_platformEnumerateFiles(const char *dirname, + int omitSymLinks, + PHYSFS_EnumFilesCallback callback, + const char *origdir, + void *callbackdata) +{ + HANDLE dir; + WIN32_FIND_DATA ent; + size_t len = strlen(dirname); + char *SearchPath; + + /* Allocate a new string for path, maybe '\\', "*", and NULL terminator */ + SearchPath = (char *) alloca(len + 3); + if (SearchPath == NULL) + return; + + /* Copy current dirname */ + strcpy(SearchPath, dirname); + + /* if there's no '\\' at the end of the path, stick one in there. */ + if (SearchPath[len - 1] != '\\') + { + SearchPath[len++] = '\\'; + SearchPath[len] = '\0'; + } /* if */ + + /* Append the "*" to the end of the string */ + strcat(SearchPath, "*"); + + dir = FindFirstFile(SearchPath, &ent); + if (dir == INVALID_HANDLE_VALUE) + return; + + do + { + if (strcmp(ent.cFileName, ".") == 0) + continue; + + if (strcmp(ent.cFileName, "..") == 0) + continue; + + callback(callbackdata, origdir, ent.cFileName); + } while (FindNextFile(dir, &ent) != 0); + + FindClose(dir); +} /* __PHYSFS_platformEnumerateFiles */ + + +char *__PHYSFS_platformCurrentDir(void) +{ + LPTSTR retval; + DWORD buflen = 0; + + buflen = GetCurrentDirectory(buflen, NULL); + retval = (LPTSTR) allocator.Malloc(sizeof (TCHAR) * (buflen + 2)); + BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); + GetCurrentDirectory(buflen, retval); + + if (retval[buflen - 2] != '\\') + strcat(retval, "\\"); + + return((char *) retval); +} /* __PHYSFS_platformCurrentDir */ + + +/* this could probably use a cleanup. */ +char *__PHYSFS_platformRealPath(const char *path) +{ + char *retval = NULL; + char *p = NULL; + + BAIL_IF_MACRO(path == NULL, ERR_INVALID_ARGUMENT, NULL); + BAIL_IF_MACRO(*path == '\0', ERR_INVALID_ARGUMENT, NULL); + + retval = (char *) allocator.Malloc(MAX_PATH); + BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); + + /* + * If in \\server\path format, it's already an absolute path. + * We'll need to check for "." and ".." dirs, though, just in case. + */ + if ((path[0] == '\\') && (path[1] == '\\')) + strcpy(retval, path); + + else + { + char *currentDir = __PHYSFS_platformCurrentDir(); + if (currentDir == NULL) + { + allocator.Free(retval); + BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); + } /* if */ + + if (path[1] == ':') /* drive letter specified? */ + { + /* + * Apparently, "D:mypath" is the same as "D:\\mypath" if + * D: is not the current drive. However, if D: is the + * current drive, then "D:mypath" is a relative path. Ugh. + */ + if (path[2] == '\\') /* maybe an absolute path? */ + strcpy(retval, path); + else /* definitely an absolute path. */ + { + if (path[0] == currentDir[0]) /* current drive; relative. */ + { + strcpy(retval, currentDir); + strcat(retval, path + 2); + } /* if */ + + else /* not current drive; absolute. */ + { + retval[0] = path[0]; + retval[1] = ':'; + retval[2] = '\\'; + strcpy(retval + 3, path + 2); + } /* else */ + } /* else */ + } /* if */ + + else /* no drive letter specified. */ + { + if (path[0] == '\\') /* absolute path. */ + { + retval[0] = currentDir[0]; + retval[1] = ':'; + strcpy(retval + 2, path); + } /* if */ + else + { + strcpy(retval, currentDir); + strcat(retval, path); + } /* else */ + } /* else */ + + allocator.Free(currentDir); + } /* else */ + + /* (whew.) Ok, now take out "." and ".." path entries... */ + + p = retval; + while ( (p = strstr(p, "\\.")) != NULL) + { + /* it's a "." entry that doesn't end the string. */ + if (p[2] == '\\') + memmove(p + 1, p + 3, strlen(p + 3) + 1); + + /* it's a "." entry that ends the string. */ + else if (p[2] == '\0') + p[0] = '\0'; + + /* it's a ".." entry. */ + else if (p[2] == '.') + { + char *prevEntry = p - 1; + while ((prevEntry != retval) && (*prevEntry != '\\')) + prevEntry--; + + if (prevEntry == retval) /* make it look like a "." entry. */ + memmove(p + 1, p + 2, strlen(p + 2) + 1); + else + { + if (p[3] != '\0') /* doesn't end string. */ + *prevEntry = '\0'; + else /* ends string. */ + memmove(prevEntry + 1, p + 4, strlen(p + 4) + 1); + + p = prevEntry; + } /* else */ + } /* else if */ + + else + { + p++; /* look past current char. */ + } /* else */ + } /* while */ + + /* shrink the retval's memory block if possible... */ + p = (char *) allocator.Realloc(retval, strlen(retval) + 1); + if (p != NULL) + retval = p; + + return(retval); +} /* __PHYSFS_platformRealPath */ + + +int __PHYSFS_platformMkDir(const char *path) +{ + DWORD rc = CreateDirectory(path, NULL); + BAIL_IF_MACRO(rc == 0, win32strerror(), 0); + return(1); +} /* __PHYSFS_platformMkDir */ + + +/* + * Get OS info and save the important parts. + * + * Returns non-zero if successful, otherwise it returns zero on failure. + */ +static int getOSInfo(void) +{ +#if 0 /* we don't actually use this at the moment, but may in the future. */ + OSVERSIONINFO OSVersionInfo; /* Information about the OS */ + OSVersionInfo.dwOSVersionInfoSize = sizeof(OSVersionInfo); + BAIL_IF_MACRO(!GetVersionEx(&OSVersionInfo), win32strerror(), 0); + + /* Set to TRUE if we are runnign a WinNT based OS 4.0 or greater */ + runningNT = ((OSVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) && + (OSVersionInfo.dwMajorVersion >= 4)); +#endif + + return(1); +} /* getOSInfo */ + + +/* + * Some things we want/need are in external DLLs that may or may not be + * available, based on the operating system, etc. This function loads those + * libraries and hunts down the needed pointers. + * + * Libraries that are one-shot deals, or better loaded as needed, are loaded + * elsewhere (see determineUserDir()). + * + * Returns zero if a needed library couldn't load, non-zero if we have enough + * to go on (which means some useful but non-crucial libraries may _NOT_ be + * loaded; check the related module-scope variables). + */ +static int loadLibraries(void) +{ + /* If this get unwieldy, make it table driven. */ + + int allNeededLibrariesLoaded = 1; /* flip to zero as needed. */ + + libKernel32 = LoadLibrary("kernel32.dll"); + if (libKernel32) + { + pGetFileAttributesEx = (LPFNGETFILEATTRIBUTESEX) + GetProcAddress(libKernel32, "GetFileAttributesExA"); + } /* if */ + + /* add other DLLs here... */ + + + /* see if there's any reason to keep kernel32.dll around... */ + if (libKernel32) + { + if ((pGetFileAttributesEx == NULL) /* && (somethingElse == NULL) */ ) + { + FreeLibrary(libKernel32); + libKernel32 = NULL; + } /* if */ + } /* if */ + + return(allNeededLibrariesLoaded); +} /* loadLibraries */ + + +int __PHYSFS_platformInit(void) +{ + BAIL_IF_MACRO(!getOSInfo(), NULL, 0); + BAIL_IF_MACRO(!loadLibraries(), NULL, 0); + BAIL_IF_MACRO(!determineUserDir(), NULL, 0); + + return(1); /* It's all good */ +} /* __PHYSFS_platformInit */ + + +int __PHYSFS_platformDeinit(void) +{ + if (userDir != NULL) + { + allocator.Free(userDir); + userDir = NULL; + } /* if */ + + if (libKernel32) + { + FreeLibrary(libKernel32); + libKernel32 = NULL; + } /* if */ + + return(1); /* It's all good */ +} /* __PHYSFS_platformDeinit */ + + +static void *doOpen(const char *fname, DWORD mode, DWORD creation, int rdonly) +{ + HANDLE fileHandle; + win32file *retval; + + fileHandle = CreateFile(fname, mode, FILE_SHARE_READ, NULL, + creation, FILE_ATTRIBUTE_NORMAL, NULL); + + BAIL_IF_MACRO + ( + fileHandle == INVALID_HANDLE_VALUE, + win32strerror(), NULL + ); + + retval = (win32file *) allocator.Malloc(sizeof (win32file)); + if (retval == NULL) + { + CloseHandle(fileHandle); + BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); + } /* if */ + + retval->readonly = rdonly; + retval->handle = fileHandle; + return(retval); +} /* doOpen */ + + +void *__PHYSFS_platformOpenRead(const char *filename) +{ + return(doOpen(filename, GENERIC_READ, OPEN_EXISTING, 1)); +} /* __PHYSFS_platformOpenRead */ + + +void *__PHYSFS_platformOpenWrite(const char *filename) +{ + return(doOpen(filename, GENERIC_WRITE, CREATE_ALWAYS, 0)); +} /* __PHYSFS_platformOpenWrite */ + + +void *__PHYSFS_platformOpenAppend(const char *filename) +{ + void *retval = doOpen(filename, GENERIC_WRITE, OPEN_ALWAYS, 0); + if (retval != NULL) + { + HANDLE h = ((win32file *) retval)->handle; + DWORD rc = SetFilePointer(h, 0, NULL, FILE_END); + if (rc == PHYSFS_INVALID_SET_FILE_POINTER) + { + const char *err = win32strerror(); + CloseHandle(h); + allocator.Free(retval); + BAIL_MACRO(err, NULL); + } /* if */ + } /* if */ + + return(retval); +} /* __PHYSFS_platformOpenAppend */ + + +PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer, + PHYSFS_uint32 size, PHYSFS_uint32 count) +{ + HANDLE Handle = ((win32file *) opaque)->handle; + DWORD CountOfBytesRead; + PHYSFS_sint64 retval; + + /* Read data from the file */ + /* !!! FIXME: uint32 might be a greater # than DWORD */ + if(!ReadFile(Handle, buffer, count * size, &CountOfBytesRead, NULL)) + { + BAIL_MACRO(win32strerror(), -1); + } /* if */ + else + { + /* Return the number of "objects" read. */ + /* !!! FIXME: What if not the right amount of bytes was read to make an object? */ + retval = CountOfBytesRead / size; + } /* else */ + + return(retval); +} /* __PHYSFS_platformRead */ + + +PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer, + PHYSFS_uint32 size, PHYSFS_uint32 count) +{ + HANDLE Handle = ((win32file *) opaque)->handle; + DWORD CountOfBytesWritten; + PHYSFS_sint64 retval; + + /* Read data from the file */ + /* !!! FIXME: uint32 might be a greater # than DWORD */ + if(!WriteFile(Handle, buffer, count * size, &CountOfBytesWritten, NULL)) + { + BAIL_MACRO(win32strerror(), -1); + } /* if */ + else + { + /* Return the number of "objects" read. */ + /* !!! FIXME: What if not the right number of bytes was written? */ + retval = CountOfBytesWritten / size; + } /* else */ + + return(retval); +} /* __PHYSFS_platformWrite */ + + +int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos) +{ + HANDLE Handle = ((win32file *) opaque)->handle; + DWORD HighOrderPos; + DWORD *pHighOrderPos; + DWORD rc; + + /* Get the high order 32-bits of the position */ + HighOrderPos = HIGHORDER_UINT64(pos); + + /* + * MSDN: "If you do not need the high-order 32 bits, this + * pointer must be set to NULL." + */ + pHighOrderPos = (HighOrderPos) ? &HighOrderPos : NULL; + + /* + * !!! FIXME: MSDN: "Windows Me/98/95: If the pointer + * !!! FIXME: lpDistanceToMoveHigh is not NULL, then it must + * !!! FIXME: point to either 0, INVALID_SET_FILE_POINTER, or + * !!! FIXME: the sign extension of the value of lDistanceToMove. + * !!! FIXME: Any other value will be rejected." + */ + + /* Move pointer "pos" count from start of file */ + rc = SetFilePointer(Handle, LOWORDER_UINT64(pos), + pHighOrderPos, FILE_BEGIN); + + if ( (rc == PHYSFS_INVALID_SET_FILE_POINTER) && + (GetLastError() != NO_ERROR) ) + { + BAIL_MACRO(win32strerror(), 0); + } /* if */ + + return(1); /* No error occured */ +} /* __PHYSFS_platformSeek */ + + +PHYSFS_sint64 __PHYSFS_platformTell(void *opaque) +{ + HANDLE Handle = ((win32file *) opaque)->handle; + DWORD HighPos = 0; + DWORD LowPos; + PHYSFS_sint64 retval; + + /* Get current position */ + LowPos = SetFilePointer(Handle, 0, &HighPos, FILE_CURRENT); + if ( (LowPos == PHYSFS_INVALID_SET_FILE_POINTER) && + (GetLastError() != NO_ERROR) ) + { + BAIL_MACRO(win32strerror(), 0); + } /* if */ + else + { + /* Combine the high/low order to create the 64-bit position value */ + retval = (((PHYSFS_uint64) HighPos) << 32) | LowPos; + assert(retval >= 0); + } /* else */ + + return(retval); +} /* __PHYSFS_platformTell */ + + +PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) +{ + HANDLE Handle = ((win32file *) opaque)->handle; + DWORD SizeHigh; + DWORD SizeLow; + PHYSFS_sint64 retval; + + SizeLow = GetFileSize(Handle, &SizeHigh); + if ( (SizeLow == PHYSFS_INVALID_SET_FILE_POINTER) && + (GetLastError() != NO_ERROR) ) + { + BAIL_MACRO(win32strerror(), -1); + } /* if */ + else + { + /* Combine the high/low order to create the 64-bit position value */ + retval = (((PHYSFS_uint64) SizeHigh) << 32) | SizeLow; + assert(retval >= 0); + } /* else */ + + return(retval); +} /* __PHYSFS_platformFileLength */ + + +int __PHYSFS_platformEOF(void *opaque) +{ + PHYSFS_sint64 FilePosition; + int retval = 0; + + /* Get the current position in the file */ + if ((FilePosition = __PHYSFS_platformTell(opaque)) != 0) + { + /* Non-zero if EOF is equal to the file length */ + retval = FilePosition == __PHYSFS_platformFileLength(opaque); + } /* if */ + + return(retval); +} /* __PHYSFS_platformEOF */ + + +int __PHYSFS_platformFlush(void *opaque) +{ + win32file *fh = ((win32file *) opaque); + if (!fh->readonly) + BAIL_IF_MACRO(!FlushFileBuffers(fh->handle), win32strerror(), 0); + + return(1); +} /* __PHYSFS_platformFlush */ + + +int __PHYSFS_platformClose(void *opaque) +{ + HANDLE Handle = ((win32file *) opaque)->handle; + BAIL_IF_MACRO(!CloseHandle(Handle), win32strerror(), 0); + allocator.Free(opaque); + return(1); +} /* __PHYSFS_platformClose */ + + +int __PHYSFS_platformDelete(const char *path) +{ + /* If filename is a folder */ + if (GetFileAttributes(path) == FILE_ATTRIBUTE_DIRECTORY) + { + BAIL_IF_MACRO(!RemoveDirectory(path), win32strerror(), 0); + } /* if */ + else + { + BAIL_IF_MACRO(!DeleteFile(path), win32strerror(), 0); + } /* else */ + + return(1); /* if you got here, it worked. */ +} /* __PHYSFS_platformDelete */ + + +void *__PHYSFS_platformCreateMutex(void) +{ + return((void *) CreateMutex(NULL, FALSE, NULL)); +} /* __PHYSFS_platformCreateMutex */ + + +void __PHYSFS_platformDestroyMutex(void *mutex) +{ + CloseHandle((HANDLE) mutex); +} /* __PHYSFS_platformDestroyMutex */ + + +int __PHYSFS_platformGrabMutex(void *mutex) +{ + return(WaitForSingleObject((HANDLE) mutex, INFINITE) != WAIT_FAILED); +} /* __PHYSFS_platformGrabMutex */ + + +void __PHYSFS_platformReleaseMutex(void *mutex) +{ + ReleaseMutex((HANDLE) mutex); +} /* __PHYSFS_platformReleaseMutex */ + + +static PHYSFS_sint64 FileTimeToPhysfsTime(const FILETIME *ft) +{ + SYSTEMTIME st_utc; + SYSTEMTIME st_localtz; + TIME_ZONE_INFORMATION tzi; + DWORD tzid; + PHYSFS_sint64 retval; + struct tm tm; + + BAIL_IF_MACRO(!FileTimeToSystemTime(ft, &st_utc), win32strerror(), -1); + tzid = GetTimeZoneInformation(&tzi); + BAIL_IF_MACRO(tzid == TIME_ZONE_ID_INVALID, win32strerror(), -1); + + /* (This API is unsupported and fails on non-NT systems. */ + if (!SystemTimeToTzSpecificLocalTime(&tzi, &st_utc, &st_localtz)) + { + /* do it by hand. Grumble... */ + ULARGE_INTEGER ui64; + FILETIME new_ft; + ui64.LowPart = ft->dwLowDateTime; + ui64.HighPart = ft->dwHighDateTime; + + if (tzid == TIME_ZONE_ID_STANDARD) + tzi.Bias += tzi.StandardBias; + else if (tzid == TIME_ZONE_ID_DAYLIGHT) + tzi.Bias += tzi.DaylightBias; + + /* convert from minutes to 100-nanosecond increments... */ + #if 0 /* For compilers that puke on 64-bit math. */ + /* goddamn this is inefficient... */ + while (tzi.Bias > 0) + { + DWORD tmp = ui64.LowPart - 60000000; + if ((ui64.LowPart < tmp) && (tmp > 60000000)) + ui64.HighPart--; + ui64.LowPart = tmp; + tzi.Bias--; + } /* while */ + + while (tzi.Bias < 0) + { + DWORD tmp = ui64.LowPart + 60000000; + if ((ui64.LowPart > tmp) && (tmp < 60000000)) + ui64.HighPart++; + ui64.LowPart = tmp; + tzi.Bias++; + } /* while */ + #else + ui64.QuadPart -= (((LONGLONG) tzi.Bias) * (600000000)); + #endif + + /* Move it back into a FILETIME structure... */ + new_ft.dwLowDateTime = ui64.LowPart; + new_ft.dwHighDateTime = ui64.HighPart; + + /* Convert to something human-readable... */ + if (!FileTimeToSystemTime(&new_ft, &st_localtz)) + BAIL_MACRO(win32strerror(), -1); + } /* if */ + + /* Convert to a format that mktime() can grok... */ + tm.tm_sec = st_localtz.wSecond; + tm.tm_min = st_localtz.wMinute; + tm.tm_hour = st_localtz.wHour; + tm.tm_mday = st_localtz.wDay; + tm.tm_mon = st_localtz.wMonth - 1; + tm.tm_year = st_localtz.wYear - 1900; + tm.tm_wday = -1 /*st_localtz.wDayOfWeek*/; + tm.tm_yday = -1; + tm.tm_isdst = -1; + + /* Convert to a format PhysicsFS can grok... */ + retval = (PHYSFS_sint64) mktime(&tm); + BAIL_IF_MACRO(retval == -1, strerror(errno), -1); + return(retval); +} /* FileTimeToPhysfsTime */ + + +PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname) +{ + PHYSFS_sint64 retval = -1; + WIN32_FILE_ATTRIBUTE_DATA attrData; + memset(&attrData, '\0', sizeof (attrData)); + + /* GetFileAttributesEx didn't show up until Win98 and NT4. */ + if (pGetFileAttributesEx != NULL) + { + if (pGetFileAttributesEx(fname, GetFileExInfoStandard, &attrData)) + { + /* 0 return value indicates an error or not supported */ + if ( (attrData.ftLastWriteTime.dwHighDateTime != 0) || + (attrData.ftLastWriteTime.dwLowDateTime != 0) ) + { + retval = FileTimeToPhysfsTime(&attrData.ftLastWriteTime); + } /* if */ + } /* if */ + } /* if */ + + /* GetFileTime() has been in the Win32 API since the start. */ + if (retval == -1) /* try a fallback... */ + { + FILETIME ft; + BOOL rc; + const char *err; + win32file *f = (win32file *) __PHYSFS_platformOpenRead(fname); + BAIL_IF_MACRO(f == NULL, NULL, -1) + rc = GetFileTime(f->handle, NULL, NULL, &ft); + err = win32strerror(); + CloseHandle(f->handle); + allocator.Free(f); + BAIL_IF_MACRO(!rc, err, -1); + retval = FileTimeToPhysfsTime(&ft); + } /* if */ + + return(retval); +} /* __PHYSFS_platformGetLastModTime */ + + +/* !!! FIXME: Don't use C runtime for allocators? */ +int __PHYSFS_platformAllocatorInit(void) +{ + return(1); /* always succeeds. */ +} /* __PHYSFS_platformAllocatorInit */ + + +void __PHYSFS_platformAllocatorDeinit(void) +{ + /* no-op */ +} /* __PHYSFS_platformAllocatorInit */ + + +void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s) +{ + BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); + #undef malloc + return(malloc((size_t) s)); +} /* __PHYSFS_platformMalloc */ + + +void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s) +{ + BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); + #undef realloc + return(realloc(ptr, (size_t) s)); +} /* __PHYSFS_platformRealloc */ + + +void __PHYSFS_platformAllocatorFree(void *ptr) +{ + #undef free + free(ptr); +} /* __PHYSFS_platformAllocatorFree */ + +#endif + +/* end of windows.c ... */ + From DONOTREPLY at icculus.org Thu Mar 8 17:37:51 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 8 Mar 2007 17:37:51 -0500 Subject: r804 - in trunk: . platform Message-ID: <20070308223751.1326.qmail@icculus.org> Author: icculus Date: 2007-03-08 17:37:51 -0500 (Thu, 08 Mar 2007) New Revision: 804 Modified: trunk/CHANGELOG trunk/platform/pocketpc.c Log: Ryanized the formatting in pocketpc.c Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-08 22:22:24 UTC (rev 803) +++ trunk/CHANGELOG 2007-03-08 22:37:51 UTC (rev 804) @@ -3,6 +3,7 @@ */ 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. + Cleaned up whitespace/formatting in pocketpc.c 11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work. Minor BeOS realpath tweak. 09272006 - Reworked 7zip archiver (thanks, Dennis!). Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-08 22:22:24 UTC (rev 803) +++ trunk/platform/pocketpc.c 2007-03-08 22:37:51 UTC (rev 804) @@ -69,26 +69,21 @@ { char *str = NULL; - if (w_str != NULL) + if (w_str == NULL) + return NULL; + else { int len = wcslen(w_str) + 1; str = (char *) allocator.Malloc(len); - if (WideCharToMultiByte(CP_ACP,0,w_str,-1,str,len,NULL,NULL) == 0) - { /*Conversion failed */ + if (WideCharToMultiByte(CP_ACP,0,w_str,-1,str,len,NULL,NULL) != 0) + return(str); + else /* Conversion failed */ + { allocator.Free(str); return(NULL); - } /* if */ - else - { /* Conversion successful */ - return(str); } /* else */ - } /* if */ - - else - { /* Given NULL string */ - return NULL; - } + } /* else */ } /* UnicodeToAsc */ @@ -127,20 +122,20 @@ retval[0] = _T('\0'); buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1); - if (buflen <= 0) { + if (buflen <= 0) __PHYSFS_setError(win32strerror()); - } else { - retval[buflen] = '\0'; /* does API always null-terminate this? */ - ptr = retval+buflen; - while( ptr != retval ) + else { - if( *ptr != _T('\\') ) { - *ptr-- = _T('\0'); - } else { - break; - } - } - success = 1; + retval[buflen] = '\0'; /* does API always null-terminate this? */ + ptr = retval+buflen; + while( ptr != retval ) + { + if( *ptr != _T('\\') ) + *ptr-- = _T('\0'); + else + break; + } /* while */ + success = 1; } /* else */ if (!success) @@ -156,13 +151,12 @@ charretval = UnicodeToAsc(retval); allocator.Free(retval); - if(charretval == NULL) { - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - } - + BAIL_IF_MACRO((!charretval) && (!retval), ERR_OUT_OF_MEMORY, NULL); + return(charretval); /* w00t. */ } /* getExePath */ + int __PHYSFS_platformInit(void) { userDir = getExePath(); @@ -229,9 +223,9 @@ if(w_fname!=NULL) { - retval=(GetFileAttributes(w_fname) != INVALID_FILE_ATTRIBUTES); - allocator.Free(w_fname); - } + retval=(GetFileAttributes(w_fname) != INVALID_FILE_ATTRIBUTES); + allocator.Free(w_fname); + } /* if */ return(retval); } /* __PHYSFS_platformExists */ @@ -251,9 +245,9 @@ if(w_fname!=NULL) { - retval=((GetFileAttributes(w_fname) & FILE_ATTRIBUTE_DIRECTORY) != 0); - allocator.Free(w_fname); - } + retval=((GetFileAttributes(w_fname) & FILE_ATTRIBUTE_DIRECTORY) != 0); + allocator.Free(w_fname); + } /* if */ return(retval); } /* __PHYSFS_platformIsDirectory */ @@ -372,20 +366,16 @@ int __PHYSFS_platformMkDir(const char *path) { wchar_t *w_path = AscToUnicode(path); - if(w_path!=NULL) - { - DWORD rc = CreateDirectory(w_path, NULL); - allocator.Free(w_path); - if(rc==0) - { + if(w_path == NULL) return(0); - } - return(1); - } else { - return(0); - } + DWORD rc = CreateDirectory(w_path, NULL); + allocator.Free(w_path); + if(rc==0) + return(0); + return(1); + } /* else */ } /* __PHYSFS_platformMkDir */ @@ -402,7 +392,7 @@ if(fileHandle==INVALID_HANDLE_VALUE) { - return NULL; + return NULL; } BAIL_IF_MACRO(fileHandle == INVALID_HANDLE_VALUE, win32strerror(), NULL); @@ -410,8 +400,8 @@ retval = (winCEfile *) allocator.Malloc(sizeof (winCEfile)); if (retval == NULL) { - CloseHandle(fileHandle); - BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); + CloseHandle(fileHandle); + BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); } /* if */ retval->readonly = rdonly; From DONOTREPLY at icculus.org Fri Mar 9 03:15:52 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 9 Mar 2007 03:15:52 -0500 Subject: r805 - in trunk: . platform Message-ID: <20070309081552.29343.qmail@icculus.org> Author: icculus Date: 2007-03-09 03:15:47 -0500 (Fri, 09 Mar 2007) New Revision: 805 Modified: trunk/CHANGELOG trunk/platform/pocketpc.c Log: Updated PocketPC code to handle UTF-8 strings. Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-08 22:37:51 UTC (rev 804) +++ trunk/CHANGELOG 2007-03-09 08:15:47 UTC (rev 805) @@ -3,7 +3,8 @@ */ 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. - Cleaned up whitespace/formatting in pocketpc.c + Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC + code to expect UTF-8 strings from the higher level. 11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work. Minor BeOS realpath tweak. 09272006 - Reworked 7zip archiver (thanks, Dennis!). @@ -103,6 +104,10 @@ Made bootstrap script MacOSX-friendly. Moved byteorder defines into physfs_internal.h ... 01152003 - Added Portuguese (Brazil) translation (Thanks, Danny!) + + +--- This is where the 1.1 development branch starts. --- + 12292003 - Updated CodeWarrior projects from CW6 to CW7, and made a bunch of patches to get the Mac Classic target building again. Removed zlib114 from CVS repository. Updated OS/2 build batch file. Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-08 22:37:51 UTC (rev 804) +++ trunk/platform/pocketpc.c 2007-03-09 08:15:47 UTC (rev 805) @@ -64,53 +64,17 @@ return((const char *) msgbuf); } /* win32strerror */ +#define UTF8_TO_UNICODE_STACK_MACRO(w_assignto, str) { \ + if (str == NULL) \ + w_assignto = NULL; \ + else { \ + const PHYSFS_uint64 len = (PHYSFS_uint64) ((strlen(str) * 4) + 1); \ + w_assignto = (char *) alloca(len); \ + PHYSFS_uc2fromutf8(str, (PHYSFS_uint16 *) w_assignto, len); \ + } \ +} \ -static char *UnicodeToAsc(const wchar_t *w_str) -{ - char *str = NULL; - if (w_str == NULL) - return NULL; - else - { - int len = wcslen(w_str) + 1; - str = (char *) allocator.Malloc(len); - - if (WideCharToMultiByte(CP_ACP,0,w_str,-1,str,len,NULL,NULL) != 0) - return(str); - else /* Conversion failed */ - { - allocator.Free(str); - return(NULL); - } /* else */ - } /* else */ -} /* UnicodeToAsc */ - - -static wchar_t *AscToUnicode(const char *str) -{ - wchar_t *w_str = NULL; - if (str != NULL) - { - int len = strlen(str) + 1; - w_str = (wchar_t *) allocator.Malloc(sizeof (wchar_t) * len); - if (MultiByteToWideChar(CP_ACP,0,str,-1,w_str,len) == 0) - { - allocator.Free(w_str); - return(NULL); - } /* if */ - else - { - return(w_str); - } /* else */ - } /* if */ - else - { - return(NULL); - } /* else */ -} /* AscToUnicode */ - - static char *getExePath() { DWORD buflen; @@ -121,6 +85,7 @@ BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); retval[0] = _T('\0'); + /* !!! FIXME: don't preallocate here? */ buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1); if (buflen <= 0) __PHYSFS_setError(win32strerror()); @@ -144,15 +109,11 @@ return(NULL); /* physfs error message will be set, above. */ } /* if */ - /* free up the bytes we didn't actually use. */ - ptr = (TCHAR *) allocator.Realloc(retval, sizeof(TCHAR)*_tcslen(retval)+1); - if (ptr != NULL) - retval = ptr; - - charretval = UnicodeToAsc(retval); + buflen = (buflen * 4) + 1; + charretval = (char *) allocator.Malloc(buflen); + if (charretval != NULL) + PHYSFS_utf8fromucs2((const PHYSFS_uint16 *) retval, charretval, buflen); allocator.Free(retval); - BAIL_IF_MACRO((!charretval) && (!retval), ERR_OUT_OF_MEMORY, NULL); - return(charretval); /* w00t. */ } /* getExePath */ @@ -217,15 +178,12 @@ int __PHYSFS_platformExists(const char *fname) { - int retval=0; + int retval = 0; + wchar_t *w_fname = NULL; - wchar_t *w_fname=AscToUnicode(fname); - - if(w_fname!=NULL) - { - retval=(GetFileAttributes(w_fname) != INVALID_FILE_ATTRIBUTES); - allocator.Free(w_fname); - } /* if */ + UTF8_TO_UNICODE_STACK_MACRO(w_fname, fname); + if (w_fname != NULL) + retval = (GetFileAttributes(w_fname) != INVALID_FILE_ATTRIBUTES); return(retval); } /* __PHYSFS_platformExists */ @@ -239,16 +197,13 @@ int __PHYSFS_platformIsDirectory(const char *fname) { - int retval=0; + int retval = 0; + wchar_t *w_fname = NULL; - wchar_t *w_fname=AscToUnicode(fname); + UTF8_TO_UNICODE_STACK_MACRO(w_fname, fname); + if (w_fname != NULL) + retval = ((GetFileAttributes(w_fname) & FILE_ATTRIBUTE_DIRECTORY) != 0); - if(w_fname!=NULL) - { - retval=((GetFileAttributes(w_fname) & FILE_ATTRIBUTE_DIRECTORY) != 0); - allocator.Free(w_fname); - } /* if */ - return(retval); } /* __PHYSFS_platformIsDirectory */ @@ -288,6 +243,16 @@ } /* __PHYSFS_platformTimeslice */ +static int doEnumCallback(const wchar_t *w_fname) +{ + const PHYSFS_uint64 len = (PHYSFS_uint64) ((wcslen(w_fname) * 4) + 1); + char *str = (char *) alloca(len); + PHYSFS_utf8fromucs2((const PHYSFS_uint16 *) w_fname, str, len); + callback(callbackdata, origdir, str); + return 1; +} /* doEnumCallback */ + + void __PHYSFS_platformEnumerateFiles(const char *dirname, int omitSymLinks, PHYSFS_EnumFilesCallback callback, @@ -317,18 +282,15 @@ /* Append the "*" to the end of the string */ strcat(SearchPath, "*"); - w_SearchPath=AscToUnicode(SearchPath); - + UTF8_TO_UNICODE_STACK_MACRO(w_SearchPath, SearchPath); dir = FindFirstFile(w_SearchPath, &ent); - allocator.Free(w_SearchPath); - allocator.Free(SearchPath); if (dir == INVALID_HANDLE_VALUE) return; do { - const char *str; + const char *str = NULL; if (wcscmp(ent.cFileName, L".") == 0) continue; @@ -336,13 +298,8 @@ if (wcscmp(ent.cFileName, L"..") == 0) continue; - /* !!! FIXME: avoid malloc in UnicodeToAsc? */ - str = UnicodeToAsc(ent.cFileName); - if (str == NULL) + if (!doEnumCallback(ent.cFileName)) break; - - callback(callbackdata, origdir, str); - allocator.Free(str); } while (FindNextFile(dir, &ent) != 0); FindClose(dir); @@ -365,17 +322,9 @@ int __PHYSFS_platformMkDir(const char *path) { - wchar_t *w_path = AscToUnicode(path); - if(w_path == NULL) - return(0); - else - { - DWORD rc = CreateDirectory(w_path, NULL); - allocator.Free(w_path); - if(rc==0) - return(0); - return(1); - } /* else */ + wchar_t *w_path = NULL; + UTF8_TO_UNICODE_STACK_MACRO(w_path, path); + return ( (w_path != NULL) && (CreateDirectory(w_path, NULL)) ); } /* __PHYSFS_platformMkDir */ @@ -383,18 +332,13 @@ { HANDLE fileHandle; winCEfile *retval; - wchar_t *w_fname=AscToUnicode(fname); + 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); - allocator.Free(w_fname); - - if(fileHandle==INVALID_HANDLE_VALUE) - { - return NULL; - } - BAIL_IF_MACRO(fileHandle == INVALID_HANDLE_VALUE, win32strerror(), NULL); retval = (winCEfile *) allocator.Malloc(sizeof (winCEfile)); @@ -600,19 +544,18 @@ int __PHYSFS_platformDelete(const char *path) { - wchar_t *w_path=AscToUnicode(path); + wchar_t *w_path = NULL; + UTF8_TO_UNICODE_STACK_MACRO(w_path, path); /* If filename is a folder */ if (GetFileAttributes(w_path) == FILE_ATTRIBUTE_DIRECTORY) { - int retval=!RemoveDirectory(w_path); - allocator.Free(w_path); + int retval = !RemoveDirectory(w_path); BAIL_IF_MACRO(retval, win32strerror(), 0); } /* if */ else { - int retval=!DeleteFile(w_path); - allocator.Free(w_path); + int retval = !DeleteFile(w_path); BAIL_IF_MACRO(retval, win32strerror(), 0); } /* else */ From DONOTREPLY at icculus.org Fri Mar 9 03:16:38 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 9 Mar 2007 03:16:38 -0500 Subject: r806 - trunk Message-ID: <20070309081638.29582.qmail@icculus.org> Author: icculus Date: 2007-03-09 03:16:32 -0500 (Fri, 09 Mar 2007) New Revision: 806 Modified: trunk/TODO Log: Updated. Modified: trunk/TODO =================================================================== --- trunk/TODO 2007-03-09 08:15:47 UTC (rev 805) +++ trunk/TODO 2007-03-09 08:16:32 UTC (rev 806) @@ -4,9 +4,6 @@ Some might be dupes, some might be done already. UNICODE: -- BeOS: uses UTF-8 internally in the OS, so that's already done. -- PocketPC: uses UCS-2 internally in the OS, and we're currently converting to - and from ASCII. Need to change this out. - Windows: Can use Unicode, but might only allow "codepages" ... Use GetProcAddress() to find Unicode entry points on WinNT-based systems, otherwise try to use a sane codepage. @@ -14,20 +11,9 @@ as a loss. - OS/2: Codepages. No full Unicode in the filesystem, but we can probably make a conversion effort. -- Linux: uses UTF-8 internally, so that's already done. -- Mac OS X: uses UTF-8 in the Unix layer, and is smart enough to convert - internally when needed. -- DIR: just pass UTF-8 strings through to platform layer. -- GRP: No Unicode (only 12 bytes for filename, 8.3 format). Legacy format. -- HOG: No Unicode (only 12 bytes for filename, 8.3 format). Legacy format. -- LZMA: Uses UTF-8 internally, so we're good to go. -- MIX: only stores filename HASHES...this driver is going away. -- MVL: No Unicode (only 12 bytes for filename, 8.3 format). Legacy format. -- QPAK: Only has 56 bytes for a path, but we can just treat these as - UTF-8 and be done with it. -- WAD: No Unicode (only 8 bytes for filename). Legacy format. -- ZIP: Uses UTF-8 internally, so it's good to go. +- Everywhere: Move stricmp() out of platform layer and make it grok UTF-8. + Stuff: - Other archivers: perhaps tar(.gz|.bz2), RPM, ARJ, etc. These are less important, since streaming archives aren't of much value to games (which @@ -66,7 +52,6 @@ - MIX grabs all archives that no other archivers claim. - MIX enumerates files as hash values. - Should file enumeration return an error or set error state? -- Ryanify pocketpc.c ... - Update internal zlib? - Need "getmountpoint" command in test_physfs.c ... - Look for calloc() calls that aren't going through the allocation hooks. @@ -74,6 +59,7 @@ - Is -Wall enabled? - Make mutexes recursive, so callbacks can call into the API. - Archivers need abstracted i/o to read from memory or files (archives in archives?) +- Move to CMake. // end of TODO ... From DONOTREPLY at icculus.org Fri Mar 9 03:18:04 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 9 Mar 2007 03:18:04 -0500 Subject: r807 - in trunk: . archivers Message-ID: <20070309081804.30084.qmail@icculus.org> Author: icculus Date: 2007-03-09 03:17:56 -0500 (Fri, 09 Mar 2007) New Revision: 807 Modified: trunk/CHANGELOG trunk/archivers/lzma.c trunk/physfs.c Log: Changed PHYSFS_SUPPORTS_LZMA to PHYSFS_SUPPORTS_7Z. Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-09 08:16:32 UTC (rev 806) +++ trunk/CHANGELOG 2007-03-09 08:17:56 UTC (rev 807) @@ -4,7 +4,8 @@ 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC - code to expect UTF-8 strings from the higher level. + code to expect UTF-8 strings from the higher level. Changed + PHYSFS_SUPPORTS_LZMA to PHYSFS_SUPPORTS_7Z. 11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work. Minor BeOS realpath tweak. 09272006 - Reworked 7zip archiver (thanks, Dennis!). Modified: trunk/archivers/lzma.c =================================================================== --- trunk/archivers/lzma.c 2007-03-09 08:16:32 UTC (rev 806) +++ trunk/archivers/lzma.c 2007-03-09 08:17:56 UTC (rev 807) @@ -11,7 +11,7 @@ # include #endif -#if (defined PHYSFS_SUPPORTS_LZMA) +#if (defined PHYSFS_SUPPORTS_7Z) #include #include @@ -680,7 +680,7 @@ LZMA_fileClose /* fileClose() method */ }; -#endif /* defined PHYSFS_SUPPORTS_LZMA */ +#endif /* defined PHYSFS_SUPPORTS_7Z */ /* end of lzma.c ... */ Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-09 08:16:32 UTC (rev 806) +++ trunk/physfs.c 2007-03-09 08:17:56 UTC (rev 807) @@ -55,13 +55,13 @@ /* The various i/o drivers... */ - +/* !!! FIXME: consolidate these into one struct? */ #if (defined PHYSFS_SUPPORTS_ZIP) extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP; extern const PHYSFS_Archiver __PHYSFS_Archiver_ZIP; #endif -#if (defined PHYSFS_SUPPORTS_LZMA) +#if (defined PHYSFS_SUPPORTS_7Z) extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_LZMA; extern const PHYSFS_Archiver __PHYSFS_Archiver_LZMA; #endif @@ -105,7 +105,7 @@ &__PHYSFS_ArchiveInfo_ZIP, #endif -#if (defined PHYSFS_SUPPORTS_LZMA) +#if (defined PHYSFS_SUPPORTS_7Z) &__PHYSFS_ArchiveInfo_LZMA, #endif @@ -142,7 +142,7 @@ &__PHYSFS_Archiver_ZIP, #endif -#if (defined PHYSFS_SUPPORTS_LZMA) +#if (defined PHYSFS_SUPPORTS_7Z) &__PHYSFS_Archiver_LZMA, #endif From DONOTREPLY at icculus.org Sat Mar 10 01:24:56 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 10 Mar 2007 01:24:56 -0500 Subject: r808 - trunk Message-ID: <20070310062456.30184.qmail@icculus.org> Author: icculus Date: 2007-03-10 01:24:56 -0500 (Sat, 10 Mar 2007) New Revision: 808 Modified: trunk/CHANGELOG trunk/physfs.c Log: Killed some #ifdefs and whitespace. Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-09 08:17:56 UTC (rev 807) +++ trunk/CHANGELOG 2007-03-10 06:24:56 UTC (rev 808) @@ -5,7 +5,8 @@ 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC code to expect UTF-8 strings from the higher level. Changed - PHYSFS_SUPPORTS_LZMA to PHYSFS_SUPPORTS_7Z. + PHYSFS_SUPPORTS_LZMA to PHYSFS_SUPPORTS_7Z. Killed some #ifdefs + in physfs.c. 11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work. Minor BeOS realpath tweak. 09272006 - Reworked 7zip archiver (thanks, Dennis!). Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-09 08:17:56 UTC (rev 807) +++ trunk/physfs.c 2007-03-10 06:24:56 UTC (rev 808) @@ -54,85 +54,52 @@ } ErrMsg; -/* The various i/o drivers... */ -/* !!! FIXME: consolidate these into one struct? */ -#if (defined PHYSFS_SUPPORTS_ZIP) +/* The various i/o drivers...some of these may not be compiled in. */ extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP; extern const PHYSFS_Archiver __PHYSFS_Archiver_ZIP; -#endif - -#if (defined PHYSFS_SUPPORTS_7Z) extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_LZMA; extern const PHYSFS_Archiver __PHYSFS_Archiver_LZMA; -#endif - -#if (defined PHYSFS_SUPPORTS_GRP) extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP; extern const PHYSFS_Archiver __PHYSFS_Archiver_GRP; -#endif - -#if (defined PHYSFS_SUPPORTS_QPAK) extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK; extern const PHYSFS_Archiver __PHYSFS_Archiver_QPAK; -#endif - -#if (defined PHYSFS_SUPPORTS_HOG) extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_HOG; extern const PHYSFS_Archiver __PHYSFS_Archiver_HOG; -#endif - -#if (defined PHYSFS_SUPPORTS_MVL) extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MVL; extern const PHYSFS_Archiver __PHYSFS_Archiver_MVL; -#endif - -#if (defined PHYSFS_SUPPORTS_WAD) extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_WAD; extern const PHYSFS_Archiver __PHYSFS_Archiver_WAD; -#endif - -#if (defined PHYSFS_SUPPORTS_MIX) extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MIX; extern const PHYSFS_Archiver __PHYSFS_Archiver_MIX; -#endif +extern const PHYSFS_Archiver __PHYSFS_Archiver_DIR; -extern const PHYSFS_Archiver __PHYSFS_Archiver_DIR; - static const PHYSFS_ArchiveInfo *supported_types[] = { #if (defined PHYSFS_SUPPORTS_ZIP) &__PHYSFS_ArchiveInfo_ZIP, #endif - #if (defined PHYSFS_SUPPORTS_7Z) &__PHYSFS_ArchiveInfo_LZMA, #endif - #if (defined PHYSFS_SUPPORTS_GRP) &__PHYSFS_ArchiveInfo_GRP, #endif - #if (defined PHYSFS_SUPPORTS_QPAK) &__PHYSFS_ArchiveInfo_QPAK, #endif - #if (defined PHYSFS_SUPPORTS_HOG) &__PHYSFS_ArchiveInfo_HOG, #endif - #if (defined PHYSFS_SUPPORTS_MVL) &__PHYSFS_ArchiveInfo_MVL, #endif - #if (defined PHYSFS_SUPPORTS_WAD) &__PHYSFS_ArchiveInfo_WAD, #endif - #if (defined PHYSFS_SUPPORTS_MIX) &__PHYSFS_ArchiveInfo_MIX, #endif - NULL }; @@ -141,35 +108,27 @@ #if (defined PHYSFS_SUPPORTS_ZIP) &__PHYSFS_Archiver_ZIP, #endif - #if (defined PHYSFS_SUPPORTS_7Z) &__PHYSFS_Archiver_LZMA, #endif - #if (defined PHYSFS_SUPPORTS_GRP) &__PHYSFS_Archiver_GRP, #endif - #if (defined PHYSFS_SUPPORTS_QPAK) &__PHYSFS_Archiver_QPAK, #endif - #if (defined PHYSFS_SUPPORTS_HOG) &__PHYSFS_Archiver_HOG, #endif - #if (defined PHYSFS_SUPPORTS_MVL) &__PHYSFS_Archiver_MVL, #endif - #if (defined PHYSFS_SUPPORTS_WAD) &__PHYSFS_Archiver_WAD, #endif - #if (defined PHYSFS_SUPPORTS_MIX) &__PHYSFS_Archiver_MIX, #endif - &__PHYSFS_Archiver_DIR, NULL }; From DONOTREPLY at icculus.org Sat Mar 10 01:26:11 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 10 Mar 2007 01:26:11 -0500 Subject: r809 - trunk/archivers Message-ID: <20070310062611.30641.qmail@icculus.org> Author: icculus Date: 2007-03-10 01:26:11 -0500 (Sat, 10 Mar 2007) New Revision: 809 Modified: trunk/archivers/lzma.c Log: Patched to compile. Modified: trunk/archivers/lzma.c =================================================================== --- trunk/archivers/lzma.c 2007-03-10 06:24:56 UTC (rev 808) +++ trunk/archivers/lzma.c 2007-03-10 06:26:11 UTC (rev 809) @@ -289,7 +289,9 @@ /* Only decompress the folder if it is not allready cached */ if (entry->archive->folder[entry->folderIndex].cache == NULL) - if (lzma_err(SzExtract( + { + size_t tmpsize = entry->archive->folder[entry->folderIndex].size; + int rc = lzma_err(SzExtract( &entry->archive->stream.InStream, /* compressed data */ &entry->archive->db, entry->fileIndex, @@ -298,14 +300,17 @@ /* Cache for decompressed folder, allocated/freed by SzExtract */ &entry->archive->folder[entry->folderIndex].cache, /* Size of cache, will be changed by SzExtract */ - &entry->archive->folder[entry->folderIndex].size, + &tmpsize, /* Offset of this file inside the cache, set by SzExtract */ &entry->offset, &fileSize, /* Size of this file */ &allocImp, - &allocTempImp - )) != SZ_OK) + &allocTempImp)); + + entry->archive->folder[entry->folderIndex].size = tmpsize; + if (rc != SZ_OK) return -1; + } /* if */ /* Copy wanted bytes over from cache to outBuffer */ strncpy(outBuffer, From DONOTREPLY at icculus.org Sat Mar 10 01:32:53 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 10 Mar 2007 01:32:53 -0500 Subject: r810 - in trunk: . archivers extras lzma platform test zlib123 Message-ID: <20070310063253.932.qmail@icculus.org> Author: icculus Date: 2007-03-10 01:32:52 -0500 (Sat, 10 Mar 2007) New Revision: 810 Added: trunk/CMakeLists.txt Removed: trunk/Makefile.am.newautomake trunk/Makefile.am.oldautomake trunk/PBProjects/ trunk/archivers/Makefile.am trunk/bootstrap trunk/configure.in trunk/extras/Makefile.am trunk/lzma/Makefile.am trunk/physfs.dsp trunk/physfs.vcproj trunk/physfs_static.dsp trunk/platform/Makefile.am trunk/test/Makefile.am trunk/test_physfs.dsp trunk/test_physfs.vcproj trunk/zlib123/Makefile.am Modified: trunk/ trunk/CHANGELOG trunk/TODO trunk/archivers/lzma.c Log: Moved to CMake! Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - physfs_static_debug physfs_static_release depcomp Makefile .deps .libs aclocal.m4 config.status ltmain.sh configure libtool physfs.lo config.guess install-sh config.log config.sub missing stamp-h mkinstalldirs config.h Makefile.in config.h.in libphysfs.la stamp-h.in stamp-h1 physfs_byteorder.lo ltconfig inftrees.lo trees.lo uncompr.lo zutil.lo infcodes.lo unzip.lo inflate.lo adler32.lo posix.lo infblock.lo compress.lo dir.lo inffast.lo grp.lo test_physfs unix.lo crc32.lo zip.lo infutil.lo deflate.lo beos.lo Makefile.am config.cache autom4te.cache configure.lineno physfs.spec docs + physfs.spec docs PhysicsFS.xcodeproj PhysicsFS.build build Debug Release CMakeScripts CMakeOutput.log CMakeCache.txt cmake_install.cmake test_physfs CMakeTmp CMakeFiles Makefile *.so *.dylib *.dll *.exe Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/CHANGELOG 2007-03-10 06:32:52 UTC (rev 810) @@ -6,7 +6,7 @@ Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC code to expect UTF-8 strings from the higher level. Changed PHYSFS_SUPPORTS_LZMA to PHYSFS_SUPPORTS_7Z. Killed some #ifdefs - in physfs.c. + in physfs.c. Moved to CMake...so long, autotools! 11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work. Minor BeOS realpath tweak. 09272006 - Reworked 7zip archiver (thanks, Dennis!). Added: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt (rev 0) +++ trunk/CMakeLists.txt 2007-03-10 06:32:52 UTC (rev 810) @@ -0,0 +1,296 @@ +# PhysicsFS; a portable, flexible file i/o abstraction. +# Copyright (C) 2007 Ryan C. Gordon. +# +# Please see the file LICENSE in the source's root directory. + +PROJECT(PhysicsFS) +SET(PHYSFS_VERSION 1.1.2) + +# I hate that they define "WIN32" ... we're about to move to Win64...I hope! +IF(WIN32 AND NOT WINDOWS) + SET(WINDOWS TRUE) +ENDIF(WIN32 AND NOT WINDOWS) + +# Bleh, let's do it for "APPLE" too. +IF(APPLE AND NOT MACOSX) + SET(MACOSX TRUE) +ENDIF(APPLE AND NOT MACOSX) + +INCLUDE(CheckIncludeFile) +INCLUDE(CheckLibraryExists) +INCLUDE(CheckCSourceCompiles) + +INCLUDE_DIRECTORIES(.) +#INCLUDE_DIRECTORIES(platform) +#INCLUDE_DIRECTORIES(archivers) + +# Fallback to older Mac OS X on PowerPC to support a wider range of systems... +IF(MACOSX) + IF(CMAKE_OSX_ARCHITECTURES MATCHES ppc) + ADD_DEFINITIONS(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -fno-common) + SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-mmacosx-version-min=10.2 -framework Carbon -framework IOKit") + ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES ppc) +ENDIF(MACOSX) + +# Add some gcc-specific command lines. +IF(CMAKE_COMPILER_IS_GNUCC) + # Always build with debug symbols...you can strip it later. + ADD_DEFINITIONS(-g -pipe -Wall -Werror -fsigned-char) + + CHECK_C_SOURCE_COMPILES(" + #if ((defined(__GNUC__)) && (__GNUC__ >= 4)) + int main(int argc, char **argv) { int is_gcc4 = 1; return 0; } + #else + #error This is not gcc4. + #endif + " PHYSFS_IS_GCC4) + + IF(PHYSFS_IS_GCC4) + ADD_DEFINITIONS(-fvisibility=hidden) + ENDIF(PHYSFS_IS_GCC4) +ENDIF(CMAKE_COMPILER_IS_GNUCC) + + +# Basic chunks of source code ... + +SET(ZLIB_SRCS + zlib123/adler32.c + zlib123/compress.c + zlib123/crc32.c + zlib123/deflate.c + zlib123/gzio.c + zlib123/infback.c + zlib123/inffast.c + zlib123/inflate.c + zlib123/inftrees.c + zlib123/trees.c + zlib123/uncompr.c + zlib123/zutil.c +) + +SET(LZMA_SRCS + lzma/7zBuffer.c + lzma/7zCrc.c + lzma/7zDecode.c + lzma/7zExtract.c + lzma/7zHeader.c + lzma/7zIn.c + lzma/7zItem.c + lzma/7zMethodID.c + lzma/LzmaDecode.c + lzma/LzmaStateDecode.c +) + +SET(PHYSFS_SRCS + physfs.c + physfs_byteorder.c + physfs_unicode.c + archivers/dir.c +) + + +# platform layers ... + +IF(UNIX) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/posix.c) + IF(BEOS) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/beos.cpp) + SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) + ELSE(BEOS) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/unix.c) + # !!! FIXME + # AC_DEFINE([PHYSFS_HAVE_LLSEEK], 1, [define if we have llseek]) + CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H) + IF(HAVE_UCRED_H) + ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_UCRED_H=1) + SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) + ENDIF(HAVE_UCRED_H) + + CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H) + IF(HAVE_MNTENT_H) + ADD_DEFINITIONS(-DPHYSFS_HAVE_MNTENT_H=1) + SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) + ENDIF(HAVE_MNTENT_H) + ENDIF(BEOS) + + 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(UNIX) + +IF(WINDOWS) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/windows.c) + SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) + SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE) + # !!! FIXME: platform/pocketpc.c ... ? +ENDIF(WINDOWS) + +IF(NOT PHYSFS_HAVE_CDROM_SUPPORT) + ADD_DEFINITIONS(-DPHYSFS_NO_CDROM_SUPPORT=1) + MESSAGE(WARNING " ***") + MESSAGE(WARNING " *** There is no CD-ROM support in this build!") + MESSAGE(WARNING " *** PhysicsFS will just pretend there are no discs.") + MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,") + MESSAGE(WARNING " *** but is this what you REALLY wanted?") + MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)") + MESSAGE(WARNING " ***") +ENDIF(NOT PHYSFS_HAVE_CDROM_SUPPORT) + +IF(PHYSFS_HAVE_THREAD_SUPPORT) + ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE) +ELSE(PHYSFS_HAVE_THREAD_SUPPORT) + MESSAGE(WARNING " ***") + MESSAGE(WARNING " *** There is no thread support in this build!") + MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!") + MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,") + MESSAGE(WARNING " *** but is this what you REALLY wanted?") + MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)") + MESSAGE(WARNING " ***") +ENDIF(PHYSFS_HAVE_THREAD_SUPPORT) + +# Archivers ... + +OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE) +IF(PHYSFS_ARCHIVE_ZIP) + ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/zip.c) + SET(PHYSFS_NEED_ZLIB TRUE) +ENDIF(PHYSFS_ARCHIVE_ZIP) + +OPTION(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE) +IF(PHYSFS_ARCHIVE_7Z) + ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_7Z=1) + # !!! FIXME: rename to 7z.c? + SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS} archivers/lzma.c) + INCLUDE_DIRECTORIES(lzma) + ADD_DEFINITIONS(-D_LZMA_IN_CB=1) + ADD_DEFINITIONS(-D_LZMA_PROB32=1) + ADD_DEFINITIONS(-D_LZMA_SYSTEM_SIZE_T=1) + ADD_DEFINITIONS(-D_SZ_ONE_DIRECTORY=1) +ENDIF(PHYSFS_ARCHIVE_7Z) + +OPTION(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE) +IF(PHYSFS_ARCHIVE_GRP) + ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_GRP=1) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/grp.c) +ENDIF(PHYSFS_ARCHIVE_GRP) + +OPTION(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE) +IF(PHYSFS_ARCHIVE_WAD) + ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_WAD=1) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/wad.c) +ENDIF(PHYSFS_ARCHIVE_WAD) + +OPTION(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE) +IF(PHYSFS_ARCHIVE_HOG) + ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_HOG=1) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/hog.c) +ENDIF(PHYSFS_ARCHIVE_HOG) + +OPTION(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE) +IF(PHYSFS_ARCHIVE_MVL) + ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MVL=1) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/mvl.c) +ENDIF(PHYSFS_ARCHIVE_MVL) + +OPTION(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE) +IF(PHYSFS_ARCHIVE_QPAK) + ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_QPAK=1) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/qpak.c) +ENDIF(PHYSFS_ARCHIVE_QPAK) + +OPTION(PHYSFS_ARCHIVE_MIX "Enable Westwood MIX support" FALSE) +IF(PHYSFS_ARCHIVE_MIX) + ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MIX=1) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/mix.c) +ENDIF(PHYSFS_ARCHIVE_MIX) + + +# 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) + + IF(HAVE_SYSTEM_ZLIB) + 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) + + 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) + ENDIF(PHYSFS_INTERNAL_ZLIB) +ENDIF(PHYSFS_NEED_ZLIB) + + + +ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS}) +TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) + +OPTION(PHYSFS_BUILD_TEST "Build 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) + SET(HAVE_SYSTEM_READLINE TRUE) + SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} " " readline curses) + ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1) + ENDIF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY) + ENDIF(HAVE_READLINE_H AND HAVE_HISTORY_H) + ADD_EXECUTABLE(test_physfs test/test_physfs.c) + TARGET_LINK_LIBRARIES(test_physfs physfs ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS}) +ENDIF(PHYSFS_BUILD_TEST) + +FIND_PACKAGE(Doxygen) +IF(DOXYGEN_FOUND) + ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} COMMENT "Building documentation") +ELSE(DOXYGEN_FOUND) + MESSAGE(STATUS "Doxygen not found. You won't be able to build documentation.") +ENDIF(DOXYGEN_FOUND) + + +MACRO(MESSAGE_BOOL_OPTION _NAME _VALUE) + IF(${_VALUE}) + MESSAGE(STATUS " ${_NAME}: enabled") + ELSE(${_VALUE}) + MESSAGE(STATUS " ${_NAME}: disabled") + ENDIF(${_VALUE}) +ENDMACRO(MESSAGE_BOOL_OPTION) + +MESSAGE(STATUS "PhysicsFS will build with the following options:") +MESSAGE_BOOL_OPTION("ZIP support" PHYSFS_ARCHIVE_ZIP) +MESSAGE_BOOL_OPTION("7zip support" PHYSFS_ARCHIVE_7Z) +MESSAGE_BOOL_OPTION("GRP support" PHYSFS_ARCHIVE_GRP) +MESSAGE_BOOL_OPTION("WAD support" PHYSFS_ARCHIVE_WAD) +MESSAGE_BOOL_OPTION("HOG support" PHYSFS_ARCHIVE_HOG) +MESSAGE_BOOL_OPTION("MVL support" PHYSFS_ARCHIVE_MVL) +MESSAGE_BOOL_OPTION("QPAK support" PHYSFS_ARCHIVE_QPAK) +MESSAGE_BOOL_OPTION("MIX support" PHYSFS_ARCHIVE_MIX) +MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT) +MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT) +MESSAGE_BOOL_OPTION("Build own zlib" PHYSFS_INTERNAL_ZLIB) +MESSAGE_BOOL_OPTION("Build test program" PHYSFS_BUILD_TEST) +IF(PHYSFS_BUILD_TEST) + MESSAGE_BOOL_OPTION(" Use readline in test program" HAVE_SYSTEM_READLINE) +ENDIF(PHYSFS_BUILD_TEST) + +# end of CMakeLists.txt ... + Deleted: trunk/Makefile.am.newautomake =================================================================== --- trunk/Makefile.am.newautomake 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/Makefile.am.newautomake 2007-03-10 06:32:52 UTC (rev 810) @@ -1,169 +0,0 @@ -lib_LTLIBRARIES = libphysfs.la - -libphysfsincludedir = $(includedir) -libphysfsinclude_HEADERS = \ - physfs.h - -if BUILD_MACOSX - -ZLIB_FILES = zlib123/adler32.c \ - zlib123/compress.c \ - zlib123/crc32.c \ - zlib123/crc32.h \ - zlib123/deflate.c \ - zlib123/deflate.h \ - zlib123/gzio.c \ - zlib123/infback.c \ - zlib123/inffast.c \ - zlib123/inffast.h \ - zlib123/inffixed.h \ - zlib123/inflate.c \ - zlib123/inflate.h \ - zlib123/inftrees.c \ - zlib123/inftrees.h \ - zlib123/trees.c \ - zlib123/trees.h \ - zlib123/uncompr.c \ - zlib123/zconf.h \ - zlib123/zlib.h \ - zlib123/zutil.c \ - zlib123/zutil.h - - -if BUILD_ZLIB - ZLIB_SRC = $(ZLIB_FILES) - ZLIB_INC = -I$(top_srcdir)/zlib123 - ZLIB_EXTRADIST = -else - ZLIB_SRC = - ZLIB_INC = - ZLIB_EXTRADIST = $(ZLIB_FILES) -endif - -libphysfs_la_SOURCES = \ - physfs.c \ - physfs_internal.h \ - physfs_byteorder.c \ - archivers/dir.c \ - archivers/grp.c \ - archivers/wad.c \ - archivers/hog.c \ - archivers/mvl.c \ - archivers/zip.c \ - archivers/qpak.c \ - archivers/mix.c \ - platform/unix.c \ - platform/posix.c \ - $(ZLIB_SRC) - -libphysfs_la_INCLUDES = $(ZLIB_INC) - -libphysfs_la_LDFLAGS = \ - -release $(LT_RELEASE) \ - -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) - - -if BUILD_TEST_PHYSFS -bin_PROGRAMS = test_physfs -test_physfs_INCLUDES = -I$(top_srcdir) -test_physfs_LDADD = $(top_srcdir)/libphysfs.la -test_physfs_SOURCES = test/test_physfs.c -TEST_EXTRADIST = -else -TEST_EXTRADIST = test/test_physfs.c -endif - - -EXTRA_DIST = \ - CREDITS \ - LICENSE \ - CHANGELOG \ - INSTALL \ - TODO \ - Doxyfile \ - CWProjects.sit \ - physfs.spec \ - physfs.dsp \ - test_physfs.dsp \ - physfs_static.dsp \ - physfs.vcproj \ - test_physfs.vcproj \ - platform/skeleton.c \ - platform/macclassic.c \ - platform/win32.c \ - platform/beos.cpp \ - platform/os2.c \ - extras/physfsrwops.h \ - extras/physfsrwops.c \ - extras/physfshttpd.c \ - Makefile.am.oldautomake \ - Makefile.am.newautomake \ - zlib_license_change.txt \ - makeos2.cmd \ - PBProjects \ - $(ZLIB_EXTRADIST) $(BEOS_EXTRADIST) $(TEST_EXTRADIST) - -else - -SUBDIRS = platform archivers zlib123 lzma . test extras - -libphysfs_la_SOURCES = \ - physfs.c \ - physfs_internal.h \ - physfs_unicode.c \ - physfs_byteorder.c - -if BUILD_ZLIB -ZLIB_LIB = zlib123/libz.la -else -ZLIB_LIB = -endif - -if BUILD_LZMA -LZMA_LIB = lzma/liblzma.la -else -LZMA_LIB = -endif - -libphysfs_la_LDFLAGS = \ - -release $(LT_RELEASE) \ - -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -libphysfs_la_LIBADD = \ - archivers/libarchivers.la \ - platform/libplatform.la \ - $(ZLIB_LIB) \ - $(LZMA_LIB) - -EXTRA_DIST = \ - CREDITS \ - LICENSE \ - CHANGELOG \ - INSTALL \ - TODO \ - Doxyfile \ - PBProjects \ - CWProjects.sit \ - physfsMPW.make \ - physfs.spec.in \ - physfs.spec \ - physfs.dsp \ - test_physfs.dsp \ - physfs_static.dsp \ - physfs.vcproj \ - test_physfs.vcproj \ - zlib_license_change.txt \ - makeos2.cmd - - -endif - - -dist-hook: - perl -w -pi -e 'chomp; $$_ .= "\r\n";' $(distdir)/*.dsp $(distdir)/*.vcproj - mkdir $(distdir)/docs - echo "Docs are generated with the program "Doxygen" (http://www.doxygen.org/)," >> $(distdir)/docs/README - echo " or can be read online at http://icculus.org/physfs/docs/" >> $(distdir)/docs/README - echo >> $(distdir)/docs/README - rm -rf `find $(distdir) -name "CVS" -type d` - rm -rf `find $(distdir) -name ".svn" -type d` - Deleted: trunk/Makefile.am.oldautomake =================================================================== --- trunk/Makefile.am.oldautomake 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/Makefile.am.oldautomake 2007-03-10 06:32:52 UTC (rev 810) @@ -1,56 +0,0 @@ -lib_LTLIBRARIES = libphysfs.la - -SUBDIRS = platform archivers zlib123 . test extras - -libphysfsincludedir = $(includedir) -libphysfsinclude_HEADERS = \ - physfs.h - -libphysfs_la_SOURCES = \ - physfs.c \ - physfs_internal.h \ - physfs_unicode.c \ - physfs_byteorder.c - -if BUILD_ZLIB -ZLIB_LIB = zlib123/libz.la -else -ZLIB_LIB = -endif - -libphysfs_la_LDFLAGS = \ - -release $(LT_RELEASE) \ - -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -libphysfs_la_LIBADD = \ - archivers/libarchivers.la \ - platform/libplatform.la \ - $(ZLIB_LIB) - -EXTRA_DIST = \ - CREDITS \ - LICENSE \ - CHANGELOG \ - INSTALL \ - TODO \ - Doxyfile \ - PBProjects \ - CWProjects.sit \ - physfsMPW.make \ - physfs.spec.in \ - physfs.spec \ - physfs.dsp \ - physfs_static.dsp \ - test_physfs.dsp \ - physfs.vcproj \ - test_physfs.vcproj \ - zlib_license_change.txt \ - makeos2.cmd - -dist-hook: - perl -w -pi -e 'chomp; $$_ .= "\r\n";' $(distdir)/*.dsp $(distdir)/*.vcproj - mkdir $(distdir)/docs - echo "Docs are generated with the program "Doxygen" (http://www.doxygen.org/)," >> $(distdir)/docs/README - echo " or can be read online at http://icculus.org/physfs/docs/" >> $(distdir)/docs/README - echo >> $(distdir)/docs/README - rm -rf `find $(distdir) -name "CVS" -type d` - rm -rf `find $(distdir) -name ".svn" -type d` Modified: trunk/TODO =================================================================== --- trunk/TODO 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/TODO 2007-03-10 06:32:52 UTC (rev 810) @@ -59,7 +59,6 @@ - Is -Wall enabled? - Make mutexes recursive, so callbacks can call into the API. - Archivers need abstracted i/o to read from memory or files (archives in archives?) -- Move to CMake. // end of TODO ... Deleted: trunk/archivers/Makefile.am =================================================================== --- trunk/archivers/Makefile.am 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/archivers/Makefile.am 2007-03-10 06:32:52 UTC (rev 810) @@ -1,22 +0,0 @@ -noinst_LTLIBRARIES = libarchivers.la - -INCLUDES = -I$(top_srcdir) - -if BUILD_ZLIB -INCLUDES += -I$(top_srcdir)/zlib123 -endif - -if BUILD_LZMA -INCLUDES += -I$(top_srcdir)/lzma -endif - -libarchivers_la_SOURCES = \ - dir.c \ - grp.c \ - wad.c \ - hog.c \ - mvl.c \ - zip.c \ - lzma.c \ - qpak.c \ - mix.c Modified: trunk/archivers/lzma.c =================================================================== --- trunk/archivers/lzma.c 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/archivers/lzma.c 2007-03-10 06:32:52 UTC (rev 810) @@ -21,21 +21,25 @@ #define __PHYSICSFS_INTERNAL__ #include "physfs_internal.h" - +#ifndef _LZMA_IN_CB #define _LZMA_IN_CB /* Use callback for input data */ +#endif /* #define _LZMA_OUT_READ */ /* Use read function for output data */ +#ifndef _LZMA_PROB32 #define _LZMA_PROB32 /* It can increase speed on some 32-bit CPUs, but memory usage will be doubled in that case */ +#endif +#ifndef _LZMA_SYSTEM_SIZE_T #define _LZMA_SYSTEM_SIZE_T /* Use system's size_t. You can use it to enable 64-bit sizes supporting */ +#endif - #include "7zIn.h" #include "7zCrc.h" #include "7zExtract.h" Deleted: trunk/bootstrap =================================================================== --- trunk/bootstrap 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/bootstrap 2007-03-10 06:32:52 UTC (rev 810) @@ -1,22 +0,0 @@ -#!/bin/sh - -set -e -echo "Initial preparation...this can take awhile, so sit tight..." -rm -f Makefile.am -perl -w -e 'use File::Copy; exit 0 if (-f "Makefile.am"); my $x = `automake --version |head -n 1`; chomp($x); $x = 0.0 if ($x !~ s/\A.*?(\d+\.\d+).*\Z/$1/); if ($x < 1.5) { copy("./Makefile.am.oldautomake", "./Makefile.am"); } else { copy("./Makefile.am.newautomake", "./Makefile.am"); }' -aclocal - -# MacOS X renames GNU libtool to "glibtool", since they have something -# else called "libtool" already... -if [ -x /usr/bin/glibtoolize ]; then - glibtoolize --automake --copy --force -else - libtoolize --automake --copy --force -fi - -autoheader -automake --foreign --add-missing --copy -autoconf - -echo "You are now ready to run ./configure ..." - Deleted: trunk/configure.in =================================================================== --- trunk/configure.in 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/configure.in 2007-03-10 06:32:52 UTC (rev 810) @@ -1,598 +0,0 @@ -# Process this file with autoconf to produce a configure script. -AC_INIT(physfs.c) - -dnl --------------------------------------------------------------------- -dnl System/version info -dnl --------------------------------------------------------------------- - -# Making releases: -# MICRO_VERSION += 1; -# INTERFACE_AGE += 1; -# BINARY_AGE += 1; -# if any functions have been added, set INTERFACE_AGE to 0. -# if backwards compatibility has been broken, -# set BINARY_AGE and INTERFACE_AGE to 0. - -MAJOR_VERSION=1 -MINOR_VERSION=0 -MICRO_VERSION=1 -INTERFACE_AGE=1 -BINARY_AGE=1 -VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION - -AC_SUBST(MAJOR_VERSION) -AC_SUBST(MINOR_VERSION) -AC_SUBST(MICRO_VERSION) -AC_SUBST(INTERFACE_AGE) -AC_SUBST(BINARY_AGE) -AC_SUBST(VERSION) - -# libtool versioning -LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION -LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE` -LT_REVISION=$INTERFACE_AGE -LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE` - -AC_SUBST(LT_RELEASE) -AC_SUBST(LT_CURRENT) -AC_SUBST(LT_REVISION) -AC_SUBST(LT_AGE) - -dnl Detect the canonical host and target build environment -AC_CANONICAL_SYSTEM - -dnl Setup for automake -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(physfs, $VERSION) - - -dnl --------------------------------------------------------------------- -dnl Compilers and other tools -dnl --------------------------------------------------------------------- - -AC_PROG_CC -AC_PROG_CXX -AC_PROG_INSTALL -AC_PROG_LN_S -AC_LIBTOOL_WIN32_DLL -LIBTOOL="libtool" -AM_PROG_LIBTOOL -AC_CHECK_PROG(we_have_sed, sed, yes, no) - -dnl --------------------------------------------------------------------- -dnl Debug mode? -dnl --------------------------------------------------------------------- - -AC_ARG_ENABLE(debug, -[ --enable-debug enable debug mode [default=no]], - , enable_debug=no) -if test x$enable_debug = xyes; then - if test x$ac_cv_prog_cc_g = xyes; then - PHYSFSCFLAGS="$PHYSFSCFLAGS -g -O0" - else - PHYSFSCFLAGS="$PHYSFSCFLAGS -O0" - fi - PHYSFSCFLAGS="$PHYSFSCFLAGS -Werror -Wall" - AC_DEFINE([DEBUG], 1, [define if debug build is enabled]) - AC_DEFINE([DEBUG_CHATTER], 1, [define if debug chatter is enabled]) -else - PHYSFSCFLAGS="$PHYSFSCFLAGS -O2" - AC_DEFINE([NDEBUG], 1, [define if debug build is disabled]) -fi - - -dnl --------------------------------------------------------------------- -dnl Have GCC's -fvisibility option? -dnl --------------------------------------------------------------------- -AC_MSG_CHECKING(for GCC -fvisibility=hidden option) -have_gcc_fvisibility=no -visibility_CFLAGS="-fvisibility=hidden" -save_CFLAGS="$CFLAGS" -CFLAGS="$save_CFLAGS $visibility_CFLAGS" -AC_TRY_COMPILE([ -int placeholder = 1; -],[ -],[ -have_gcc_fvisibility=yes -]) -AC_MSG_RESULT($have_gcc_fvisibility) -CFLAGS="$save_CFLAGS" - -if test x$have_gcc_fvisibility = xyes; then - PHYSFSCFLAGS="$PHYSFSCFLAGS $visibility_CFLAGS" -fi - - -dnl --------------------------------------------------------------------- -dnl Profile sorts, etc? -dnl --------------------------------------------------------------------- - -AC_ARG_ENABLE(profiling, -[ --enable-profiling do algorithm profiling [default=no]], - , enable_profiling=no) -if test x$enable_profiling = xyes; then - AC_DEFINE([PHYSFS_PROFILING], 1, [define to profile sorting, etc algorithms]) -fi - - -dnl --------------------------------------------------------------------- -dnl Build test program? -dnl --------------------------------------------------------------------- - -AC_ARG_ENABLE(testprog, -[ --enable-testprog build test program [default=yes]], - , enable_testprog=yes) - -dnl --------------------------------------------------------------------- -dnl Checks for libraries. -dnl --------------------------------------------------------------------- - -require_zlib="no" - -dnl Check for zip archiver inclusion... -AC_ARG_ENABLE(zip, -[ --enable-zip enable ZIP support [default=yes]], - , enable_zip=yes) -if test x$enable_zip = xyes; then - AC_DEFINE([PHYSFS_SUPPORTS_ZIP], 1, [define if zip support is enabled]) - require_zlib="yes" -fi - - -require_lzma="no" - -dnl Check for lzma archiver inclusion... -AC_ARG_ENABLE(lzma, -[ --enable-lzma enable lzma support [default=yes]], - , enable_lzma=yes) -if test x$enable_lzma = xyes; then - AC_DEFINE([PHYSFS_SUPPORTS_LZMA], 1, [define if lzma support is enabled]) - require_lzma="yes" -fi - - -dnl Check for grp archiver inclusion... -AC_ARG_ENABLE(grp, -[ --enable-grp enable Build Engine GRP support [default=yes]], - , enable_grp=yes) -if test x$enable_grp = xyes; then - AC_DEFINE([PHYSFS_SUPPORTS_GRP], 1, [define if grp support is enabled]) -fi - -dnl Check for wad archiver inclusion... -AC_ARG_ENABLE(wad, -[ --enable-wad enable Doom WAD support [default=yes]], - , enable_wad=yes) -if test x$enable_wad = xyes; then - AC_DEFINE([PHYSFS_SUPPORTS_WAD], 1, [define if wad support is enabled]) -fi - -dnl Check for hog archiver inclusion... -AC_ARG_ENABLE(hog, -[ --enable-hog enable Descent I/II HOG support [default=yes]], - , enable_hog=yes) -if test x$enable_hog = xyes; then - AC_DEFINE([PHYSFS_SUPPORTS_HOG], 1, [define if hog support is enabled]) -fi - - -dnl Check for mvl archiver inclusion... -AC_ARG_ENABLE(mvl, -[ --enable-mvl enable Descent II MVL support [default=yes]], - , enable_mvl=yes) -if test x$enable_mvl = xyes; then - AC_DEFINE([PHYSFS_SUPPORTS_MVL], 1, [define if mvl support is enabled]) -fi - - -dnl Check for qpak archiver inclusion... -AC_ARG_ENABLE(qpak, -[ --enable-qpak enable Quake PAK support [default=yes]], - , enable_qpak=yes) -if test x$enable_qpak = xyes; then - AC_DEFINE([PHYSFS_SUPPORTS_QPAK], 1, [define if qpak support is enabled]) -fi - -dnl Check for mix archiver inclusion... -AC_ARG_ENABLE(mix, -[ --enable-mix enable Westwood MIX support [default=no]], - , enable_mix=no) -if test x$enable_mix = xyes; then - AC_DEFINE([PHYSFS_SUPPORTS_MIX], 1, [define if mix support is enabled]) -fi - - -dnl Check if we should statically link the included zlib... -AC_ARG_ENABLE(internal-zlib, -[ --enable-internal-zlib use included zlib [default=only if needed]], - , enable_internal_zlib=maybe) - -dnl Check for zlib if needed. -have_external_zlib="no" -if test x$enable_internal_zlib != xyes; then - if test x$require_zlib = xyes; then - AC_CHECK_HEADER(zlib.h, have_zlib_hdr=yes) - AC_CHECK_LIB(z, zlibVersion, have_zlib_lib=yes) - if test x$have_zlib_hdr = xyes -a x$have_zlib_lib = xyes; then - have_external_zlib="yes" - fi - fi -fi - -AC_MSG_CHECKING([what zlib to use]) - -dnl no zlib is needed at all if we aren't supporting ZIP files. -if test x$require_zlib = xno; then - enable_internal_zlib="no" - enable_external_zlib="no" - AC_MSG_RESULT([no zlib needed]) -else - - if test x$enable_internal_zlib = xmaybe; then - if test x$have_external_zlib = xyes; then - enable_internal_zlib="no" - enable_external_zlib="yes" - else - enable_internal_zlib="yes" - enable_external_zlib="no" - fi - else - if test x$enable_internal_zlib = xno -a x$have_external_zlib = xyes; then - enable_internal_zlib="no" - enable_external_zlib="yes" - fi - fi - - if test x$enable_internal_zlib = xyes; then - AC_MSG_RESULT([internal zlib]) - PHYSFSCFLAGS="$PHYSFSCFLAGS -DZ_PREFIX" - else - if test x$enable_external_zlib = xyes; then - AC_MSG_RESULT([external zlib]) - LIBS="$LIBS -lz" - else - AC_MSG_ERROR([Need zlib, but you disabled our copy and have no system lib]) - fi - fi -fi - - -dnl determine if we should include readline support... -AC_ARG_ENABLE(readline, -[ --enable-readline use GNU readline in test program [default=yes]], - , enable_readline=yes) - -if test x$enable_readline = xyes; then - AC_CHECK_HEADER(readline/readline.h, have_readline_hdr=yes) - AC_CHECK_LIB(readline, readline, have_readline_lib=yes, , -lcurses) - AC_CHECK_HEADER(readline/history.h, have_history_hdr=yes) - AC_CHECK_LIB(readline, add_history, have_history_lib=yes, , -lcurses) - if test x$have_readline_hdr = xyes -a x$have_readline_lib = xyes; then - if test x$have_history_hdr = xyes -a x$have_history_lib = xyes; then - AC_DEFINE([PHYSFS_HAVE_READLINE], 1, [define if we have readline]) - have_readline="yes" - fi - fi -fi - -dnl !!! FIXME: Not sure how to detect this... -dnl check for 64-bit llseek()... -dnl AC_CHECK_LIB(c, llseek, have_llseek=yes) -if test x$have_llseek = xyes; then - AC_DEFINE([PHYSFS_HAVE_LLSEEK], 1, [define if we have llseek]) -fi - - -dnl determine if we should use the stubbed pthread code. -AC_ARG_ENABLE(pthreads, -[ --enable-pthreads include POSIX threads support [default=yes]], - , enable_pthreads=yes) -if test x$enable_pthreads = xyes; then - AC_CHECK_HEADER(pthread.h, have_pthread_hdr=yes) - if test x$have_pthread_hdr != xyes; then - enable_pthreads=no - fi -fi - -dnl determine if we should use the stubbed CD-ROM detection code. -AC_ARG_ENABLE(cdrom, -[ --enable-cdrom include CD-ROM support [default=yes]], - , enable_cdrom=yes) - -if test x$enable_cdrom = xyes; then - dnl reset this and let header detection reenable... - enable_cdrom=no - - dnl BSD systems use sys/ucred.h for getting mounted volumes. - dnl Linux and others use mntent.h. - AC_CHECK_HEADER(sys/ucred.h, have_ucred_hdr=yes) - if test x$have_ucred_hdr = xyes; then - AC_DEFINE([PHYSFS_HAVE_SYS_UCRED_H], 1, [define if we have sys/ucred.h]) - enable_cdrom=yes - fi - - AC_CHECK_HEADER(mntent.h, have_mntent_hdr=yes) - if test x$have_mntent_hdr = xyes; then - AC_DEFINE([PHYSFS_HAVE_MNTENT_H], 1, [define if we have mntent.h]) - enable_cdrom=yes - fi -fi - -dnl determine language. -AC_ARG_ENABLE(language, -[ --enable-language=lang Select natural language. [default=english]], - physfslang=`echo $enable_language |tr A-Z a-z`, physfslang=english) - -AC_MSG_CHECKING([if language choice is supported]) -physfs_valid_lang=no - -if test x$physfslang = xenglish; then - physfs_valid_lang=yes - AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_ENGLISH, [define desired natural language]) -fi - -if test x$physfslang = xgerman; then - physfs_valid_lang=yes - AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_GERMAN, [define desired natural language]) -fi - -if test x$physfslang = xfrench; then - physfs_valid_lang=yes - AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_FRENCH, [define desired natural language]) -fi - -if test x$physfslang = xspanish; then - physfs_valid_lang=yes - AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_SPANISH, [define desired natural language]) -fi - -if test x$physfslang = xportuguese-br; then - physfs_valid_lang=yes - AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_PORTUGUESE_BR, [define desired natural language]) -fi - -if test x$physfslang = xrussian-koi8-r; then - physfs_valid_lang=yes - AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_KOI8_R, [define desired natural language]) -fi - -if test x$physfslang = xrussian-cp1251; then - physfs_valid_lang=yes - AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_CP866, [define desired natural language]) -fi - -if test x$physfslang = xrussian-cp866; then - physfs_valid_lang=yes - AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_CP866, [define desired natural language]) -fi - -if test x$physfslang = xrussian-iso-8859-5; then - physfs_valid_lang=yes - AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_RUSSIAN_ISO_8859_5, [define desired natural language]) -fi - -if test x$physfslang = xportuguese-br; then - physfs_valid_lang=yes - AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_PORTUGUESE_BR, [define desired natural language]) -fi - -dnl Add other language checks here... - - -AC_MSG_RESULT([$physfs_valid_lang]) -if test x$physfs_valid_lang = xno; then - AC_MSG_WARN([***]) - AC_MSG_WARN([*** You've asked for "$physfslang" language support...]) - AC_MSG_WARN([*** ...but we don't support that.]) - AC_MSG_WARN([*** You could choose another language,]) - AC_MSG_WARN([*** but is this what you REALLY wanted?]) - AC_MSG_WARN([*** Please see the LANG section of physfs_internal.h]) - AC_MSG_WARN([*** for info on writing a translation.]) - AC_MSG_WARN([***]) - AC_MSG_WARN([*** Currently known languages:]) - AC_MSG_WARN([*** --enable-language=english]) - AC_MSG_WARN([*** --enable-language=spanish]) - AC_MSG_WARN([*** --enable-language=german]) - AC_MSG_WARN([*** --enable-language=french]) - AC_MSG_WARN([*** --enable-language=spanish]) - AC_MSG_WARN([*** --enable-language=portuguese-br]) - AC_MSG_WARN([*** --enable-language=russian-koi8-r]) - AC_MSG_WARN([*** --enable-language=russian-cp1251]) - AC_MSG_WARN([*** --enable-language=russian-cp866]) - AC_MSG_WARN([*** --enable-language=russian-iso-8859-5]) - AC_MSG_WARN([*** --enable-language=portuguese-br]) - AC_MSG_WARN([***]) - AC_MSG_ERROR([*** unsupported language. stop.]) -fi - -have_non_posix_threads=no - -AC_MSG_CHECKING([if this is BeOS]) -if test x$target_os = xbeos; then - this_is_beos=yes - have_non_posix_threads=yes - enable_cdrom=yes - enable_pthreads=no - LIBS="$LIBS -lroot -lbe" -else - this_is_beos=no -fi - -AC_MSG_RESULT([$this_is_beos]) - -AC_MSG_CHECKING([if this is Cygwin]) -if test x$target_os = xcygwin; then - this_is_cygwin=yes - PHYSFSCFLAGS="$PHYSFSCFLAGS -DWIN32" - enable_cdrom=yes - enable_pthreads=no - have_non_posix_threads=yes -else - this_is_cygwin=no -fi -AC_MSG_RESULT([$this_is_cygwin]) - -AC_MSG_CHECKING([if this is mingw]) -if test x$target_os = xmingw32; then - this_is_mingw=yes -fi -if test x$target_os = xmingw32msvc; then - this_is_mingw=yes -fi -if test x$this_is_mingw = xyes; then - PHYSFSCFLAGS="$PHYSFSCFLAGS -DWIN32" - enable_cdrom=yes - enable_pthreads=no - have_non_posix_threads=yes -else - this_is_mingw=no -fi -AC_MSG_RESULT([$this_is_mingw]) - -this_is_macosx=no -if test x$we_have_sed = xyes; then - AC_MSG_CHECKING([if this is MacOS X]) - x=`echo $target_os |sed "s/darwin.*/darwin/"` - if test x$x = xdarwin -a x$target_vendor = xapple; then - this_is_macosx=yes - PHYSFSLDFLAGS="$PHYSFSLDFLAGS -Wl,-framework -Wl,Carbon -Wl,-framework -Wl,IOKit" - fi - - AC_MSG_RESULT([$this_is_macosx]) -fi - -this_is_freebsd=no -if test x$we_have_sed = xyes; then - AC_MSG_CHECKING([if this is FreeBSD]) - x=`echo $target_os |tr A-Z a-z |sed "s/.*freebsd.*/freebsd/"` - if test x$x = xfreebsd; then - this_is_freebsd=yes - PHYSFSLDFLAGS="$PHYSFSLDFLAGS -pthread" - fi - - AC_MSG_RESULT([$this_is_freebsd]) -fi - -this_is_openbsd=no -if test x$we_have_sed = xyes; then - AC_MSG_CHECKING([if this is OpenBSD]) - x=`echo $target_os |tr A-Z a-z |sed "s/.*openbsd.*/openbsd/"` - if test x$x = xopenbsd; then - this_is_openbsd=yes - PHYSFSLDFLAGS="$PHYSFSLDFLAGS -pthread" - fi - - AC_MSG_RESULT([$this_is_openbsd]) -fi - -this_is_atheos=no -if test x$we_have_sed = xyes; then - AC_MSG_CHECKING([if this is AtheOS]) - x=`echo $target_os |tr A-Z a-z |sed "s/.*atheos.*/atheos/"` - if test x$x = xatheos; then - this_is_atheos=yes - enable_cdrom=no - enable_pthreads=no - fi - - AC_MSG_RESULT([$this_is_atheos]) -fi - -this_is_os2=no -if test x$we_have_sed = xyes; then - AC_MSG_CHECKING([if this is OS/2]) - x=`echo $target_os |tr A-Z a-z |sed "s/.*os2.*/os2/"` - if test x$x = xos2; then - this_is_os2=yes - have_non_posix_threads=yes - enable_cdrom=yes - enable_pthreads=no - PHYSFSCFLAGS="$PHYSFSCFLAGS -DOS2" - fi - - AC_MSG_RESULT([$this_is_os2]) -fi - -this_is_mint=no -if test x$we_have_sed = xyes; then - AC_MSG_CHECKING([if this is MiNT]) - x=`echo $target_os |tr A-Z a-z |sed "s/.*mint.*/mint/"` - if test x$x = xmint; then - this_is_mint=yes - enable_cdrom=no - enable_pthreads=no - fi - - AC_MSG_RESULT([$this_is_mint]) -fi - - -dnl Some platform might disable this, so check this down here... -if test x$enable_cdrom != xyes; then - AC_DEFINE([PHYSFS_NO_CDROM_SUPPORT], 1, [define if we have no CD support]) - AC_MSG_WARN([***]) - AC_MSG_WARN([*** There is no CD-ROM support in this build!]) - AC_MSG_WARN([*** PhysicsFS will just pretend there are no discs.]) - AC_MSG_WARN([*** This may be fine, depending on how PhysicsFS is used,]) - AC_MSG_WARN([*** but is this what you REALLY wanted?]) - AC_MSG_WARN([*** (Maybe fix configure.in, or write a platform driver?)]) - AC_MSG_WARN([***]) -fi - -if test x$enable_pthreads != xyes; then - AC_DEFINE([PHYSFS_NO_PTHREADS_SUPPORT], 1, [define if we have no POSIX threads support]) - if test x$have_non_posix_threads != xyes; then - AC_MSG_WARN([***]) - AC_MSG_WARN([*** There is no thread support in this build!]) - AC_MSG_WARN([*** PhysicsFS will NOT be reentrant!]) - AC_MSG_WARN([*** This may be fine, depending on how PhysicsFS is used,]) - AC_MSG_WARN([*** but is this what you REALLY wanted?]) - AC_MSG_WARN([*** (Maybe fix configure.in, or write a platform driver?)]) - AC_MSG_WARN([***]) - fi -fi - - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([stdlib.h string.h assert.h]) - -# Checks for typedefs, structures, and compiler characteristics. -dnl AC_C_CONST -dnl AC_TYPE_SIZE_T - -# Checks for library functions. - -# This is only in the bleeding edge autoconf distro... -#AC_FUNC_MALLOC - -AC_FUNC_MEMCMP -AC_CHECK_FUNCS([memset strrchr]) - -AC_CHECK_SIZEOF(int, 4) - -CFLAGS="$PHYSFSCFLAGS $CFLAGS -D_REENTRANT -D_THREAD_SAFE" -LDFLAGS="$LDFLAGS $PHYSFSLDFLAGS -no-undefined" - -dnl Add Makefile conditionals -AM_CONDITIONAL(BUILD_ZLIB, test x$enable_internal_zlib = xyes) -AM_CONDITIONAL(BUILD_LZMA, test x$enable_lzma = xyes) -AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes) -AM_CONDITIONAL(BUILD_MACOSX, test x$this_is_macosx = xyes) -AM_CONDITIONAL(BUILD_BEOS, test x$this_is_beos = xyes) -AM_CONDITIONAL(BUILD_CYGWIN, test x$this_is_cygwin = xyes) -AM_CONDITIONAL(BUILD_READLINE, test x$have_readline = xyes) - -AC_OUTPUT([ -Makefile -archivers/Makefile -platform/Makefile -zlib123/Makefile -lzma/Makefile -test/Makefile -extras/Makefile -physfs.spec -]) - -dnl end of configure.in ... - Deleted: trunk/extras/Makefile.am =================================================================== --- trunk/extras/Makefile.am 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/extras/Makefile.am 2007-03-10 06:32:52 UTC (rev 810) @@ -1,13 +0,0 @@ -EXTRA_DIST = \ - physfsrwops.c \ - physfsrwops.h \ - abs-file.h \ - physfshttpd.c \ - globbing.h \ - globbing.c \ - selfextract.c \ - ignorecase.c \ - ignorecase.h \ - PhysFS.NET \ - physfs_rb - Deleted: trunk/lzma/Makefile.am =================================================================== --- trunk/lzma/Makefile.am 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/lzma/Makefile.am 2007-03-10 06:32:52 UTC (rev 810) @@ -1,6 +0,0 @@ -if BUILD_LZMA -noinst_LTLIBRARIES = liblzma.la -liblzma_la_CFLAGS = -D_LZMA_IN_CB -D_LZMA_PROB32 -D_LZMA_SYSTEM_SIZE_T -D_SZ_ONE_DIRECTORY -liblzma_la_SOURCES = 7zBuffer.c 7zCrc.c 7zHeader.c 7zIn.c 7zItem.c \ - 7zMethodID.c 7zExtract.c 7zDecode.c LzmaDecode.c -endif Deleted: trunk/physfs.dsp =================================================================== --- trunk/physfs.dsp 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/physfs.dsp 2007-03-10 06:32:52 UTC (rev 810) @@ -1,244 +0,0 @@ -# Microsoft Developer Studio Project File - Name="physfs" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=physfs - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "physfs.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "physfs.mak" CFG="physfs - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "physfs - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "physfs - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "physfs - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /WX /Gm /ZI /Od /I "." /I "zlibwin32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Z_PREFIX" /D "PHYSFS_EXPORTS" /D "PHYSFS_SUPPORTS_GRP" /D "PHYSFS_SUPPORTS_WAD" /D "PHYSFS_SUPPORTS_ZIP" /D "PHYSFS_SUPPORTS_QPAK" /D "PHYSFS_SUPPORTS_MVL" /D "PHYSFS_SUPPORTS_HOG" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /WX /Zi /Od /I "." /I "zlib123" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "Z_PREFIX" /D "PHYSFS_EXPORTS" /D "PHYSFS_SUPPORTS_GRP" /D "PHYSFS_SUPPORTS_WAD" /D "PHYSFS_SUPPORTS_ZIP" /D "PHYSFS_SUPPORTS_QPAK" /D "PHYSFS_SUPPORTS_MVL" /D "PHYSFS_SUPPORTS_HOG" /FR /YX /FD /GZ /c -# SUBTRACT CPP /X -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# SUBTRACT BASE LINK32 /incremental:no -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../src/Debug/physfs.dll" -# SUBTRACT LINK32 /pdb:none /force - -!ELSEIF "$(CFG)" == "physfs - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /WX /O2 /I "." /I "zlibwin32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHYSFS_EXPORTS" /D "PHYSFS_SUPPORTS_GRP" /D "PHYSFS_SUPPORTS_WAD" /D "PHYSFS_SUPPORTS_ZIP" /YX /FD /c -# ADD CPP /nologo /MD /W3 /WX /O2 /I "." /I "zlib123" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHYSFS_EXPORTS" /D "PHYSFS_SUPPORTS_GRP" /D "PHYSFS_SUPPORTS_WAD" /D "PHYSFS_SUPPORTS_ZIP" /D "PHYSFS_SUPPORTS_QPAK" /D "PHYSFS_SUPPORTS_HOG" /D "PHYSFS_SUPPORTS_MVL" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 zlibwin32\zlibstat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 - -!ENDIF - -# Begin Target - -# Name "physfs - Win32 Debug" -# Name "physfs - Win32 Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\zlib123\adler32.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\compress.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\crc32.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\deflate.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\dir.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\grp.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\hog.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\inffast.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\inflate.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\inftrees.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\mvl.c -# End Source File -# Begin Source File - -SOURCE=.\physfs.c -# End Source File -# Begin Source File - -SOURCE=.\physfs_byteorder.c -# End Source File -# Begin Source File - -SOURCE=.\physfs_unicode.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\qpak.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\trees.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\uncompr.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\wad.c -# End Source File -# Begin Source File - -SOURCE=.\platform\windows.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\zip.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\zutil.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\zlib123\deflate.h -# End Source File -# Begin Source File - -SOURCE=.\zlib123\infblock.h -# End Source File -# Begin Source File - -SOURCE=.\zlib123\infcodes.h -# End Source File -# Begin Source File - -SOURCE=.\zlib123\inffast.h -# End Source File -# Begin Source File - -SOURCE=.\zlib123\inffixed.h -# End Source File -# Begin Source File - -SOURCE=.\zlib123\inftrees.h -# End Source File -# Begin Source File - -SOURCE=.\zlib123\infutil.h -# End Source File -# Begin Source File - -SOURCE=.\physfs.h -# End Source File -# Begin Source File - -SOURCE=.\physfs_internal.h -# End Source File -# Begin Source File - -SOURCE=.\zlib123\trees.h -# End Source File -# Begin Source File - -SOURCE=.\zlib123\zconf.h -# End Source File -# Begin Source File - -SOURCE=.\zlib123\zlib.h -# End Source File -# Begin Source File - -SOURCE=.\zlib123\zutil.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project Deleted: trunk/physfs.vcproj =================================================================== --- trunk/physfs.vcproj 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/physfs.vcproj 2007-03-10 06:32:52 UTC (rev 810) @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: trunk/physfs_static.dsp =================================================================== --- trunk/physfs_static.dsp 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/physfs_static.dsp 2007-03-10 06:32:52 UTC (rev 810) @@ -1,194 +0,0 @@ -# Microsoft Developer Studio Project File - Name="physfs_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=physfs_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "physfs_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "physfs_static.mak" CFG="physfs_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "physfs_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "physfs_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "Perforce Project" -# PROP Scc_LocalPath "." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "physfs_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "physfs_static___Win32_Release" -# PROP BASE Intermediate_Dir "physfs_static___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "physfs_static_release" -# PROP Intermediate_Dir "physfs_static_release" -# PROP Target_Dir "" -MTL=midl.exe -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "zlib123" /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PHYSFS_SUPPORTS_QPAK=1 /D PHYSFS_SUPPORTS_ZIP=1 /D PHYSFS_SUPPORTS_HOG=1 /D PHYSFS_SUPPORTS_GRP=1 /D PHYSFS_SUPPORTS_WAD=1 /D PHYSFS_SUPPORTS_MVL=1 /D Z_PREFIX=1 /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "physfs_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "physfs_static___Win32_Debug" -# PROP BASE Intermediate_Dir "physfs_static___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "physfs_static_debug" -# PROP Intermediate_Dir "physfs_static_debug" -# PROP Target_Dir "" -MTL=midl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "zlib123" /I "." /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PHYSFS_SUPPORTS_QPAK=1 /D PHYSFS_SUPPORTS_ZIP=1 /D PHYSFS_SUPPORTS_HOG=1 /D PHYSFS_SUPPORTS_GRP=1 /D PHYSFS_SUPPORTS_WAD=1 /D PHYSFS_SUPPORTS_MVL=1 /D Z_PREFIX=1 /FR /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "physfs_static - Win32 Release" -# Name "physfs_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Group "zlib" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\zlib123\adler32.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\compress.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\crc32.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\deflate.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\infback.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\inffast.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\inflate.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\inftrees.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\trees.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\uncompr.c -# End Source File -# Begin Source File - -SOURCE=.\zlib123\zutil.c -# End Source File -# End Group -# Begin Source File - -SOURCE=.\archivers\dir.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\grp.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\hog.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\mvl.c -# End Source File -# Begin Source File - -SOURCE=.\physfs.c -# End Source File -# Begin Source File - -SOURCE=.\physfs_byteorder.c -# End Source File -# Begin Source File - -SOURCE=.\physfs_unicode.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\qpak.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\wad.c -# End Source File -# Begin Source File - -SOURCE=.\platform\windows.c -# End Source File -# Begin Source File - -SOURCE=.\archivers\zip.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\physfs.h -# End Source File -# Begin Source File - -SOURCE=.\physfs_internal.h -# End Source File -# End Group -# End Target -# End Project Deleted: trunk/platform/Makefile.am =================================================================== --- trunk/platform/Makefile.am 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/platform/Makefile.am 2007-03-10 06:32:52 UTC (rev 810) @@ -1,26 +0,0 @@ -noinst_LTLIBRARIES = libplatform.la - -INCLUDES = -I$(top_srcdir) - -if BUILD_BEOS -libplatform_la_SOURCES = \ - posix.c \ - beos.cpp -else -libplatform_la_SOURCES = \ - unix.c \ - windows.c \ - posix.c \ - os2.c -endif - - -EXTRA_DIST = \ - skeleton.c \ - macclassic.c \ - windows.c \ - pocketpc.c \ - unix.c \ - os2.c \ - beos.cpp - Deleted: trunk/test/Makefile.am =================================================================== --- trunk/test/Makefile.am 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/test/Makefile.am 2007-03-10 06:32:52 UTC (rev 810) @@ -1,14 +0,0 @@ -if BUILD_TEST_PHYSFS - -bin_PROGRAMS = test_physfs - -INCLUDES = -I$(top_srcdir) - -if BUILD_READLINE -test_physfs_LDFLAGS="-lreadline -lcurses" -endif - -test_physfs_LDADD = ../libphysfs.la -test_physfs_SOURCES = test_physfs.c - -endif Deleted: trunk/test_physfs.dsp =================================================================== --- trunk/test_physfs.dsp 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/test_physfs.dsp 2007-03-10 06:32:52 UTC (rev 810) @@ -1,102 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_physfs" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=test_physfs - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "test_physfs.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "test_physfs.mak" CFG="test_physfs - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "test_physfs - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "test_physfs - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "test_physfs - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 Release\physfs.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "test_physfs - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 Debug\physfs.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "test_physfs - Win32 Release" -# Name "test_physfs - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\test\test_physfs.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project Deleted: trunk/test_physfs.vcproj =================================================================== --- trunk/test_physfs.vcproj 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/test_physfs.vcproj 2007-03-10 06:32:52 UTC (rev 810) @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deleted: trunk/zlib123/Makefile.am =================================================================== --- trunk/zlib123/Makefile.am 2007-03-10 06:26:11 UTC (rev 809) +++ trunk/zlib123/Makefile.am 2007-03-10 06:32:52 UTC (rev 810) @@ -1,29 +0,0 @@ -X = adler32.c \ - compress.c \ - crc32.c \ - crc32.h \ - deflate.c \ - deflate.h \ - gzio.c \ - infback.c \ - inffast.c \ - inffast.h \ - inffixed.h \ - inflate.c \ - inflate.h \ - inftrees.c \ - inftrees.h \ - trees.c \ - trees.h \ - uncompr.c \ - zconf.h \ - zlib.h \ - zutil.c \ - zutil.h - -if BUILD_ZLIB -noinst_LTLIBRARIES = libz.la -libz_la_SOURCES = $(X) -endif - -EXTRA_DIST = $(X) From DONOTREPLY at icculus.org Sat Mar 10 01:41:26 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 10 Mar 2007 01:41:26 -0500 Subject: r811 - in trunk: . archivers Message-ID: <20070310064126.5913.qmail@icculus.org> Author: icculus Date: 2007-03-10 01:41:26 -0500 (Sat, 10 Mar 2007) New Revision: 811 Removed: trunk/archivers/mix.c Modified: trunk/CHANGELOG trunk/CMakeLists.txt trunk/TODO trunk/physfs.c trunk/physfs.h trunk/physfsMPW.make Log: Killed MIX archiver. Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-10 06:32:52 UTC (rev 810) +++ trunk/CHANGELOG 2007-03-10 06:41:26 UTC (rev 811) @@ -6,7 +6,8 @@ Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC code to expect UTF-8 strings from the higher level. Changed PHYSFS_SUPPORTS_LZMA to PHYSFS_SUPPORTS_7Z. Killed some #ifdefs - in physfs.c. Moved to CMake...so long, autotools! + in physfs.c. Moved to CMake...so long, autotools! Killed MIX + archiver, too. 11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work. Minor BeOS realpath tweak. 09272006 - Reworked 7zip archiver (thanks, Dennis!). Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-10 06:32:52 UTC (rev 810) +++ trunk/CMakeLists.txt 2007-03-10 06:41:26 UTC (rev 811) @@ -202,13 +202,7 @@ SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/qpak.c) ENDIF(PHYSFS_ARCHIVE_QPAK) -OPTION(PHYSFS_ARCHIVE_MIX "Enable Westwood MIX support" FALSE) -IF(PHYSFS_ARCHIVE_MIX) - ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MIX=1) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/mix.c) -ENDIF(PHYSFS_ARCHIVE_MIX) - # See if some archiver required zlib, and see about using system version. IF(PHYSFS_NEED_ZLIB) @@ -283,7 +277,6 @@ MESSAGE_BOOL_OPTION("HOG support" PHYSFS_ARCHIVE_HOG) MESSAGE_BOOL_OPTION("MVL support" PHYSFS_ARCHIVE_MVL) MESSAGE_BOOL_OPTION("QPAK support" PHYSFS_ARCHIVE_QPAK) -MESSAGE_BOOL_OPTION("MIX support" PHYSFS_ARCHIVE_MIX) MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT) MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT) MESSAGE_BOOL_OPTION("Build own zlib" PHYSFS_INTERNAL_ZLIB) Modified: trunk/TODO =================================================================== --- trunk/TODO 2007-03-10 06:32:52 UTC (rev 810) +++ trunk/TODO 2007-03-10 06:41:26 UTC (rev 811) @@ -49,8 +49,6 @@ - Deprecate PHYSFS_setSaneConfig and move it to extras? - Why is physfsrwops.c cut-and-pasted into the ruby bindings? - Replace code from SDL... -- MIX grabs all archives that no other archivers claim. -- MIX enumerates files as hash values. - Should file enumeration return an error or set error state? - Update internal zlib? - Need "getmountpoint" command in test_physfs.c ... Deleted: trunk/archivers/mix.c =================================================================== --- trunk/archivers/mix.c 2007-03-10 06:32:52 UTC (rev 810) +++ trunk/archivers/mix.c 2007-03-10 06:41:26 UTC (rev 811) @@ -1,452 +0,0 @@ -/* - * MIX support routines for PhysicsFS. - * - * This driver handles old archives used in the famous games - * Command&Conquer Tiberium Dawn and Command&Conquer Red Alert. - * - * Newer MIX files as they are used in C&C Tiberium Sun and C&C Red Alert 2 - * aren't supported yet. Keep your eyes open for future updates. - * - * A MIX file has three parts: - * (1) Header - * 16bit integer -> number of files stored in this MIX - * 32bit integer -> filesize - * (2) "Directory" - * 32bit integer -> hash of the filename - * 32bit integer -> starting offset in the MIX - * 32bit integer -> end offset in the MIX - * (3) Data (BODY) - * All data comes here - * - * NOTES: - * The offsets are relative to the body. So offset 0 is directly after - * the directory. - * - * Filenames only exist as hashes. So enumerate_files() will only report all - * hashes. Searching a filename in hashes is extremly quick so I decided not - * to include any sorting routines after then opening of the archive. - * - * - * I found the structure of MIX files here: - * http://www.geocities.com/SiliconValley/8682/cncmap1f.txt - * - * - * Please see the file LICENSE in the source's root directory. - * - * This file written by Sebastian Steinhauer - */ - -#if HAVE_CONFIG_H -# include -#endif - -#if (defined PHYSFS_SUPPORTS_MIX) - -#include -#include -#include -#include "physfs.h" - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" - -typedef struct -{ - PHYSFS_uint16 num_files; - PHYSFS_uint32 filesize; -} MIXheader; - -typedef struct -{ - PHYSFS_uint32 hash; - PHYSFS_uint32 start_offset; - PHYSFS_uint32 end_offset; -} MIXentry; - -typedef struct -{ - char *filename; /* filename of the archive */ - MIXentry *entry; /* list of entries */ - MIXheader header; /* the header of the MIX file */ - PHYSFS_uint32 delta; /* size of header + entries */ -} MIXinfo; - -typedef struct -{ - PHYSFS_uint64 size; /* filesize */ - PHYSFS_uint64 cur_pos; /* position in this file */ - MIXentry *entry; /* pointer to the MIX entry */ - MIXinfo *info; /* pointer to our MIXinfo */ - void *handle; /* filehandle */ -} MIXfileinfo; - - -static PHYSFS_uint32 MIX_hash(const char *name) -{ - PHYSFS_uint32 id = 0; - PHYSFS_uint32 a = 0; - PHYSFS_uint32 i = 0; - PHYSFS_uint32 l; - PHYSFS_uint32 j; - - l = strlen(name); - while (i < l) - { - a = 0; - for(j = 0; j < 4; j++) - { - a >>= 8; - if (i < l) - { - a += (unsigned int) (name[i]) << 24; - i++; - } /* if */ - } /* for */ - - id = (id << 1 | id >> 31) + a; - } /* while */ - - /* a bit debuggin :) - /printf("Filename %s -> %X\n",name,id); */ - - return(id); -} /* MIX_hash */ - - -static void MIX_dirClose(dvoid *opaque) -{ - MIXinfo *info = ((MIXinfo *) opaque); - allocator.Free(info->entry); - allocator.Free(info->filename); -} /* MIX_dirClose */ - - -static PHYSFS_sint64 MIX_read(fvoid *opaque, void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount) -{ - MIXfileinfo *finfo = (MIXfileinfo *) opaque; - MIXentry *entry = finfo->entry; - PHYSFS_uint32 read; - - /* set position in the archive */ - __PHYSFS_platformSeek(finfo->handle, - finfo->info->delta + - entry->start_offset + - finfo->cur_pos); - - /* read n bytes */ - read = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount); - - /* keep filepointer up to date */ - if (read) - finfo->cur_pos += read * objSize; - - return(read); -} /* MIX_read */ - - -static PHYSFS_sint64 MIX_write(fvoid *opaque, const void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount) -{ - BAIL_MACRO(ERR_NOT_SUPPORTED, -1); -} /* MIX_write */ - - -static int MIX_eof(fvoid *opaque) -{ - MIXfileinfo *fifo = (MIXfileinfo *) opaque; - return(fifo->cur_pos >= fifo->size); -} /* MIX_eof */ - - -static PHYSFS_sint64 MIX_tell(fvoid *opaque) -{ - return(((MIXfileinfo *) opaque)->cur_pos); -} /* MIX_tell */ - - -static int MIX_seek(fvoid *opaque, PHYSFS_uint64 offset) -{ - MIXfileinfo *h = (MIXfileinfo *) opaque; - - BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0); - BAIL_IF_MACRO(offset >= h->size, ERR_PAST_EOF, 0); - h->cur_pos = offset; - return(1); -} /* MIX_seek */ - - -static PHYSFS_sint64 MIX_fileLength(fvoid *opaque) -{ - return (((MIXfileinfo *) opaque)->size); -} /* MIX_fileLength */ - - -static int MIX_fileClose(fvoid *opaque) -{ - MIXfileinfo *finfo = (MIXfileinfo *) opaque; - __PHYSFS_platformClose(finfo->handle); - allocator.Free(finfo); - return(1); -} /* MIX_fileClose */ - - -static int MIX_isArchive(const char *filename, int forWriting) -{ - /* !!! FIXME: - write a simple detection routine for MIX files. - Unfortunaly MIX files have no ID in the header. - */ - return(1); -} /* MIX_isArchive */ - - -/* - * Read an unsigned 32-bit int and swap to native byte order. - */ -static int readui32(void *in, PHYSFS_uint32 *val) -{ - PHYSFS_uint32 v; - BAIL_IF_MACRO(__PHYSFS_platformRead(in, &v, sizeof (v), 1) != 1, NULL, 0); - *val = PHYSFS_swapULE32(v); - return(1); -} /* readui32 */ - - -/* - * Read an unsigned 16-bit int and swap to native byte order. - */ -static int readui16(void *in, PHYSFS_uint16 *val) -{ - PHYSFS_uint16 v; - BAIL_IF_MACRO(__PHYSFS_platformRead(in, &v, sizeof (v), 1) != 1, NULL, 0); - *val = PHYSFS_swapULE16(v); - return(1); -} /* readui16 */ - - -static void *MIX_openArchive(const char *name, int forWriting) -{ - PHYSFS_uint32 i = 0; - MIXinfo *info = NULL; - void *handle = NULL; - - info = (MIXinfo *) allocator.Malloc(sizeof (MIXinfo)); - BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, 0); - memset(info, '\0', sizeof (MIXinfo)); - - info->filename = (char *) allocator.Malloc(strlen(name) + 1); - GOTO_IF_MACRO(!info->filename, ERR_OUT_OF_MEMORY, MIX_openArchive_failed); - - /* store filename */ - strcpy(info->filename, name); - - /* open the file */ - handle = __PHYSFS_platformOpenRead(name); - if (!handle) - goto MIX_openArchive_failed; - - /* read the MIX header */ - if ( (!readui16(handle, &info->header.num_files)) || - (!readui32(handle, &info->header.filesize)) ) - goto MIX_openArchive_failed; - - info->delta = 6 + (info->header.num_files * 12); - - /* allocate space for the entries and read the entries */ - info->entry = allocator.Malloc(sizeof (MIXentry) * info->header.num_files); - GOTO_IF_MACRO(!info->entry, ERR_OUT_OF_MEMORY, MIX_openArchive_failed); - - /* read the directory list */ - for (i = 0; i < header.num_files; i++) - { - if ( (!readui32(handle, &info->entry[i].hash)) || - (!readui32(handle, &info->entry[i].start_offset)) || - (!readui32(handle, &info->entry[i].end_offset)) ) - goto MIX_openArchive_failed; - } /* for */ - - __PHYSFS_platformClose(handle); - - return(info); - -MIX_openArchive_failed: - if (info != NULL) - { - if (info->filename != NULL) - allocator.Free(info->filename); - if (info->entry != NULL) - allocator.Free(info->entry); - allocator.Free(info); - } /* if */ - - if (handle != NULL) - __PHYSFS_platformClose(handle); - - return(NULL); -} /* MIX_openArchive */ - - -static void MIX_enumerateFiles(dvoid *opaque, const char *dname, - int omitSymLinks, PHYSFS_EnumFilesCallback cb, - const char *origdir, void *callbackdata) -{ - /* no directories in MIX files. */ - if (*dirname != '\0') - { - MIXinfo *info = (MIXinfo*) opaque; - MIXentry *entry = info->entry; - int i; - char buffer[32]; - - for (i = 0; i < info->header.num_files; i++, entry++) - { - sprintf(buffer, "%X", entry->hash); - cb(callbackdata, origdir, buffer); - } /* for */ - } /* if */ -} /* MIX_enumerateFiles */ - - -static MIXentry *MIX_find_entry(MIXinfo *info, const char *name) -{ - MIXentry *entry = info->entry; - PHYSFS_uint32 i, id; - - /* create hash */ - id = MIX_hash(name); - - /* look for this hash */ - for (i = 0; i < info->header.num_files; i++, entry++) - { - if (entry->hash == id) - return(entry); - } /* for */ - - /* nothing found... :( */ - return(NULL); -} /* MIX_find_entry */ - - -static int MIX_exists(dvoid *opaque, const char *name) -{ - return(MIX_find_entry(((MIXinfo *) opaque), name) != NULL); -} /* MIX_exists */ - - -static int MIX_isDirectory(dvoid *opaque, const char *name, int *fileExists) -{ - *fileExists = MIX_exists(opaque, name); - return(0); /* never directories in a MIX */ -} /* MIX_isDirectory */ - - -static int MIX_isSymLink(dvoid *opaque, const char *name, int *fileExists) -{ - *fileExists = MIX_exists(opaque, name); - return(0); /* never symlinks in a MIX. */ -} /* MIX_isSymLink */ - - -static PHYSFS_sint64 MIX_getLastModTime(dvoid *opaque, - const char *name, - int *fileExists) -{ - BAIL_MACRO(ERR_NOT_SUPPORTED, 0); /* !!! FIXME: return .MIX's modtime. */ -} /* MIX_getLastModTime */ - - -static fvoid *MIX_openRead(dvoid *opaque, const char *fnm, int *fileExists) -{ - MIXinfo *info = ((MIXinfo*) opaque); - MIXfileinfo *finfo; - MIXentry *entry; - - /* try to find this file */ - entry = MIX_find_entry(info,fnm); - BAIL_IF_MACRO(entry == NULL, ERR_NO_SUCH_FILE, NULL); - - /* allocate a MIX handle */ - finfo = (MIXfileinfo *) allocator.Malloc(sizeof (MIXfileinfo)); - BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL); - - /* open the archive */ - finfo->handle = __PHYSFS_platformOpenRead(info->filename); - if(!finfo->handle) - { - allocator.Free(finfo); - return(NULL); - } /* if */ - - /* setup structures */ - finfo->cur_pos = 0; - finfo->info = info; - finfo->entry = entry; - finfo->size = entry->end_offset - entry->start_offset; - - return(finfo); -} /* MIX_openRead */ - - -static fvoid *MIX_openWrite(dvoid *opaque, const char *name) -{ - BAIL_MACRO(ERR_NOT_SUPPORTED, NULL); -} /* MIX_openWrite */ - - -static fvoid *MIX_openAppend(dvoid *opaque, const char *name) -{ - BAIL_MACRO(ERR_NOT_SUPPORTED, NULL); -} /* MIX_openAppend */ - - -static int MIX_remove(dvoid *opaque, const char *name) -{ - BAIL_MACRO(ERR_NOT_SUPPORTED, 0); -} /* MIX_remove */ - - -static int MIX_mkdir(dvoid *opaque, const char *name) -{ - BAIL_MACRO(ERR_NOT_SUPPORTED, 0); -} /* MIX_mkdir */ - - -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MIX = -{ - "MIX", - "Westwood archive (Tiberian Dawn / Red Alert)", - "Sebastian Steinhauer ", - "http://icculus.org/physfs/", -}; - - -const PHYSFS_Archiver __PHYSFS_Archiver_MIX = -{ - &__PHYSFS_ArchiveInfo_MIX, - MIX_isArchive, /* isArchive() method */ - MIX_openArchive, /* openArchive() method */ - MIX_enumerateFiles, /* enumerateFiles() method */ - MIX_exists, /* exists() method */ - MIX_isDirectory, /* isDirectory() method */ - MIX_isSymLink, /* isSymLink() method */ - MIX_getLastModTime, /* getLastModTime() method */ - MIX_openRead, /* openRead() method */ - MIX_openWrite, /* openWrite() method */ - MIX_openAppend, /* openAppend() method */ - MIX_remove, /* remove() method */ - MIX_mkdir, /* mkdir() method */ - MIX_dirClose, /* dirClose() method */ - MIX_read, /* read() method */ - MIX_write, /* write() method */ - MIX_eof, /* eof() method */ - MIX_tell, /* tell() method */ - MIX_seek, /* seek() method */ - MIX_fileLength, /* fileLength() method */ - MIX_fileClose /* fileClose() method */ -}; - -#endif /* defined PHYSFS_SUPPORTS_MIX */ - -/* end of mix.c ... */ - Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-10 06:32:52 UTC (rev 810) +++ trunk/physfs.c 2007-03-10 06:41:26 UTC (rev 811) @@ -69,8 +69,6 @@ extern const PHYSFS_Archiver __PHYSFS_Archiver_MVL; extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_WAD; extern const PHYSFS_Archiver __PHYSFS_Archiver_WAD; -extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MIX; -extern const PHYSFS_Archiver __PHYSFS_Archiver_MIX; extern const PHYSFS_Archiver __PHYSFS_Archiver_DIR; @@ -97,9 +95,6 @@ #if (defined PHYSFS_SUPPORTS_WAD) &__PHYSFS_ArchiveInfo_WAD, #endif -#if (defined PHYSFS_SUPPORTS_MIX) - &__PHYSFS_ArchiveInfo_MIX, -#endif NULL }; @@ -126,9 +121,6 @@ #if (defined PHYSFS_SUPPORTS_WAD) &__PHYSFS_Archiver_WAD, #endif -#if (defined PHYSFS_SUPPORTS_MIX) - &__PHYSFS_Archiver_MIX, -#endif &__PHYSFS_Archiver_DIR, NULL }; Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-03-10 06:32:52 UTC (rev 810) +++ trunk/physfs.h 2007-03-10 06:41:26 UTC (rev 811) @@ -145,7 +145,6 @@ * - .HOG (Descent I/II HOG file archives) * - .MVL (Descent II movielib archives) * - .WAD (DOOM engine archives) - * - .MIX (Older Westwood games archives) * * * String policy for PhysicsFS 2.0 and later: Modified: trunk/physfsMPW.make =================================================================== --- trunk/physfsMPW.make 2007-03-10 06:32:52 UTC (rev 810) +++ trunk/physfsMPW.make 2007-03-10 06:41:26 UTC (rev 811) @@ -21,7 +21,6 @@ :archivers:dir.c ? :archivers:grp.c ? :archivers:hog.c ? - :archivers:mix.c ? :archivers:mvl.c ? :archivers:qpak.c ? :archivers:wad.c ? @@ -50,7 +49,6 @@ "{ObjDir}dir.c.x" ? "{ObjDir}grp.c.x" ? "{ObjDir}hog.c.x" ? - "{ObjDir}mix.c.x" ? "{ObjDir}mvl.c.x" ? "{ObjDir}qpak.c.x" ? "{ObjDir}wad.c.x" ? @@ -110,7 +108,6 @@ "{ObjDir}dir.c.x" ? :archivers:dir.c "{ObjDir}grp.c.x" ? :archivers:grp.c "{ObjDir}hog.c.x" ? :archivers:hog.c -"{ObjDir}mix.c.x" ? :archivers:mix.c "{ObjDir}mvl.c.x" ? :archivers:mvl.c "{ObjDir}qpak.c.x" ? :archivers:qpak.c "{ObjDir}wad.c.x" ? :archivers:wad.c From DONOTREPLY at icculus.org Sun Mar 11 04:11:36 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 04:11:36 -0400 Subject: r812 - trunk Message-ID: <20070311081136.13487.qmail@icculus.org> Author: icculus Date: 2007-03-11 04:11:36 -0400 (Sun, 11 Mar 2007) New Revision: 812 Removed: trunk/zlib_license_change.txt Modified: trunk/CHANGELOG Log: Removed zlib_license_change.txt. Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-10 06:41:26 UTC (rev 811) +++ trunk/CHANGELOG 2007-03-11 08:11:36 UTC (rev 812) @@ -2,6 +2,8 @@ * CHANGELOG. */ +03112007 - Removed zlib_license_change.txt ... it's in Subversion and the 1.0 + branch for history's sake. 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC code to expect UTF-8 strings from the higher level. Changed Deleted: trunk/zlib_license_change.txt =================================================================== --- trunk/zlib_license_change.txt 2007-03-10 06:41:26 UTC (rev 811) +++ trunk/zlib_license_change.txt 2007-03-11 08:11:36 UTC (rev 812) @@ -1,786 +0,0 @@ -Original discussion is partially quoted in here, thread is archived at: - http://icculus.org/cgi-bin/ezmlm/ezmlm-cgi?4:mss:209:200306:nhnacekcfbbhichggfpk - - -These are the emails I got approving the change to a zlib license. I have -removed the authors' email addresses for spam safety. --ryan. - - - - - - - -From xxxxxxxxxxx Mon Jun 9 07:56:24 2003 -Date: Mon, 09 Jun 2003 12:17:18 +0100 -From: Adam D. Moss -Reply-To: "physfs at icculus.org" -To: "physfs at icculus.org" -Subject: Re: [physfs] License change proposition. - - -"I approve of a switch to the zlib license for code I own -in PhysicsFS" (and think it's generally a swell idea...) - -> Adam D. Moss -> ------------ -> extras/abs-file.h (need you to sign off on whole file): -> http://cvs.icculus.org/horde/chora/co.php/extras/abs-file.h?rt=physfs&r=1.3 - - --- -Adam D. Moss . ,,^^ xxxxxxxxx http://www.foxbox.org/ co:3 -"Responsible parents don't raise kids in West Virginia." - - -From xxxxxxxxxxxxxxx Mon Jun 9 16:45:02 2003 -Date: Mon, 9 Jun 2003 11:37:31 -0700 -From: Bradley Bell -Reply-To: "physfs at icculus.org" -To: "physfs at icculus.org" -Subject: Re: [physfs] License change proposition. - - [ The following text is in the "iso-8859-1" character set. ] - [ Your display is set for the "US-ASCII" character set. ] - [ Some characters may be displayed incorrectly. ] - -Quoting "Ryan C. Gordon" : - -> Please discuss. - -Sounds fine to me. And it makes it easier for me to use it in d2x. (which has a -very confusing license) - --brad - - - -From xxxxxxxxxxxx Mon Jun 9 16:45:12 2003 -Date: Mon, 09 Jun 2003 12:00:13 -0700 -From: David Hedbor -To: Ryan C. Gordon -Subject: Re: [physfs] License change proposition. - -As mentioned before, I'm all for the license change since it would -benefit me personally. --- -[ Below is a random fortune, which is unrelated to the above message. ] -The Hollywood tradition I like best is called "sucking up to the stars." - -- Johnny Carson - - -From xxxxxxxxxxxxx Mon Jun 9 16:45:22 2003 -Date: 09 Jun 2003 14:13:00 -0500 -From: Edward Rudd -Reply-To: "physfs at icculus.org" -To: "physfs at icculus.org" -Subject: Re: [physfs] License change proposition. - -On Mon, 2003-06-09 at 05:50, Ryan C. Gordon wrote: -That's fine with me.. You have permissions from me. -> -> Edward Rudd -> ----------- -> RPM specfile (need you to sign off on whole file): -> http://cvs.icculus.org/horde/chora/cvs.php/physfs.spec.in?rt=physfs - --- -Edward Rudd -Home Page - - -From xxxxxxxxxxx Wed Jun 11 13:15:28 2003 -Date: Wed, 11 Jun 2003 06:43:43 -0700 (PDT) -From: Eric Wing -To: Ryan C. Gordon -Subject: Re: [physfs] License change proposition. - -Hi Ryan, -Sorry for the delayed response. (email troubles at -Stanford among other things) - -I approve of a switch to the zlib license for -code I own in PhysicsFS, so you can sign off -everything I have there. - -Thanks, -Eric - - ---- "Ryan C. Gordon" -wrote: -> -> I like to be helpful when people ask me questions -> about PhysicsFS. I may not -> always have an immediate solution, but I hate -> telling people "that can't be -> done at all". -> -> There is one problem that comes up a lot at which I -> just have to shrug my -> shoulders, and that's distribution. -> -> PhysicsFS, being LGPL'd, can not be statically -> linked to a closed-source -> program. Generally this is not an obstacle so much -> as an annoyance for the -> application developer, since they need to ship a -> shared library and do some -> other legal tapdancing (hey, _someone_ will be a -> pain and demand a copy of the -> physfs source tree by postal mail someday!). End -> result: developers unhappily -> put up with distribution issues and possible bug -> reports, or they do without. -> -> There are places where this annoyance can be a -> showstopper, though. For -> example, I was contacted about a year ago by a game -> shop that wanted to use -> PhysicsFS in a PlayStation 2 title, since the -> PhysicsFS API combined with -> its efficient zipfile archiver is _very_ appealing -> in light of the PSX2's -> awful native filesystem limitations. -> -> How does one ship an LGPL'd library in a console -> game? End users can't relink -> the bugger, after all. Furthermore, their legal -> department had a fit when they -> heard about the "viral" nature of the license when -> statically linking it... -> there is no such thing as "dynamic" linking on a -> PlayStation 2. -> -> Now, here's the lesson for any future project -> maintainers: either don't accept -> patches, or make sure you own the copyright on _all_ -> the code before accepting -> it. I have poured years of effort into PhysicsFS, -> but I don't own all the code, -> so I couldn't just grant a license exemption to this -> console developer. End -> result: they did without. -> -> I don't like my own hands being tied by my own -> license. That really doesn't -> seem fair to me. -> -> So for these reasons, I've decided to switch -> PhysicsFS to the zlib license. -> The end result of this is that there will be no -> confusion as to how you can -> use the library ("any way you like") and how you can -> distribute it ("any way -> you like"). The only significant loss is that -> contributers are no longer -> legally obligated to give back source changes, but -> I'm confident that -> developers will if it's generally useful and -> relevant to the public. At least, -> I don't think we should license the library with the -> assumption that -> programmers must have their hands forced to do the -> right thing. -> -> For those that aren't aware of the zlib license, -> here it is. zlib is used in -> all sorts of software without you needing to think -> about it (including -> PhysicsFS), and the license is by far the simplest -> I've ever seen. This is -> the text: -> -> Copyright (c) -> -> 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 -> the use of this software. -> -> Permission is granted to anyone to use this -> software for any purpose, -> including commercial applications, and to alter -> it and redistribute it -> freely, subject to the following restrictions: -> -> 1. The origin of this software must not be -> misrepresented; you must not -> claim that you wrote the original software. If -> you use this software in a -> product, an acknowledgment in the product -> documentation would be -> appreciated but is not required. -> -> 2. Altered source versions must be plainly marked -> as such, and must not be -> misrepresented as being the original software. -> -> 3. This notice may not be removed or altered from -> any source distribution. -> -> -> That's that. -> -> -> Here's how this works: I've compiled a list of all -> contributors to PhysicsFS -> and what was contributed. I need from these people a -> message saying that they -> will approve a switch to the zlib license. Nothing -> fancy, just quote this -> email and say something like "I approve of a switch -> to the zlib license for -> code I own in PhysicsFS." You still own the -> copyright on that bit of code, but -> it'll be under the zlib license. -> -> I can't switch the license until all the developers, -> below, give me permission, -> or their code has been replaced or removed. -> -> If you contributed something and I missed you, -> please let me know. If I don't -> hear from you, I'll try to track you down. If I -> can't track you down, we've -> got to remove or replace your code. -> -> For application developers and end users: you use -> any code up until we switch -> under the LGPL. After the switch, you can use the -> older code under the LGPL -> and the new code under the zlib license. You have -> less restrictions with the -> zlib license, so you'll probably want to upgrade. -> -> -> Please discuss. -> -> --ryan. -> -> -> -> Contributors: -> I tried to list everything, but the LGPL says you -> can cut-and-paste up to ten -> lines of code, so if you fixed a few typos, you -> might not be listed here. If -> this is a concern, please speak up. -> -> -> -> David Hedbor -> ------------ -> Patch to handle situation when CWD is deleted out -> from under program: -> -> -http://cvs.icculus.org/horde/chora/diff.php/physfs.c?rt=physfs&r1=1.22&r2=1.23&ty=u -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/unix.c?rt=physfs&r1=1.11&r2=1.12&ty=u -> -> Patch to make PHYSFS_setSaneConfig() set Write -> Directory correctly: -> -> -http://cvs.icculus.org/horde/chora/diff.php/physfs.c?rt=physfs&r1=1.23&r2=1.24&ty=u -> -> PocketPC patches: -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/pocketpc.c?rt=physfs&r1=1.1&r2=1.2&ty=u -> -> -http://cvs.icculus.org/horde/chora/diff.php/archivers/zip.c?rt=physfs&ws=0&r1=1.61&r2=1.62&ty=u -> -> -> Patrick Stein -> ------------- -> More-portable __PHYSFS_platformTimeslice() for -> Unix: -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/unix.c?rt=physfs&ws=0&r1=1.12&r2=1.13&ty=u -> -> General BSD-ish (but originally for Darwin) CD-ROM -> detection: -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/unix.c?rt=physfs&ws=0&r1=1.13&r2=1.14&ty=u -> -> -> Gregory S. Read -> --------------- -> Lots of Win32 work (need you to sign off on whole -> file): -> -> -http://cvs.icculus.org/horde/chora/cvs.php/platform/win32.c?rt=physfs -> -> Microsoft .NET bindings (need you to sign off on -> whole directory tree): -> -> -http://cvs.icculus.org/horde/chora/cvs.php/extras/PhysFS.NET?rt=physfs -> -> -> John Hall -> --------- -> PHYSFS_getLastModTime() API: -> -> -http://cvs.icculus.org/horde/chora/diff.php/physfs.c?rt=physfs&r1=1.39&r2=1.40&ty=u -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/macclassic.c?rt=physfs&r1=1.9&r2=1.10&ty=u -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/posix.c?rt=physfs&r1=1.1&r2=1.2&ty=u -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/skeleton.c?rt=physfs&r1=1.3&r2=1.4&ty=u -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/win32.c?rt=physfs&r1=1.18&r2=1.19&ty=u -> -> -> Alexander Pipelka -> ----------------- -> configure.in fixes: -> -> -http://cvs.icculus.org/horde/chora/diff.php/configure.in?rt=physfs&r1=1.19&r2=1.20&ty=u -> -> doOpen() fix: -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/posix.c?rt=physfs&ws=0&r1=1.6&r2=1.7&ty=u -> -> Strange $PATH fix: -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/unix.c?rt=physfs&ws=0&r1=1.38&r2=1.39&ty=u -> -> -> Edward Rudd -> ----------- -> RPM specfile (need you to sign off on whole file): -> -> -http://cvs.icculus.org/horde/chora/cvs.php/physfs.spec.in?rt=physfs -> -> -> Ed Sinjiashvili -> --------------- -> Various Russian translations: -> -> -http://cvs.icculus.org/horde/chora/diff.php/physfs_internal.h?rt=physfs&r1=1.33&r2=1.34&ty=u -> -> -http://cvs.icculus.org/horde/chora/diff.php/physfs_internal.h?rt=physfs&r1=1.34&r2=1.35&ty=u -> -> -http://cvs.icculus.org/horde/chora/diff.php/physfs_internal.h?rt=physfs&r1=1.37&r2=1.38&ty=u -> -> Ruby bindings (need you to sign off on whole -> directory tree): -> -> -http://cvs.icculus.org/horde/chora/cvs.php/extras/physfs_rb?rt=physfs -> -> QPAK archiver (need you to sign off on whole file): -> -> -http://cvs.icculus.org/horde/chora/cvs.php/archivers/qpak.c?rt=physfs -> -> -> Pedro J. P^?rez -> --------------- -> Spanish translation: -> -> -http://cvs.icculus.org/horde/chora/diff.php/physfs_internal.h?rt=physfs&r1=1.35&r2=1.36&ty=u -> -> -> Stepane Peter -> ------------- -> French translation: -> -> -http://cvs.icculus.org/horde/chora/diff.php/physfs_internal.h?rt=physfs&r1=1.36&r2=1.37&ty=u -> -> -> Michael Renner -> -------------- -> German translation: -> -> -http://cvs.icculus.org/horde/chora/diff.php/physfs_internal.h?rt=physfs&r1=1.42&r2=1.43&ty=u -> -> -> Adam D. Moss -> ------------ -> extras/abs-file.h (need you to sign off on whole -> file): -> -> -http://cvs.icculus.org/horde/chora/co.php/extras/abs-file.h?rt=physfs&r=1.3 -> -> -> "Corona688" -> ----------- -> Initial PocketPC port (need you to sign off on -> whole file): -> -> -http://cvs.icculus.org/horde/chora/co.php/platform/pocketpc.c?rt=physfs&r=1.1 -> -> -> Eric Wing -> --------- -> Apple Project Builder build system (need you to -> sign off on whole dir tree): -> -> -http://cvs.icculus.org/horde/chora/cvs.php/PBProjects?rt=physfs -> -> MacOS X Application Bundle workarounds: -> -> -http://cvs.icculus.org/horde/chora/diff.php/platform/unix.c?rt=physfs&r1=1.39&r2=1.40&ty=u -> -> -> Colin Bayer -> ----------- -> Debian package support (need you to sign off on -> whole directory tree): -> -> -http://cvs.icculus.org/horde/chora/cvs.php/debian?rt=physfs -> -> -> Bradley Bell -> ------------ -> HOG archiver: -> -> -http://cvs.icculus.org/horde/chora/cvs.php/archivers/hog.c?rt=physfs -> -> MVL archiver: -> -> -http://cvs.icculus.org/horde/chora/cvs.php/archivers/mvl.c?rt=physfs -> -> -> -> - - -__________________________________ -Do you Yahoo!? -Yahoo! Calendar - Free online calendar with sync to Outlook(TM). -http://calendar.yahoo.com - -From xxxxxxxxxxxxxxxx Fri Jun 20 18:07:25 2003 -Date: 16 Jun 2003 16:41:31 +0200 -From: Alexander Pipelka -To: "icculus at clutteredmind.org" -Subject: Re: [physfs] License change proposition. - -Hi Ryan, - -No problem. Please change the licensing model as you like. - -Alex - -PS: Sorry for my late reply, I just returned from vacation. - -Am Mon, 2003-06-09 um 12.50 schrieb Ryan C. Gordon: -> Alexander Pipelka -> ----------------- -> configure.in fixes: -> http://cvs.icculus.org/horde/chora/diff.php/configure.in?rt=physfs&r1=1.19&r2=1.20&ty=u -> -> doOpen() fix: -> http://cvs.icculus.org/horde/chora/diff.php/platform/posix.c?rt=physfs&ws=0&r1=1.6&r2=1.7&ty=u -> -> Strange $PATH fix: -> http://cvs.icculus.org/horde/chora/diff.php/platform/unix.c?rt=physfs&ws=0&r1=1.38&r2=1.39&ty=u - - - -From xxxxxxxxxxxxxx Thu Jul 10 03:27:43 2003 -Date: Thu, 10 Jul 2003 00:10:16 -0700 -From: "xxxxxxxxxxx" -To: "icculus at icculus.org" -Subject: physfs - -I hereby assign the copyright of any changes I have made to PhysicsFS to Ryan Gordon. - -And thanks for asking, even though I obviously wouldn't have a problem with this. - --John - -From xxxxxxxxxxxxxxxx Thu Jul 10 04:26:07 2003 -Date: 10 Jul 2003 01:23:25 -0700 -From: Colin Bayer -To: Ryan C. Gordon -Subject: physicsfs/zlib - -> Here's how this works: I've compiled a list of all contributors to -PhysicsFS -> and what was contributed. I need from these people a message saying that they -> will approve a switch to the zlib license. Nothing fancy, just quote this -> email and say something like "I approve of a switch to the zlib license for -> code I own in PhysicsFS." You still own the copyright on that bit of code, but -> it'll be under the zlib license. - -I approve of a switch to the zlib license for code I own in PhysicsFS. - --- Colin Bayer - - [ Part 2, "This is a digitally signed message part" ] - [ Application/PGP-SIGNATURE 196bytes. ] - [ Unable to print this part. ] - - -From xxxxxxxxxxxxxxx Thu Jul 10 14:40:34 2003 -Date: Thu, 10 Jul 2003 13:17:00 -0500 -From: Patrick Stein -To: Ryan C. Gordon -Subject: Re: PhysicsFS license change. - - -Wow... forgot that I had ever written anything for that... -Anyhow... in addition to having no problems with you -changing the license.... I also give to you any say in -any future matters pertaining to the two or three lines -of code that I sent you. 8^) - -alter, -Patrick - - -On Thursday, July 10, 2003, at 01:07 PM, Ryan C. Gordon wrote: - -> -> Hey there, -> -> I'm looking to change the licensing on PhysicsFS from LGPL to the zlib -> license. The long explanation is here: -> -> -> http://icculus.org/cgi-bin/ezmlm/ezmlm- -> cgi?4:mss:209:200306:nhnacekcfbbhichggfpk -> -> If you're reading this, it means that I never got a response on the -> mailing list, either because you aren't subscribed, or because you -> missed -> it, and this is the last email address I have for you....but I need -> explicit permission from you to convert code you wrote (even if it was -> just a natural language translation) to a different license. -> -> If you don't mind switching to zlib, please respond with something -> along -> the lines of "I approve of a switch to the zlib license for code I own -> in -> PhysicsFS." -> -> If you have any problems, that's okay, too, just let me know. -> -> Thanks, -> --ryan. -> - - -From xxxxxxxxxxxxxx Thu Jul 10 14:40:40 2003 -Date: 10 Jul 2003 11:33:26 -0700 -From: Stephane Peter -To: Ryan C. Gordon -Subject: Re: PhysicsFS license change. - -You know, I don't think I ever contributed code to physfs, but if you -manage to find out something I may have, then you have my approval to -switch it to the zlib license... - - -On Thu, 2003-07-10 at 11:07, Ryan C. Gordon wrote: -> Hey there, -> -> I'm looking to change the licensing on PhysicsFS from LGPL to the zlib -> license. The long explanation is here: -> -> http://icculus.org/cgi-bin/ezmlm/ezmlm-cgi?4:mss:209:200306:nhnacekcfbbhichggfpk -> -> If you're reading this, it means that I never got a response on the -> mailing list, either because you aren't subscribed, or because you missed -> it, and this is the last email address I have for you....but I need -> explicit permission from you to convert code you wrote (even if it was -> just a natural language translation) to a different license. -> -> If you don't mind switching to zlib, please respond with something along -> the lines of "I approve of a switch to the zlib license for code I own in -> PhysicsFS." -> -> If you have any problems, that's okay, too, just let me know. -> -> Thanks, -> --ryan. --- -Stephane Peter -Sr. Software Engineer -Codehost, Inc. - - - -From xxxxxxxxxxxx Thu Jul 10 21:07:13 2003 -Date: Fri, 11 Jul 2003 00:08:44 +0200 (CEST) -From: Michael Renner -To: Ryan C. Gordon -Subject: Re: PhysicsFS license change. - - - -On Thu, 10 Jul 2003, Ryan C. Gordon wrote: - -> -> Hey there, -> -> I'm looking to change the licensing on PhysicsFS from LGPL to the zlib -> license. The long explanation is here: - -Hi Ryan! - -For your mailfilters: - -"I approve of a switch to the zlib license for code I own in PhysicsFS." - -The change of license makes sense, what use is a library when the target -audience is reluctant to use it. Keep up the good work. - -Btw. if you need any other non-babelfish english -> german translations -just contact me. - -best regards, -michael renner - -From xxxxxxxxxxxxx Mon Jul 14 16:36:06 2003 -Date: Sat, 12 Jul 2003 22:57:28 -0400 -From: Gregory S. Read -To: Ryan C. Gordon -Subject: Re: PhysicsFS license change. - -I have no problem with you licensing my contributed code for PhysFS to -the zlib licensing. - -Have a nice day. - -Greg - -Ryan C. Gordon wrote: - ->Hey there, -> ->I'm looking to change the licensing on PhysicsFS from LGPL to the zlib ->license. The long explanation is here: -> -> http://icculus.org/cgi-bin/ezmlm/ezmlm-cgi?4:mss:209:200306:nhnacekcfbbhichggfpk -> ->If you're reading this, it means that I never got a response on the ->mailing list, either because you aren't subscribed, or because you missed ->it, and this is the last email address I have for you....but I need ->explicit permission from you to convert code you wrote (even if it was ->just a natural language translation) to a different license. -> ->If you don't mind switching to zlib, please respond with something along ->the lines of "I approve of a switch to the zlib license for code I own in ->PhysicsFS." -> ->If you have any problems, that's okay, too, just let me know. -> ->Thanks, ->--ryan. -> -> -> -> - - -From xxxxxxxxxxxx Mon Jul 14 16:36:15 2003 -Date: Mon, 14 Jul 2003 14:26:38 -0600 -From: Tyler Montbriand -To: Ryan C. Gordon -Subject: Re: PhysicsFS license change. - - [ The following text is in the "iso-8859-1" character set. ] - [ Your display is set for the "US-ASCII" character set. ] - [ Some characters may be displayed incorrectly. ] - -Hello. Sorry for delay in reply, things've been messed up for the last couple -while.. - -I think that changing it to the Zlib license is a great idea... never -realized there were those sort of complications with the LGPL - thought it -was a much less restrictive license than your plain vanilla GPL, but I guess -not less restrictive enough. I've no problem at all with you putting any of -the code I've contributed under the Zlib license. - --Tyler Montbriand/Corona688 - -On Thursday 10 July 2003 12:07 pm, you wrote: -> Hey there, -> -> I'm looking to change the licensing on PhysicsFS from LGPL to the zlib -> license. The long explanation is here: -> -> -> http://icculus.org/cgi-bin/ezmlm/ezmlm-cgi?4:mss:209:200306:nhnacekcfbbhich ->ggfpk -> -> If you're reading this, it means that I never got a response on the -> mailing list, either because you aren't subscribed, or because you missed -> it, and this is the last email address I have for you....but I need -> explicit permission from you to convert code you wrote (even if it was -> just a natural language translation) to a different license. -> -> If you don't mind switching to zlib, please respond with something along -> the lines of "I approve of a switch to the zlib license for code I own in -> PhysicsFS." -> -> If you have any problems, that's okay, too, just let me know. -> -> Thanks, -> --ryan. - - -From xxxxxxxxxxxxxx Sun Jul 20 23:59:48 2003 -Date: Mon, 21 Jul 2003 07:09:24 +0400 -From: Ed Sinjiashvili -To: Ryan C. Gordon -Subject: PhysicsFS license change -Resent-Date: Mon, 21 Jul 2003 07:15:32 +0400 -Resent-From: Ed Sinjiashvili -Resent-To: "Ryan C. Gordon" - -Hi, - -I have just read the news on icculus.org and I guess I'm one of the -two contributors you could not contact (at least I did not got any -mails from PhysicsFS mailing list for quite a while - so I did not -know what was happenning). - -I really have no problems with this licence switch from LGPL to zlib -and I agree to sign all my contributions (qpak archiver, ruby bindings -and russian translations) under zlib. - -I saw that you removed all my contributions from PhysicsFS - now that -I agreed to license change you could revert them. - --- Ed - -P.S. I have mail on icculus.org - if you can't reach me I guess -xxxxxxxxxxxxxxx is always possible. - From DONOTREPLY at icculus.org Sun Mar 11 04:33:15 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 04:33:15 -0400 Subject: r813 - trunk Message-ID: <20070311083315.22290.qmail@icculus.org> Author: icculus Date: 2007-03-11 04:33:15 -0400 (Sun, 11 Mar 2007) New Revision: 813 Modified: trunk/CMakeLists.txt Log: Fixes to CMakeLists.txt for Intel Mac. Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-11 08:11:36 UTC (rev 812) +++ trunk/CMakeLists.txt 2007-03-11 08:33:15 UTC (rev 813) @@ -26,10 +26,12 @@ # Fallback to older Mac OS X on PowerPC to support a wider range of systems... IF(MACOSX) + ADD_DEFINITIONS(-fno-common) IF(CMAKE_OSX_ARCHITECTURES MATCHES ppc) - ADD_DEFINITIONS(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 -fno-common) - SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-mmacosx-version-min=10.2 -framework Carbon -framework IOKit") + ADD_DEFINITIONS(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020) + SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2") ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES ppc) + SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -framework Carbon -framework IOKit") ENDIF(MACOSX) # Add some gcc-specific command lines. From DONOTREPLY at icculus.org Sun Mar 11 04:37:01 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 04:37:01 -0400 Subject: r814 - trunk Message-ID: <20070311083701.24132.qmail@icculus.org> Author: icculus Date: 2007-03-11 04:37:01 -0400 (Sun, 11 Mar 2007) New Revision: 814 Modified: trunk/CHANGELOG trunk/CMakeLists.txt Log: Can now build shared or static (or both) libraries. Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-11 08:33:15 UTC (rev 813) +++ trunk/CHANGELOG 2007-03-11 08:37:01 UTC (rev 814) @@ -3,7 +3,8 @@ */ 03112007 - Removed zlib_license_change.txt ... it's in Subversion and the 1.0 - branch for history's sake. + branch for history's sake. Added shared and static build options + to CMakeLists.txt 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC code to expect UTF-8 strings from the higher level. Changed Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-11 08:33:15 UTC (rev 813) +++ trunk/CMakeLists.txt 2007-03-11 08:37:01 UTC (rev 814) @@ -231,11 +231,30 @@ ENDIF(PHYSFS_INTERNAL_ZLIB) ENDIF(PHYSFS_NEED_ZLIB) +OPTION(PHYSFS_BUILD_STATIC "Build static library" TRUE) +IF(PHYSFS_BUILD_STATIC) + ADD_LIBRARY(physfs-static STATIC ${PHYSFS_SRCS}) + SET_TARGET_PROPERTIES(physfs-static PROPERTIES OUTPUT_NAME "physfs") + SET(PHYSFS_LIB_TARGET physfs-static) +ENDIF(PHYSFS_BUILD_STATIC) +OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE) +IF(PHYSFS_BUILD_SHARED) + ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS}) + TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) + SET(PHYSFS_LIB_TARGET physfs) +ENDIF(PHYSFS_BUILD_SHARED) -ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS}) -TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) +IF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC) + MESSAGE(FATAL "Both shared and static libraries are disabled!") +ENDIF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC) +# CMake FAQ says I need this... +IF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC) + SET_TARGET_PROPERTIES(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1) + SET_TARGET_PROPERTIES(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) +ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC) + OPTION(PHYSFS_BUILD_TEST "Build test program." TRUE) MARK_AS_ADVANCED(PHYSFS_BUILD_TEST) IF(PHYSFS_BUILD_TEST) @@ -252,7 +271,7 @@ ENDIF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY) ENDIF(HAVE_READLINE_H AND HAVE_HISTORY_H) ADD_EXECUTABLE(test_physfs test/test_physfs.c) - TARGET_LINK_LIBRARIES(test_physfs physfs ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS}) + TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS}) ENDIF(PHYSFS_BUILD_TEST) FIND_PACKAGE(Doxygen) @@ -282,6 +301,8 @@ MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT) MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT) MESSAGE_BOOL_OPTION("Build own zlib" PHYSFS_INTERNAL_ZLIB) +MESSAGE_BOOL_OPTION("Build static library" PHYSFS_BUILD_STATIC) +MESSAGE_BOOL_OPTION("Build shared library" PHYSFS_BUILD_SHARED) MESSAGE_BOOL_OPTION("Build test program" PHYSFS_BUILD_TEST) IF(PHYSFS_BUILD_TEST) MESSAGE_BOOL_OPTION(" Use readline in test program" HAVE_SYSTEM_READLINE) From DONOTREPLY at icculus.org Sun Mar 11 04:40:52 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 04:40:52 -0400 Subject: r815 - trunk Message-ID: <20070311084052.25880.qmail@icculus.org> Author: icculus Date: 2007-03-11 04:40:51 -0400 (Sun, 11 Mar 2007) New Revision: 815 Modified: trunk/CMakeLists.txt Log: Clarified a comment. Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-11 08:37:01 UTC (rev 814) +++ trunk/CMakeLists.txt 2007-03-11 08:40:51 UTC (rev 815) @@ -24,13 +24,15 @@ #INCLUDE_DIRECTORIES(platform) #INCLUDE_DIRECTORIES(archivers) -# Fallback to older Mac OS X on PowerPC to support a wider range of systems... IF(MACOSX) - ADD_DEFINITIONS(-fno-common) + # Fallback to older OS X on PowerPC to support wider range of systems... IF(CMAKE_OSX_ARCHITECTURES MATCHES ppc) ADD_DEFINITIONS(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020) SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2") ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES ppc) + + # Need these everywhere... + ADD_DEFINITIONS(-fno-common) SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -framework Carbon -framework IOKit") ENDIF(MACOSX) From DONOTREPLY at icculus.org Sun Mar 11 04:56:23 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 04:56:23 -0400 Subject: r816 - trunk Message-ID: <20070311085623.307.qmail@icculus.org> Author: icculus Date: 2007-03-11 04:56:23 -0400 (Sun, 11 Mar 2007) New Revision: 816 Modified: trunk/CMakeLists.txt Log: Added install targets for "make install" Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-11 08:40:51 UTC (rev 815) +++ trunk/CMakeLists.txt 2007-03-11 08:56:23 UTC (rev 816) @@ -3,6 +3,8 @@ # # Please see the file LICENSE in the source's root directory. +CMAKE_MINIMUM_REQUIRED(VERSION 2.4) + PROJECT(PhysicsFS) SET(PHYSFS_VERSION 1.1.2) @@ -238,6 +240,7 @@ ADD_LIBRARY(physfs-static STATIC ${PHYSFS_SRCS}) SET_TARGET_PROPERTIES(physfs-static PROPERTIES OUTPUT_NAME "physfs") SET(PHYSFS_LIB_TARGET physfs-static) + SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs") ENDIF(PHYSFS_BUILD_STATIC) OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE) @@ -245,6 +248,7 @@ ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS}) TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) SET(PHYSFS_LIB_TARGET physfs) + SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static") ENDIF(PHYSFS_BUILD_SHARED) IF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC) @@ -274,8 +278,15 @@ ENDIF(HAVE_READLINE_H AND HAVE_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") ENDIF(PHYSFS_BUILD_TEST) +INSTALL(TARGETS ${PHYSFS_INSTALL_TARGETS} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +INSTALL(FILES physfs.h DESTINATION include) + FIND_PACKAGE(Doxygen) IF(DOXYGEN_FOUND) ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} COMMENT "Building documentation") From DONOTREPLY at icculus.org Sun Mar 11 05:13:55 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 05:13:55 -0400 Subject: r817 - trunk Message-ID: <20070311091355.8693.qmail@icculus.org> Author: icculus Date: 2007-03-11 05:13:55 -0400 (Sun, 11 Mar 2007) New Revision: 817 Modified: trunk/CHANGELOG trunk/CMakeLists.txt Log: Install libraries with a VERSION and SOVERSION. Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-11 08:56:23 UTC (rev 816) +++ trunk/CHANGELOG 2007-03-11 09:13:55 UTC (rev 817) @@ -4,7 +4,7 @@ 03112007 - Removed zlib_license_change.txt ... it's in Subversion and the 1.0 branch for history's sake. Added shared and static build options - to CMakeLists.txt + to CMakeLists.txt, and the expected "make install" target. 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC code to expect UTF-8 strings from the higher level. Changed Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-11 08:56:23 UTC (rev 816) +++ trunk/CMakeLists.txt 2007-03-11 09:13:55 UTC (rev 817) @@ -7,6 +7,7 @@ PROJECT(PhysicsFS) SET(PHYSFS_VERSION 1.1.2) +SET(PHYSFS_SOVERSION 1) # I hate that they define "WIN32" ... we're about to move to Win64...I hope! IF(WIN32 AND NOT WINDOWS) @@ -246,6 +247,8 @@ OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE) IF(PHYSFS_BUILD_SHARED) ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS}) + SET_TARGET_PROPERTIES(physfs PROPERTIES VERSION ${PHYSFS_VERSION}) + SET_TARGET_PROPERTIES(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION}) TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) SET(PHYSFS_LIB_TARGET physfs) SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static") From DONOTREPLY at icculus.org Sun Mar 11 05:14:09 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 05:14:09 -0400 Subject: r818 - trunk Message-ID: <20070311091409.8899.qmail@icculus.org> Author: icculus Date: 2007-03-11 05:14:08 -0400 (Sun, 11 Mar 2007) New Revision: 818 Modified: trunk/ Log: svn:ignore update. Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - physfs.spec docs PhysicsFS.xcodeproj PhysicsFS.build build Debug Release CMakeScripts CMakeOutput.log CMakeCache.txt cmake_install.cmake test_physfs CMakeTmp CMakeFiles Makefile *.so *.dylib *.dll *.exe + physfs.spec docs PhysicsFS.xcodeproj PhysicsFS.build build Debug Release CMakeScripts CMakeOutput.log CMakeCache.txt cmake_install.cmake install_manifest.txt test_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe From DONOTREPLY at icculus.org Sun Mar 11 05:30:08 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 05:30:08 -0400 Subject: r819 - trunk Message-ID: <20070311093008.20151.qmail@icculus.org> Author: icculus Date: 2007-03-11 05:30:08 -0400 (Sun, 11 Mar 2007) New Revision: 819 Modified: trunk/physfs.h Log: More ranting and raving about Unicode. Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-03-11 09:14:08 UTC (rev 818) +++ trunk/physfs.h 2007-03-11 09:30:08 UTC (rev 819) @@ -149,8 +149,11 @@ * * String policy for PhysicsFS 2.0 and later: * - * PhysicsFS 1.0 deals with null-terminated ASCII strings. All high ASCII - * chars resulted in undefined behaviour, and there was no Unicode support. + * PhysicsFS 1.0 could only deal with null-terminated ASCII strings. All high + * ASCII chars resulted in undefined behaviour, and there was no Unicode + * support at all. PhysicsFS 2.0 supports Unicode without breaking binary + * compatibility with the 1.0 API by using UTF-8 encoding of all strings + * passed in and out of the library. * * All strings passed through PhysicsFS are in null-terminated UTF-8 format. * This means that if all you care about is English (ASCII characters <= 127) @@ -178,7 +181,23 @@ * PhysicsFS offers basic encoding conversion support, but not a whole string * library. Get your stuff into whatever format you can work with. * + * Some platforms and archivers don't offer full Unicode support behind the + * scenes. For example, OS/2 only offers "codepages" and the filesystem + * itself doesn't support multibyte encodings. We make an earnest effort to + * convert to/from the current locale here, but all bets are off if + * you want to hand an arbitrary Japanese character through to these systems. + * Modern OSes (Mac OS X, Linux, Windows, PocketPC, etc) should all be fine. + * Many game-specific archivers are seriously unprepared for Unicode (the + * Descent HOG/MVL and Build Engine GRP archivers, for example, only offer a + * DOS 8.3 filename, for example). Nothing can be done for these, but they + * tend to be legacy formats for existing content that was all ASCII (and + * thus, valid UTF-8) anyhow. Other formats, like .ZIP, don't explicitly + * offer Unicode support, but unofficially expect filenames to be UTF-8 + * encoded, and thus Just Work. Most everything does the right thing without + * bothering you, but it's good to be aware of these nuances in case they + * don't. * + * * Other stuff: * * Please see the file LICENSE in the source's root directory for licensing From DONOTREPLY at icculus.org Sun Mar 11 05:44:21 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 05:44:21 -0400 Subject: r820 - in trunk: . archivers platform test Message-ID: <20070311094421.29598.qmail@icculus.org> Author: icculus Date: 2007-03-11 05:44:21 -0400 (Sun, 11 Mar 2007) New Revision: 820 Modified: trunk/archivers/dir.c trunk/archivers/grp.c trunk/archivers/hog.c trunk/archivers/lzma.c trunk/archivers/mvl.c trunk/archivers/qpak.c trunk/archivers/wad.c trunk/archivers/zip.c trunk/physfs.c trunk/physfs_byteorder.c trunk/physfs_unicode.c trunk/platform/beos.cpp trunk/platform/macclassic.c trunk/platform/os2.c trunk/platform/pocketpc.c trunk/platform/posix.c trunk/platform/skeleton.c trunk/platform/unix.c trunk/platform/windows.c trunk/test/test_physfs.c Log: Removed config.h references from old autotools build system. Modified: trunk/archivers/dir.c =================================================================== --- trunk/archivers/dir.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/archivers/dir.c 2007-03-11 09:44:21 UTC (rev 820) @@ -6,10 +6,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #include #include #include Modified: trunk/archivers/grp.c =================================================================== --- trunk/archivers/grp.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/archivers/grp.c 2007-03-11 09:44:21 UTC (rev 820) @@ -24,10 +24,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #if (defined PHYSFS_SUPPORTS_GRP) #include Modified: trunk/archivers/hog.c =================================================================== --- trunk/archivers/hog.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/archivers/hog.c 2007-03-11 09:44:21 UTC (rev 820) @@ -29,10 +29,6 @@ * Based on grp.c by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #if (defined PHYSFS_SUPPORTS_HOG) #include Modified: trunk/archivers/lzma.c =================================================================== --- trunk/archivers/lzma.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/archivers/lzma.c 2007-03-11 09:44:21 UTC (rev 820) @@ -7,10 +7,6 @@ * by Igor Pavlov. */ -#if HAVE_CONFIG_H -# include -#endif - #if (defined PHYSFS_SUPPORTS_7Z) #include Modified: trunk/archivers/mvl.c =================================================================== --- trunk/archivers/mvl.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/archivers/mvl.c 2007-03-11 09:44:21 UTC (rev 820) @@ -27,10 +27,6 @@ * Based on grp.c by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #if (defined PHYSFS_SUPPORTS_MVL) #include Modified: trunk/archivers/qpak.c =================================================================== --- trunk/archivers/qpak.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/archivers/qpak.c 2007-03-11 09:44:21 UTC (rev 820) @@ -29,10 +29,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #if (defined PHYSFS_SUPPORTS_QPAK) #include Modified: trunk/archivers/wad.c =================================================================== --- trunk/archivers/wad.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/archivers/wad.c 2007-03-11 09:44:21 UTC (rev 820) @@ -42,10 +42,6 @@ * Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #if (defined PHYSFS_SUPPORTS_WAD) #include Modified: trunk/archivers/zip.c =================================================================== --- trunk/archivers/zip.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/archivers/zip.c 2007-03-11 09:44:21 UTC (rev 820) @@ -7,10 +7,6 @@ * by Gilles Vollant. */ -#if HAVE_CONFIG_H -# include -#endif - #if (defined PHYSFS_SUPPORTS_ZIP) #include Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/physfs.c 2007-03-11 09:44:21 UTC (rev 820) @@ -8,10 +8,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #include #include #include Modified: trunk/physfs_byteorder.c =================================================================== --- trunk/physfs_byteorder.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/physfs_byteorder.c 2007-03-11 09:44:21 UTC (rev 820) @@ -8,10 +8,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #include #include Modified: trunk/physfs_unicode.c =================================================================== --- trunk/physfs_unicode.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/physfs_unicode.c 2007-03-11 09:44:21 UTC (rev 820) @@ -1,7 +1,3 @@ -#if HAVE_CONFIG_H -# include -#endif - #include "physfs.h" #define __PHYSICSFS_INTERNAL__ Modified: trunk/platform/beos.cpp =================================================================== --- trunk/platform/beos.cpp 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/platform/beos.cpp 2007-03-11 09:44:21 UTC (rev 820) @@ -6,10 +6,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #ifdef __BEOS__ #include Modified: trunk/platform/macclassic.c =================================================================== --- trunk/platform/macclassic.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/platform/macclassic.c 2007-03-11 09:44:21 UTC (rev 820) @@ -6,10 +6,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #include #include #include Modified: trunk/platform/os2.c =================================================================== --- trunk/platform/os2.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/platform/os2.c 2007-03-11 09:44:21 UTC (rev 820) @@ -6,10 +6,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #if (defined OS2) #define INCL_DOSSEMAPHORES Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/platform/pocketpc.c 2007-03-11 09:44:21 UTC (rev 820) @@ -6,10 +6,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #include #include Modified: trunk/platform/posix.c =================================================================== --- trunk/platform/posix.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/platform/posix.c 2007-03-11 09:44:21 UTC (rev 820) @@ -6,10 +6,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #if ((!defined WIN32) && (!defined OS2)) #if (defined __STRICT_ANSI__) Modified: trunk/platform/skeleton.c =================================================================== --- trunk/platform/skeleton.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/platform/skeleton.c 2007-03-11 09:44:21 UTC (rev 820) @@ -6,10 +6,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #define __PHYSICSFS_INTERNAL__ #include "physfs_internal.h" Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/platform/unix.c 2007-03-11 09:44:21 UTC (rev 820) @@ -6,10 +6,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - /* BeOS uses beos.cpp and posix.c ... Cygwin and such use windows.c ... */ #if ((!defined __BEOS__) && (!defined WIN32)) Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/platform/windows.c 2007-03-11 09:44:21 UTC (rev 820) @@ -6,10 +6,6 @@ * This file written by Ryan C. Gordon, and made sane by Gregory S. Read. */ -#if HAVE_CONFIG_H -# include -#endif - #ifdef WIN32 #include Modified: trunk/test/test_physfs.c =================================================================== --- trunk/test/test_physfs.c 2007-03-11 09:30:08 UTC (rev 819) +++ trunk/test/test_physfs.c 2007-03-11 09:44:21 UTC (rev 820) @@ -6,10 +6,6 @@ * This file written by Ryan C. Gordon. */ -#if HAVE_CONFIG_H -# include -#endif - #include #include #include From DONOTREPLY at icculus.org Sun Mar 11 06:10:28 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 06:10:28 -0400 Subject: r821 - in trunk: . archivers extras platform test Message-ID: <20070311101028.10819.qmail@icculus.org> Author: icculus Date: 2007-03-11 06:10:28 -0400 (Sun, 11 Mar 2007) New Revision: 821 Added: trunk/LICENSE.txt Removed: trunk/LICENSE Modified: trunk/CHANGELOG trunk/CMakeLists.txt trunk/INSTALL trunk/archivers/dir.c trunk/archivers/grp.c trunk/archivers/hog.c trunk/archivers/lzma.c trunk/archivers/mvl.c trunk/archivers/qpak.c trunk/archivers/wad.c trunk/archivers/zip.c trunk/extras/globbing.c trunk/extras/globbing.h trunk/extras/ignorecase.c trunk/extras/ignorecase.h trunk/extras/physfshttpd.c trunk/extras/physfsrwops.c trunk/extras/physfsrwops.h trunk/extras/selfextract.c trunk/physfs.c trunk/physfs.h trunk/physfs.spec.in trunk/physfs_byteorder.c trunk/physfs_internal.h trunk/platform/beos.cpp trunk/platform/macclassic.c trunk/platform/os2.c trunk/platform/pocketpc.c trunk/platform/posix.c trunk/platform/skeleton.c trunk/platform/unix.c trunk/platform/windows.c trunk/test/test_physfs.c Log: Renamed LICENSE to LICENSE.txt Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/CHANGELOG 2007-03-11 10:10:28 UTC (rev 821) @@ -5,6 +5,7 @@ 03112007 - Removed zlib_license_change.txt ... it's in Subversion and the 1.0 branch for history's sake. Added shared and static build options to CMakeLists.txt, and the expected "make install" target. + Renamed some FILENAME files to FILENAME.txt. 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC code to expect UTF-8 strings from the higher level. Changed Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/CMakeLists.txt 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ # PhysicsFS; a portable, flexible file i/o abstraction. # Copyright (C) 2007 Ryan C. Gordon. # -# Please see the file LICENSE in the source's root directory. +# Please see the file LICENSE.txt in the source's root directory. CMAKE_MINIMUM_REQUIRED(VERSION 2.4) Modified: trunk/INSTALL =================================================================== --- trunk/INSTALL 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/INSTALL 2007-03-11 10:10:28 UTC (rev 821) @@ -7,8 +7,9 @@ ALL PLATFORMS: -Please understand your rights and mine: read the text file LICENSE in the root -of the source tree. If you can't abide by it, delete this source tree now. +Please understand your rights and mine: read the text file LICENSE.txt in the + root of the source tree. If you can't abide by it, delete this source tree + now. If you've got Doxygen (http://www.doxygen.org/) installed, you can run it without any command line arguments in the root of the source tree to generate Deleted: trunk/LICENSE =================================================================== --- trunk/LICENSE 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/LICENSE 2007-03-11 10:10:28 UTC (rev 821) @@ -1,29 +0,0 @@ - - Copyright (c) 2003 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 - the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software in a - product, an acknowledgment in the product documentation would be - appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source distribution. - - Ryan C. Gordon - - -(Please note that versions of PhysicsFS prior to 0.1.9 are licensed under -the GNU Lesser General Public License, which restricts you significantly more. -For your own safety, please make sure you've got 0.1.9 or later if you plan -to use physfs in a commercial or closed-source project.) - Copied: trunk/LICENSE.txt (from rev 817, trunk/LICENSE) =================================================================== --- trunk/LICENSE.txt (rev 0) +++ trunk/LICENSE.txt 2007-03-11 10:10:28 UTC (rev 821) @@ -0,0 +1,29 @@ + + Copyright (c) 2003 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 + the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software in a + product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source distribution. + + Ryan C. Gordon + + +(Please note that versions of PhysicsFS prior to 0.1.9 are licensed under +the GNU Lesser General Public License, which restricts you significantly more. +For your own safety, please make sure you've got 0.1.9 or later if you plan +to use physfs in a commercial or closed-source project.) + Modified: trunk/archivers/dir.c =================================================================== --- trunk/archivers/dir.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/archivers/dir.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * Standard directory I/O support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/archivers/grp.c =================================================================== --- trunk/archivers/grp.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/archivers/grp.c 2007-03-11 10:10:28 UTC (rev 821) @@ -19,7 +19,7 @@ * * (That info is from http://www.advsys.net/ken/build.htm ...) * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/archivers/hog.c =================================================================== --- trunk/archivers/hog.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/archivers/hog.c 2007-03-11 10:10:28 UTC (rev 821) @@ -23,7 +23,7 @@ * * (That info is from http://www.descent2.com/ddn/specs/hog/) * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Bradley Bell. * Based on grp.c by Ryan C. Gordon. Modified: trunk/archivers/lzma.c =================================================================== --- trunk/archivers/lzma.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/archivers/lzma.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * LZMA support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file is written by Dennis Schridde, with some peeking at "7zMain.c" * by Igor Pavlov. Modified: trunk/archivers/mvl.c =================================================================== --- trunk/archivers/mvl.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/archivers/mvl.c 2007-03-11 10:10:28 UTC (rev 821) @@ -21,7 +21,7 @@ * * (That info is from http://www.descent2.com/ddn/specs/mvl/) * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Bradley Bell. * Based on grp.c by Ryan C. Gordon. Modified: trunk/archivers/qpak.c =================================================================== --- trunk/archivers/qpak.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/archivers/qpak.c 2007-03-11 10:10:28 UTC (rev 821) @@ -24,7 +24,7 @@ * * ======================================================================== * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/archivers/wad.c =================================================================== --- trunk/archivers/wad.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/archivers/wad.c 2007-03-11 10:10:28 UTC (rev 821) @@ -36,7 +36,7 @@ * I don't think it's really that important though. * * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Travis Wells, based on the GRP archiver by * Ryan C. Gordon. Modified: trunk/archivers/zip.c =================================================================== --- trunk/archivers/zip.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/archivers/zip.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * ZIP support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon, with some peeking at "unzip.c" * by Gilles Vollant. Modified: trunk/extras/globbing.c =================================================================== --- trunk/extras/globbing.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/extras/globbing.c 2007-03-11 10:10:28 UTC (rev 821) @@ -22,7 +22,7 @@ * NO WARRANTY. * * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. - * Please see LICENSE in the root of the source tree. + * Please see LICENSE.txt in the root of the source tree. * * \author Ryan C. Gordon. */ Modified: trunk/extras/globbing.h =================================================================== --- trunk/extras/globbing.h 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/extras/globbing.h 2007-03-11 10:10:28 UTC (rev 821) @@ -25,7 +25,7 @@ * NO WARRANTY. * * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. - * Please see LICENSE in the root of the source tree. + * Please see LICENSE.txt in the root of the source tree. * * \author Ryan C. Gordon. */ Modified: trunk/extras/ignorecase.c =================================================================== --- trunk/extras/ignorecase.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/extras/ignorecase.c 2007-03-11 10:10:28 UTC (rev 821) @@ -22,7 +22,7 @@ * NO WARRANTY. * * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. - * Please see LICENSE in the root of the source tree. + * Please see LICENSE.txt in the root of the source tree. * * \author Ryan C. Gordon. */ Modified: trunk/extras/ignorecase.h =================================================================== --- trunk/extras/ignorecase.h 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/extras/ignorecase.h 2007-03-11 10:10:28 UTC (rev 821) @@ -39,7 +39,7 @@ * NO WARRANTY. * * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. - * Please see LICENSE in the root of the source tree. + * Please see LICENSE.txt in the root of the source tree. * * \author Ryan C. Gordon. */ Modified: trunk/extras/physfshttpd.c =================================================================== --- trunk/extras/physfshttpd.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/extras/physfshttpd.c 2007-03-11 10:10:28 UTC (rev 821) @@ -27,7 +27,7 @@ * NO WARRANTY. * * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. - * Please see LICENSE in the root of the source tree. + * Please see LICENSE.txt in the root of the source tree. * * This file was written by Ryan C. Gordon. (icculus at icculus.org). */ Modified: trunk/extras/physfsrwops.c =================================================================== --- trunk/extras/physfsrwops.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/extras/physfsrwops.c 2007-03-11 10:10:28 UTC (rev 821) @@ -13,7 +13,7 @@ * NO WARRANTY. * * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. - * Please see LICENSE in the root of the source tree. + * Please see LICENSE.txt in the root of the source tree. * * SDL falls under the LGPL license. You can get SDL at http://www.libsdl.org/ * Modified: trunk/extras/physfsrwops.h =================================================================== --- trunk/extras/physfsrwops.h 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/extras/physfsrwops.h 2007-03-11 10:10:28 UTC (rev 821) @@ -13,7 +13,7 @@ * NO WARRANTY. * * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. - * Please see LICENSE in the root of the source tree. + * Please see LICENSE.txt in the root of the source tree. * * SDL falls under the LGPL license. You can get SDL at http://www.libsdl.org/ * Modified: trunk/extras/selfextract.c =================================================================== --- trunk/extras/selfextract.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/extras/selfextract.c 2007-03-11 10:10:28 UTC (rev 821) @@ -12,7 +12,7 @@ * NO WARRANTY. * * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license. - * Please see LICENSE in the root of the source tree. + * Please see LICENSE.txt in the root of the source tree. * * This file was written by Ryan C. Gordon. (icculus at icculus.org). */ Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/physfs.c 2007-03-11 10:10:28 UTC (rev 821) @@ -3,7 +3,7 @@ * * Documentation is in physfs.h. It's verbose, honest. :) * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/physfs.h 2007-03-11 10:10:28 UTC (rev 821) @@ -200,7 +200,7 @@ * * Other stuff: * - * Please see the file LICENSE in the source's root directory for licensing + * Please see the file LICENSE.txt in the source's root directory for licensing * and redistribution rights. * * Please see the file CREDITS in the source's root directory for a more or Modified: trunk/physfs.spec.in =================================================================== --- trunk/physfs.spec.in 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/physfs.spec.in 2007-03-11 10:10:28 UTC (rev 821) @@ -67,7 +67,7 @@ %files %defattr(-,root,root) -%doc CHANGELOG CREDITS INSTALL LICENSE TODO zlib_license_change.txt +%doc CHANGELOG CREDITS INSTALL LICENSE.txt TODO zlib_license_change.txt %{_bindir}/test_physfs %{_libdir}/*so.* Modified: trunk/physfs_byteorder.c =================================================================== --- trunk/physfs_byteorder.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/physfs_byteorder.c 2007-03-11 10:10:28 UTC (rev 821) @@ -3,7 +3,7 @@ * * Documentation is in physfs.h. It's verbose, honest. :) * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/physfs_internal.h =================================================================== --- trunk/physfs_internal.h 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/physfs_internal.h 2007-03-11 10:10:28 UTC (rev 821) @@ -2,7 +2,7 @@ * Internal function/structure declaration. Do NOT include in your * application. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/platform/beos.cpp =================================================================== --- trunk/platform/beos.cpp 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/platform/beos.cpp 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * BeOS platform-dependent support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/platform/macclassic.c =================================================================== --- trunk/platform/macclassic.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/platform/macclassic.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * MacOS Classic support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/platform/os2.c =================================================================== --- trunk/platform/os2.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/platform/os2.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * OS/2 support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/platform/pocketpc.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * Skeleton platform-dependent support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/platform/posix.c =================================================================== --- trunk/platform/posix.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/platform/posix.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * Posix-esque support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/platform/skeleton.c =================================================================== --- trunk/platform/skeleton.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/platform/skeleton.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * Skeleton platform-dependent support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/platform/unix.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * Unix support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/platform/windows.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /* * Win32 support routines for PhysicsFS. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon, and made sane by Gregory S. Read. */ Modified: trunk/test/test_physfs.c =================================================================== --- trunk/test/test_physfs.c 2007-03-11 09:44:21 UTC (rev 820) +++ trunk/test/test_physfs.c 2007-03-11 10:10:28 UTC (rev 821) @@ -1,7 +1,7 @@ /** * Test program for PhysicsFS. May only work on Unix. * - * Please see the file LICENSE in the source's root directory. + * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ From DONOTREPLY at icculus.org Sun Mar 11 06:12:39 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 06:12:39 -0400 Subject: r822 - trunk/platform Message-ID: <20070311101239.12153.qmail@icculus.org> Author: icculus Date: 2007-03-11 06:12:39 -0400 (Sun, 11 Mar 2007) New Revision: 822 Modified: trunk/platform/macclassic.c trunk/platform/pocketpc.c trunk/platform/windows.c Log: Fixed some comments. Modified: trunk/platform/macclassic.c =================================================================== --- trunk/platform/macclassic.c 2007-03-11 10:10:28 UTC (rev 821) +++ trunk/platform/macclassic.c 2007-03-11 10:12:39 UTC (rev 822) @@ -1,5 +1,5 @@ /* - * MacOS Classic support routines for PhysicsFS. + * Mac OS classic support routines for PhysicsFS. * * Please see the file LICENSE.txt in the source's root directory. * @@ -13,14 +13,14 @@ /* * Most of the API calls in here are, according to ADC, available since - * MacOS 8.1. I don't think I used any MacOS 9 or CarbonLib-specific + * Mac OS 8.1. I don't think I used any Mac OS 9 or CarbonLib-specific * functions. There might be one or two 8.5 calls, and perhaps when the - * ADC docs say "Available in MacOS 8.1" they really mean "this works + * ADC docs say "Available in Mac OS 8.1" they really mean "this works * with System 6, but we don't want to hear about it at this point." * - * IsAliasFile() showed up in MacOS 8.5. You can duplicate this code with + * IsAliasFile() showed up in Mac OS 8.5. You can duplicate this code with * PBGetCatInfoSync(), which is an older API, if you hope the bits in the - * catalog info never change (which they won't for, say, MacOS 8.1). + * catalog info never change (which they won't for, say, Mac OS 8.1). * See Apple Technote FL-30: * http://developer.apple.com/technotes/fl/fl_30.html * @@ -33,7 +33,7 @@ /* * Please note that I haven't tried this code with CarbonLib or under - * MacOS X at all. The code in unix.c is known to work with Darwin, + * Mac OS X at all. The code in unix.c is known to work with Darwin, * and you may or may not be better off using that, especially since * mutexes are no-ops in this file. Patches welcome. */ @@ -636,7 +636,7 @@ char *__PHYSFS_platformCurrentDir(void) { /* - * I don't think MacOS has a concept of "current directory", beyond + * I don't think Mac OS has a concept of "current directory", beyond * what is grafted on by a given standard C library implementation, * so just return the base dir. * We don't use this for anything crucial at the moment anyhow. @@ -876,25 +876,25 @@ void *__PHYSFS_platformCreateMutex(void) { - return((void *) 0x0001); /* no mutexes on MacOS Classic. */ + return((void *) 0x0001); /* no mutexes on Mac OS classic. */ } /* __PHYSFS_platformCreateMutex */ void __PHYSFS_platformDestroyMutex(void *mutex) { - /* no mutexes on MacOS Classic. */ + /* no mutexes on Mac OS classic. */ } /* __PHYSFS_platformDestroyMutex */ int __PHYSFS_platformGrabMutex(void *mutex) { - return(1); /* no mutexes on MacOS Classic. */ + return(1); /* no mutexes on Mac OS classic. */ } /* __PHYSFS_platformGrabMutex */ void __PHYSFS_platformReleaseMutex(void *mutex) { - /* no mutexes on MacOS Classic. */ + /* no mutexes on Mac OS classic. */ } /* __PHYSFS_platformReleaseMutex */ @@ -917,7 +917,7 @@ modDate = ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0) ? infoPB.dirInfo.ioDrMdDat : infoPB.hFileInfo.ioFlMdDat; - /* epoch is different on MacOS. They use Jan 1, 1904, apparently. */ + /* epoch is different on Mac OS. They use Jan 1, 1904, apparently. */ /* subtract seconds between those epochs, counting leap years. */ modDate -= 2082844800; Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-11 10:10:28 UTC (rev 821) +++ trunk/platform/pocketpc.c 2007-03-11 10:12:39 UTC (rev 822) @@ -1,5 +1,5 @@ /* - * Skeleton platform-dependent support routines for PhysicsFS. + * PocketPC support routines for PhysicsFS. * * Please see the file LICENSE.txt in the source's root directory. * Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-11 10:10:28 UTC (rev 821) +++ trunk/platform/windows.c 2007-03-11 10:12:39 UTC (rev 822) @@ -1,5 +1,5 @@ /* - * Win32 support routines for PhysicsFS. + * Windows support routines for PhysicsFS. * * Please see the file LICENSE.txt in the source's root directory. * From DONOTREPLY at icculus.org Sun Mar 11 06:15:42 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 06:15:42 -0400 Subject: r823 - trunk Message-ID: <20070311101542.13634.qmail@icculus.org> Author: icculus Date: 2007-03-11 06:15:42 -0400 (Sun, 11 Mar 2007) New Revision: 823 Added: trunk/INSTALL.txt Removed: trunk/INSTALL Modified: trunk/physfs.spec.in Log: Renamed INSTALL to INSTALL.txt. Deleted: trunk/INSTALL =================================================================== --- trunk/INSTALL 2007-03-11 10:12:39 UTC (rev 822) +++ trunk/INSTALL 2007-03-11 10:15:42 UTC (rev 823) @@ -1,134 +0,0 @@ - -The latest PhysicsFS information and releases can be found at: - http://icculus.org/physfs/ - -Building is (ahem) very easy. - - -ALL PLATFORMS: - -Please understand your rights and mine: read the text file LICENSE.txt in the - root of the source tree. If you can't abide by it, delete this source tree - now. - -If you've got Doxygen (http://www.doxygen.org/) installed, you can run it - without any command line arguments in the root of the source tree to generate - the API reference. This is optional. You can browse the API docs online - here: http://icculus.org/physfs/docs/ - - - -UNIX: -(If you got this code from CVS, run "./bootstrap" first.) - -Run ./configure --help and see what features can be optionally enabled or -disabled. "./configure" does its best to pick optimal defaults for your -platform. - -Run "make". -As root, run "make install". -If you get sick of the library, run "make uninstall" as root and it will -remove all traces of the library from the system paths. - -Primary Unix development is done with GNU/Linux, but PhysicsFS is known to -work out of the box with several flavors of Unix. It it doesn't work, patches -to get it running can be sent to icculus at icculus.org. - - -BeOS: -Use the "Unix" instructions, above. - - -AtheOS/Syllable: -Use the "Unix" instructions, above. - - -WIN32: -If building with CygWin, mingw32 or something else that uses the GNU -toolchain, follow the Unix instructions, above. - -If you're using Visual C++ 6, point it at "physfs.dsp" in the root of the -source tree, and build. This will produce a "physfs.dll" and "physfs.lib" -(shared library and import lib, respectively) in either a "Debug" or -"Release" directory, depending on what configuration you chose to build. -After building the lib, you can make sure it works by building the -"test_physfs.dsp" project file, which will create "test_physfs.exe" in -"Debug" or "Release". This EXE is linked against the DLL you built -previously. - -If you're using Visual C++ 6 and want to generate a static LIB file, point -it at "physfs_static.dsp" in the root of the source tree and build. This -will produce a "physfs_static.lib" in either a "physfs_static_debug" -or a "physfs_static_release" directory, depending on what configuration -you chose to build. NOTE: "test_physfs.dsp" does not work with the -statically linked build. - -Visual Studio.NET users should do the same thing, but use the "physfs.vcproj" -and "test_physfs.vcproj" project files instead. - -NOTE: to change build options such as which drivers are loaded (ZIP, QPAK, -etc.) modify the appropriate manifest constants under the Project Settings. -By default the LIB version supports all drivers, but the DLL build does -not support MVL or HOG file formats. - -If you're using another compiler, send me a patch when you get it working. :) - -No one's tried building this for a WinCE (PocketPC) platform, but it may or -may not work. Patches are welcome. - -If someone is willing to maintain prebuilt PhysicsFS DLLs, I'd like to hear -from you; send an email to icculus at icculus.org. - -MACOS 8/9: -Double-click on "CWProjects.sit" in the root of the source tree. This will -unpack into a folder called "Mac Classic Support", which has CodeWarrior 6 -project files. - -Point CodeWarrior at "physfs.mcp" in that new folder, and build. This will -produce a "PhysicsFS" or "PhysicsFS Debug" shared library, depending on what -configuration you chose to build. After building the lib, you can make sure -it works by building the "test_physfs.mcp" project file, which will create -"test_physfs" or "test_physfs Debug". These binaries are linked against the -DLLs you built previously. - -If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for -the Mac, I'd like to hear from you; send an email to icculus at icculus.org. - - - -MACOS X: -You (currently) need to use the freeware Apple Developer Tools, which are -based on the GNU toolchain. Fire up a terminal and run "cc"...if this reports -"no input files" then you've got the tools installed. - -Follow the Unix directions, above (configure, make, make install). - -If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for -MacOS X, I'd like to hear from you; send an email to icculus at icculus.org. - - -OS/2: -You need EMX installed. I tried this on a stock Warp 4 install, no fixpaks. -I used the latest EMX and patches (which are several years old now). You need -to install link386.exe (Selective Install, "link object modules" option). Once -EMX is installed correctly, unpack the source to PhysicsFS and run the script -file "makeos2.cmd". I know this isn't ideal, but I wanted to have this build -without users having to hunt down a "make" program (While several exist, EMX -doesn't come with one). If someone wants to hack some REXX to make this a bit -more picky about recompiling, I'll accept the patch. - -If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for -OS/2, I'd like to hear from you; send an email to icculus at icculus.org. - - -OTHER PLATFORMS: -Many Unix-like platforms might "just work" with the GNU autoconf tools. Some -of these platforms are known to have worked at one time, but have not been -heavily tested, if tested at all. PhysicsFS is, as far as we know, 64-bit and -byteorder clean, and is known to compile on several compilers across many -platforms. To implement a new platform or archiver, please read the -heavily-commented physfs_internal.h and look in the platform/ and archiver/ -directories for examples. - ---ryan. (icculus at icculus.org) - Copied: trunk/INSTALL.txt (from rev 821, trunk/INSTALL) =================================================================== --- trunk/INSTALL.txt (rev 0) +++ trunk/INSTALL.txt 2007-03-11 10:15:42 UTC (rev 823) @@ -0,0 +1,134 @@ + +The latest PhysicsFS information and releases can be found at: + http://icculus.org/physfs/ + +Building is (ahem) very easy. + + +ALL PLATFORMS: + +Please understand your rights and mine: read the text file LICENSE.txt in the + root of the source tree. If you can't abide by it, delete this source tree + now. + +If you've got Doxygen (http://www.doxygen.org/) installed, you can run it + without any command line arguments in the root of the source tree to generate + the API reference. This is optional. You can browse the API docs online + here: http://icculus.org/physfs/docs/ + + + +UNIX: +(If you got this code from CVS, run "./bootstrap" first.) + +Run ./configure --help and see what features can be optionally enabled or +disabled. "./configure" does its best to pick optimal defaults for your +platform. + +Run "make". +As root, run "make install". +If you get sick of the library, run "make uninstall" as root and it will +remove all traces of the library from the system paths. + +Primary Unix development is done with GNU/Linux, but PhysicsFS is known to +work out of the box with several flavors of Unix. It it doesn't work, patches +to get it running can be sent to icculus at icculus.org. + + +BeOS: +Use the "Unix" instructions, above. + + +AtheOS/Syllable: +Use the "Unix" instructions, above. + + +WIN32: +If building with CygWin, mingw32 or something else that uses the GNU +toolchain, follow the Unix instructions, above. + +If you're using Visual C++ 6, point it at "physfs.dsp" in the root of the +source tree, and build. This will produce a "physfs.dll" and "physfs.lib" +(shared library and import lib, respectively) in either a "Debug" or +"Release" directory, depending on what configuration you chose to build. +After building the lib, you can make sure it works by building the +"test_physfs.dsp" project file, which will create "test_physfs.exe" in +"Debug" or "Release". This EXE is linked against the DLL you built +previously. + +If you're using Visual C++ 6 and want to generate a static LIB file, point +it at "physfs_static.dsp" in the root of the source tree and build. This +will produce a "physfs_static.lib" in either a "physfs_static_debug" +or a "physfs_static_release" directory, depending on what configuration +you chose to build. NOTE: "test_physfs.dsp" does not work with the +statically linked build. + +Visual Studio.NET users should do the same thing, but use the "physfs.vcproj" +and "test_physfs.vcproj" project files instead. + +NOTE: to change build options such as which drivers are loaded (ZIP, QPAK, +etc.) modify the appropriate manifest constants under the Project Settings. +By default the LIB version supports all drivers, but the DLL build does +not support MVL or HOG file formats. + +If you're using another compiler, send me a patch when you get it working. :) + +No one's tried building this for a WinCE (PocketPC) platform, but it may or +may not work. Patches are welcome. + +If someone is willing to maintain prebuilt PhysicsFS DLLs, I'd like to hear +from you; send an email to icculus at icculus.org. + +MACOS 8/9: +Double-click on "CWProjects.sit" in the root of the source tree. This will +unpack into a folder called "Mac Classic Support", which has CodeWarrior 6 +project files. + +Point CodeWarrior at "physfs.mcp" in that new folder, and build. This will +produce a "PhysicsFS" or "PhysicsFS Debug" shared library, depending on what +configuration you chose to build. After building the lib, you can make sure +it works by building the "test_physfs.mcp" project file, which will create +"test_physfs" or "test_physfs Debug". These binaries are linked against the +DLLs you built previously. + +If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for +the Mac, I'd like to hear from you; send an email to icculus at icculus.org. + + + +MACOS X: +You (currently) need to use the freeware Apple Developer Tools, which are +based on the GNU toolchain. Fire up a terminal and run "cc"...if this reports +"no input files" then you've got the tools installed. + +Follow the Unix directions, above (configure, make, make install). + +If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for +MacOS X, I'd like to hear from you; send an email to icculus at icculus.org. + + +OS/2: +You need EMX installed. I tried this on a stock Warp 4 install, no fixpaks. +I used the latest EMX and patches (which are several years old now). You need +to install link386.exe (Selective Install, "link object modules" option). Once +EMX is installed correctly, unpack the source to PhysicsFS and run the script +file "makeos2.cmd". I know this isn't ideal, but I wanted to have this build +without users having to hunt down a "make" program (While several exist, EMX +doesn't come with one). If someone wants to hack some REXX to make this a bit +more picky about recompiling, I'll accept the patch. + +If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for +OS/2, I'd like to hear from you; send an email to icculus at icculus.org. + + +OTHER PLATFORMS: +Many Unix-like platforms might "just work" with the GNU autoconf tools. Some +of these platforms are known to have worked at one time, but have not been +heavily tested, if tested at all. PhysicsFS is, as far as we know, 64-bit and +byteorder clean, and is known to compile on several compilers across many +platforms. To implement a new platform or archiver, please read the +heavily-commented physfs_internal.h and look in the platform/ and archiver/ +directories for examples. + +--ryan. (icculus at icculus.org) + Modified: trunk/physfs.spec.in =================================================================== --- trunk/physfs.spec.in 2007-03-11 10:12:39 UTC (rev 822) +++ trunk/physfs.spec.in 2007-03-11 10:15:42 UTC (rev 823) @@ -67,7 +67,7 @@ %files %defattr(-,root,root) -%doc CHANGELOG CREDITS INSTALL LICENSE.txt TODO zlib_license_change.txt +%doc CHANGELOG.txt CREDITS.txt INSTALL.txt LICENSE.txt TODO.txt %{_bindir}/test_physfs %{_libdir}/*so.* @@ -78,6 +78,9 @@ %{_includedir}/physfs.h %changelog +* Sun Mar 11 2007 Ryan C. Gordon +- Updated filenames in documents. + * Thu Dec 18 2002 Edward Rudd - added zlib_license_change.txt to documents @@ -93,3 +96,4 @@ * Tue Apr 30 2002 Edward Rudd - Initial spec file + From DONOTREPLY at icculus.org Sun Mar 11 06:16:15 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 06:16:15 -0400 Subject: r824 - trunk Message-ID: <20070311101615.13998.qmail@icculus.org> Author: icculus Date: 2007-03-11 06:16:15 -0400 (Sun, 11 Mar 2007) New Revision: 824 Modified: trunk/INSTALL.txt Log: Updated INSTALL.txt with updated info. Modified: trunk/INSTALL.txt =================================================================== --- trunk/INSTALL.txt 2007-03-11 10:15:42 UTC (rev 823) +++ trunk/INSTALL.txt 2007-03-11 10:16:15 UTC (rev 824) @@ -9,126 +9,144 @@ Please understand your rights and mine: read the text file LICENSE.txt in the root of the source tree. If you can't abide by it, delete this source tree - now. + now. The license is extremely liberal, even to closed-source, commercial + applications. If you've got Doxygen (http://www.doxygen.org/) installed, you can run it without any command line arguments in the root of the source tree to generate - the API reference. This is optional. You can browse the API docs online - here: http://icculus.org/physfs/docs/ + the API reference (or build the "docs" target from your build system). This + is optional. You can browse the API docs online here: + http://icculus.org/physfs/docs/ + + UNIX: -(If you got this code from CVS, run "./bootstrap" first.) -Run ./configure --help and see what features can be optionally enabled or -disabled. "./configure" does its best to pick optimal defaults for your -platform. +You will need CMake (http://www.cmake.org/) 2.4 or later installed. -Run "make". +Run "cmake ." in the root of the source directory to generate Makefiles. + You can then run "ccmake ." and customize the build, but the defaults are + probably okay. You can have CMake generate KDevelop project files if you + prefer these. + +Run "make". PhysicsFS will now build. + As root, run "make install". -If you get sick of the library, run "make uninstall" as root and it will -remove all traces of the library from the system paths. + If you get sick of the library, run "xargs rm < install_manifest.txt" as root + and it will remove all traces of the library from the system paths. Primary Unix development is done with GNU/Linux, but PhysicsFS is known to -work out of the box with several flavors of Unix. It it doesn't work, patches -to get it running can be sent to icculus at icculus.org. + work out of the box with several flavors of Unix. It it doesn't work, patches + to get it running can be sent to icculus at icculus.org. + BeOS: -Use the "Unix" instructions, above. +Use the "Unix" instructions, above. The CMake port to BeOS is fairly new at + the time of this writing, but it works. You can get it from bebits.com ... -AtheOS/Syllable: -Use the "Unix" instructions, above. -WIN32: +Windows: + If building with CygWin, mingw32 or something else that uses the GNU -toolchain, follow the Unix instructions, above. + toolchain, follow the Unix instructions, above. -If you're using Visual C++ 6, point it at "physfs.dsp" in the root of the -source tree, and build. This will produce a "physfs.dll" and "physfs.lib" -(shared library and import lib, respectively) in either a "Debug" or -"Release" directory, depending on what configuration you chose to build. -After building the lib, you can make sure it works by building the -"test_physfs.dsp" project file, which will create "test_physfs.exe" in -"Debug" or "Release". This EXE is linked against the DLL you built -previously. +If you want to use Visual Studio, nmake, or the Platform SDK, you will need + CMake (http://www.cmake.org/) 2.4 or later installed. Point CMake at the + CMakeLists.txt file in the root of the source directory and it will generate + project files for you. -If you're using Visual C++ 6 and want to generate a static LIB file, point -it at "physfs_static.dsp" in the root of the source tree and build. This -will produce a "physfs_static.lib" in either a "physfs_static_debug" -or a "physfs_static_release" directory, depending on what configuration -you chose to build. NOTE: "test_physfs.dsp" does not work with the -statically linked build. +PhysicsFS will only link directly against system libraries that have existed + since Windows 95 and Windows NT 3.51. If there's a newer API we want to use, + we try to dynamically load it at runtime and fallback to a reasonable + behaviour when we can't find it...this is used for Unicode support and + locating user-specific directories, etc. -Visual Studio.NET users should do the same thing, but use the "physfs.vcproj" -and "test_physfs.vcproj" project files instead. +PhysicsFS has not been tested on 64-bit Windows, but probably works. There is + no 16-bit Windows support at all. Reports of success and problems can go to + Ryan at icculus at icculus.org ... -NOTE: to change build options such as which drivers are loaded (ZIP, QPAK, -etc.) modify the appropriate manifest constants under the Project Settings. -By default the LIB version supports all drivers, but the DLL build does -not support MVL or HOG file formats. +If someone is willing to maintain prebuilt PhysicsFS DLLs, I'd like to hear +from you; send an email to icculus at icculus.org ... -If you're using another compiler, send me a patch when you get it working. :) -No one's tried building this for a WinCE (PocketPC) platform, but it may or -may not work. Patches are welcome. -If someone is willing to maintain prebuilt PhysicsFS DLLs, I'd like to hear -from you; send an email to icculus at icculus.org. +PocketPC/WindowsCE: -MACOS 8/9: +Code exists for PocketPC support, and there are shipping titles that used + PhysicsFS 1.0 on PocketPC...but it isn't tested in 2.0, and is probably + broken with the new build system. Please send patches. + + + +MAC OS 8/9: + Double-click on "CWProjects.sit" in the root of the source tree. This will -unpack into a folder called "Mac Classic Support", which has CodeWarrior 6 -project files. + unpack into a folder called "Mac Classic Support", which has CodeWarrior 6 + project files. Point CodeWarrior at "physfs.mcp" in that new folder, and build. This will -produce a "PhysicsFS" or "PhysicsFS Debug" shared library, depending on what -configuration you chose to build. After building the lib, you can make sure -it works by building the "test_physfs.mcp" project file, which will create -"test_physfs" or "test_physfs Debug". These binaries are linked against the -DLLs you built previously. + produce a "PhysicsFS" or "PhysicsFS Debug" shared library, depending on what + configuration you chose to build. After building the lib, you can make sure + it works by building the "test_physfs.mcp" project file, which will create + "test_physfs" or "test_physfs Debug". These binaries are linked against the + DLLs you built previously. +PhysicsFS builds for classic Mac OS do not require CarbonLib...they use + OS 8 (8.5?) APIs exclusively. + If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for -the Mac, I'd like to hear from you; send an email to icculus at icculus.org. + the Mac, I'd like to hear from you; send an email to icculus at icculus.org. -MACOS X: -You (currently) need to use the freeware Apple Developer Tools, which are -based on the GNU toolchain. Fire up a terminal and run "cc"...if this reports -"no input files" then you've got the tools installed. -Follow the Unix directions, above (configure, make, make install). +MAC OS X: +You will need CMake (http://www.cmake.org/) 2.4 or later installed. + +You can either generate a Unix makefile with CMake, or generate an Xcode + project, whichever makes you more comfortable. + +PowerPC and Intel Macs should both be supported. + If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for -MacOS X, I'd like to hear from you; send an email to icculus at icculus.org. + Mac OS X, I'd like to hear from you; send an email to icculus at icculus.org. + OS/2: + You need EMX installed. I tried this on a stock Warp 4 install, no fixpaks. -I used the latest EMX and patches (which are several years old now). You need -to install link386.exe (Selective Install, "link object modules" option). Once -EMX is installed correctly, unpack the source to PhysicsFS and run the script -file "makeos2.cmd". I know this isn't ideal, but I wanted to have this build -without users having to hunt down a "make" program (While several exist, EMX -doesn't come with one). If someone wants to hack some REXX to make this a bit -more picky about recompiling, I'll accept the patch. + I used the latest EMX and patches (which are several years old now). You need + to install link386.exe (Selective Install, "link object modules" option). Once + EMX is installed correctly, unpack the source to PhysicsFS and run the script + file "makeos2.cmd". I know this isn't ideal, but I wanted to have this build + without users having to hunt down a "make" program (While several exist, EMX + doesn't come with one). If someone wants to hack some REXX to make this a bit + more picky about recompiling, I'll accept the patch. +Modernizing this for post-EMX systems or OpenWatcom may be good solutions, too. + Send patches. And port CMake. + If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for -OS/2, I'd like to hear from you; send an email to icculus at icculus.org. + OS/2, I'd like to hear from you; send an email to icculus at icculus.org. + OTHER PLATFORMS: -Many Unix-like platforms might "just work" with the GNU autoconf tools. Some -of these platforms are known to have worked at one time, but have not been -heavily tested, if tested at all. PhysicsFS is, as far as we know, 64-bit and -byteorder clean, and is known to compile on several compilers across many -platforms. To implement a new platform or archiver, please read the -heavily-commented physfs_internal.h and look in the platform/ and archiver/ -directories for examples. +Many Unix-like platforms might "just work" with CMake. Some of these platforms + are known to have worked at one time, but have not been heavily tested, if + tested at all. PhysicsFS is, as far as we know, 64-bit and byteorder clean, + and is known to compile on several compilers across many platforms. To + implement a new platform or archiver, please read the heavily-commented + physfs_internal.h and look in the platform/ and archiver/ directories for + examples. + --ryan. (icculus at icculus.org) From DONOTREPLY at icculus.org Sun Mar 11 06:17:12 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 06:17:12 -0400 Subject: r825 - trunk Message-ID: <20070311101712.14373.qmail@icculus.org> Author: icculus Date: 2007-03-11 06:17:11 -0400 (Sun, 11 Mar 2007) New Revision: 825 Removed: trunk/physfs.rc Log: Removed physfs.rc (CMake should handle this, right?!) Deleted: trunk/physfs.rc =================================================================== --- trunk/physfs.rc 2007-03-11 10:16:15 UTC (rev 824) +++ trunk/physfs.rc 2007-03-11 10:17:11 UTC (rev 825) @@ -1,27 +0,0 @@ - -1 VERSIONINFO -FILEVERSION 1,0,1,0 -PRODUCTVERSION 1,0,1,0 -FILEOS 0x40004 -FILETYPE 0x2 -{ -BLOCK "StringFileInfo" -{ - BLOCK "040904B0" - { - VALUE "CompanyName", "" - VALUE "FileDescription", "PhysicsFS" - VALUE "FileVersion", "1, 0, 1, 0" - VALUE "InternalName", "PhysFS" - VALUE "LegalCopyright", "Copyright ? 2006 Ryan C. Gordon" - VALUE "OriginalFilename", "phyfs.dll" - VALUE "ProductName", "PhysicsFS" - VALUE "ProductVersion", "1, 0, 1, 0" - } -} - -BLOCK "VarFileInfo" -{ - VALUE "Translation", 0x0409 0x04B0 -} -} From DONOTREPLY at icculus.org Sun Mar 11 06:17:37 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 06:17:37 -0400 Subject: r826 - trunk Message-ID: <20070311101737.14612.qmail@icculus.org> Author: icculus Date: 2007-03-11 06:17:37 -0400 (Sun, 11 Mar 2007) New Revision: 826 Modified: trunk/CHANGELOG Log: Updated. Modified: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-11 10:17:11 UTC (rev 825) +++ trunk/CHANGELOG 2007-03-11 10:17:37 UTC (rev 826) @@ -5,7 +5,7 @@ 03112007 - Removed zlib_license_change.txt ... it's in Subversion and the 1.0 branch for history's sake. Added shared and static build options to CMakeLists.txt, and the expected "make install" target. - Renamed some FILENAME files to FILENAME.txt. + Renamed some FILENAME files to FILENAME.txt, removed physfs.rc. 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC code to expect UTF-8 strings from the higher level. Changed From DONOTREPLY at icculus.org Sun Mar 11 06:19:52 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 06:19:52 -0400 Subject: r827 - trunk Message-ID: <20070311101952.15612.qmail@icculus.org> Author: icculus Date: 2007-03-11 06:19:52 -0400 (Sun, 11 Mar 2007) New Revision: 827 Added: trunk/CHANGELOG.txt trunk/CREDITS.txt trunk/TODO.txt Removed: trunk/CHANGELOG trunk/CREDITS trunk/TODO Modified: trunk/physfs.h Log: Moved more files from FILENAME to FILENAME.txt ... Deleted: trunk/CHANGELOG =================================================================== --- trunk/CHANGELOG 2007-03-11 10:17:37 UTC (rev 826) +++ trunk/CHANGELOG 2007-03-11 10:19:52 UTC (rev 827) @@ -1,523 +0,0 @@ -/* - * CHANGELOG. - */ - -03112007 - Removed zlib_license_change.txt ... it's in Subversion and the 1.0 - branch for history's sake. Added shared and static build options - to CMakeLists.txt, and the expected "make install" target. - Renamed some FILENAME files to FILENAME.txt, removed physfs.rc. -03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. - Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC - code to expect UTF-8 strings from the higher level. Changed - PHYSFS_SUPPORTS_LZMA to PHYSFS_SUPPORTS_7Z. Killed some #ifdefs - in physfs.c. Moved to CMake...so long, autotools! Killed MIX - archiver, too. -11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work. - Minor BeOS realpath tweak. -09272006 - Reworked 7zip archiver (thanks, Dennis!). -09232006 - Fixed typo in doxygen comment. -04112006 - Added LZMA archiver...7zip support (thanks, Dennis!). -03232006 - Added -fvisibility for gcc4 (http://gcc.gnu.org/wiki/Visibility) -01012006 - Cleaned up overflow checks in platform memory allocators (thanks to - Nicolas Lebedenco for pointing out the original issue with - long long literals). Added physfs.rc (thanks, Dennis!). Changed my - email address. Removed acconfig.h. -11282005 - Corrected docs on PHYSFS_setWriteDir(). -10122005 - Fixed locateInStringList() in physfs.c (thanks, Matze!). Patched - archivers/wad.c to compile. -09192005 - Make unix mutexes recursive above pthread layer...fixes deadlock on - MacOS X, for now. -09182005 - API BREAKAGE: PHYSFS_enumerateFilesCallback() now passes the - original directory name back to the app in the callback. This - API was only in 1.1.0, and wasn't promised to be stable at this - point. Please update your apps! Cleaned out a FIXME in file - enumeration that would confuse the library under certain - circumstances. -09092005 - Some tweaks to PHYSFS_Allocator. Apparently configure.in doesn't - work like I thought for version bumps, so it thinks 1.1.0 isn't - binary compatible with 1.0...fixed, I think. -09062005 - Happy September. Changed the allocation abstraction to use - PHYSFS_uint64 instead of size_t, so we don't have to include - system headers inside physfs.h. Minor MingW fixes (but it's still - broken, I think). -08202005 - Fixed bug in verifyPath() that was breaking PHYSFS_setSaneConfig() - and other corner cases. -07242005 - Patched to compile on BeOS. -07232005 - Fixed bug in zip archiver (thanks, J?rg Walter!). - More minor OS/2 tweaks. Updated zlib to 1.2.3, which properly - includes the security fix. Fixed "make dist" to handle .svn dirs - and other file changes. Removed "debian" directory. Allow a mount - point of NULL to be "/", per the documentation. Fixed warning in - physfs.c. Assert definition fix. Updated CWProjects.sit. - Upped version to 1.1.0 ... first release of 1.1 dev branch! -07212005 - Patched to compile on OS/2 again. -07132005 - Updated zlib to 1.2.2, and patched it for this security hole: - http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-2096 -06122005 - Added support for mingw to Unix build process (thanks, Matze!). -03162005 - Added missing translation and Portuguese support (thanks, Danny!). - MPW support and several MacOS Classic fixes (thanks, Chris!). - Changed CWProjects from SITX to SIT format, so OS9 users can - unpack it. -03132005 - More mount work, added PHYSFS_getMountPoint() and more cleanups. - Replaced all the C runtime allocations with PhysFS allocation hooks. - Added pocketpc.c to EXTRA_DIST. Added allocation hooks to some - platform drivers. Updated Mac Classic build. -03122005 - Added evil GOTO_*_MACRO_* macros. Fixed unix.c to compile again on - MacOS X. Added PHYSFS_mount() (thanks, Philip!). Cleaned up the - INSTALL and CREDITS files a little. Split off start of - verifySecurity() into a path sanitizer and changed entry points to - sanitize input paths into a stack-allocated buffer before further - processing. This removes the need for a malloc() for almost all - file system operations, and generally cleaned things up. Added a - "mount" command to test_physfs. Other general cleanups. -02152005 - Minor comment fix in platform/pocketpc.c -01052005 - Fixed HOG archiver file lookup (thanks, Chris!) -12162004 - Fixed some documentation/header comment typos (thanks, Gaetan!) -10302004 - Fixed a strcpy that should have been a strcat. (thanks, Tolga!) - Build system respects external CFLAGS now. (thanks, Adam!) - Fixed infinite loop in new enumeration code. (thanks, Adam!) -10062004 - Removed profiling code from physfs.c. -09292004 - Every API that can return a list of strings can now use a - callback mechanism if the application wants to do it's own - allocation or handling on a per-item basis. The guts of those - APIs that create string lists now use the callbacks themselves to - build the lists, too. The callback functionality goes all the way - down to the archivers and platform drivers where appropriate, which - cleans things up and simplifies some internal tasks very nicely. - Got rid of all the annoying forward declarations in all the - archivers and moved their PHYSFS_Archiver data to the end of the - file, since this was annoying me and I was getting sick of updating - function signatures in two places when the internal API changed. - Removed the code/data for LinkedStringLists...it isn't used anymore - now that the callback code is in place. -09262004 - Did the same thing to FileHandles than I did to DirHandles, but - this triggered massive tweaking in physfs.c. A lot of code got - little cleanups, which was nice. Less malloc pressure, too, since - opening a file used to allocate a ton of crap and mush it - together...now it's basically down to one structure and the - instance data in whatever archiver. Minor varname tweak in win32.c - and pocketpc.c. Changed PHYSFS_file to PHYSFS_File to match the - rest of the API's naming scheme (but put a typedef for source - compatibility). -09252004 - Cleaned up archiver interface to not deal with DirHandles anymore, - which simplifies things, removes some responsibility and code - duplication from the archivers, and trims some malloc pressure. - Ripped up the allocation hook code a little. We'll try to screw - with memory locking later, since it makes everything ugly and - complex. Oh well. -09232004 - Started adding allocation hooks. -09222004 - Happy September. Added Spanish translation back in. -04092004 - Added MIX support for legacy Westwood titles (Thanks, Sebastian!). - Made bootstrap script MacOSX-friendly. Moved byteorder defines into - physfs_internal.h ... -01152003 - Added Portuguese (Brazil) translation (Thanks, Danny!) - - ---- This is where the 1.1 development branch starts. --- - -12292003 - Updated CodeWarrior projects from CW6 to CW7, and made a bunch of - patches to get the Mac Classic target building again. Removed - zlib114 from CVS repository. Updated OS/2 build batch file. - Added Z_PREFIX define to Unix builds that use internal zlib. - Patched up some (outdated?) Visual C project files for zlib121. - Patched Doxyfile and physfs.h for newer Doxygen. Fixed OS/2 - build script. Tweaked Project Builder files to at least compile. - Added some last minute BeOS and Cygwin build fixes. Updated - Visual Studio projects and tweaked some Makefile.am crap. Made - changes so Visual Studio files would pack with DOS endlines and... - Upped version to 1.0.0 (woohoo!). -12222003 - Fixed a search-and-replace mistake in win32.c that preventing - compiling on Windows. (thanks, Brian!) Converted VC6 .dsp to use - zlib121; made Z_PREFIX=1 enabled by default to avoid link clashes; - put zlib files in separate logical folder in .dsp project; updated - zlib121/zconf.h to address remaining symbols that were still - causing link warnings. -12182003 - WAD archiver now puts maps into subdirectories, making them - accessible to the application. (Thanks, Travis!) RPM spec and - Makefile.am* now package zlib_license_change.txt (Thanks, Edward!) -12142003 - Added Doom WAD support (Thanks, Travis!) -12082003 - Fixed some win32.c deficiencies that Robby Dermody pointed - out (thanks!) -12072003 - Upgraded internal zlib to 1.2.1 (thanks, Adam!) Other - Unix build fixes. -11112003 - Patches to make OS/2 support compile again. -11092003 - Added __PHYSFS_platformStrnicmp(), and made qpak.c case-insensitive. -09122003 - Happy September. Actually released current tree as 0.1.9. -08262003 - Added MiNT support to build process and fixed cross-compiling - (thanks Patrice Mandin!) -08092003 - Some Windows build fixes (thanks, Brian Hook!) -07232003 - Upped version to 0.1.9. -07202003 - Switched to zlib license (see new LICENSE text in root of source - tree, and zlib_license_switch.txt for details). Had to remove - archivers/qpak.c, the Ruby bindings from the extras directory, and - the Russian and Spanish translations, since those contributors - couldn't be contacted. If they show up, we'll readd them to the - project, otherwise we'll eventually replace their work...everyone - else signed on for the change. Committed a patch to convert all - tabs to spaces (Thanks, James!). Added patch to zip.c to fix - crash (thanks, dillo!). Reimplmented qpak.c, by welding together - bits of grp.c and zip.c. Ed contacted me, so I could readd his - contributions post-license change...I'm going to keep the new - qpak.c, but I've readded his Ruby bindings and Russian translations. -06112003 - Patches to globbing.c to handle corner cases (thanks, Bradley!). -06102003 - Added globbing.c to "extras" directory. -05232003 - Rewrote MacOSX/Darwin CD-ROM detection code to use IOKit, which is - much much more accurate than the previous code. Updated - configure.in and Makefile.am.newautomake for some MacOSX stuff. -05222003 - Fixed win32 crash if PHYSFS_init() is called with a NULL. -05182003 - PocketPC fixes (thanks, David Hedbor!) -05162003 - Compiler warning cleanup in HOG and MVL archivers (Thanks, Bradley!) -04082003 - Minor changes to extras/abs-file.h (Thanks, Adam!) -03302003 - Fixed seeking in uncompressed ZIP entries, and handle a - misbehaviour in Java's JAR creation tools. Thanks to "Tree" for - pointing these bugs out. Added HOG and MVL archive support for - Descent I and II (Thanks, Bradley Bell!). Added example code to - do case-insensitive file searches ("extras/ignorecase.*"). -03192003 - Fixed problem in PHYSFS_mkdir() when dirs to be created already - exist. Fixed problem where PHYSFS_mkdir() incorrectly tripped an - alarm in __PHYSFS_verifySecurity(). -03122003 - Attempt at cleaning up some type correctness for VC++6. Made QPAK - archiver case-insensitive (since Quake2 has problems without it). -01302003 - Added buffering API to OS/2 build's exported symbol list. Updated - CWProjects.sit and made several fixes to get physfs building on - MacOS Classic again. -01282003 - Fixed seeking in buffered files opened for read. -01072003 - .NET assembly and C# wrapper by Gregory S. Read in the extras dir. -01042003 - Added a hack for dealing with OSX bundles and newer PBProjects - (thanks, Eric Wing!). Added some missing files to "make dist". - Fixed minor Doxygen typo in PHYSFS_flush() docs. Upped version to - 0.1.8. -12172002 - Added Apple Project Builder support files (thanks, Eric Wing!). -12112002 - Added Ruby bindings to extras directory (thanks, Ed Sinjiashvili!). - Patched win32.c to compile with Mingw32 (thanks, Niels Wagenaar!). -12032002 - Adam updated his extras/abs-file.h for the new buffering API. -12022002 - German translation added, compliments of Michael Renner. -12012002 - Minor fix to configure.in: reported --enable-debug's default - setting incorrectly. Added buffering to the API: you can now - buffer a file with PHYSFS_setBuffer(), and flush the buffer to - disk with PHYSFS_flush(). PhysicsFS file handles are unbuffered - by default (as they were before this API addition), so this does - not break the API. Other fixes for bugs I stumbled upon during - this work are in CVS, too. -11292002 - Minor fix for strange PATH strings in unix.c (thanks, Alexander!) -11222002 - Initial PocketPC port by Corona688. -10222002 - Fixed segfault in test_physfs.c when user hits CTRL-D (and - readline() thus returns NULL)...now gracefully exits, as it should. -10142002 - Added check for AMD's x86-64 ("Hammer") architecture when - determining platform byte order. -10112002 - Fixed "setsaneconfig" command in test_physfs.c ... -09232002 - Happy September. Updated VC++6 project files, fixed some - VC++ compile nags (more work to be done in zip.c). -08302002 - Cleaned tab stops out of zip.c, and fixed a possible infinite loop - in zip_find_entry(). -08292002 - Fixed a mistake in makeos2.cmd, and updated the INSTALL docs. - Added physfs.spec.in to EXTRA_DIST in Makefile.am* -08292002 - Added a physfs/stdio wrapper header to the "extras" dir, - compliments of Adam D. Moss (file is "abs-file.h"). -08282002 - Cleanups in grp.c so that Visual C++ doesn't complain anymore. - zip.c now works correctly when PhysicsFS is disallowing symlinks. - A few minor optimizations in zip.c, with a few more to come later. - Added VS.NET project files to CVS. -08222002 - Fixed ZIP_exists() to work with directories. Now breaks out of - __PHYSFS_verifySecurity() early if a path element is missing - (since all the others will be, too)...this check is only done - if symlinks are disabled, but we might as well save easy cycles - where we can. -08212002 - Did a couple tedious-for-small-rewards cleanups, optimizations, - corrections and streamlinings I've been meaning to do. Touched a - lot of code. One of the side results is that ZIP_isDirectory() - got fixed. -08192002 - Generalized sorting routines, moved them into physfs.c and removed - the multiple copies from the various archivers. Adding profiling - code (currently only for sort routines)...enable it with - --enable-profiling in the configure script. Fixed incorrect - behaviours in configure.in. -08172002 - Patched configure.in to work around buggy autoconfs. -08162002 - Fixed QPAK archiver, since I broke it (sorry!). Also fixed a - qpak memory leak. -08092002 - Added Quake PAK archiver (qpak.c) by Ed Sinjiashvili. Thanks! - Made (successful?) attempt to fix pthread-to-ui64 cast problem. - Check for OS/2 in configure.in, in case anyone gets autoconf and - such to work right on their OS/2 box. -08012002 - Patched win32.c to compile. -07302002 - Minor error handling fix (thanks, Alexander!) -07292002 - Found some memory leaks, thanks to Valgrind (which rules, btw). - Added Russian translations (koi8-r, cp1251, cp866, and iso-8859-5) - by Ed Sinjiashvili. Added Spanish translation by Pedro J. P?rez. - Debian package support in CVS, thanks to Colin Bayer. French - translation by St?phane Peter. -07282002 - macclassic.c now returns human readable error messages instead of - ERR_OS_ERROR. Closing files on MacOS no longer fails if the volume - info can't be flushed. Minor error message tweak in os2.c. All - possible human-readable literal strings (including all those OS/2 - and MacOS error messages) have moved to constants in - physfs_internal.h...this allows the library to be translated to - other spoken languages fairly easily. -07272002 - Patched the OS/2 code to be useful...works pretty well, now. Added - makeos2.cmd for building (not an ideal solution, but oh well). - Initialized some variables in zip.c to prevent compiler whining. -07262002 - Fixed a typo in documentation. Archivers with matching file - extensions are now given first shot at opening an archive, but if - they fail, the other archivers are tried. More fixes to zip.c's - ZIP_enumerateFiles(). Wrote an OS/2 platform driver based on API - specs and a heavy pounding of Google Groups...as I don't have an - OS/2 compiler at the moment, it probably doesn't even compile. :) -07252002 - configure.in and unix.c now deal with platforms that lack a - functional pthread library. Edward Rudd sent in a patch to the RPM - specfile to have the build system set the correct version. - Clean ups in grp.c, beos.cpp and macclassic.c. -07242002 - Rewrote ZIP_enumerate(). Hopefully it sucks less this time. - unix.c and configure.in now have the infrastructure to disable - the CD-ROM detection code, and use a stub that successfully (and - unconditionally) reports no detected discs. Currently this is - used on AtheOS (which doesn't have CD-ROM support at the moment - anyhow), but it will be useful to get the library up on odd, - Unix-like systems that don't use either getmntinfo() or getmntent(). -07232002 - Cleaned up the cut-and-pastes in the various file enumeration - routines and moved it into __PHYSFS_addToLinkedStringList(). - Tons more ZIP file enhancing. I'm fairly certain it's robust and - fast in every reasonable respect, now. GRP archiver now caches - the file table...it was generally overhauled like the ZIP driver. - Added "ls" as an alias of "enumerate" in test_physfs. - I lied about zip.c's robustness; disabled the enumeration code. -07212002 - More FreeBSD build system patches. Added some new autoconf spew to - .cvsignore. bootstrap now copies the appropriate Makefile.am - instead of rename()ing it. -07192002 - Cleaned up configure.in and unix.c so that we check by available - header to determine the appropriate CD-ROM detection code...this - should make this more future-proof (and probably get it building - out of the box on other BSD platforms.) -07172002 - Fixed seeking backwards in ZIP_seek(). Changed the error message - ERR_TOO_MANY_SYMLINKS to ERR_SYMLINK_LOOP. Patches to build system - and unix.c for FreeBSD compatibility. Added physfs.spec to - "make dist" archives (thanks, Edward Rudd!). -07152002 - Symlinks in ZIP archives are detected correctly now, I think. -07142002 - Use GetVolumeInformation() instead of GetDiskFreeSpace() in - win32.c's mediaInDrive() function. This allows Windows NT 3.x to - correctly detect CD-ROM drives. Library now appears to be fully - functional on WinNT 3.51...need to try NT 3.1 still. :) - Patches to new ZIP code; cleaned up bugs in symlink reading code, - but we incorrectly identify some entries as symlinks, which doesn't - fly...for now, symlink code is commented out, so symlinks look - like regular files (and reading from a symlink entry gives you - the link as file data). -07122002 - Rewrote the ZIP archiver to no longer use Gilles Vollant's unzip.c - code. Losing that abstraction should make the ZIP archiver - significantly more efficient, and halved the amount of code used. - Plus, being a control freak, I like my coding style more than - Gilles's. :) There are still bugs to shake out, but this is good - progress. -07112002 - configure.in updated to make it happier on newer autoconfs - (thanks again, Alexander!). FIXME cleanups. -07102002 - Added a byteorder-friendly convenience API, so you can read/write - data and convert to the native byteorder without too much effort. - Upped version to 0.1.7. - Build system corrections for BeOS and Cygwin (thanks, Alexander!). - Added RPM specfile for PhysicsFS (thanks, Edward Rudd!). -06292002 - Fixed incorrect error message when opening a file for read without - defining a search path. LOTS of win32 updates and fixes; lots of - things that were broken work now, and we are slowly becoming - more compatible with legacy win32 systems. Builds on Cygwin again. - All platform drivers (except beos.cpp) had a buffer overflow when - detecting mounted CD-ROM drives...it only occurs when a drive is - detected, and it probably won't result in your box getting rooted, - but upgrade soon anyhow. Readded the .cvsignore files from the old - build system. -06282002 - Reworked build system _AGAIN_. -06222002 - Alexander Pipelka spotted a bug in the file open routines in - posix.c; patched. -06152002 - Autoconf build system will now generate shared libraries on BeOS, - and (supposedly) Cygwin. -06142002 - Rewrote autoconf build system. It now works around the MacOS X bug - that prevented shared libraries from building. -06112002 - Updated CodeWarrior projects and added them to CVS. _Finally_ - officially released 0.1.6. -06102002 - Major overhauls to platform/win32.c ... should work on all Windows - platforms, including 95/98/ME and NT/2K/XP flavors. Someone should - see if this builds on WinCE! :) You no longer need the latest - platform SDK to build it, either; the questionable DLL is accessed - with LoadLibrary() at runtime now, and handled if not present. This - now builds correctly on a freshly installed Visual Studio 6.0, and - the DLL it builds works everywhere. Plus, a bunch of other bugs - and incorrect behaviours were squashed. Visual Studio 6.0 project - file added to CVS. -06082002 - Fixes to __PHYSFS_platformEnumerateFiles() in win32.c: cleaned up - memory leak, handles paths more robustly, and prevents possible - skipped file entries. Removed AC_C_CONST and AC_TYPE_SIZE_T checks - from configure.in (not needed, and they broke BeOS build). Clean - out the docs/ directory when doing a "make dist". Fixed crashbug - when calling PHYSFS_deinit() more than once in a row. Tried to get - MacOS X to build a shared library, gave up; I'm doing something - wrong in my Makefile.am, I think. On MacOS X, running ./configure - --enable-static --disable-shared works, though. Hopefully someone - will fix this soon. In unix.c, the Darwin version of - __PHYSFS_platformDetectAvailableCDs() was free()ing a static - buffer; fixed. -06072002 - Manpages! Finally installed Doxygen and scratched together a - Doxyfile. After some revision to physfs.h, we've got a rather - nice API reference. -06062002 - Fixed __PHYSFS_platformSeek() in archivers/posix.c. Implemented the - getLastModTime method in archivers/zip.c (returns legitimate info) - and archivers/grp.c (returns lastmodtime of GRPfile itself in the - physical filesystem). Put a 64-bit _llseek() version of the seek() - and tell() methods in platform/posix.c, but you need to hack (or - rather, fix) configure.in to enable it. From Greg on win32.c: Fixed - file enumerator function (needed a wildcard '*' specification), CD - enumeration only reports CDs that have media, getLastModTime() has - been implemented. -06012002 - Added -Wall to debug builds. Removed ANSI stdio calls from - platform/posix.c, and replaced them with actual POSIX calls (that - is, fopen() became open(), fseek() became lseek(), etc...) -05272002 - Added some explicit casts when calling malloc() in platform/posix.c -05252002 - Added John Hall's file modification time patch, and added a - getlastmodtime command to test_physfs. Corrected error reporting - for missing files a little bit. Changed build system to only try - building beos.cpp if on a BeOS system (since we need a C++ compiler - available to do so). Implemented getLastModTime in macclassic.c. -05242002 - Upped version to 0.1.6 (not officially released yet). -05232002 - Fixed the build system to always package the complete source, not - just what we built for a given system, when doing a "make dist". - Updated INSTALL. Wrote BeOS platform code (platform/beos.cpp). - Split unix.c into unix.c and posix.c. Linux and BeOS both share - posix.c, although I don't think it's completely POSIX compliant at - this point (not that it matters much). -05212002 - Cleaned up some FIXMEs. -05202002 - Added .cvsignore files. -05162002 - Edward Rudd also caught an embarrassing screwup by me in - unix.c: the open-for-append call was using "wb+" instead of - "ab" when calling fopen(). Doh! -05152002 - configure script now deals with systems that have a readline - lib, but require it to be linked with curses. Thanks to Edward - Rudd for the patch. -05102002 - A trimmed-down zlib 1.1.4 is now included in the source distro, for - use by win32, MacOS, and Unix systems that don't have it installed - on the system. Autoconf support! Initial attempt at this. Lots of - stuff may be very broken. -05082002 - From Greg: More win32 work. Library is now 95% functional on win32. - Only known win32 problem is that the CD drives are reported whether - they contain a disc or not). -05062002 - From Greg: Win32 boxes without the latest Platform SDK can now - #define DISABLE_NT_SUPPORT. Other fixes. -04242002 - Updated win32 info in INSTALL to discuss Platform SDK issues. -04202002 - Added a (very) quick and (very) dirty http server to the - extras directory (public domain), as another example of using - the library. -04192002 - Corrected some win32 info in INSTALL. Changed Makefile to - package releases as .tar.gz instead of .tar.bz2. -04122002 - Some win32 cleanups and fixes across several files. Upped - version to 0.1.5. -04082002 - Fixed problem when calling __PHYSFS_setError before PHYSFS_init. -04062002 - Added MacOS info, etc to INSTALL. Patched unix.c and - test_physfs.c to compile on Darwin again. -04052002 - Added byte ordering API. Byte ordering fixes in grp.c, and some - cleanups in unzip.c. Mac work is more or less complete. -04042002 - Mac work continues. Almost complete, now. test_physfs now has - tests for write, append, and filelength, and most of the - commands can tolerate a quoted argument (although this is - hacky, it's good enough for these purposes). Upped test_physfs - version to 0.1.1. Added a malloc-failure check in the Unix - CD-ROM detection code. -04032002 - PHYSFS_init always makes sure the calling thread initializes its - error state. Win32 codebase is updated with mutex implementation - (thanks, Greg!). -04022002 - Mac work continues. Found a bug where we put a double dir - separator in if we had to resort to the fallback userdir (if - __PHYSFS_platformGetUserDir() returned NULL to calculateUserDir(). - Made note of potential infinite recursion in platform driver docs. -04012002 - (_NOT_ an April Fool's Joke:) Started working on MacOS Classic - port. Added skeleton.c to platform directory. Minor patches to - get things compiling on Mac (notably, DirInfo conflicts with - a type exposed by MacOS's namespace-polluting API, and some - typecasting issues). Found a call to ferror() I had missed in - unzip.c. -03302002 - Mutexes! PhysicsFS should be thread safe now, so long as you - don't try to do something like close a file at the same time as - you are reading from it in another thread. All reasonable race - conditions should now be gone, but the new code will need some - eyeballing before we install it on life support systems or anything. - The mutex abstraction is implemented in unix.c, win32.c will be - updated shortly. -03292002 - Fixed a potential problem in ZIP_realpath() and some byte order - issues in zip.c. Converted unzip.c to use physfs file i/o - abstractions. Converted CHANGELOG to list latest entries first. -03242002 - Added __PHYSFS_platformInit() and __PHYSFS_platformDeinit(). Win32 - improvements by Gregory S. Read. Added PHYSFS_[us]int(8|16|32) - types...this breaks binary compatibility with previous PhysicsFS - releases! Added platform specific i/o functions, so we don't have - to rely on stdio anymore. Updated TODO with my comments on the - physfs mailing list. 1.0, here we come! Removed race condition from - grp.c and converted to file i/o abstraction layer calls from stdio. - Tons of other fixes and enhancements. -03202002 - Patched platform/win32.c to compile. -03152002 - PHYSFS_setSaneConfig() now handles failure to set the write dir - better. Patched makefile to link the test program. Changed all the - "write" functions to get data from a "const" buffer. Added an - "extras" dir, which currently contains PhysFS->SDL_RWops glue code. -03052002 - Made unix.c's timeslice implementation more portable, and added a - Darwin-specific means to detect CDs (thanks to Patrick Stein). - Minor cleanup in win32.c (changed "for (; condition ;)" into - "while (condition)" ...) -11142001 - Removed a redundant error check in platform/win32.c -10092001 - Syntax fixes in dir.c, a FIXME in grp.c, and a "cat" command in - the test program. Apparently I had accidentally removed a rather - crucial line from dir.c a few revisions ago, and no one noticed. :( - Fixed. The win32 userdir will default to the base dir, now. -09252001 - Changed API: PHYSFS_setSaneConfig() takes an organization name, and - sets up less directories. Be warned. Fixes from David Hedbor: - make setSaneConfig() set write directory correctly if it had to - create the directory, and make sure that the writing functions - get used in dir.c when a file is opened for writing/appending. - Updated CREDITS. -09142001 - David Hedbor submitted a patch to handle a case where the - current working directory has been deleted out from under the - process (both in platform/unix.c and physfs.c itself). Thanks, - David! Added a CREDITS file. Changed the format of the author field - in PHYSFS_ArchiveInfo to put the email address between "<>" instead - of "()" chars. Updated TODO. make install now deletes previous - revisions of the library. Changed version to 0.1.4. -09012001 - Happy September. Moved the Visual C project files and the zlib - source to a separate download. Look for it at - http://icculus.org/physfs/downloads/physfs-win32-support.zip ... - Updated the INSTALL doc for Win32 building. Rewrote win32.c's - __PHYSFS_platformRealPath() to not rely on Visual C's runtime lib, - which was the last Cygwin incompatibility (although the Makefile - needs to be updated to build a DLL under Cygwin). Tinkered with the - Makefile a little, but it needs more work. Started working on a - MacOS version. All I have is CodeWarrior 4, which is way out of - date, and (for what is supposed to be an ultra-user-friendly - environment) is completely uninituitive to me. Still, managed to - get most everything compiling, which improved the quality of the - code somewhat). Haven't tried to compile the zipfile support, and - I still can't link the library. Dunno what the hell I'm supposed - to do there. Isn't Unix supposed to be hard compared to this? -08312001 - Built PhysicsFS on Mandrake 8.0 for the PowerPC. Compiles clean, - but there's at least one byte-ordering issue in zip.c that needs - to be fixed. -08292001 - win32.c calculates the base dir with GetModuleFileName() first, now, - and falls back to SearchPath() if there were problems. Changed an - occurence of _MAX_PATH to MAX_PATH, so both CygWin and Visual C can - handle it. -08282001 - win32.c now checks HOMEDRIVE, HOMEPATH, and HOME when calculating - the userdir. Added include files that make it a little closer to - compiling under Cygwin. Added a TODO file. Fixed unix.c's - __PHYSFS_platformCalcBaseDir() so that it actually works. Fixed - Makefile so that it links the test program properly. - Changed version to 0.1.3. -08232001 - Fixed a potential free()ing of a NULL pointer in - __PHYSFS_platformEnumerateFiles() in platform/unix.c. Added - platform/win32.c. Other cleanups to get this compiling with - Visual C and CygWin. Added BAIL_MACRO for times when we were doing - BAIL_IF_MACRO(1, ...). Abstracted mkdir() in the platform drivers. - Added GRP setting output to showcfg in the Makefile. Updated INSTALL - with license info and Win32 build instructions. Dependency on the - readline library in test_physfs.c is now optional. - Changed version to 0.1.2. -08072001 - Changed version to 0.1.1. -08062001 - Added CD-ROM detection code to the unix platform driver. -08012001 - Added a safety memset in error setting, fixed URLs and email addr. -07282001 - Initial release. - ---ryan. (icculus at icculus.org) - -/* end of CHANGELOG ... */ - Copied: trunk/CHANGELOG.txt (from rev 826, trunk/CHANGELOG) =================================================================== --- trunk/CHANGELOG.txt (rev 0) +++ trunk/CHANGELOG.txt 2007-03-11 10:19:52 UTC (rev 827) @@ -0,0 +1,523 @@ +/* + * CHANGELOG. + */ + +03112007 - Removed zlib_license_change.txt ... it's in Subversion and the 1.0 + branch for history's sake. Added shared and static build options + to CMakeLists.txt, and the expected "make install" target. + Renamed some FILENAME files to FILENAME.txt, removed physfs.rc. +03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. + Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC + code to expect UTF-8 strings from the higher level. Changed + PHYSFS_SUPPORTS_LZMA to PHYSFS_SUPPORTS_7Z. Killed some #ifdefs + in physfs.c. Moved to CMake...so long, autotools! Killed MIX + archiver, too. +11052006 - More 7zip archiver work (thanks, Dennis!). Initial Unicode work. + Minor BeOS realpath tweak. +09272006 - Reworked 7zip archiver (thanks, Dennis!). +09232006 - Fixed typo in doxygen comment. +04112006 - Added LZMA archiver...7zip support (thanks, Dennis!). +03232006 - Added -fvisibility for gcc4 (http://gcc.gnu.org/wiki/Visibility) +01012006 - Cleaned up overflow checks in platform memory allocators (thanks to + Nicolas Lebedenco for pointing out the original issue with + long long literals). Added physfs.rc (thanks, Dennis!). Changed my + email address. Removed acconfig.h. +11282005 - Corrected docs on PHYSFS_setWriteDir(). +10122005 - Fixed locateInStringList() in physfs.c (thanks, Matze!). Patched + archivers/wad.c to compile. +09192005 - Make unix mutexes recursive above pthread layer...fixes deadlock on + MacOS X, for now. +09182005 - API BREAKAGE: PHYSFS_enumerateFilesCallback() now passes the + original directory name back to the app in the callback. This + API was only in 1.1.0, and wasn't promised to be stable at this + point. Please update your apps! Cleaned out a FIXME in file + enumeration that would confuse the library under certain + circumstances. +09092005 - Some tweaks to PHYSFS_Allocator. Apparently configure.in doesn't + work like I thought for version bumps, so it thinks 1.1.0 isn't + binary compatible with 1.0...fixed, I think. +09062005 - Happy September. Changed the allocation abstraction to use + PHYSFS_uint64 instead of size_t, so we don't have to include + system headers inside physfs.h. Minor MingW fixes (but it's still + broken, I think). +08202005 - Fixed bug in verifyPath() that was breaking PHYSFS_setSaneConfig() + and other corner cases. +07242005 - Patched to compile on BeOS. +07232005 - Fixed bug in zip archiver (thanks, J?rg Walter!). + More minor OS/2 tweaks. Updated zlib to 1.2.3, which properly + includes the security fix. Fixed "make dist" to handle .svn dirs + and other file changes. Removed "debian" directory. Allow a mount + point of NULL to be "/", per the documentation. Fixed warning in + physfs.c. Assert definition fix. Updated CWProjects.sit. + Upped version to 1.1.0 ... first release of 1.1 dev branch! +07212005 - Patched to compile on OS/2 again. +07132005 - Updated zlib to 1.2.2, and patched it for this security hole: + http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-2096 +06122005 - Added support for mingw to Unix build process (thanks, Matze!). +03162005 - Added missing translation and Portuguese support (thanks, Danny!). + MPW support and several MacOS Classic fixes (thanks, Chris!). + Changed CWProjects from SITX to SIT format, so OS9 users can + unpack it. +03132005 - More mount work, added PHYSFS_getMountPoint() and more cleanups. + Replaced all the C runtime allocations with PhysFS allocation hooks. + Added pocketpc.c to EXTRA_DIST. Added allocation hooks to some + platform drivers. Updated Mac Classic build. +03122005 - Added evil GOTO_*_MACRO_* macros. Fixed unix.c to compile again on + MacOS X. Added PHYSFS_mount() (thanks, Philip!). Cleaned up the + INSTALL and CREDITS files a little. Split off start of + verifySecurity() into a path sanitizer and changed entry points to + sanitize input paths into a stack-allocated buffer before further + processing. This removes the need for a malloc() for almost all + file system operations, and generally cleaned things up. Added a + "mount" command to test_physfs. Other general cleanups. +02152005 - Minor comment fix in platform/pocketpc.c +01052005 - Fixed HOG archiver file lookup (thanks, Chris!) +12162004 - Fixed some documentation/header comment typos (thanks, Gaetan!) +10302004 - Fixed a strcpy that should have been a strcat. (thanks, Tolga!) + Build system respects external CFLAGS now. (thanks, Adam!) + Fixed infinite loop in new enumeration code. (thanks, Adam!) +10062004 - Removed profiling code from physfs.c. +09292004 - Every API that can return a list of strings can now use a + callback mechanism if the application wants to do it's own + allocation or handling on a per-item basis. The guts of those + APIs that create string lists now use the callbacks themselves to + build the lists, too. The callback functionality goes all the way + down to the archivers and platform drivers where appropriate, which + cleans things up and simplifies some internal tasks very nicely. + Got rid of all the annoying forward declarations in all the + archivers and moved their PHYSFS_Archiver data to the end of the + file, since this was annoying me and I was getting sick of updating + function signatures in two places when the internal API changed. + Removed the code/data for LinkedStringLists...it isn't used anymore + now that the callback code is in place. +09262004 - Did the same thing to FileHandles than I did to DirHandles, but + this triggered massive tweaking in physfs.c. A lot of code got + little cleanups, which was nice. Less malloc pressure, too, since + opening a file used to allocate a ton of crap and mush it + together...now it's basically down to one structure and the + instance data in whatever archiver. Minor varname tweak in win32.c + and pocketpc.c. Changed PHYSFS_file to PHYSFS_File to match the + rest of the API's naming scheme (but put a typedef for source + compatibility). +09252004 - Cleaned up archiver interface to not deal with DirHandles anymore, + which simplifies things, removes some responsibility and code + duplication from the archivers, and trims some malloc pressure. + Ripped up the allocation hook code a little. We'll try to screw + with memory locking later, since it makes everything ugly and + complex. Oh well. +09232004 - Started adding allocation hooks. +09222004 - Happy September. Added Spanish translation back in. +04092004 - Added MIX support for legacy Westwood titles (Thanks, Sebastian!). + Made bootstrap script MacOSX-friendly. Moved byteorder defines into + physfs_internal.h ... +01152003 - Added Portuguese (Brazil) translation (Thanks, Danny!) + + +--- This is where the 1.1 development branch starts. --- + +12292003 - Updated CodeWarrior projects from CW6 to CW7, and made a bunch of + patches to get the Mac Classic target building again. Removed + zlib114 from CVS repository. Updated OS/2 build batch file. + Added Z_PREFIX define to Unix builds that use internal zlib. + Patched up some (outdated?) Visual C project files for zlib121. + Patched Doxyfile and physfs.h for newer Doxygen. Fixed OS/2 + build script. Tweaked Project Builder files to at least compile. + Added some last minute BeOS and Cygwin build fixes. Updated + Visual Studio projects and tweaked some Makefile.am crap. Made + changes so Visual Studio files would pack with DOS endlines and... + Upped version to 1.0.0 (woohoo!). +12222003 - Fixed a search-and-replace mistake in win32.c that preventing + compiling on Windows. (thanks, Brian!) Converted VC6 .dsp to use + zlib121; made Z_PREFIX=1 enabled by default to avoid link clashes; + put zlib files in separate logical folder in .dsp project; updated + zlib121/zconf.h to address remaining symbols that were still + causing link warnings. +12182003 - WAD archiver now puts maps into subdirectories, making them + accessible to the application. (Thanks, Travis!) RPM spec and + Makefile.am* now package zlib_license_change.txt (Thanks, Edward!) +12142003 - Added Doom WAD support (Thanks, Travis!) +12082003 - Fixed some win32.c deficiencies that Robby Dermody pointed + out (thanks!) +12072003 - Upgraded internal zlib to 1.2.1 (thanks, Adam!) Other + Unix build fixes. +11112003 - Patches to make OS/2 support compile again. +11092003 - Added __PHYSFS_platformStrnicmp(), and made qpak.c case-insensitive. +09122003 - Happy September. Actually released current tree as 0.1.9. +08262003 - Added MiNT support to build process and fixed cross-compiling + (thanks Patrice Mandin!) +08092003 - Some Windows build fixes (thanks, Brian Hook!) +07232003 - Upped version to 0.1.9. +07202003 - Switched to zlib license (see new LICENSE text in root of source + tree, and zlib_license_switch.txt for details). Had to remove + archivers/qpak.c, the Ruby bindings from the extras directory, and + the Russian and Spanish translations, since those contributors + couldn't be contacted. If they show up, we'll readd them to the + project, otherwise we'll eventually replace their work...everyone + else signed on for the change. Committed a patch to convert all + tabs to spaces (Thanks, James!). Added patch to zip.c to fix + crash (thanks, dillo!). Reimplmented qpak.c, by welding together + bits of grp.c and zip.c. Ed contacted me, so I could readd his + contributions post-license change...I'm going to keep the new + qpak.c, but I've readded his Ruby bindings and Russian translations. +06112003 - Patches to globbing.c to handle corner cases (thanks, Bradley!). +06102003 - Added globbing.c to "extras" directory. +05232003 - Rewrote MacOSX/Darwin CD-ROM detection code to use IOKit, which is + much much more accurate than the previous code. Updated + configure.in and Makefile.am.newautomake for some MacOSX stuff. +05222003 - Fixed win32 crash if PHYSFS_init() is called with a NULL. +05182003 - PocketPC fixes (thanks, David Hedbor!) +05162003 - Compiler warning cleanup in HOG and MVL archivers (Thanks, Bradley!) +04082003 - Minor changes to extras/abs-file.h (Thanks, Adam!) +03302003 - Fixed seeking in uncompressed ZIP entries, and handle a + misbehaviour in Java's JAR creation tools. Thanks to "Tree" for + pointing these bugs out. Added HOG and MVL archive support for + Descent I and II (Thanks, Bradley Bell!). Added example code to + do case-insensitive file searches ("extras/ignorecase.*"). +03192003 - Fixed problem in PHYSFS_mkdir() when dirs to be created already + exist. Fixed problem where PHYSFS_mkdir() incorrectly tripped an + alarm in __PHYSFS_verifySecurity(). +03122003 - Attempt at cleaning up some type correctness for VC++6. Made QPAK + archiver case-insensitive (since Quake2 has problems without it). +01302003 - Added buffering API to OS/2 build's exported symbol list. Updated + CWProjects.sit and made several fixes to get physfs building on + MacOS Classic again. +01282003 - Fixed seeking in buffered files opened for read. +01072003 - .NET assembly and C# wrapper by Gregory S. Read in the extras dir. +01042003 - Added a hack for dealing with OSX bundles and newer PBProjects + (thanks, Eric Wing!). Added some missing files to "make dist". + Fixed minor Doxygen typo in PHYSFS_flush() docs. Upped version to + 0.1.8. +12172002 - Added Apple Project Builder support files (thanks, Eric Wing!). +12112002 - Added Ruby bindings to extras directory (thanks, Ed Sinjiashvili!). + Patched win32.c to compile with Mingw32 (thanks, Niels Wagenaar!). +12032002 - Adam updated his extras/abs-file.h for the new buffering API. +12022002 - German translation added, compliments of Michael Renner. +12012002 - Minor fix to configure.in: reported --enable-debug's default + setting incorrectly. Added buffering to the API: you can now + buffer a file with PHYSFS_setBuffer(), and flush the buffer to + disk with PHYSFS_flush(). PhysicsFS file handles are unbuffered + by default (as they were before this API addition), so this does + not break the API. Other fixes for bugs I stumbled upon during + this work are in CVS, too. +11292002 - Minor fix for strange PATH strings in unix.c (thanks, Alexander!) +11222002 - Initial PocketPC port by Corona688. +10222002 - Fixed segfault in test_physfs.c when user hits CTRL-D (and + readline() thus returns NULL)...now gracefully exits, as it should. +10142002 - Added check for AMD's x86-64 ("Hammer") architecture when + determining platform byte order. +10112002 - Fixed "setsaneconfig" command in test_physfs.c ... +09232002 - Happy September. Updated VC++6 project files, fixed some + VC++ compile nags (more work to be done in zip.c). +08302002 - Cleaned tab stops out of zip.c, and fixed a possible infinite loop + in zip_find_entry(). +08292002 - Fixed a mistake in makeos2.cmd, and updated the INSTALL docs. + Added physfs.spec.in to EXTRA_DIST in Makefile.am* +08292002 - Added a physfs/stdio wrapper header to the "extras" dir, + compliments of Adam D. Moss (file is "abs-file.h"). +08282002 - Cleanups in grp.c so that Visual C++ doesn't complain anymore. + zip.c now works correctly when PhysicsFS is disallowing symlinks. + A few minor optimizations in zip.c, with a few more to come later. + Added VS.NET project files to CVS. +08222002 - Fixed ZIP_exists() to work with directories. Now breaks out of + __PHYSFS_verifySecurity() early if a path element is missing + (since all the others will be, too)...this check is only done + if symlinks are disabled, but we might as well save easy cycles + where we can. +08212002 - Did a couple tedious-for-small-rewards cleanups, optimizations, + corrections and streamlinings I've been meaning to do. Touched a + lot of code. One of the side results is that ZIP_isDirectory() + got fixed. +08192002 - Generalized sorting routines, moved them into physfs.c and removed + the multiple copies from the various archivers. Adding profiling + code (currently only for sort routines)...enable it with + --enable-profiling in the configure script. Fixed incorrect + behaviours in configure.in. +08172002 - Patched configure.in to work around buggy autoconfs. +08162002 - Fixed QPAK archiver, since I broke it (sorry!). Also fixed a + qpak memory leak. +08092002 - Added Quake PAK archiver (qpak.c) by Ed Sinjiashvili. Thanks! + Made (successful?) attempt to fix pthread-to-ui64 cast problem. + Check for OS/2 in configure.in, in case anyone gets autoconf and + such to work right on their OS/2 box. +08012002 - Patched win32.c to compile. +07302002 - Minor error handling fix (thanks, Alexander!) +07292002 - Found some memory leaks, thanks to Valgrind (which rules, btw). + Added Russian translations (koi8-r, cp1251, cp866, and iso-8859-5) + by Ed Sinjiashvili. Added Spanish translation by Pedro J. P?rez. + Debian package support in CVS, thanks to Colin Bayer. French + translation by St?phane Peter. +07282002 - macclassic.c now returns human readable error messages instead of + ERR_OS_ERROR. Closing files on MacOS no longer fails if the volume + info can't be flushed. Minor error message tweak in os2.c. All + possible human-readable literal strings (including all those OS/2 + and MacOS error messages) have moved to constants in + physfs_internal.h...this allows the library to be translated to + other spoken languages fairly easily. +07272002 - Patched the OS/2 code to be useful...works pretty well, now. Added + makeos2.cmd for building (not an ideal solution, but oh well). + Initialized some variables in zip.c to prevent compiler whining. +07262002 - Fixed a typo in documentation. Archivers with matching file + extensions are now given first shot at opening an archive, but if + they fail, the other archivers are tried. More fixes to zip.c's + ZIP_enumerateFiles(). Wrote an OS/2 platform driver based on API + specs and a heavy pounding of Google Groups...as I don't have an + OS/2 compiler at the moment, it probably doesn't even compile. :) +07252002 - configure.in and unix.c now deal with platforms that lack a + functional pthread library. Edward Rudd sent in a patch to the RPM + specfile to have the build system set the correct version. + Clean ups in grp.c, beos.cpp and macclassic.c. +07242002 - Rewrote ZIP_enumerate(). Hopefully it sucks less this time. + unix.c and configure.in now have the infrastructure to disable + the CD-ROM detection code, and use a stub that successfully (and + unconditionally) reports no detected discs. Currently this is + used on AtheOS (which doesn't have CD-ROM support at the moment + anyhow), but it will be useful to get the library up on odd, + Unix-like systems that don't use either getmntinfo() or getmntent(). +07232002 - Cleaned up the cut-and-pastes in the various file enumeration + routines and moved it into __PHYSFS_addToLinkedStringList(). + Tons more ZIP file enhancing. I'm fairly certain it's robust and + fast in every reasonable respect, now. GRP archiver now caches + the file table...it was generally overhauled like the ZIP driver. + Added "ls" as an alias of "enumerate" in test_physfs. + I lied about zip.c's robustness; disabled the enumeration code. +07212002 - More FreeBSD build system patches. Added some new autoconf spew to + .cvsignore. bootstrap now copies the appropriate Makefile.am + instead of rename()ing it. +07192002 - Cleaned up configure.in and unix.c so that we check by available + header to determine the appropriate CD-ROM detection code...this + should make this more future-proof (and probably get it building + out of the box on other BSD platforms.) +07172002 - Fixed seeking backwards in ZIP_seek(). Changed the error message + ERR_TOO_MANY_SYMLINKS to ERR_SYMLINK_LOOP. Patches to build system + and unix.c for FreeBSD compatibility. Added physfs.spec to + "make dist" archives (thanks, Edward Rudd!). +07152002 - Symlinks in ZIP archives are detected correctly now, I think. +07142002 - Use GetVolumeInformation() instead of GetDiskFreeSpace() in + win32.c's mediaInDrive() function. This allows Windows NT 3.x to + correctly detect CD-ROM drives. Library now appears to be fully + functional on WinNT 3.51...need to try NT 3.1 still. :) + Patches to new ZIP code; cleaned up bugs in symlink reading code, + but we incorrectly identify some entries as symlinks, which doesn't + fly...for now, symlink code is commented out, so symlinks look + like regular files (and reading from a symlink entry gives you + the link as file data). +07122002 - Rewrote the ZIP archiver to no longer use Gilles Vollant's unzip.c + code. Losing that abstraction should make the ZIP archiver + significantly more efficient, and halved the amount of code used. + Plus, being a control freak, I like my coding style more than + Gilles's. :) There are still bugs to shake out, but this is good + progress. +07112002 - configure.in updated to make it happier on newer autoconfs + (thanks again, Alexander!). FIXME cleanups. +07102002 - Added a byteorder-friendly convenience API, so you can read/write + data and convert to the native byteorder without too much effort. + Upped version to 0.1.7. + Build system corrections for BeOS and Cygwin (thanks, Alexander!). + Added RPM specfile for PhysicsFS (thanks, Edward Rudd!). +06292002 - Fixed incorrect error message when opening a file for read without + defining a search path. LOTS of win32 updates and fixes; lots of + things that were broken work now, and we are slowly becoming + more compatible with legacy win32 systems. Builds on Cygwin again. + All platform drivers (except beos.cpp) had a buffer overflow when + detecting mounted CD-ROM drives...it only occurs when a drive is + detected, and it probably won't result in your box getting rooted, + but upgrade soon anyhow. Readded the .cvsignore files from the old + build system. +06282002 - Reworked build system _AGAIN_. +06222002 - Alexander Pipelka spotted a bug in the file open routines in + posix.c; patched. +06152002 - Autoconf build system will now generate shared libraries on BeOS, + and (supposedly) Cygwin. +06142002 - Rewrote autoconf build system. It now works around the MacOS X bug + that prevented shared libraries from building. +06112002 - Updated CodeWarrior projects and added them to CVS. _Finally_ + officially released 0.1.6. +06102002 - Major overhauls to platform/win32.c ... should work on all Windows + platforms, including 95/98/ME and NT/2K/XP flavors. Someone should + see if this builds on WinCE! :) You no longer need the latest + platform SDK to build it, either; the questionable DLL is accessed + with LoadLibrary() at runtime now, and handled if not present. This + now builds correctly on a freshly installed Visual Studio 6.0, and + the DLL it builds works everywhere. Plus, a bunch of other bugs + and incorrect behaviours were squashed. Visual Studio 6.0 project + file added to CVS. +06082002 - Fixes to __PHYSFS_platformEnumerateFiles() in win32.c: cleaned up + memory leak, handles paths more robustly, and prevents possible + skipped file entries. Removed AC_C_CONST and AC_TYPE_SIZE_T checks + from configure.in (not needed, and they broke BeOS build). Clean + out the docs/ directory when doing a "make dist". Fixed crashbug + when calling PHYSFS_deinit() more than once in a row. Tried to get + MacOS X to build a shared library, gave up; I'm doing something + wrong in my Makefile.am, I think. On MacOS X, running ./configure + --enable-static --disable-shared works, though. Hopefully someone + will fix this soon. In unix.c, the Darwin version of + __PHYSFS_platformDetectAvailableCDs() was free()ing a static + buffer; fixed. +06072002 - Manpages! Finally installed Doxygen and scratched together a + Doxyfile. After some revision to physfs.h, we've got a rather + nice API reference. +06062002 - Fixed __PHYSFS_platformSeek() in archivers/posix.c. Implemented the + getLastModTime method in archivers/zip.c (returns legitimate info) + and archivers/grp.c (returns lastmodtime of GRPfile itself in the + physical filesystem). Put a 64-bit _llseek() version of the seek() + and tell() methods in platform/posix.c, but you need to hack (or + rather, fix) configure.in to enable it. From Greg on win32.c: Fixed + file enumerator function (needed a wildcard '*' specification), CD + enumeration only reports CDs that have media, getLastModTime() has + been implemented. +06012002 - Added -Wall to debug builds. Removed ANSI stdio calls from + platform/posix.c, and replaced them with actual POSIX calls (that + is, fopen() became open(), fseek() became lseek(), etc...) +05272002 - Added some explicit casts when calling malloc() in platform/posix.c +05252002 - Added John Hall's file modification time patch, and added a + getlastmodtime command to test_physfs. Corrected error reporting + for missing files a little bit. Changed build system to only try + building beos.cpp if on a BeOS system (since we need a C++ compiler + available to do so). Implemented getLastModTime in macclassic.c. +05242002 - Upped version to 0.1.6 (not officially released yet). +05232002 - Fixed the build system to always package the complete source, not + just what we built for a given system, when doing a "make dist". + Updated INSTALL. Wrote BeOS platform code (platform/beos.cpp). + Split unix.c into unix.c and posix.c. Linux and BeOS both share + posix.c, although I don't think it's completely POSIX compliant at + this point (not that it matters much). +05212002 - Cleaned up some FIXMEs. +05202002 - Added .cvsignore files. +05162002 - Edward Rudd also caught an embarrassing screwup by me in + unix.c: the open-for-append call was using "wb+" instead of + "ab" when calling fopen(). Doh! +05152002 - configure script now deals with systems that have a readline + lib, but require it to be linked with curses. Thanks to Edward + Rudd for the patch. +05102002 - A trimmed-down zlib 1.1.4 is now included in the source distro, for + use by win32, MacOS, and Unix systems that don't have it installed + on the system. Autoconf support! Initial attempt at this. Lots of + stuff may be very broken. +05082002 - From Greg: More win32 work. Library is now 95% functional on win32. + Only known win32 problem is that the CD drives are reported whether + they contain a disc or not). +05062002 - From Greg: Win32 boxes without the latest Platform SDK can now + #define DISABLE_NT_SUPPORT. Other fixes. +04242002 - Updated win32 info in INSTALL to discuss Platform SDK issues. +04202002 - Added a (very) quick and (very) dirty http server to the + extras directory (public domain), as another example of using + the library. +04192002 - Corrected some win32 info in INSTALL. Changed Makefile to + package releases as .tar.gz instead of .tar.bz2. +04122002 - Some win32 cleanups and fixes across several files. Upped + version to 0.1.5. +04082002 - Fixed problem when calling __PHYSFS_setError before PHYSFS_init. +04062002 - Added MacOS info, etc to INSTALL. Patched unix.c and + test_physfs.c to compile on Darwin again. +04052002 - Added byte ordering API. Byte ordering fixes in grp.c, and some + cleanups in unzip.c. Mac work is more or less complete. +04042002 - Mac work continues. Almost complete, now. test_physfs now has + tests for write, append, and filelength, and most of the + commands can tolerate a quoted argument (although this is + hacky, it's good enough for these purposes). Upped test_physfs + version to 0.1.1. Added a malloc-failure check in the Unix + CD-ROM detection code. +04032002 - PHYSFS_init always makes sure the calling thread initializes its + error state. Win32 codebase is updated with mutex implementation + (thanks, Greg!). +04022002 - Mac work continues. Found a bug where we put a double dir + separator in if we had to resort to the fallback userdir (if + __PHYSFS_platformGetUserDir() returned NULL to calculateUserDir(). + Made note of potential infinite recursion in platform driver docs. +04012002 - (_NOT_ an April Fool's Joke:) Started working on MacOS Classic + port. Added skeleton.c to platform directory. Minor patches to + get things compiling on Mac (notably, DirInfo conflicts with + a type exposed by MacOS's namespace-polluting API, and some + typecasting issues). Found a call to ferror() I had missed in + unzip.c. +03302002 - Mutexes! PhysicsFS should be thread safe now, so long as you + don't try to do something like close a file at the same time as + you are reading from it in another thread. All reasonable race + conditions should now be gone, but the new code will need some + eyeballing before we install it on life support systems or anything. + The mutex abstraction is implemented in unix.c, win32.c will be + updated shortly. +03292002 - Fixed a potential problem in ZIP_realpath() and some byte order + issues in zip.c. Converted unzip.c to use physfs file i/o + abstractions. Converted CHANGELOG to list latest entries first. +03242002 - Added __PHYSFS_platformInit() and __PHYSFS_platformDeinit(). Win32 + improvements by Gregory S. Read. Added PHYSFS_[us]int(8|16|32) + types...this breaks binary compatibility with previous PhysicsFS + releases! Added platform specific i/o functions, so we don't have + to rely on stdio anymore. Updated TODO with my comments on the + physfs mailing list. 1.0, here we come! Removed race condition from + grp.c and converted to file i/o abstraction layer calls from stdio. + Tons of other fixes and enhancements. +03202002 - Patched platform/win32.c to compile. +03152002 - PHYSFS_setSaneConfig() now handles failure to set the write dir + better. Patched makefile to link the test program. Changed all the + "write" functions to get data from a "const" buffer. Added an + "extras" dir, which currently contains PhysFS->SDL_RWops glue code. +03052002 - Made unix.c's timeslice implementation more portable, and added a + Darwin-specific means to detect CDs (thanks to Patrick Stein). + Minor cleanup in win32.c (changed "for (; condition ;)" into + "while (condition)" ...) +11142001 - Removed a redundant error check in platform/win32.c +10092001 - Syntax fixes in dir.c, a FIXME in grp.c, and a "cat" command in + the test program. Apparently I had accidentally removed a rather + crucial line from dir.c a few revisions ago, and no one noticed. :( + Fixed. The win32 userdir will default to the base dir, now. +09252001 - Changed API: PHYSFS_setSaneConfig() takes an organization name, and + sets up less directories. Be warned. Fixes from David Hedbor: + make setSaneConfig() set write directory correctly if it had to + create the directory, and make sure that the writing functions + get used in dir.c when a file is opened for writing/appending. + Updated CREDITS. +09142001 - David Hedbor submitted a patch to handle a case where the + current working directory has been deleted out from under the + process (both in platform/unix.c and physfs.c itself). Thanks, + David! Added a CREDITS file. Changed the format of the author field + in PHYSFS_ArchiveInfo to put the email address between "<>" instead + of "()" chars. Updated TODO. make install now deletes previous + revisions of the library. Changed version to 0.1.4. +09012001 - Happy September. Moved the Visual C project files and the zlib + source to a separate download. Look for it at + http://icculus.org/physfs/downloads/physfs-win32-support.zip ... + Updated the INSTALL doc for Win32 building. Rewrote win32.c's + __PHYSFS_platformRealPath() to not rely on Visual C's runtime lib, + which was the last Cygwin incompatibility (although the Makefile + needs to be updated to build a DLL under Cygwin). Tinkered with the + Makefile a little, but it needs more work. Started working on a + MacOS version. All I have is CodeWarrior 4, which is way out of + date, and (for what is supposed to be an ultra-user-friendly + environment) is completely uninituitive to me. Still, managed to + get most everything compiling, which improved the quality of the + code somewhat). Haven't tried to compile the zipfile support, and + I still can't link the library. Dunno what the hell I'm supposed + to do there. Isn't Unix supposed to be hard compared to this? +08312001 - Built PhysicsFS on Mandrake 8.0 for the PowerPC. Compiles clean, + but there's at least one byte-ordering issue in zip.c that needs + to be fixed. +08292001 - win32.c calculates the base dir with GetModuleFileName() first, now, + and falls back to SearchPath() if there were problems. Changed an + occurence of _MAX_PATH to MAX_PATH, so both CygWin and Visual C can + handle it. +08282001 - win32.c now checks HOMEDRIVE, HOMEPATH, and HOME when calculating + the userdir. Added include files that make it a little closer to + compiling under Cygwin. Added a TODO file. Fixed unix.c's + __PHYSFS_platformCalcBaseDir() so that it actually works. Fixed + Makefile so that it links the test program properly. + Changed version to 0.1.3. +08232001 - Fixed a potential free()ing of a NULL pointer in + __PHYSFS_platformEnumerateFiles() in platform/unix.c. Added + platform/win32.c. Other cleanups to get this compiling with + Visual C and CygWin. Added BAIL_MACRO for times when we were doing + BAIL_IF_MACRO(1, ...). Abstracted mkdir() in the platform drivers. + Added GRP setting output to showcfg in the Makefile. Updated INSTALL + with license info and Win32 build instructions. Dependency on the + readline library in test_physfs.c is now optional. + Changed version to 0.1.2. +08072001 - Changed version to 0.1.1. +08062001 - Added CD-ROM detection code to the unix platform driver. +08012001 - Added a safety memset in error setting, fixed URLs and email addr. +07282001 - Initial release. + +--ryan. (icculus at icculus.org) + +/* end of CHANGELOG ... */ + Deleted: trunk/CREDITS =================================================================== --- trunk/CREDITS 2007-03-11 10:17:37 UTC (rev 826) +++ trunk/CREDITS 2007-03-11 10:19:52 UTC (rev 827) @@ -1,102 +0,0 @@ -Initial API interface and implementation, -Unix support, -Win32 support, -BeOS support, -POSIX support, -MacOS support, -OS/2 support, -GRP archiver, -DIR archiver, -ZIP archiver, -QPAK archiver, -MacOS Classic support: - Ryan C. Gordon - -Tons of win32 help: - Adam Gates - -More win32 hacking: - Gregory S. Read - -Fixes for missing current working directories, -PHYSFS_setSaneConfig() improvements, -other bugfixes: - David Hedbor - -Darwin support: - Patrick Stein - -configure fixes, -RPM specfile: - Edward Rudd - -GetLastModTime API, -other stuff: - John R. Hall - -Various support, fixes and suggestions: - Alexander Pipelka - -Russian translation, -Ruby bindings, -QPAK archiver: - Ed Sinjiashvili - -French translation: - St?phane Peter - -Debian package support: - Colin Bayer - -"abs-file.h" in "extras" dir: - Adam D. Moss - -WinCE port and other Win32 patches: - Corona688 - -German translation: - Michael Renner - -Apple Project Builder support, -MacOS X improvements: - Eric Wing - -HOG archiver, -MVL archiver, - Bradley Bell - -MIX archiver, - Sebastian Steinhauer - -Bug fixes: - Tolga Dalman - -Initial PHYSFS_mount() work: - Philip D. Bober - -Brazillian Portuguese translation: - Danny Angelo Carminati Grein - -Spanish translation: - Pedro J. P?rez - -MacOS Classic fixes, -MPW support: - Chris Taylor - -Mingw support, -General bug fixes: - Matze Braun - -Bug fixes: - J?rg Walter - -Windows .rc file: -7zip/lzma archiver, - Dennis Schridde - -Other stuff: - Your name here! Patches go to icculus at icculus.org ... - -/* end of CREDITS ... */ - Copied: trunk/CREDITS.txt (from rev 817, trunk/CREDITS) =================================================================== --- trunk/CREDITS.txt (rev 0) +++ trunk/CREDITS.txt 2007-03-11 10:19:52 UTC (rev 827) @@ -0,0 +1,102 @@ +Initial API interface and implementation, +Unix support, +Win32 support, +BeOS support, +POSIX support, +MacOS support, +OS/2 support, +GRP archiver, +DIR archiver, +ZIP archiver, +QPAK archiver, +MacOS Classic support: + Ryan C. Gordon + +Tons of win32 help: + Adam Gates + +More win32 hacking: + Gregory S. Read + +Fixes for missing current working directories, +PHYSFS_setSaneConfig() improvements, +other bugfixes: + David Hedbor + +Darwin support: + Patrick Stein + +configure fixes, +RPM specfile: + Edward Rudd + +GetLastModTime API, +other stuff: + John R. Hall + +Various support, fixes and suggestions: + Alexander Pipelka + +Russian translation, +Ruby bindings, +QPAK archiver: + Ed Sinjiashvili + +French translation: + St?phane Peter + +Debian package support: + Colin Bayer + +"abs-file.h" in "extras" dir: + Adam D. Moss + +WinCE port and other Win32 patches: + Corona688 + +German translation: + Michael Renner + +Apple Project Builder support, +MacOS X improvements: + Eric Wing + +HOG archiver, +MVL archiver, + Bradley Bell + +MIX archiver, + Sebastian Steinhauer + +Bug fixes: + Tolga Dalman + +Initial PHYSFS_mount() work: + Philip D. Bober + +Brazillian Portuguese translation: + Danny Angelo Carminati Grein + +Spanish translation: + Pedro J. P?rez + +MacOS Classic fixes, +MPW support: + Chris Taylor + +Mingw support, +General bug fixes: + Matze Braun + +Bug fixes: + J?rg Walter + +Windows .rc file: +7zip/lzma archiver, + Dennis Schridde + +Other stuff: + Your name here! Patches go to icculus at icculus.org ... + +/* end of CREDITS.txt ... */ + Deleted: trunk/TODO =================================================================== --- trunk/TODO 2007-03-11 10:17:37 UTC (rev 826) +++ trunk/TODO 2007-03-11 10:19:52 UTC (rev 827) @@ -1,62 +0,0 @@ -Stuff that needs to be done and wishlist: - -These are in no particular order. -Some might be dupes, some might be done already. - -UNICODE: -- Windows: Can use Unicode, but might only allow "codepages" ... Use - GetProcAddress() to find Unicode entry points on WinNT-based - systems, otherwise try to use a sane codepage. -- Mac Classic: apparently supports _something_, but I might just write it off - as a loss. -- OS/2: Codepages. No full Unicode in the filesystem, but we can probably make - a conversion effort. -- Everywhere: Move stricmp() out of platform layer and make it grok UTF-8. - - -Stuff: -- Other archivers: perhaps tar(.gz|.bz2), RPM, ARJ, etc. These are less - important, since streaming archives aren't of much value to games (which - is why zipfiles are king: random access), but it could have uses for, say, - an installer/updater. -- Stack allocate in stripAppleBundle() (platform/unix.c) instead of calloc(). -- Reduce malloc() pressure all over the place. We fragment memory like mad. -- macclassic.c : - "/* (Hmm. Default behaviour is broken in the base library. :) ) */" -- Platforms to port to: Amiga (needs platform driver), DOS4GW (platform driver). -- profile string list interpolation. -- We have two different ways to find dir entries in zip.c. -- Do symlinks in zip archiver work when they point to dirs? -- Enable more warnings? -- Use __cdecl in physfs.h? -- Look for FIXMEs (many marked with "!!!" in comments). -- Probably other stuff. Requests and recommendations are welcome. -- Cygwin should use unix/posix and not win32 platform code. -- Expose the archiver registration mechanism to the outside world. -- Find some way to relax or remove the security model for external tools. -- Non-blocking I/O -- mmap() in posix.c -- OSX shouldn't use ~/.app for userdir. -- fscanf and fprintf support in extras dir. -- Why do we call it openArchive and dirClose? -- Sanity check byte order at runtime. -- Memory locking? -- Find a better name than dvoid and fvoid. -- Can win32.c and pocketpc.c get merged? -- There's so much cut-and-paste between archivers...can this be reduced? -- General code audit. -- Multiple write dirs with mount points? -- Deprecate PHYSFS_setSaneConfig and move it to extras? -- Why is physfsrwops.c cut-and-pasted into the ruby bindings? -- Replace code from SDL... -- Should file enumeration return an error or set error state? -- Update internal zlib? -- Need "getmountpoint" command in test_physfs.c ... -- Look for calloc() calls that aren't going through the allocation hooks. -- maybe other stuff. -- Is -Wall enabled? -- Make mutexes recursive, so callbacks can call into the API. -- Archivers need abstracted i/o to read from memory or files (archives in archives?) - -// end of TODO ... - Copied: trunk/TODO.txt (from rev 817, trunk/TODO) =================================================================== --- trunk/TODO.txt (rev 0) +++ trunk/TODO.txt 2007-03-11 10:19:52 UTC (rev 827) @@ -0,0 +1,62 @@ +Stuff that needs to be done and wishlist: + +These are in no particular order. +Some might be dupes, some might be done already. + +UNICODE: +- Windows: Can use Unicode, but might only allow "codepages" ... Use + GetProcAddress() to find Unicode entry points on WinNT-based + systems, otherwise try to use a sane codepage. +- Mac Classic: apparently supports _something_, but I might just write it off + as a loss. +- OS/2: Codepages. No full Unicode in the filesystem, but we can probably make + a conversion effort. +- Everywhere: Move stricmp() out of platform layer and make it grok UTF-8. + + +Stuff: +- Other archivers: perhaps tar(.gz|.bz2), RPM, ARJ, etc. These are less + important, since streaming archives aren't of much value to games (which + is why zipfiles are king: random access), but it could have uses for, say, + an installer/updater. +- Stack allocate in stripAppleBundle() (platform/unix.c) instead of calloc(). +- Reduce malloc() pressure all over the place. We fragment memory like mad. +- macclassic.c : + "/* (Hmm. Default behaviour is broken in the base library. :) ) */" +- Platforms to port to: Amiga (needs platform driver), DOS4GW (platform driver). +- profile string list interpolation. +- We have two different ways to find dir entries in zip.c. +- Do symlinks in zip archiver work when they point to dirs? +- Enable more warnings? +- Use __cdecl in physfs.h? +- Look for FIXMEs (many marked with "!!!" in comments). +- Probably other stuff. Requests and recommendations are welcome. +- Cygwin should use unix/posix and not win32 platform code. +- Expose the archiver registration mechanism to the outside world. +- Find some way to relax or remove the security model for external tools. +- Non-blocking I/O +- mmap() in posix.c +- OSX shouldn't use ~/.app for userdir. +- fscanf and fprintf support in extras dir. +- Why do we call it openArchive and dirClose? +- Sanity check byte order at runtime. +- Memory locking? +- Find a better name than dvoid and fvoid. +- Can win32.c and pocketpc.c get merged? +- There's so much cut-and-paste between archivers...can this be reduced? +- General code audit. +- Multiple write dirs with mount points? +- Deprecate PHYSFS_setSaneConfig and move it to extras? +- Why is physfsrwops.c cut-and-pasted into the ruby bindings? +- Replace code from SDL... +- Should file enumeration return an error or set error state? +- Update internal zlib? +- Need "getmountpoint" command in test_physfs.c ... +- Look for calloc() calls that aren't going through the allocation hooks. +- maybe other stuff. +- Is -Wall enabled? +- Make mutexes recursive, so callbacks can call into the API. +- Archivers need abstracted i/o to read from memory or files (archives in archives?) + +// end of TODO.txt ... + Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-03-11 10:17:37 UTC (rev 826) +++ trunk/physfs.h 2007-03-11 10:19:52 UTC (rev 827) @@ -203,7 +203,7 @@ * Please see the file LICENSE.txt in the source's root directory for licensing * and redistribution rights. * - * Please see the file CREDITS in the source's root directory for a more or + * Please see the file CREDITS.txt in the source's root directory for a more or * less complete list of who's responsible for this. * * \author Ryan C. Gordon. From DONOTREPLY at icculus.org Sun Mar 11 06:30:43 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 06:30:43 -0400 Subject: r828 - trunk Message-ID: <20070311103043.21131.qmail@icculus.org> Author: icculus Date: 2007-03-11 06:30:43 -0400 (Sun, 11 Mar 2007) New Revision: 828 Modified: trunk/TODO.txt Log: Cleaned out some TODOs. Modified: trunk/TODO.txt =================================================================== --- trunk/TODO.txt 2007-03-11 10:19:52 UTC (rev 827) +++ trunk/TODO.txt 2007-03-11 10:30:43 UTC (rev 828) @@ -23,18 +23,15 @@ - Reduce malloc() pressure all over the place. We fragment memory like mad. - macclassic.c : "/* (Hmm. Default behaviour is broken in the base library. :) ) */" -- Platforms to port to: Amiga (needs platform driver), DOS4GW (platform driver). - profile string list interpolation. - We have two different ways to find dir entries in zip.c. - Do symlinks in zip archiver work when they point to dirs? - Enable more warnings? - Use __cdecl in physfs.h? - Look for FIXMEs (many marked with "!!!" in comments). -- Probably other stuff. Requests and recommendations are welcome. - Cygwin should use unix/posix and not win32 platform code. - Expose the archiver registration mechanism to the outside world. - Find some way to relax or remove the security model for external tools. -- Non-blocking I/O - mmap() in posix.c - OSX shouldn't use ~/.app for userdir. - fscanf and fprintf support in extras dir. @@ -42,7 +39,7 @@ - Sanity check byte order at runtime. - Memory locking? - Find a better name than dvoid and fvoid. -- Can win32.c and pocketpc.c get merged? +- Can windows.c and pocketpc.c get merged? - There's so much cut-and-paste between archivers...can this be reduced? - General code audit. - Multiple write dirs with mount points? @@ -50,13 +47,12 @@ - Why is physfsrwops.c cut-and-pasted into the ruby bindings? - Replace code from SDL... - Should file enumeration return an error or set error state? -- Update internal zlib? - Need "getmountpoint" command in test_physfs.c ... - Look for calloc() calls that aren't going through the allocation hooks. - maybe other stuff. -- Is -Wall enabled? - Make mutexes recursive, so callbacks can call into the API. - Archivers need abstracted i/o to read from memory or files (archives in archives?) +- Probably other stuff. Requests and recommendations are welcome. // end of TODO.txt ... From DONOTREPLY at icculus.org Sun Mar 11 06:52:35 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 06:52:35 -0400 Subject: r829 - trunk Message-ID: <20070311105235.31745.qmail@icculus.org> Author: icculus Date: 2007-03-11 06:52:35 -0400 (Sun, 11 Mar 2007) New Revision: 829 Modified: trunk/INSTALL.txt Log: Minor OS 9 note. Modified: trunk/INSTALL.txt =================================================================== --- trunk/INSTALL.txt 2007-03-11 10:30:43 UTC (rev 828) +++ trunk/INSTALL.txt 2007-03-11 10:52:35 UTC (rev 829) @@ -96,6 +96,8 @@ "test_physfs" or "test_physfs Debug". These binaries are linked against the DLLs you built previously. +There is also an MPW project file included, if you don't have CodeWarrior. + PhysicsFS builds for classic Mac OS do not require CarbonLib...they use OS 8 (8.5?) APIs exclusively. From DONOTREPLY at icculus.org Sun Mar 11 18:50:54 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 18:50:54 -0400 Subject: r830 - in trunk: . platform Message-ID: <20070311225054.13234.qmail@icculus.org> Author: icculus Date: 2007-03-11 18:50:53 -0400 (Sun, 11 Mar 2007) New Revision: 830 Added: trunk/physfs_platforms.h Modified: trunk/CHANGELOG.txt trunk/CMakeLists.txt trunk/platform/beos.cpp trunk/platform/macclassic.c trunk/platform/os2.c trunk/platform/pocketpc.c trunk/platform/posix.c trunk/platform/skeleton.c trunk/platform/unix.c trunk/platform/windows.c Log: Now compiles everything whether we need it or not, removing whole files with #ifdefs...this will make it easier to "embed" this library in other projects or use a different build system: just push everything through the compiler with preprocessor defines for the parts you want/need...platform modules are determined automatically without the build system needing to intervene, so you just have to #define the archivers, etc that you want. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-11 10:52:35 UTC (rev 829) +++ trunk/CHANGELOG.txt 2007-03-11 22:50:53 UTC (rev 830) @@ -6,6 +6,13 @@ branch for history's sake. Added shared and static build options to CMakeLists.txt, and the expected "make install" target. Renamed some FILENAME files to FILENAME.txt, removed physfs.rc. + Now compiles everything whether we need it or not, removing whole + files with #ifdefs...this will make it easier to "embed" this + library in other projects or use a different build system: just + push everything through the compiler with preprocessor defines for + the parts you want/need...platform modules are determined + automatically without the build system needing to intervene, so you + just have to #define the archivers, etc that you want. 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC code to expect UTF-8 strings from the higher level. Changed Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-11 10:52:35 UTC (rev 829) +++ trunk/CMakeLists.txt 2007-03-11 22:50:53 UTC (rev 830) @@ -6,7 +6,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4) PROJECT(PhysicsFS) -SET(PHYSFS_VERSION 1.1.2) +SET(PHYSFS_VERSION 1.1.1) SET(PHYSFS_SOVERSION 1) # I hate that they define "WIN32" ... we're about to move to Win64...I hope! @@ -88,23 +88,46 @@ lzma/LzmaStateDecode.c ) +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) +ENDIF(BEOS) + +# Almost everything is "compiled" here, but things that don't apply to the +# build are #ifdef'd out. This is to make it easy to embed PhysicsFS into +# another project or bring up a new build system: just compile all the source +# code and #define the things you want. SET(PHYSFS_SRCS physfs.c physfs_byteorder.c physfs_unicode.c + platform/macclassic.c + platform/os2.c + platform/pocketpc.c + platform/posix.c + platform/unix.c + platform/windows.c archivers/dir.c + archivers/grp.c + archivers/hog.c + archivers/lzma.c + archivers/mvl.c + archivers/qpak.c + archivers/wad.c + archivers/zip.c + ${PHYSFS_BEOS_SRCS} ) # platform layers ... IF(UNIX) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/posix.c) IF(BEOS) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/beos.cpp) SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) + SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE) + SET(HAVE_PTHREAD_H TRUE) ELSE(BEOS) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/unix.c) # !!! FIXME # AC_DEFINE([PHYSFS_HAVE_LLSEEK], 1, [define if we have llseek]) CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H) @@ -118,21 +141,19 @@ ADD_DEFINITIONS(-DPHYSFS_HAVE_MNTENT_H=1) SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) ENDIF(HAVE_MNTENT_H) + + 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) - - 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(UNIX) IF(WINDOWS) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/windows.c) SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE) SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE) - # !!! FIXME: platform/pocketpc.c ... ? ENDIF(WINDOWS) IF(NOT PHYSFS_HAVE_CDROM_SUPPORT) @@ -158,12 +179,18 @@ MESSAGE(WARNING " ***") ENDIF(PHYSFS_HAVE_THREAD_SUPPORT) +CHECK_INCLUDE_FILE(assert.h HAVE_ASSERT_H) +IF(HAVE_ASSERT_H) + ADD_DEFINITIONS(-DHAVE_ASSERT_H=1) +ENDIF(HAVE_ASSERT_H) + + + # Archivers ... OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE) IF(PHYSFS_ARCHIVE_ZIP) ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/zip.c) SET(PHYSFS_NEED_ZLIB TRUE) ENDIF(PHYSFS_ARCHIVE_ZIP) @@ -171,7 +198,7 @@ IF(PHYSFS_ARCHIVE_7Z) ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_7Z=1) # !!! FIXME: rename to 7z.c? - SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS} archivers/lzma.c) + SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS}) INCLUDE_DIRECTORIES(lzma) ADD_DEFINITIONS(-D_LZMA_IN_CB=1) ADD_DEFINITIONS(-D_LZMA_PROB32=1) @@ -182,31 +209,26 @@ OPTION(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE) IF(PHYSFS_ARCHIVE_GRP) ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_GRP=1) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/grp.c) ENDIF(PHYSFS_ARCHIVE_GRP) OPTION(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE) IF(PHYSFS_ARCHIVE_WAD) ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_WAD=1) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/wad.c) ENDIF(PHYSFS_ARCHIVE_WAD) OPTION(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE) IF(PHYSFS_ARCHIVE_HOG) ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_HOG=1) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/hog.c) ENDIF(PHYSFS_ARCHIVE_HOG) OPTION(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE) IF(PHYSFS_ARCHIVE_MVL) ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MVL=1) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/mvl.c) ENDIF(PHYSFS_ARCHIVE_MVL) OPTION(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE) IF(PHYSFS_ARCHIVE_QPAK) ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_QPAK=1) - SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/qpak.c) ENDIF(PHYSFS_ARCHIVE_QPAK) Added: trunk/physfs_platforms.h =================================================================== --- trunk/physfs_platforms.h (rev 0) +++ trunk/physfs_platforms.h 2007-03-11 22:50:53 UTC (rev 830) @@ -0,0 +1,38 @@ +#ifndef _INCL_PHYSFS_PLATFORMS +#define _INCL_PHYSFS_PLATFORMS + +#ifndef __PHYSICSFS_INTERNAL__ +#error Do not include this header from your applications. +#endif + +/* + * These only define the platforms to determine which files in the platforms + * directory should be compiled. For example, technically BeOS can be called + * a "unix" system, but since it doesn't use unix.c, we don't define + * PHYSFS_PLATFORM_UNIX on that system. + */ + +#if ((defined __BEOS__) || (defined __beos__)) +# define PHYSFS_PLATFORM_BEOS +# define PHYSFS_PLATFORM_POSIX +#elif (defined _WIN32_WCE) || (defined _WIN64_WCE) +# define PHYSFS_PLATFORM_POCKETPC +#elif (((defined _WIN32) || (defined _WIN64)) && (!defined __CYGWIN__)) +# define PHYSFS_PLATFORM_WINDOWS +#elif (defined OS2) +# define PHYSFS_PLATFORM_OS2 +#elif ((defined __MACH__) && (defined __APPLE__)) +# define PHYSFS_PLATFORM_MACOSX +# define PHYSFS_PLATFORM_UNIX +# define PHYSFS_PLATFORM_POSIX +#elif defined(macintosh) +# define PHYSFS_PLATFORM_MACCLASSIC +#elif defined(unix) +# define PHYSFS_PLATFORM_UNIX +# define PHYSFS_PLATFORM_POSIX +#else +# error Unknown platform. +#endif + +#endif /* include-once blocker. */ + Modified: trunk/platform/beos.cpp =================================================================== --- trunk/platform/beos.cpp 2007-03-11 10:52:35 UTC (rev 829) +++ trunk/platform/beos.cpp 2007-03-11 22:50:53 UTC (rev 830) @@ -6,8 +6,11 @@ * This file written by Ryan C. Gordon. */ -#ifdef __BEOS__ +#define __PHYSICSFS_INTERNAL__ +#include "physfs_platforms.h" +#ifdef PHYSFS_PLATFORM_BEOS + #include #include #include @@ -24,7 +27,6 @@ #include #include -#define __PHYSICSFS_INTERNAL__ #include "physfs_internal.h" @@ -244,7 +246,7 @@ release_sem(*((sem_id *) mutex)); } /* __PHYSFS_platformReleaseMutex */ -#endif +#endif /* PHYSFS_PLATFORM_BEOS */ /* end of beos.cpp ... */ Modified: trunk/platform/macclassic.c =================================================================== --- trunk/platform/macclassic.c 2007-03-11 10:52:35 UTC (rev 829) +++ trunk/platform/macclassic.c 2007-03-11 22:50:53 UTC (rev 830) @@ -6,6 +6,11 @@ * This file written by Ryan C. Gordon. */ +#define __PHYSICSFS_INTERNAL__ +#include "physfs_platforms.h" + +#ifdef PHYSFS_PLATFORM_MACCLASSIC + #include #include #include @@ -31,15 +36,6 @@ */ -/* - * Please note that I haven't tried this code with CarbonLib or under - * Mac OS X at all. The code in unix.c is known to work with Darwin, - * and you may or may not be better off using that, especially since - * mutexes are no-ops in this file. Patches welcome. - */ -#ifdef __PHYSFS_CARBONIZED__ /* this is currently not defined anywhere. */ -#include -#else #include #include #include @@ -49,12 +45,9 @@ #include #include #include -#endif -#define __PHYSICSFS_INTERNAL__ #include "physfs_internal.h" - const char *__PHYSFS_platformDirSeparator = ":"; @@ -960,5 +953,7 @@ free(ptr); } /* __PHYSFS_platformAllocatorFree */ +#endif /* PHYSFS_PLATFORM_MACCLASSIC */ + /* end of macclassic.c ... */ Modified: trunk/platform/os2.c =================================================================== --- trunk/platform/os2.c 2007-03-11 10:52:35 UTC (rev 829) +++ trunk/platform/os2.c 2007-03-11 22:50:53 UTC (rev 830) @@ -6,8 +6,11 @@ * This file written by Ryan C. Gordon. */ -#if (defined OS2) +#define __PHYSICSFS_INTERNAL__ +#include "physfs_platforms.h" +#ifdef PHYSFS_PLATFORM_OS2 + #define INCL_DOSSEMAPHORES #define INCL_DOSDATETIME #define INCL_DOSFILEMGR @@ -26,7 +29,6 @@ #include #include -#define __PHYSICSFS_INTERNAL__ #include "physfs_internal.h" const char *__PHYSFS_platformDirSeparator = "\\"; @@ -773,7 +775,7 @@ free(ptr); } /* __PHYSFS_platformAllocatorFree */ -#endif /* defined OS2 */ +#endif /* PHYSFS_PLATFORM_OS2 */ /* end of os2.c ... */ Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-11 10:52:35 UTC (rev 829) +++ trunk/platform/pocketpc.c 2007-03-11 22:50:53 UTC (rev 830) @@ -6,10 +6,14 @@ * This file written by Ryan C. Gordon. */ +#define __PHYSICSFS_INTERNAL__ +#include "physfs_platforms.h" + +#ifdef PHYSFS_PLATFORM_POCKETPC + #include #include -#define __PHYSICSFS_INTERNAL__ #include "physfs_internal.h" #define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF @@ -624,5 +628,7 @@ free(ptr); } /* __PHYSFS_platformAllocatorFree */ +#endif /* PHYSFS_PLATFORM_POCKETPC */ + /* end of pocketpc.c ... */ Modified: trunk/platform/posix.c =================================================================== --- trunk/platform/posix.c 2007-03-11 10:52:35 UTC (rev 829) +++ trunk/platform/posix.c 2007-03-11 22:50:53 UTC (rev 830) @@ -6,8 +6,11 @@ * This file written by Ryan C. Gordon. */ -#if ((!defined WIN32) && (!defined OS2)) +#define __PHYSICSFS_INTERNAL__ +#include "physfs_platforms.h" +#ifdef PHYSFS_PLATFORM_POSIX + #if (defined __STRICT_ANSI__) #define __PHYSFS_DOING_STRICT_ANSI__ #endif @@ -44,7 +47,6 @@ #include #endif -#define __PHYSICSFS_INTERNAL__ #include "physfs_internal.h" @@ -533,7 +535,7 @@ free(ptr); } /* __PHYSFS_platformAllocatorFree */ -#endif /* !defined WIN32 */ +#endif /* PHYSFS_PLATFORM_POSIX */ /* end of posix.c ... */ Modified: trunk/platform/skeleton.c =================================================================== --- trunk/platform/skeleton.c 2007-03-11 10:52:35 UTC (rev 829) +++ trunk/platform/skeleton.c 2007-03-11 22:50:53 UTC (rev 830) @@ -6,13 +6,15 @@ * This file written by Ryan C. Gordon. */ +#error DO NOT COMPILE THIS. IT IS JUST A SKELETON EXAMPLE FILE. + #define __PHYSICSFS_INTERNAL__ -#include "physfs_internal.h" +#include "physfs_platforms.h" +#ifdef PHYSFS_PLATFORM_SKELETON -#error DO NOT COMPILE THIS. IT IS JUST A SKELETON EXAMPLE FILE. +#include "physfs_internal.h" - const char *__PHYSFS_platformDirSeparator = ":"; @@ -265,5 +267,8 @@ free(ptr); } /* __PHYSFS_platformAllocatorFree */ +#endif /* PHYSFS_PLATFORM_SKELETON */ + + /* end of skeleton.c ... */ Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-11 10:52:35 UTC (rev 829) +++ trunk/platform/unix.c 2007-03-11 22:50:53 UTC (rev 830) @@ -6,9 +6,11 @@ * This file written by Ryan C. Gordon. */ -/* BeOS uses beos.cpp and posix.c ... Cygwin and such use windows.c ... */ -#if ((!defined __BEOS__) && (!defined WIN32)) +#define __PHYSICSFS_INTERNAL__ +#include "physfs_platforms.h" +#ifdef PHYSFS_PLATFORM_UNIX + #include #include #include @@ -23,16 +25,13 @@ #include #include -#ifndef PHYSFS_DARWIN -# if defined(__MACH__) && defined(__APPLE__) -# define PHYSFS_DARWIN 1 -# include -# include -# include -# include -# include -# include -# endif +#ifdef PHYSFS_PLATFORM_MACOSX +# include +# include +# include +# include +# include +# include #endif #if (!defined PHYSFS_NO_PTHREADS_SUPPORT) @@ -50,7 +49,6 @@ #include #endif -#define __PHYSICSFS_INTERNAL__ #include "physfs_internal.h" /* Seems to get defined in some system header... */ @@ -81,7 +79,7 @@ } /* __PHYSFS_platformDetectAvailableCDs */ -#elif (defined PHYSFS_DARWIN) /* "Big Nasty." */ +#elif (defined PHYSFS_PLATFORM_MACOSX) /* "Big Nasty." */ /* * Code based on sample from Apple Developer Connection: * http://developer.apple.com/samplecode/Sample_Code/Devices_and_Hardware/Disks/VolumeToBSDNode/VolumeToBSDNode.c.htm @@ -332,7 +330,7 @@ } /* __PHYSFS_platformTimeslice */ -#if PHYSFS_DARWIN +#if PHYSFS_PLATFORM_MACOSX /* * This function is only for OSX. The problem is that Apple's applications * can actually be directory structures with the actual executable nested @@ -552,8 +550,7 @@ #endif /* !PHYSFS_NO_PTHREADS_SUPPORT */ +#endif /* PHYSFS_PLATFORM_UNIX */ -#endif /* !defined __BEOS__ && !defined WIN32 */ - /* end of unix.c ... */ Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-11 10:52:35 UTC (rev 829) +++ trunk/platform/windows.c 2007-03-11 22:50:53 UTC (rev 830) @@ -6,8 +6,11 @@ * This file written by Ryan C. Gordon, and made sane by Gregory S. Read. */ -#ifdef WIN32 +#define __PHYSICSFS_INTERNAL__ +#include "physfs_platforms.h" +#ifdef PHYSFS_PLATFORM_WINDOWS + #include #include #include @@ -16,7 +19,6 @@ #include #include -#define __PHYSICSFS_INTERNAL__ #include "physfs_internal.h" #if (defined _MSC_VER) @@ -1141,7 +1143,8 @@ free(ptr); } /* __PHYSFS_platformAllocatorFree */ -#endif +#endif /* PHYSFS_PLATFORM_WINDOWS */ /* end of windows.c ... */ + From DONOTREPLY at icculus.org Sun Mar 11 21:01:58 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 21:01:58 -0400 Subject: r831 - trunk Message-ID: <20070312010158.30367.qmail@icculus.org> Author: icculus Date: 2007-03-11 21:01:58 -0400 (Sun, 11 Mar 2007) New Revision: 831 Modified: trunk/makeos2.cmd Log: First shot at updating makeos2.cmd for Innotek/kLIBC's build tools. Farewell, EMX, you have served me well. Thanks to Dave Yeo for the details on this. (This is untested at the moment.) Modified: trunk/makeos2.cmd =================================================================== --- trunk/makeos2.cmd 2007-03-11 22:50:53 UTC (rev 830) +++ trunk/makeos2.cmd 2007-03-12 01:01:58 UTC (rev 831) @@ -1,14 +1,16 @@ @echo off rem this is a simple batch file to build PhysicsFS on OS/2. You need to have -rem the EMX development tools installed for this to work. +rem the Innotek libc and GCC (or "kLIBC") installed for this to work: rem +rem http://svn.netlabs.org/libc +rem rem This script (and, indeed, our OS/2 support) could use some tweaking. rem Patches go to icculus at icculus.org ... set PHYSFSLANG=PHYSFS_LANG_ENGLISH set DEBUGFLAGS=-D_NDEBUG -O2 -s -rem set CFLAGS=%DEBUGFLAGS% -Wall -Werror -Zomf -Zmt -Zmtd -I. -Izlib123 -c -D__ST_MT_ERRNO__ -DOS2 -DZ_PREFIX -DPHYSFS_SUPPORTS_ZIP -DPHYSFS_SUPPORTS_GRP -DPHYSFS_SUPPORTS_WAD -DPHYSFS_SUPPORTS_QPAK -DPHYSFS_SUPPORTS_HOG -DPHYSFS_SUPPORTS_MVL -DPHYSFS_LANG=%PHYSFSLANG% -DHAVE_ASSERT_H -set CFLAGS=%DEBUGFLAGS% -Wall -Werror -Zomf -Zmt -Zmtd -I. -Izlib123 -c -D__ST_MT_ERRNO__ -DOS2 -DZ_PREFIX -DPHYSFS_SUPPORTS_ZIP -DPHYSFS_SUPPORTS_GRP -DPHYSFS_SUPPORTS_WAD -DPHYSFS_SUPPORTS_QPAK -DPHYSFS_SUPPORTS_HOG -DPHYSFS_SUPPORTS_MVL -DHAVE_ASSERT_H +rem set CFLAGS=%DEBUGFLAGS% -Wall -Werror -Zomf -Zmt -Zmtd -I. -Izlib123 -c -D__ST_MT_ERRNO__ -DOS2 -DZ_PREFIX -DPHYSFS_SUPPORTS_ZIP -DPHYSFS_SUPPORTS_7Z -DPHYSFS_SUPPORTS_GRP -DPHYSFS_SUPPORTS_WAD -DPHYSFS_SUPPORTS_QPAK -DPHYSFS_SUPPORTS_HOG -DPHYSFS_SUPPORTS_MVL -DPHYSFS_LANG=%PHYSFSLANG% -DHAVE_ASSERT_H +set CFLAGS=%DEBUGFLAGS% -Wall -Werror -Zomf -I. -Iz -c -D__ST_MT_ERRNO__ -DOS2 -DZ_PREFIX -DPHYSFS_SUPPORTS_ZIP -DPHYSFS_SUPPORTS_7Z -DPHYSFS_SUPPORTS_GRP -DPHYSFS_SUPPORTS_WAD -DPHYSFS_SUPPORTS_QPAK -DPHYSFS_SUPPORTS_HOG -DPHYSFS_SUPPORTS_MVL -DHAVE_ASSERT_H rem goto :dolinking @@ -31,93 +33,94 @@ @echo DATA LOADONCALL NONSHARED MULTIPLE >> bin\physfs.def @echo DESCRIPTION 'PhysicsFS: http://icculus.org/physfs/' >> bin\physfs.def @echo EXPORTS >> bin\physfs.def - at echo "PHYSFS_getLinkedVersion" >> bin\physfs.def - at echo "PHYSFS_init" >> bin\physfs.def - at echo "PHYSFS_deinit" >> bin\physfs.def - at echo "PHYSFS_supportedArchiveTypes" >> bin\physfs.def - at echo "PHYSFS_freeList" >> bin\physfs.def - at echo "PHYSFS_getLastError" >> bin\physfs.def - at echo "PHYSFS_getDirSeparator" >> bin\physfs.def - at echo "PHYSFS_permitSymbolicLinks" >> bin\physfs.def - at echo "PHYSFS_getCdRomDirs" >> bin\physfs.def - at echo "PHYSFS_getBaseDir" >> bin\physfs.def - at echo "PHYSFS_getUserDir" >> bin\physfs.def - at echo "PHYSFS_getWriteDir" >> bin\physfs.def - at echo "PHYSFS_setWriteDir" >> bin\physfs.def - at echo "PHYSFS_addToSearchPath" >> bin\physfs.def - at echo "PHYSFS_removeFromSearchPath" >> bin\physfs.def - at echo "PHYSFS_getSearchPath" >> bin\physfs.def - at echo "PHYSFS_setSaneConfig" >> bin\physfs.def - at echo "PHYSFS_mkdir" >> bin\physfs.def - at echo "PHYSFS_delete" >> bin\physfs.def - at echo "PHYSFS_getRealDir" >> bin\physfs.def - at echo "PHYSFS_enumerateFiles" >> bin\physfs.def - at echo "PHYSFS_exists" >> bin\physfs.def - at echo "PHYSFS_isDirectory" >> bin\physfs.def - at echo "PHYSFS_isSymbolicLink" >> bin\physfs.def - at echo "PHYSFS_openWrite" >> bin\physfs.def - at echo "PHYSFS_openAppend" >> bin\physfs.def - at echo "PHYSFS_openRead" >> bin\physfs.def - at echo "PHYSFS_close" >> bin\physfs.def - at echo "PHYSFS_read" >> bin\physfs.def - at echo "PHYSFS_write" >> bin\physfs.def - at echo "PHYSFS_eof" >> bin\physfs.def - at echo "PHYSFS_tell" >> bin\physfs.def - at echo "PHYSFS_seek" >> bin\physfs.def - at echo "PHYSFS_fileLength" >> bin\physfs.def - at echo "PHYSFS_swapSLE16" >> bin\physfs.def - at echo "PHYSFS_swapULE16" >> bin\physfs.def - at echo "PHYSFS_swapSLE32" >> bin\physfs.def - at echo "PHYSFS_swapULE32" >> bin\physfs.def - at echo "PHYSFS_swapSLE64" >> bin\physfs.def - at echo "PHYSFS_swapULE64" >> bin\physfs.def - at echo "PHYSFS_swapSBE16" >> bin\physfs.def - at echo "PHYSFS_swapUBE16" >> bin\physfs.def - at echo "PHYSFS_swapSBE32" >> bin\physfs.def - at echo "PHYSFS_swapUBE32" >> bin\physfs.def - at echo "PHYSFS_swapSBE64" >> bin\physfs.def - at echo "PHYSFS_swapUBE64" >> bin\physfs.def - at echo "PHYSFS_getLastModTime" >> bin\physfs.def - at echo "PHYSFS_readSLE16" >> bin\physfs.def - at echo "PHYSFS_readULE16" >> bin\physfs.def - at echo "PHYSFS_readSLE32" >> bin\physfs.def - at echo "PHYSFS_readULE32" >> bin\physfs.def - at echo "PHYSFS_readSLE64" >> bin\physfs.def - at echo "PHYSFS_readULE64" >> bin\physfs.def - at echo "PHYSFS_readSBE16" >> bin\physfs.def - at echo "PHYSFS_readUBE16" >> bin\physfs.def - at echo "PHYSFS_readSBE32" >> bin\physfs.def - at echo "PHYSFS_readUBE32" >> bin\physfs.def - at echo "PHYSFS_readSBE64" >> bin\physfs.def - at echo "PHYSFS_readUBE64" >> bin\physfs.def - at echo "PHYSFS_writeSLE16" >> bin\physfs.def - at echo "PHYSFS_writeULE16" >> bin\physfs.def - at echo "PHYSFS_writeSLE32" >> bin\physfs.def - at echo "PHYSFS_writeULE32" >> bin\physfs.def - at echo "PHYSFS_writeSLE64" >> bin\physfs.def - at echo "PHYSFS_writeULE64" >> bin\physfs.def - at echo "PHYSFS_writeSBE16" >> bin\physfs.def - at echo "PHYSFS_writeUBE16" >> bin\physfs.def - at echo "PHYSFS_writeSBE32" >> bin\physfs.def - at echo "PHYSFS_writeUBE32" >> bin\physfs.def - at echo "PHYSFS_writeSBE64" >> bin\physfs.def - at echo "PHYSFS_writeUBE64" >> bin\physfs.def - at echo "PHYSFS_setBuffer" >> bin\physfs.def - at echo "PHYSFS_flush" >> bin\physfs.def - at echo "PHYSFS_mount" >> bin\physfs.def - at echo "PHYSFS_getMountPoint" >> bin\physfs.def - at echo "PHYSFS_setAllocator" >> bin\physfs.def - at echo "PHYSFS_getCdRomDirsCallback" >> bin\physfs.def - at echo "PHYSFS_getSearchPathCallback" >> bin\physfs.def - at echo "PHYSFS_enumerateFilesCallback" >> bin\physfs.def - at echo "PHYSFS_utf8toucs2" >> bin\physfs.def - at echo "PHYSFS_utf8fromucs2" >> bin\physfs.def - at echo "PHYSFS_utf8toucs4" >> bin\physfs.def - at echo "PHYSFS_utf8fromucs4" >> bin\physfs.def - at echo "PHYSFS_utf8fromlatin1" >> bin\physfs.def + at echo "_PHYSFS_getLinkedVersion" >> bin\physfs.def + at echo "_PHYSFS_init" >> bin\physfs.def + at echo "_PHYSFS_deinit" >> bin\physfs.def + at echo "_PHYSFS_supportedArchiveTypes" >> bin\physfs.def + at echo "_PHYSFS_freeList" >> bin\physfs.def + at echo "_PHYSFS_getLastError" >> bin\physfs.def + at echo "_PHYSFS_getDirSeparator" >> bin\physfs.def + at echo "_PHYSFS_permitSymbolicLinks" >> bin\physfs.def + at echo "_PHYSFS_getCdRomDirs" >> bin\physfs.def + at echo "_PHYSFS_getBaseDir" >> bin\physfs.def + at echo "_PHYSFS_getUserDir" >> bin\physfs.def + at echo "_PHYSFS_getWriteDir" >> bin\physfs.def + at echo "_PHYSFS_setWriteDir" >> bin\physfs.def + at echo "_PHYSFS_addToSearchPath" >> bin\physfs.def + at echo "_PHYSFS_removeFromSearchPath" >> bin\physfs.def + at echo "_PHYSFS_getSearchPath" >> bin\physfs.def + at echo "_PHYSFS_setSaneConfig" >> bin\physfs.def + at echo "_PHYSFS_mkdir" >> bin\physfs.def + at echo "_PHYSFS_delete" >> bin\physfs.def + at echo "_PHYSFS_getRealDir" >> bin\physfs.def + at echo "_PHYSFS_enumerateFiles" >> bin\physfs.def + at echo "_PHYSFS_exists" >> bin\physfs.def + at echo "_PHYSFS_isDirectory" >> bin\physfs.def + at echo "_PHYSFS_isSymbolicLink" >> bin\physfs.def + at echo "_PHYSFS_openWrite" >> bin\physfs.def + at echo "_PHYSFS_openAppend" >> bin\physfs.def + at echo "_PHYSFS_openRead" >> bin\physfs.def + at echo "_PHYSFS_close" >> bin\physfs.def + at echo "_PHYSFS_read" >> bin\physfs.def + at echo "_PHYSFS_write" >> bin\physfs.def + at echo "_PHYSFS_eof" >> bin\physfs.def + at echo "_PHYSFS_tell" >> bin\physfs.def + at echo "_PHYSFS_seek" >> bin\physfs.def + at echo "_PHYSFS_fileLength" >> bin\physfs.def + at echo "_PHYSFS_swapSLE16" >> bin\physfs.def + at echo "_PHYSFS_swapULE16" >> bin\physfs.def + at echo "_PHYSFS_swapSLE32" >> bin\physfs.def + at echo "_PHYSFS_swapULE32" >> bin\physfs.def + at echo "_PHYSFS_swapSLE64" >> bin\physfs.def + at echo "_PHYSFS_swapULE64" >> bin\physfs.def + at echo "_PHYSFS_swapSBE16" >> bin\physfs.def + at echo "_PHYSFS_swapUBE16" >> bin\physfs.def + at echo "_PHYSFS_swapSBE32" >> bin\physfs.def + at echo "_PHYSFS_swapUBE32" >> bin\physfs.def + at echo "_PHYSFS_swapSBE64" >> bin\physfs.def + at echo "_PHYSFS_swapUBE64" >> bin\physfs.def + at echo "_PHYSFS_getLastModTime" >> bin\physfs.def + at echo "_PHYSFS_readSLE16" >> bin\physfs.def + at echo "_PHYSFS_readULE16" >> bin\physfs.def + at echo "_PHYSFS_readSLE32" >> bin\physfs.def + at echo "_PHYSFS_readULE32" >> bin\physfs.def + at echo "_PHYSFS_readSLE64" >> bin\physfs.def + at echo "_PHYSFS_readULE64" >> bin\physfs.def + at echo "_PHYSFS_readSBE16" >> bin\physfs.def + at echo "_PHYSFS_readUBE16" >> bin\physfs.def + at echo "_PHYSFS_readSBE32" >> bin\physfs.def + at echo "_PHYSFS_readUBE32" >> bin\physfs.def + at echo "_PHYSFS_readSBE64" >> bin\physfs.def + at echo "_PHYSFS_readUBE64" >> bin\physfs.def + at echo "_PHYSFS_writeSLE16" >> bin\physfs.def + at echo "_PHYSFS_writeULE16" >> bin\physfs.def + at echo "_PHYSFS_writeSLE32" >> bin\physfs.def + at echo "_PHYSFS_writeULE32" >> bin\physfs.def + at echo "_PHYSFS_writeSLE64" >> bin\physfs.def + at echo "_PHYSFS_writeULE64" >> bin\physfs.def + at echo "_PHYSFS_writeSBE16" >> bin\physfs.def + at echo "_PHYSFS_writeUBE16" >> bin\physfs.def + at echo "_PHYSFS_writeSBE32" >> bin\physfs.def + at echo "_PHYSFS_writeUBE32" >> bin\physfs.def + at echo "_PHYSFS_writeSBE64" >> bin\physfs.def + at echo "_PHYSFS_writeUBE64" >> bin\physfs.def + at echo "_PHYSFS_setBuffer" >> bin\physfs.def + at echo "_PHYSFS_flush" >> bin\physfs.def + at echo "_PHYSFS_mount" >> bin\physfs.def + at echo "_PHYSFS_getMountPoint" >> bin\physfs.def + at echo "_PHYSFS_setAllocator" >> bin\physfs.def + at echo "_PHYSFS_getCdRomDirsCallback" >> bin\physfs.def + at echo "_PHYSFS_getSearchPathCallback" >> bin\physfs.def + at echo "_PHYSFS_enumerateFilesCallback" >> bin\physfs.def + at echo "_PHYSFS_utf8toucs2" >> bin\physfs.def + at echo "_PHYSFS_utf8fromucs2" >> bin\physfs.def + at echo "_PHYSFS_utf8toucs4" >> bin\physfs.def + at echo "_PHYSFS_utf8fromucs4" >> bin\physfs.def + at echo "_PHYSFS_utf8fromlatin1" >> bin\physfs.def @echo Building export library... emximp -o bin/physfs.lib bin/physfs.def +emximp -o bin/physfs.a bin/physfs.def @echo Compiling PhysicsFS library... @echo on @@ -128,6 +131,7 @@ gcc %CFLAGS% -o bin/dir.obj archivers/dir.c gcc %CFLAGS% -o bin/grp.obj archivers/grp.c gcc %CFLAGS% -o bin/wad.obj archivers/wad.c +gcc %CFLAGS% -o bin/lzma.obj archivers/lzma.c gcc %CFLAGS% -o bin/zip.obj archivers/zip.c gcc %CFLAGS% -o bin/qpak.obj archivers/qpak.c gcc %CFLAGS% -o bin/hog.obj archivers/hog.c @@ -144,18 +148,28 @@ gcc %CFLAGS% -o bin/trees.obj zlib123/trees.c gcc %CFLAGS% -o bin/uncompr.obj zlib123/uncompr.c gcc %CFLAGS% -o bin/zutil.obj zlib123/zutil.c +gcc %CFLAGS% -o bin/7zBuffer.obj lzma/7zBuffer.c +gcc %CFLAGS% -o bin/7zCrc.obj lzma/7zCrc.c +gcc %CFLAGS% -o bin/7zDecode.obj lzma/7zDecode.c +gcc %CFLAGS% -o bin/7zExtract.obj lzma/7zExtract.c +gcc %CFLAGS% -o bin/7zHeader.obj lzma/7zHeader.c +gcc %CFLAGS% -o bin/7zIn.obj lzma/7zIn.c +gcc %CFLAGS% -o bin/7zItem.obj lzma/7zItem.c +gcc %CFLAGS% -o bin/7zMethodID.obj lzma/7zMethodID.c +gcc %CFLAGS% -o bin/LzmaDecode.obj lzma/LzmaDecode.c +gcc %CFLAGS% -o bin/LzmaStateDecode.obj lzma/LzmaStateDecode.c @echo off :dolinking @echo Linking PhysicsFS library... -gcc %DEBUGFLAGS% -Zdll -Zcrtdll -Zomf -Zmt -Zmtd -o bin/physfs.dll bin/*.obj bin/physfs.def +gcc %DEBUGFLAGS% -Zdll -Zcrtdll -Zomf -o bin/physfs.dll bin/*.obj bin/physfs.def rem goto :builddone @echo Compiling test program... gcc %CFLAGS% -o bin/test_physfs.obj test/test_physfs.c @echo Linking test program... -gcc %DEBUGFLAGS% -Zomf -Zcrtdll -Zmt -Zmtd -o bin/test_physfs.exe bin/test_physfs.obj bin/physfs.lib bin/test_physfs.def +gcc %DEBUGFLAGS% -Zomf -Zcrtdll -o bin/test_physfs.exe bin/test_physfs.obj bin/physfs.lib bin/test_physfs.def :builddone From DONOTREPLY at icculus.org Sun Mar 11 21:07:45 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 21:07:45 -0400 Subject: r832 - trunk Message-ID: <20070312010745.761.qmail@icculus.org> Author: icculus Date: 2007-03-11 21:07:45 -0400 (Sun, 11 Mar 2007) New Revision: 832 Modified: trunk/CHANGELOG.txt trunk/CREDITS.txt trunk/INSTALL.txt Log: Updated. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-12 01:01:58 UTC (rev 831) +++ trunk/CHANGELOG.txt 2007-03-12 01:07:45 UTC (rev 832) @@ -13,6 +13,7 @@ the parts you want/need...platform modules are determined automatically without the build system needing to intervene, so you just have to #define the archivers, etc that you want. + Updated makeos2.cmd for newer Innotek toolchain (thanks, Dave!) 03082007 - Fixed a comment in physfs.h. Renamed win32.c to windows.c. Cleaned up whitespace/formatting in pocketpc.c. Updated PocketPC code to expect UTF-8 strings from the higher level. Changed Modified: trunk/CREDITS.txt =================================================================== --- trunk/CREDITS.txt 2007-03-12 01:01:58 UTC (rev 831) +++ trunk/CREDITS.txt 2007-03-12 01:07:45 UTC (rev 832) @@ -1,15 +1,4 @@ -Initial API interface and implementation, -Unix support, -Win32 support, -BeOS support, -POSIX support, -MacOS support, -OS/2 support, -GRP archiver, -DIR archiver, -ZIP archiver, -QPAK archiver, -MacOS Classic support: +Maintainer and general codemonkey: Ryan C. Gordon Tons of win32 help: @@ -58,14 +47,14 @@ Michael Renner Apple Project Builder support, -MacOS X improvements: +Mac OS X improvements: Eric Wing HOG archiver, -MVL archiver, +MVL archiver: Bradley Bell -MIX archiver, +MIX archiver: Sebastian Steinhauer Bug fixes: @@ -91,10 +80,13 @@ Bug fixes: J?rg Walter -Windows .rc file: -7zip/lzma archiver, +Windows .rc file, +7zip/lzma archiver: Dennis Schridde +OS/2 updates: + Dave Yeo + Other stuff: Your name here! Patches go to icculus at icculus.org ... Modified: trunk/INSTALL.txt =================================================================== --- trunk/INSTALL.txt 2007-03-12 01:01:58 UTC (rev 831) +++ trunk/INSTALL.txt 2007-03-12 01:07:45 UTC (rev 832) @@ -87,7 +87,8 @@ Double-click on "CWProjects.sit" in the root of the source tree. This will unpack into a folder called "Mac Classic Support", which has CodeWarrior 6 - project files. + project files. Newer CodeWarrior releases should be able to read these project + files, too. Point CodeWarrior at "physfs.mcp" in that new folder, and build. This will produce a "PhysicsFS" or "PhysicsFS Debug" shared library, depending on what @@ -96,10 +97,11 @@ "test_physfs" or "test_physfs Debug". These binaries are linked against the DLLs you built previously. -There is also an MPW project file included, if you don't have CodeWarrior. +There is also an MPW project file included, if you don't have CodeWarrior. It + is untested. PhysicsFS builds for classic Mac OS do not require CarbonLib...they use - OS 8 (8.5?) APIs exclusively. + OS 9 APIs exclusively. If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for the Mac, I'd like to hear from you; send an email to icculus at icculus.org. @@ -123,17 +125,16 @@ OS/2: -You need EMX installed. I tried this on a stock Warp 4 install, no fixpaks. - I used the latest EMX and patches (which are several years old now). You need - to install link386.exe (Selective Install, "link object modules" option). Once - EMX is installed correctly, unpack the source to PhysicsFS and run the script +You need Innotek GCC and libc installed (or kLIBC). I tried this on a stock + Warp 4 install, no fixpaks. You need to install link386.exe (Selective + Install, "link object modules" option). Once libc and GCC are installed + correctly, unpack the source to PhysicsFS and run the script file "makeos2.cmd". I know this isn't ideal, but I wanted to have this build without users having to hunt down a "make" program (While several exist, EMX doesn't come with one). If someone wants to hack some REXX to make this a bit more picky about recompiling, I'll accept the patch. -Modernizing this for post-EMX systems or OpenWatcom may be good solutions, too. - Send patches. And port CMake. +Someone please port CMake to OS/2. If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for OS/2, I'd like to hear from you; send an email to icculus at icculus.org. From DONOTREPLY at icculus.org Sun Mar 11 23:41:20 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 11 Mar 2007 23:41:20 -0400 Subject: r833 - in trunk: . archivers Message-ID: <20070312034120.6394.qmail@icculus.org> Author: icculus Date: 2007-03-11 23:41:20 -0400 (Sun, 11 Mar 2007) New Revision: 833 Modified: trunk/CMakeLists.txt trunk/archivers/lzma.c trunk/physfs.c Log: Fixes for BeOS and gcc2. Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-12 01:07:45 UTC (rev 832) +++ trunk/CMakeLists.txt 2007-03-12 03:41:20 UTC (rev 833) @@ -42,8 +42,13 @@ # Add some gcc-specific command lines. IF(CMAKE_COMPILER_IS_GNUCC) # Always build with debug symbols...you can strip it later. - ADD_DEFINITIONS(-g -pipe -Wall -Werror -fsigned-char) + ADD_DEFINITIONS(-g -pipe -Werror -fsigned-char) + # Stupid BeOS generates warnings in the system headers. + IF(NOT BEOS) + ADD_DEFINITIONS(-Wall) + ENDIF(NOT BEOS) + CHECK_C_SOURCE_COMPILES(" #if ((defined(__GNUC__)) && (__GNUC__ >= 4)) int main(int argc, char **argv) { int is_gcc4 = 1; return 0; } @@ -92,6 +97,7 @@ # 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) ENDIF(BEOS) # Almost everything is "compiled" here, but things that don't apply to the Modified: trunk/archivers/lzma.c =================================================================== --- trunk/archivers/lzma.c 2007-03-12 01:07:45 UTC (rev 832) +++ trunk/archivers/lzma.c 2007-03-12 03:41:20 UTC (rev 833) @@ -265,6 +265,10 @@ PHYSFS_sint64 wantedSize = objSize*objCount; PHYSFS_sint64 remainingSize = entry->file->Size - entry->position; + size_t fileSize; + ISzAlloc allocImp; + ISzAlloc allocTempImp; + BAIL_IF_MACRO(wantedSize == 0, NULL, 0); /* quick rejection. */ BAIL_IF_MACRO(remainingSize == 0, ERR_PAST_EOF, 0); @@ -276,10 +280,6 @@ __PHYSFS_setError(ERR_PAST_EOF); /* this is always true here. */ } /* if */ - size_t fileSize; - ISzAlloc allocImp; - ISzAlloc allocTempImp; - /* Prepare callbacks for 7z */ allocImp.Alloc = SzAllocPhysicsFS; allocImp.Free = SzFreePhysicsFS; Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-12 01:07:45 UTC (rev 832) +++ trunk/physfs.c 2007-03-12 03:41:20 UTC (rev 833) @@ -1503,10 +1503,12 @@ const char *_fname, void *data) { size_t len = strlen(arcfname); + char *ptr = NULL; + char *end = NULL; char *mountPoint = (char *) alloca(strlen(i->mountPoint) + 1); strcpy(mountPoint, i->mountPoint); - char *ptr = mountPoint + ((len) ? len + 1 : 0); - char *end = strchr(ptr, '/'); + ptr = mountPoint + ((len) ? len + 1 : 0); + end = strchr(ptr, '/'); assert(end); /* should always find a terminating '/'. */ *end = '\0'; callback(data, _fname, ptr); From DONOTREPLY at icculus.org Wed Mar 14 02:30:20 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 14 Mar 2007 02:30:20 -0400 Subject: r834 - trunk/platform Message-ID: <20070314063020.19365.qmail@icculus.org> Author: icculus Date: 2007-03-14 02:30:20 -0400 (Wed, 14 Mar 2007) New Revision: 834 Modified: trunk/platform/unix.c Log: Patched to compile on Mac OS X. Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-12 03:41:20 UTC (rev 833) +++ trunk/platform/unix.c 2007-03-14 06:30:20 UTC (rev 834) @@ -330,7 +330,7 @@ } /* __PHYSFS_platformTimeslice */ -#if PHYSFS_PLATFORM_MACOSX +#ifdef PHYSFS_PLATFORM_MACOSX /* * This function is only for OSX. The problem is that Apple's applications * can actually be directory structures with the actual executable nested @@ -442,7 +442,7 @@ BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); strcpy(retval, resolved_path); -#if defined(__MACH__) && defined(__APPLE__) +#ifdef PHYSFS_PLATFORM_MACOSX stripAppleBundle(retval); #endif /* defined __MACH__ && defined __APPLE__ */ From DONOTREPLY at icculus.org Wed Mar 14 02:30:52 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 14 Mar 2007 02:30:52 -0400 Subject: r835 - trunk/platform Message-ID: <20070314063052.19594.qmail@icculus.org> Author: icculus Date: 2007-03-14 02:30:52 -0400 (Wed, 14 Mar 2007) New Revision: 835 Modified: trunk/platform/unix.c Log: Minor comment removal. Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-14 06:30:20 UTC (rev 834) +++ trunk/platform/unix.c 2007-03-14 06:30:52 UTC (rev 835) @@ -428,7 +428,7 @@ allocator.Free(tempbuf); return; } -#endif /* defined __MACH__ && defined __APPLE__ */ +#endif char *__PHYSFS_platformRealPath(const char *path) @@ -444,7 +444,7 @@ #ifdef PHYSFS_PLATFORM_MACOSX stripAppleBundle(retval); -#endif /* defined __MACH__ && defined __APPLE__ */ +#endif return(retval); } /* __PHYSFS_platformRealPath */ From DONOTREPLY at icculus.org Wed Mar 14 02:39:17 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 14 Mar 2007 02:39:17 -0400 Subject: r836 - trunk/platform Message-ID: <20070314063917.22715.qmail@icculus.org> Author: icculus Date: 2007-03-14 02:39:17 -0400 (Wed, 14 Mar 2007) New Revision: 836 Modified: trunk/platform/macclassic.c Log: Mac Classic platform layer: don't strcmp() a NULL string. Modified: trunk/platform/macclassic.c =================================================================== --- trunk/platform/macclassic.c 2007-03-14 06:30:52 UTC (rev 835) +++ trunk/platform/macclassic.c 2007-03-14 06:39:17 UTC (rev 836) @@ -124,15 +124,16 @@ { char buf[sizeof (ERR_MACOS_GENERIC) + 32]; const char *errstr = get_macos_error_string(retval); - if (strcmp(errstr, ERR_MACOS_GENERIC) == 0) + if (errstr != NULL) { - sprintf(buf, ERR_MACOS_GENERIC, (int) retval); - errstr = buf; - } /* if */ + if (strcmp(errstr, ERR_MACOS_GENERIC) == 0) + { + sprintf(buf, ERR_MACOS_GENERIC, (int) retval); + errstr = buf; + } /* if */ - if (errstr != NULL) __PHYSFS_setError(errstr); - + } /* if */ return(retval); } /* oserr */ From DONOTREPLY at icculus.org Wed Mar 14 03:21:16 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 14 Mar 2007 03:21:16 -0400 Subject: r837 - in trunk: . platform Message-ID: <20070314072116.6205.qmail@icculus.org> Author: icculus Date: 2007-03-14 03:20:59 -0400 (Wed, 14 Mar 2007) New Revision: 837 Removed: trunk/CWProjects.sit trunk/physfsMPW.make trunk/platform/macclassic.c Modified: trunk/CHANGELOG.txt trunk/INSTALL.txt trunk/physfs_platforms.h Log: Dropped classic Mac OS support. Mac OS X remains supported, though. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-14 06:39:17 UTC (rev 836) +++ trunk/CHANGELOG.txt 2007-03-14 07:20:59 UTC (rev 837) @@ -2,6 +2,9 @@ * CHANGELOG. */ +03142007 - Dropped classic Mac OS support. It's just too hard to find a working + Mac OS 9 install and reasonable development tools, so it's not + worth it. If you still target OS 8 or 9, please use PhysicsFS 1.0. 03112007 - Removed zlib_license_change.txt ... it's in Subversion and the 1.0 branch for history's sake. Added shared and static build options to CMakeLists.txt, and the expected "make install" target. Deleted: trunk/CWProjects.sit =================================================================== (Binary files differ) Modified: trunk/INSTALL.txt =================================================================== --- trunk/INSTALL.txt 2007-03-14 06:39:17 UTC (rev 836) +++ trunk/INSTALL.txt 2007-03-14 07:20:59 UTC (rev 837) @@ -85,30 +85,17 @@ MAC OS 8/9: -Double-click on "CWProjects.sit" in the root of the source tree. This will - unpack into a folder called "Mac Classic Support", which has CodeWarrior 6 - project files. Newer CodeWarrior releases should be able to read these project - files, too. +Classic Mac OS support has been dropped in PhysicsFS 2.0. Apple hasn't updated + pre-OSX versions in almost a decade at this point, none of the hardware + they've shipped will boot it for almost as many years, and finding + developer tools for it is becoming almost impossible. As the switch to Intel + hardware has removed the "Classic" emulation environment, it was time to + remove support from PhysicsFS. That being said, the PhysicsFS 1.0 branch can + still target back to Mac OS 8.5, so you can use that if you need support for + this legacy OS. We still very much support Mac OS X, though: see below. -Point CodeWarrior at "physfs.mcp" in that new folder, and build. This will - produce a "PhysicsFS" or "PhysicsFS Debug" shared library, depending on what - configuration you chose to build. After building the lib, you can make sure - it works by building the "test_physfs.mcp" project file, which will create - "test_physfs" or "test_physfs Debug". These binaries are linked against the - DLLs you built previously. -There is also an MPW project file included, if you don't have CodeWarrior. It - is untested. -PhysicsFS builds for classic Mac OS do not require CarbonLib...they use - OS 9 APIs exclusively. - -If someone is willing to maintain prebuilt PhysicsFS Shared Libraries for - the Mac, I'd like to hear from you; send an email to icculus at icculus.org. - - - - MAC OS X: You will need CMake (http://www.cmake.org/) 2.4 or later installed. Deleted: trunk/physfsMPW.make =================================================================== --- trunk/physfsMPW.make 2007-03-14 06:39:17 UTC (rev 836) +++ trunk/physfsMPW.make 2007-03-14 07:20:59 UTC (rev 837) @@ -1,145 +0,0 @@ -# File: PhysicsFS.make -# Target: PhysicsFS -# Created: Saturday, November 20, 2004 09:37:58 PM - - -MAKEFILE = PhysicsFS.make -?MondoBuild? = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified - -ObjDir = :obj: -Includes = -i : ? - -i ":zlib123:" - -Sym-PPC = -sym on - -PPCCOptions = {Includes} {Sym-PPC} -prefix ":Mac Classic Support:codewarrior_predefs.h" -enum int -alloca - - -### Source Files ### - -SrcFiles = ? - :archivers:dir.c ? - :archivers:grp.c ? - :archivers:hog.c ? - :archivers:mvl.c ? - :archivers:qpak.c ? - :archivers:wad.c ? - :archivers:zip.c ? - physfs.c ? - physfs_unicode.c ? - physfs_byteorder.c ? - :platform:macclassic.c ? - :zlib123:adler32.c ? - :zlib123:compress.c ? - :zlib123:crc32.c ? - :zlib123:deflate.c ? - :zlib123:gzio.c ? - :zlib123:infback.c ? - :zlib123:inffast.c ? - :zlib123:inflate.c ? - :zlib123:inftrees.c ? - :zlib123:trees.c ? - :zlib123:uncompr.c ? - :zlib123:zutil.c - - -### Object Files ### - -ObjFiles-PPC = ? - "{ObjDir}dir.c.x" ? - "{ObjDir}grp.c.x" ? - "{ObjDir}hog.c.x" ? - "{ObjDir}mvl.c.x" ? - "{ObjDir}qpak.c.x" ? - "{ObjDir}wad.c.x" ? - "{ObjDir}zip.c.x" ? - "{ObjDir}physfs.c.x" ? - "{ObjDir}physfs_byteorder.c.x" ? - "{ObjDir}physfs_unicode.c.x" ? - "{ObjDir}macclassic.c.x" ? - "{ObjDir}adler32.c.x" ? - "{ObjDir}compress.c.x" ? - "{ObjDir}crc32.c.x" ? - "{ObjDir}deflate.c.x" ? - "{ObjDir}gzio.c.x" ? - "{ObjDir}infback.c.x" ? - "{ObjDir}inffast.c.x" ? - "{ObjDir}inflate.c.x" ? - "{ObjDir}inftrees.c.x" ? - "{ObjDir}trees.c.x" ? - "{ObjDir}uncompr.c.x" ? - "{ObjDir}zutil.c.x" - - -### Libraries ### - -LibFiles-PPC = ? - "{SharedLibraries}InterfaceLib" ? - "{SharedLibraries}StdCLib" ? - "{SharedLibraries}MathLib" ? - "{PPCLibraries}StdCRuntime.o" ? - "{PPCLibraries}PPCCRuntime.o" ? - "{PPCLibraries}PPCToolLibs.o" - - -### Default Rules ### - -.c.x ? .c {?MondoBuild?} - {PPCC} {depDir}{default}.c -o {targDir}{default}.c.x {PPCCOptions} - - -### Build Rules ### - -PhysicsFS ?? {ObjFiles-PPC} {LibFiles-PPC} {?MondoBuild?} - PPCLink ? - -o {Targ} ? - {ObjFiles-PPC} ? - {LibFiles-PPC} ? - {Sym-PPC} ? - - at export ":Mac Classic Support:physfs.exp" ? - -t 'shlb' ? - -c '????' ? - -xm s - - - -### Required Dependencies ### - -"{ObjDir}dir.c.x" ? :archivers:dir.c -"{ObjDir}grp.c.x" ? :archivers:grp.c -"{ObjDir}hog.c.x" ? :archivers:hog.c -"{ObjDir}mvl.c.x" ? :archivers:mvl.c -"{ObjDir}qpak.c.x" ? :archivers:qpak.c -"{ObjDir}wad.c.x" ? :archivers:wad.c -"{ObjDir}zip.c.x" ? :archivers:zip.c -"{ObjDir}physfs.c.x" ? physfs.c -"{ObjDir}physfs_byteorder.c.x" ? physfs_byteorder.c -"{ObjDir}physfs_unicode.c.x" ? physfs_unicode.c -"{ObjDir}macclassic.c.x" ? :platform:macclassic.c -"{ObjDir}adler32.c.x" ? :zlib123:adler32.c -"{ObjDir}compress.c.x" ? :zlib123:compress.c -"{ObjDir}crc32.c.x" ? :zlib123:crc32.c -"{ObjDir}deflate.c.x" ? :zlib123:deflate.c -"{ObjDir}gzio.c.x" ? :zlib123:gzio.c -"{ObjDir}infback.c.x" ? :zlib123:infback.c -"{ObjDir}inffast.c.x" ? :zlib123:inffast.c -"{ObjDir}inflate.c.x" ? :zlib123:inflate.c -"{ObjDir}inftrees.c.x" ? :zlib123:inftrees.c -"{ObjDir}trees.c.x" ? :zlib123:trees.c -"{ObjDir}uncompr.c.x" ? :zlib123:uncompr.c -"{ObjDir}zutil.c.x" ? :zlib123:zutil.c - - -### Optional Dependencies ### -### Build this target to generate "include file" dependencies. ### - -Dependencies ? $OutOfDate - MakeDepend ? - -append {MAKEFILE} ? - -ignore "{CIncludes}" ? - -objdir "{ObjDir}" ? - -objext .x ? - {Includes} ? - {SrcFiles} - - Modified: trunk/physfs_platforms.h =================================================================== --- trunk/physfs_platforms.h 2007-03-14 06:39:17 UTC (rev 836) +++ trunk/physfs_platforms.h 2007-03-14 07:20:59 UTC (rev 837) @@ -26,7 +26,7 @@ # define PHYSFS_PLATFORM_UNIX # define PHYSFS_PLATFORM_POSIX #elif defined(macintosh) -# define PHYSFS_PLATFORM_MACCLASSIC +# error Classic Mac OS support was dropped from PhysicsFS 2.0. Move to OS X. #elif defined(unix) # define PHYSFS_PLATFORM_UNIX # define PHYSFS_PLATFORM_POSIX Deleted: trunk/platform/macclassic.c =================================================================== --- trunk/platform/macclassic.c 2007-03-14 06:39:17 UTC (rev 836) +++ trunk/platform/macclassic.c 2007-03-14 07:20:59 UTC (rev 837) @@ -1,960 +0,0 @@ -/* - * Mac OS classic support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_platforms.h" - -#ifdef PHYSFS_PLATFORM_MACCLASSIC - -#include -#include -#include -#include - -/* - * Most of the API calls in here are, according to ADC, available since - * Mac OS 8.1. I don't think I used any Mac OS 9 or CarbonLib-specific - * functions. There might be one or two 8.5 calls, and perhaps when the - * ADC docs say "Available in Mac OS 8.1" they really mean "this works - * with System 6, but we don't want to hear about it at this point." - * - * IsAliasFile() showed up in Mac OS 8.5. You can duplicate this code with - * PBGetCatInfoSync(), which is an older API, if you hope the bits in the - * catalog info never change (which they won't for, say, Mac OS 8.1). - * See Apple Technote FL-30: - * http://developer.apple.com/technotes/fl/fl_30.html - * - * If you want to use weak pointers and Gestalt, and choose the correct - * code to use during __PHYSFS_platformInit(), I'll accept a patch, but - * chances are, it wasn't worth the time it took to write this, let alone - * implement that. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "physfs_internal.h" - -const char *__PHYSFS_platformDirSeparator = ":"; - - -static const char *get_macos_error_string(OSErr err) -{ - if (err == noErr) - return(NULL); - - switch (err) - { - case fnfErr: return(ERR_NO_SUCH_FILE); - case notOpenErr: return(ERR_NO_SUCH_VOLUME); - case dirFulErr: return(ERR_DIRECTORY_FULL); - case dskFulErr: return(ERR_DISK_FULL); - case nsvErr: return(ERR_NO_SUCH_VOLUME); - case ioErr: return(ERR_IO_ERROR); - case bdNamErr: return(ERR_BAD_FILENAME); - case fnOpnErr: return(ERR_NOT_A_HANDLE); - case eofErr: return(ERR_PAST_EOF); - case posErr: return(ERR_SEEK_OUT_OF_RANGE); - case tmfoErr: return(ERR_TOO_MANY_HANDLES); - case wPrErr: return(ERR_VOL_LOCKED_HW); - case fLckdErr: return(ERR_FILE_LOCKED); - case vLckdErr: return(ERR_VOL_LOCKED_SW); - case fBsyErr: return(ERR_FILE_OR_DIR_BUSY); - case dupFNErr: return(ERR_FILE_EXISTS); - case opWrErr: return(ERR_FILE_ALREADY_OPEN_W); - case rfNumErr: return(ERR_INVALID_REFNUM); - case gfpErr: return(ERR_GETTING_FILE_POS); - case volOffLinErr: return(ERR_VOLUME_OFFLINE); - case permErr: return(ERR_PERMISSION_DENIED); - case volOnLinErr: return(ERR_VOL_ALREADY_ONLINE); - case nsDrvErr: return(ERR_NO_SUCH_DRIVE); - case noMacDskErr: return(ERR_NOT_MAC_DISK); - case extFSErr: return(ERR_VOL_EXTERNAL_FS); - case fsRnErr: return(ERR_PROBLEM_RENAME); - case badMDBErr: return(ERR_BAD_MASTER_BLOCK); - case wrPermErr: return(ERR_PERMISSION_DENIED); - case memFullErr: return(ERR_OUT_OF_MEMORY); - case dirNFErr: return(ERR_NO_SUCH_PATH); - case tmwdoErr: return(ERR_TOO_MANY_HANDLES); - case badMovErr: return(ERR_CANT_MOVE_FORBIDDEN); - case wrgVolTypErr: return(ERR_WRONG_VOL_TYPE); - case volGoneErr: return(ERR_SERVER_VOL_LOST); - case errFSNameTooLong: return(ERR_BAD_FILENAME); - case errFSNotAFolder: return(ERR_NOT_A_DIR); - /*case errFSNotAFile: return(ERR_NOT_A_FILE);*/ - case fidNotFound: return(ERR_FILE_ID_NOT_FOUND); - case fidExists: return(ERR_FILE_ID_EXISTS); - case afpAccessDenied: return(ERR_ACCESS_DENIED); - case afpNoServer: return(ERR_SERVER_NO_RESPOND); - case afpUserNotAuth: return(ERR_USER_AUTH_FAILED); - case afpPwdExpiredErr: return(ERR_PWORD_EXPIRED); - - case paramErr: - case errFSBadFSRef: - case errFSBadBuffer: - case errFSMissingName: - case errFSBadPosMode: - case errFSBadAllocFlags: - case errFSBadItemCount: - case errFSBadSearchParams: - case afpDenyConflict: - return(ERR_PHYSFS_BAD_OS_CALL); - - default: return(ERR_MACOS_GENERIC); - } /* switch */ - - return(NULL); -} /* get_macos_error_string */ - - -static OSErr oserr(OSErr retval) -{ - char buf[sizeof (ERR_MACOS_GENERIC) + 32]; - const char *errstr = get_macos_error_string(retval); - if (errstr != NULL) - { - if (strcmp(errstr, ERR_MACOS_GENERIC) == 0) - { - sprintf(buf, ERR_MACOS_GENERIC, (int) retval); - errstr = buf; - } /* if */ - - __PHYSFS_setError(errstr); - } /* if */ - return(retval); -} /* oserr */ - - -static struct ProcessInfoRec procInfo; -static FSSpec procfsspec; - -int __PHYSFS_platformInit(void) -{ - OSErr err; - ProcessSerialNumber psn; - BAIL_IF_MACRO(oserr(GetCurrentProcess(&psn)) != noErr, NULL, 0); - memset(&procInfo, '\0', sizeof (ProcessInfoRec)); - memset(&procfsspec, '\0', sizeof (FSSpec)); - procInfo.processInfoLength = sizeof (ProcessInfoRec); - procInfo.processAppSpec = &procfsspec; - err = GetProcessInformation(&psn, &procInfo); - BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0); - return(1); /* we're golden. */ -} /* __PHYSFS_platformInit */ - - -int __PHYSFS_platformDeinit(void) -{ - return(1); /* always succeed. */ -} /* __PHYSFS_platformDeinit */ - - -/* - * CD detection code is borrowed from Apple Technical Q&A DV18. - * http://developer.apple.com/qa/dv/dv18.html - */ -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ - - DriverGestaltParam pb; - DrvQEl *dqp; - OSErr status; - - pb.csCode = kDriverGestaltCode; - pb.driverGestaltSelector = kdgDeviceType; - dqp = (DrvQEl *) GetDrvQHdr()->qHead; - - while (dqp != NULL) - { - pb.ioCRefNum = dqp->dQRefNum; - pb.ioVRefNum = dqp->dQDrive; - status = PBStatusSync((ParmBlkPtr) &pb); - if ((status == noErr) && (pb.driverGestaltResponse == kdgCDType)) - { - Str63 volName; - size_t size; - HParamBlockRec hpbr; - memset(&hpbr, '\0', sizeof (HParamBlockRec)); - hpbr.volumeParam.ioNamePtr = volName; - hpbr.volumeParam.ioVRefNum = dqp->dQDrive; - hpbr.volumeParam.ioVolIndex = 0; - if (PBHGetVInfoSync(&hpbr) == noErr) - { - size = (size_t) volName[0]; /* convert to ASCIZ string... */ - memmove(&volName[0], &volName[1], size); - volName[size] = '\0'; - cb(data, (const char *) volName); - } /* if */ - } /* if */ - - dqp = (DrvQEl *) dqp->qLink; - } /* while */ -} /* __PHYSFS_platformDetectAvailableCDs */ - - -static char *convFSSpecToPath(FSSpec *spec, int includeFile) -{ - char *ptr; - char *retval = NULL; - UInt32 retLength = 0; - CInfoPBRec infoPB; - Str255 str255; - - str255[0] = spec->name[0]; - memcpy(&str255[1], &spec->name[1], str255[0]); - - memset(&infoPB, '\0', sizeof (CInfoPBRec)); - infoPB.dirInfo.ioNamePtr = str255; /* put name in here. */ - infoPB.dirInfo.ioVRefNum = spec->vRefNum; /* ID of bin's volume. */ - infoPB.dirInfo.ioDrParID = spec->parID; /* ID of bin's dir. */ - infoPB.dirInfo.ioFDirIndex = (includeFile) ? 0 : -1; - - /* walk the tree back to the root dir (volume), building path string... */ - do - { - /* check parent dir of what we last looked at... */ - infoPB.dirInfo.ioDrDirID = infoPB.dirInfo.ioDrParID; - if (oserr(PBGetCatInfoSync(&infoPB)) != noErr) - { - if (retval != NULL) - allocator.Free(retval); - return(NULL); - } /* if */ - - infoPB.dirInfo.ioFDirIndex = -1; /* look at parent dir next time. */ - - /* allocate more space for the retval... */ - retLength += str255[0] + 1; /* + 1 for a ':' or null char... */ - ptr = (char *) allocator.Malloc(retLength); - if (ptr == NULL) - { - if (retval != NULL) - allocator.Free(retval); - BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); - } /* if */ - - /* prepend new dir to retval and cleanup... */ - memcpy(ptr, &str255[1], str255[0]); - ptr[str255[0]] = '\0'; /* null terminate it. */ - if (retval != NULL) - { - strcat(ptr, ":"); - strcat(ptr, retval); - allocator.Free(retval); - } /* if */ - retval = ptr; - } while (infoPB.dirInfo.ioDrDirID != fsRtDirID); - - return(retval); -} /* convFSSpecToPath */ - - -char *__PHYSFS_platformCalcBaseDir(const char *argv0) -{ - FSSpec spec; - - /* Get the name of the binary's parent directory. */ - FSMakeFSSpec(procfsspec.vRefNum, procfsspec.parID, procfsspec.name, &spec); - return(convFSSpecToPath(&spec, 0)); -} /* __PHYSFS_platformCalcBaseDir */ - - -char *__PHYSFS_platformGetUserName(void) -{ - char *retval = NULL; - StringHandle strHandle; - short origResourceFile = CurResFile(); - - /* use the System resource file. */ - UseResFile(0); - /* apparently, -16096 specifies the username. */ - strHandle = GetString(-16096); - UseResFile(origResourceFile); - BAIL_IF_MACRO(strHandle == NULL, NULL, NULL); - - HLock((Handle) strHandle); - retval = (char *) allocator.Malloc((*strHandle)[0] + 1); - if (retval == NULL) - { - HUnlock((Handle) strHandle); - BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); - } /* if */ - memcpy(retval, &(*strHandle)[1], (*strHandle)[0]); - retval[(*strHandle)[0]] = '\0'; /* null-terminate it. */ - HUnlock((Handle) strHandle); - - return(retval); -} /* __PHYSFS_platformGetUserName */ - - -char *__PHYSFS_platformGetUserDir(void) -{ -#if 0 - return(NULL); /* bah...use default behaviour, I guess. */ -#else - /* (Hmm. Default behaviour is broken in the base library. :) ) */ - return(__PHYSFS_platformCalcBaseDir(NULL)); -#endif -} /* __PHYSFS_platformGetUserDir */ - - -PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) -{ - return(1); /* single threaded. */ -} /* __PHYSFS_platformGetThreadID */ - - -int __PHYSFS_platformStricmp(const char *x, const char *y) -{ - int ux, uy; - - do - { - ux = toupper((int) *x); - uy = toupper((int) *y); - if (ux != uy) - return((ux > uy) ? 1 : -1); - x++; - y++; - } while ((ux) && (uy)); - - return(0); -} /* __PHYSFS_platformStricmp */ - - -int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 len) -{ - int ux, uy; - - if (!len) - return(0); - - do - { - ux = toupper((int) *x); - uy = toupper((int) *y); - if (ux != uy) - return((ux > uy) ? 1 : -1); - x++; - y++; - len--; - } while ((ux) && (uy) && (len)); - - return(0); -} /* __PHYSFS_platformStrnicmp */ - - -static OSErr fnameToFSSpecNoAlias(const char *fname, FSSpec *spec) -{ - OSErr err; - Str255 str255; - int needColon = (strchr(fname, ':') == NULL); - int len = strlen(fname) + ((needColon) ? 1 : 0); - if (len > 255) - return(bdNamErr); - - /* !!! FIXME: What happens with relative pathnames? */ - - str255[0] = len; - memcpy(&str255[1], fname, len); - - /* probably just a volume name, which seems to need a ':' at the end. */ - if (needColon) - str255[len] = ':'; - - err = oserr(FSMakeFSSpec(0, 0, str255, spec)); - return(err); -} /* fnameToFSSpecNoAlias */ - - -static OSErr fnameToFSSpec(const char *fname, FSSpec *spec) -{ - Boolean alias = 0; - Boolean folder = 0; - OSErr err = fnameToFSSpecNoAlias(fname, spec); - - if (err == dirNFErr) /* might be an alias in the middle of the path. */ - { - /* - * Has to be at least two ':' chars, or we wouldn't get a - * dir-not-found condition. (no ':' means it was just a volume, - * just one ':' means we would have gotten a fnfErr, if anything. - */ - char *ptr; - char *start; - char *path = alloca(strlen(fname) + 1); - strcpy(path, fname); - ptr = strchr(path, ':'); - BAIL_IF_MACRO(!ptr, ERR_NO_SUCH_FILE, err); /* just in case */ - ptr = strchr(ptr + 1, ':'); - BAIL_IF_MACRO(!ptr, ERR_NO_SUCH_FILE, err); /* just in case */ - *ptr = '\0'; - err = fnameToFSSpecNoAlias(path, spec); /* get first dir. */ - BAIL_IF_MACRO(oserr(err) != noErr, NULL, err); - start = ptr; - ptr = strchr(start + 1, ':'); - - /* Now check each element of the path for aliases... */ - do - { - CInfoPBRec infoPB; - memset(&infoPB, '\0', sizeof (CInfoPBRec)); - infoPB.dirInfo.ioNamePtr = spec->name; - infoPB.dirInfo.ioVRefNum = spec->vRefNum; - infoPB.dirInfo.ioDrDirID = spec->parID; - infoPB.dirInfo.ioFDirIndex = 0; - err = PBGetCatInfoSync(&infoPB); - if (err != noErr) /* not an alias, really just a bogus path. */ - return(fnameToFSSpecNoAlias(fname, spec)); /* reset */ - - if ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0) - spec->parID = infoPB.dirInfo.ioDrDirID; - - if (ptr != NULL) /* terminate string after next element. */ - *ptr = '\0'; - - *start = strlen(start + 1); /* make it a pstring. */ - err = FSMakeFSSpec(spec->vRefNum, spec->parID, - (const unsigned char *) start, spec); - if (err != noErr) /* not an alias, really a bogus path. */ - return(fnameToFSSpecNoAlias(fname, spec)); /* reset */ - - err = ResolveAliasFileWithMountFlags(spec, 1, &folder, &alias, 0); - if (err != noErr) /* not an alias, really a bogus path. */ - return(fnameToFSSpecNoAlias(fname, spec)); /* reset */ - - start = ptr; /* move to the next element. */ - if (ptr != NULL) - ptr = strchr(start + 1, ':'); - } while (start != NULL); - } /* if */ - - else /* there's something there; make sure final file is not an alias. */ - { - BAIL_IF_MACRO(oserr(err) != noErr, NULL, err); - err = ResolveAliasFileWithMountFlags(spec, 1, &folder, &alias, 0); - BAIL_IF_MACRO(oserr(err) != noErr, NULL, err); - } /* else */ - - return(noErr); /* w00t. */ -} /* fnameToFSSpec */ - - -int __PHYSFS_platformExists(const char *fname) -{ - FSSpec spec; - return(fnameToFSSpec(fname, &spec) == noErr); -} /* __PHYSFS_platformExists */ - - -int __PHYSFS_platformIsSymLink(const char *fname) -{ - OSErr err; - FSSpec spec; - Boolean a = 0; - Boolean f = 0; - CInfoPBRec infoPB; - char *ptr; - char *dir = alloca(strlen(fname) + 1); - BAIL_IF_MACRO(dir == NULL, ERR_OUT_OF_MEMORY, 0); - strcpy(dir, fname); - ptr = strrchr(dir, ':'); - if (ptr == NULL) /* just a volume name? Can't be a symlink. */ - return(0); - - /* resolve aliases up to the actual file... */ - *ptr = '\0'; - BAIL_IF_MACRO(fnameToFSSpec(dir, &spec) != noErr, NULL, 0); - - *ptr = strlen(ptr + 1); /* ptr is now a pascal string. Yikes! */ - memset(&infoPB, '\0', sizeof (CInfoPBRec)); - infoPB.dirInfo.ioNamePtr = spec.name; - infoPB.dirInfo.ioVRefNum = spec.vRefNum; - infoPB.dirInfo.ioDrDirID = spec.parID; - infoPB.dirInfo.ioFDirIndex = 0; - BAIL_IF_MACRO(oserr(PBGetCatInfoSync(&infoPB)) != noErr, NULL, 0); - - err = FSMakeFSSpec(spec.vRefNum, infoPB.dirInfo.ioDrDirID, - (const unsigned char *) ptr, &spec); - BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0); - BAIL_IF_MACRO(oserr(IsAliasFile(&spec, &a, &f)) != noErr, NULL, 0); - return(a); -} /* __PHYSFS_platformIsSymlink */ - - -int __PHYSFS_platformIsDirectory(const char *fname) -{ - FSSpec spec; - CInfoPBRec infoPB; - OSErr err; - - BAIL_IF_MACRO(fnameToFSSpec(fname, &spec) != noErr, NULL, 0); - memset(&infoPB, '\0', sizeof (CInfoPBRec)); - infoPB.dirInfo.ioNamePtr = spec.name; /* put name in here. */ - infoPB.dirInfo.ioVRefNum = spec.vRefNum; /* ID of file's volume. */ - infoPB.dirInfo.ioDrDirID = spec.parID; /* ID of bin's dir. */ - infoPB.dirInfo.ioFDirIndex = 0; /* file (not parent) info. */ - err = PBGetCatInfoSync(&infoPB); - BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0); - return((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0); -} /* __PHYSFS_platformIsDirectory */ - - -char *__PHYSFS_platformCvtToDependent(const char *prepend, - const char *dirName, - const char *append) -{ - int len = ((prepend) ? strlen(prepend) : 0) + - ((append) ? strlen(append) : 0) + - strlen(dirName) + 1; - const char *src; - char *dst; - char *retval = (char *) allocator.Malloc(len); - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - - if (prepend != NULL) - { - strcpy(retval, prepend); - dst = retval + strlen(retval); - } /* if */ - else - { - *retval = '\0'; - dst = retval; - } /* else */ - - for (src = dirName; *src; src++, dst++) - *dst = ((*src == '/') ? ':' : *src); - - *dst = '\0'; - return(retval); -} /* __PHYSFS_platformCvtToDependent */ - - -void __PHYSFS_platformTimeslice(void) -{ - SystemTask(); -} /* __PHYSFS_platformTimeslice */ - - -/* returns int so we can use BAIL*MACRO... */ -static int macClassicEnumerateFiles(const char *dirname, - int omitSymLinks, - PHYSFS_EnumFilesCallback callback, - const char *origdir, - void *callbackdata) -{ - UInt16 i; - UInt16 max; - FSSpec spec; - CInfoPBRec infoPB; - Str255 str255; - long dirID; - - BAIL_IF_MACRO(fnameToFSSpec(dirname, &spec) != noErr, NULL, 0); - - /* get the dir ID of what we want to enumerate... */ - memset(&infoPB, '\0', sizeof (CInfoPBRec)); - infoPB.dirInfo.ioNamePtr = spec.name; /* name of dir to enum. */ - infoPB.dirInfo.ioVRefNum = spec.vRefNum; /* ID of file's volume. */ - infoPB.dirInfo.ioDrDirID = spec.parID; /* ID of dir. */ - infoPB.dirInfo.ioFDirIndex = 0; /* file (not parent) info. */ - BAIL_IF_MACRO(oserr(PBGetCatInfoSync(&infoPB)) != noErr, NULL, NULL); - - if ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) == 0) - BAIL_MACRO(ERR_NOT_A_DIR, NULL); - - dirID = infoPB.dirInfo.ioDrDirID; - max = infoPB.dirInfo.ioDrNmFls; - - for (i = 1; i <= max; i++) - { - size_t size; - FSSpec aliasspec; - Boolean alias = 0; - Boolean folder = 0; - - memset(&infoPB, '\0', sizeof (CInfoPBRec)); - str255[0] = 0; - infoPB.dirInfo.ioNamePtr = str255; /* store name in here. */ - infoPB.dirInfo.ioVRefNum = spec.vRefNum; /* ID of dir's volume. */ - infoPB.dirInfo.ioDrDirID = dirID; /* ID of dir. */ - infoPB.dirInfo.ioFDirIndex = i; /* next file's info. */ - if (PBGetCatInfoSync(&infoPB) != noErr) - continue; /* skip this file. Oh well. */ - - if (FSMakeFSSpec(spec.vRefNum, dirID, str255, &aliasspec) != noErr) - continue; /* skip it. */ - - if (IsAliasFile(&aliasspec, &alias, &folder) != noErr) - continue; /* skip it. */ - - if ((alias) && (omitSymLinks)) - continue; - - /* still here? Add it to the list. */ - size = (size_t) str255[0]; /* (convert to ASCIZ string...) */ - memmove(&str255[0], &str255[1], size); - str255[size] = '\0'; - callback(callbackdata, origdir, (const char *) str255); - } /* for */ - - return(1); -} /* macClassicEnumerateFiles */ - - -void __PHYSFS_platformEnumerateFiles(const char *dirname, - int omitSymLinks, - PHYSFS_EnumFilesCallback callback, - const char *origdir, - void *callbackdata) -{ - macClassicEnumerateFiles(dirname, omitSymLinks, callback, - origdir, callbackdata); -} /* __PHYSFS_platformEnumerateFiles */ - - -char *__PHYSFS_platformCurrentDir(void) -{ - /* - * I don't think Mac OS has a concept of "current directory", beyond - * what is grafted on by a given standard C library implementation, - * so just return the base dir. - * We don't use this for anything crucial at the moment anyhow. - */ - return(__PHYSFS_platformCalcBaseDir(NULL)); -} /* __PHYSFS_platformCurrentDir */ - - -char *__PHYSFS_platformRealPath(const char *path) -{ - /* - * fnameToFSSpec() will resolve any symlinks to get to the real - * file's FSSpec, which, when converted, will contain the real - * direct path to a given file. convFSSpecToPath() mallocs a - * return value buffer. - */ - - FSSpec spec; - BAIL_IF_MACRO(fnameToFSSpec(path, &spec) != noErr, NULL, NULL); - return(convFSSpecToPath(&spec, 1)); -} /* __PHYSFS_platformRealPath */ - - -int __PHYSFS_platformMkDir(const char *path) -{ - SInt32 val = 0; - FSSpec spec; - OSErr err = fnameToFSSpec(path, &spec); - - BAIL_IF_MACRO(err == noErr, ERR_FILE_EXISTS, 0); - BAIL_IF_MACRO(err != fnfErr, NULL, 0); - - err = DirCreate(spec.vRefNum, spec.parID, spec.name, &val); - BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0); - return(1); -} /* __PHYSFS_platformMkDir */ - - -static SInt16 *macDoOpen(const char *fname, SInt8 perm, int createIfMissing) -{ - int created = 0; - SInt16 *retval = NULL; - FSSpec spec; - OSErr err = fnameToFSSpec(fname, &spec); - BAIL_IF_MACRO((err != noErr) && (err != fnfErr), NULL, NULL); - if (err == fnfErr) - { - BAIL_IF_MACRO(!createIfMissing, ERR_NO_SUCH_FILE, NULL); - err = HCreate(spec.vRefNum, spec.parID, spec.name, - procInfo.processSignature, 'BINA'); - BAIL_IF_MACRO(oserr(err) != noErr, NULL, NULL); - created = 1; - } /* if */ - - retval = (SInt16 *) allocator.Malloc(sizeof (SInt16)); - if (retval == NULL) - { - if (created) - HDelete(spec.vRefNum, spec.parID, spec.name); - BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); - } /* if */ - - err = HOpenDF(spec.vRefNum, spec.parID, spec.name, perm, retval); - if (oserr(err) != noErr) - { - allocator.Free(retval); - if (created) - HDelete(spec.vRefNum, spec.parID, spec.name); - return(NULL); - } /* if */ - - return(retval); -} /* macDoOpen */ - - -void *__PHYSFS_platformOpenRead(const char *filename) -{ - SInt16 *retval = macDoOpen(filename, fsRdPerm, 0); - if (retval != NULL) /* got a file; seek to start. */ - { - if (oserr(SetFPos(*retval, fsFromStart, 0)) != noErr) - { - FSClose(*retval); - return(NULL); - } /* if */ - } /* if */ - - return((void *) retval); -} /* __PHYSFS_platformOpenRead */ - - -void *__PHYSFS_platformOpenWrite(const char *filename) -{ - SInt16 *retval = macDoOpen(filename, fsRdWrPerm, 1); - if (retval != NULL) /* got a file; truncate it. */ - { - if ((oserr(SetEOF(*retval, 0)) != noErr) || - (oserr(SetFPos(*retval, fsFromStart, 0)) != noErr)) - { - FSClose(*retval); - return(NULL); - } /* if */ - } /* if */ - - return((void *) retval); -} /* __PHYSFS_platformOpenWrite */ - - -void *__PHYSFS_platformOpenAppend(const char *filename) -{ - SInt16 *retval = macDoOpen(filename, fsRdWrPerm, 1); - if (retval != NULL) /* got a file; seek to end. */ - { - if (oserr(SetFPos(*retval, fsFromLEOF, 0)) != noErr) - { - FSClose(*retval); - return(NULL); - } /* if */ - } /* if */ - - return(retval); -} /* __PHYSFS_platformOpenAppend */ - - -PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer, - PHYSFS_uint32 size, PHYSFS_uint32 count) -{ - SInt16 ref = *((SInt16 *) opaque); - SInt32 br = size*count; - - BAIL_IF_MACRO(oserr(FSRead(ref, &br, buffer)) != noErr, NULL, br/size); - BAIL_IF_MACRO(br != size*count, NULL, br/size); /* !!! FIXME: seek back if only read part of an object! */ - - return(count); -} /* __PHYSFS_platformRead */ - - -PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer, - PHYSFS_uint32 size, PHYSFS_uint32 count) -{ - SInt16 ref = *((SInt16 *) opaque); - SInt32 bw = size*count; - - BAIL_IF_MACRO(oserr(FSWrite(ref, &bw, buffer)) != noErr, NULL, bw/size); - BAIL_IF_MACRO(bw != size*count, NULL, bw/size); /* !!! FIXME: seek back if only wrote part of an object! */ - - return(count); -} /* __PHYSFS_platformWrite */ - - -int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos) -{ - SInt16 ref = *((SInt16 *) opaque); - OSErr err = SetFPos(ref, fsFromStart, (SInt32) pos); - BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0); - return(1); -} /* __PHYSFS_platformSeek */ - - -PHYSFS_sint64 __PHYSFS_platformTell(void *opaque) -{ - SInt16 ref = *((SInt16 *) opaque); - SInt32 curPos; - BAIL_IF_MACRO(oserr(GetFPos(ref, &curPos)) != noErr, NULL, -1); - return((PHYSFS_sint64) curPos); -} /* __PHYSFS_platformTell */ - - -PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) -{ - SInt16 ref = *((SInt16 *) opaque); - SInt32 eofPos; - BAIL_IF_MACRO(oserr(GetEOF(ref, &eofPos)) != noErr, NULL, -1); - return((PHYSFS_sint64) eofPos); -} /* __PHYSFS_platformFileLength */ - - -int __PHYSFS_platformEOF(void *opaque) -{ - SInt16 ref = *((SInt16 *) opaque); - SInt32 eofPos, curPos; - BAIL_IF_MACRO(oserr(GetEOF(ref, &eofPos)) != noErr, NULL, 1); - BAIL_IF_MACRO(oserr(GetFPos(ref, &curPos)) != noErr, NULL, 1); - return(curPos >= eofPos); -} /* __PHYSFS_platformEOF */ - - -int __PHYSFS_platformFlush(void *opaque) -{ - SInt16 ref = *((SInt16 *) opaque); - ParamBlockRec pb; - memset(&pb, '\0', sizeof (ParamBlockRec)); - pb.ioParam.ioRefNum = ref; - BAIL_IF_MACRO(oserr(PBFlushFileSync(&pb)) != noErr, NULL, 0); - return(1); -} /* __PHYSFS_platformFlush */ - - -int __PHYSFS_platformClose(void *opaque) -{ - SInt16 ref = *((SInt16 *) opaque); - SInt16 vRefNum; - Str63 volName; - int flushVol = 0; - - if (GetVRefNum(ref, &vRefNum) == noErr) - { - HParamBlockRec hpbr; - memset(&hpbr, '\0', sizeof (HParamBlockRec)); - hpbr.volumeParam.ioNamePtr = volName; - hpbr.volumeParam.ioVRefNum = vRefNum; - hpbr.volumeParam.ioVolIndex = 0; - if (PBHGetVInfoSync(&hpbr) == noErr) - flushVol = 1; - } /* if */ - - BAIL_IF_MACRO(oserr(FSClose(ref)) != noErr, NULL, 0); - allocator.Free(opaque); - - if (flushVol) - FlushVol(volName, vRefNum); /* update catalog info, etc. */ - - return(1); -} /* __PHYSFS_platformClose */ - - -int __PHYSFS_platformDelete(const char *path) -{ - FSSpec spec; - OSErr err; - BAIL_IF_MACRO(fnameToFSSpec(path, &spec) != noErr, NULL, 0); - err = HDelete(spec.vRefNum, spec.parID, spec.name); - BAIL_IF_MACRO(oserr(err) != noErr, NULL, 0); - return(1); -} /* __PHYSFS_platformDelete */ - - -void *__PHYSFS_platformCreateMutex(void) -{ - return((void *) 0x0001); /* no mutexes on Mac OS classic. */ -} /* __PHYSFS_platformCreateMutex */ - - -void __PHYSFS_platformDestroyMutex(void *mutex) -{ - /* no mutexes on Mac OS classic. */ -} /* __PHYSFS_platformDestroyMutex */ - - -int __PHYSFS_platformGrabMutex(void *mutex) -{ - return(1); /* no mutexes on Mac OS classic. */ -} /* __PHYSFS_platformGrabMutex */ - - -void __PHYSFS_platformReleaseMutex(void *mutex) -{ - /* no mutexes on Mac OS classic. */ -} /* __PHYSFS_platformReleaseMutex */ - - -PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname) -{ - FSSpec spec; - CInfoPBRec infoPB; - UInt32 modDate; - - if (fnameToFSSpec(fname, &spec) != noErr) - return(-1); /* fnameToFSSpec() sets physfs error message. */ - - memset(&infoPB, '\0', sizeof (CInfoPBRec)); - infoPB.dirInfo.ioNamePtr = spec.name; - infoPB.dirInfo.ioVRefNum = spec.vRefNum; - infoPB.dirInfo.ioDrDirID = spec.parID; - infoPB.dirInfo.ioFDirIndex = 0; - BAIL_IF_MACRO(oserr(PBGetCatInfoSync(&infoPB)) != noErr, NULL, -1); - - modDate = ((infoPB.dirInfo.ioFlAttrib & kioFlAttribDirMask) != 0) ? - infoPB.dirInfo.ioDrMdDat : infoPB.hFileInfo.ioFlMdDat; - - /* epoch is different on Mac OS. They use Jan 1, 1904, apparently. */ - /* subtract seconds between those epochs, counting leap years. */ - modDate -= 2082844800; - - return((PHYSFS_sint64) modDate); -} /* __PHYSFS_platformGetLastModTime */ - - -/* !!! FIXME: Don't use C runtime for allocators? */ -int __PHYSFS_platformAllocatorInit(void) -{ - return(1); /* always succeeds. */ -} /* __PHYSFS_platformAllocatorInit */ - - -void __PHYSFS_platformAllocatorDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformAllocatorInit */ - - -void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef malloc - return(malloc((size_t) s)); -} /* __PHYSFS_platformMalloc */ - - -void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef realloc - return(realloc(ptr, (size_t) s)); -} /* __PHYSFS_platformRealloc */ - - -void __PHYSFS_platformAllocatorFree(void *ptr) -{ - #undef free - free(ptr); -} /* __PHYSFS_platformAllocatorFree */ - -#endif /* PHYSFS_PLATFORM_MACCLASSIC */ - -/* end of macclassic.c ... */ - From DONOTREPLY at icculus.org Wed Mar 14 04:03:22 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 14 Mar 2007 04:03:22 -0400 Subject: r838 - trunk Message-ID: <20070314080322.19158.qmail@icculus.org> Author: icculus Date: 2007-03-14 04:03:22 -0400 (Wed, 14 Mar 2007) New Revision: 838 Modified: trunk/TODO.txt Log: Updated. Modified: trunk/TODO.txt =================================================================== --- trunk/TODO.txt 2007-03-14 07:20:59 UTC (rev 837) +++ trunk/TODO.txt 2007-03-14 08:03:22 UTC (rev 838) @@ -7,8 +7,6 @@ - Windows: Can use Unicode, but might only allow "codepages" ... Use GetProcAddress() to find Unicode entry points on WinNT-based systems, otherwise try to use a sane codepage. -- Mac Classic: apparently supports _something_, but I might just write it off - as a loss. - OS/2: Codepages. No full Unicode in the filesystem, but we can probably make a conversion effort. - Everywhere: Move stricmp() out of platform layer and make it grok UTF-8. From DONOTREPLY at icculus.org Thu Mar 15 03:33:17 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 15 Mar 2007 03:33:17 -0400 Subject: r839 - trunk Message-ID: <20070315073317.4537.qmail@icculus.org> Author: icculus Date: 2007-03-15 03:33:14 -0400 (Thu, 15 Mar 2007) New Revision: 839 Modified: trunk/CMakeLists.txt Log: More Mac Classic removal. Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-14 08:03:22 UTC (rev 838) +++ trunk/CMakeLists.txt 2007-03-15 07:33:14 UTC (rev 839) @@ -108,7 +108,6 @@ physfs.c physfs_byteorder.c physfs_unicode.c - platform/macclassic.c platform/os2.c platform/pocketpc.c platform/posix.c From DONOTREPLY at icculus.org Thu Mar 15 04:16:23 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 15 Mar 2007 04:16:23 -0400 Subject: r840 - in trunk: . archivers extras platform Message-ID: <20070315081623.19557.qmail@icculus.org> Author: icculus Date: 2007-03-15 04:16:23 -0400 (Thu, 15 Mar 2007) New Revision: 840 Added: trunk/extras/casefolding.txt trunk/extras/makecasefoldhashtable.pl trunk/physfs_casefolding.h Modified: trunk/CHANGELOG.txt trunk/TODO.txt trunk/archivers/hog.c trunk/archivers/mvl.c trunk/archivers/qpak.c trunk/extras/ignorecase.c trunk/physfs.c trunk/physfs.h trunk/physfs_internal.h trunk/physfs_unicode.c trunk/platform/os2.c trunk/platform/pocketpc.c trunk/platform/posix.c trunk/platform/skeleton.c trunk/platform/windows.c Log: Bunch of work on Unicode...added case-folding stricmp, removed platform-specific stricmp implementations, changed appropriate calls to an ASCII-only stricmp that ignores locale. Fixed case on UTF-8 API entry points. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/CHANGELOG.txt 2007-03-15 08:16:23 UTC (rev 840) @@ -2,6 +2,10 @@ * CHANGELOG. */ +03152007 - Bunch of work on Unicode...added case-folding stricmp, removed + platform-specific stricmp implementations, changed appropriate + calls to an ASCII-only stricmp that ignores locale. Fixed case on + UTF-8 API entry points. 03142007 - Dropped classic Mac OS support. It's just too hard to find a working Mac OS 9 install and reasonable development tools, so it's not worth it. If you still target OS 8 or 9, please use PhysicsFS 1.0. Modified: trunk/TODO.txt =================================================================== --- trunk/TODO.txt 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/TODO.txt 2007-03-15 08:16:23 UTC (rev 840) @@ -9,7 +9,6 @@ systems, otherwise try to use a sane codepage. - OS/2: Codepages. No full Unicode in the filesystem, but we can probably make a conversion effort. -- Everywhere: Move stricmp() out of platform layer and make it grok UTF-8. Stuff: Modified: trunk/archivers/hog.c =================================================================== --- trunk/archivers/hog.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/archivers/hog.c 2007-03-15 08:16:23 UTC (rev 840) @@ -229,7 +229,7 @@ static int hog_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two) { HOGentry *a = (HOGentry *) _a; - return(__PHYSFS_platformStricmp(a[one].name, a[two].name)); + return(__PHYSFS_stricmpASCII(a[one].name, a[two].name)); } /* hog_entry_cmp */ @@ -367,7 +367,7 @@ while (lo <= hi) { middle = lo + ((hi - lo) / 2); - rc = __PHYSFS_platformStricmp(name, a[middle].name); + rc = __PHYSFS_stricmpASCII(name, a[middle].name); if (rc == 0) /* found it! */ return(&a[middle]); else if (rc > 0) Modified: trunk/archivers/mvl.c =================================================================== --- trunk/archivers/mvl.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/archivers/mvl.c 2007-03-15 08:16:23 UTC (rev 840) @@ -324,7 +324,7 @@ while (lo <= hi) { middle = lo + ((hi - lo) / 2); - rc = __PHYSFS_platformStricmp(name, a[middle].name); + rc = __PHYSFS_stricmpASCII(name, a[middle].name); if (rc == 0) /* found it! */ return(&a[middle]); else if (rc > 0) Modified: trunk/archivers/qpak.c =================================================================== --- trunk/archivers/qpak.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/archivers/qpak.c 2007-03-15 08:16:23 UTC (rev 840) @@ -40,8 +40,8 @@ #include "physfs_internal.h" #if 1 /* Make this case insensitive? */ -#define QPAK_strcmp(x, y) __PHYSFS_platformStricmp(x, y) -#define QPAK_strncmp(x, y, z) __PHYSFS_platformStrnicmp(x, y, z) +#define QPAK_strcmp(x, y) __PHYSFS_stricmpASCII(x, y) +#define QPAK_strncmp(x, y, z) __PHYSFS_strnicmpASCII(x, y, z) #else #define QPAK_strcmp(x, y) strcmp(x, y) #define QPAK_strncmp(x, y, z) strncmp(x, y, z) Added: trunk/extras/casefolding.txt =================================================================== --- trunk/extras/casefolding.txt (rev 0) +++ trunk/extras/casefolding.txt 2007-03-15 08:16:23 UTC (rev 840) @@ -0,0 +1,1064 @@ +# CaseFolding-4.1.0.txt +# Date: 2005-03-26, 00:24:43 GMT [MD] +# +# Unicode Character Database +# Copyright (c) 1991-2005 Unicode, Inc. +# For terms of use, see http://www.unicode.org/terms_of_use.html +# For documentation, see UCD.html +# +# Case Folding Properties +# +# This file is a supplement to the UnicodeData file. +# It provides a case folding mapping generated from the Unicode Character Database. +# If all characters are mapped according to the full mapping below, then +# case differences (according to UnicodeData.txt and SpecialCasing.txt) +# are eliminated. +# +# The data supports both implementations that require simple case foldings +# (where string lengths don't change), and implementations that allow full case folding +# (where string lengths may grow). Note that where they can be supported, the +# full case foldings are superior: for example, they allow "MASSE" and "Ma?e" to match. +# +# All code points not listed in this file map to themselves. +# +# NOTE: case folding does not preserve normalization formats! +# +# For information on case folding, see +# UTR #21 Case Mappings, at http://www.unicode.org/unicode/reports/tr21/ +# +# ================================================================================ +# Format +# ================================================================================ +# The entries in this file are in the following machine-readable format: +# +# ; ; ; # +# +# The status field is: +# C: common case folding, common mappings shared by both simple and full mappings. +# F: full case folding, mappings that cause strings to grow in length. Multiple characters are separated by spaces. +# S: simple case folding, mappings to single characters where different from F. +# T: special case for uppercase I and dotted uppercase I +# - For non-Turkic languages, this mapping is normally not used. +# - For Turkic languages (tr, az), this mapping can be used instead of the normal mapping for these characters. +# Note that the Turkic mappings do not maintain canonical equivalence without additional processing. +# See the discussions of case mapping in the Unicode Standard for more information. +# +# Usage: +# A. To do a simple case folding, use the mappings with status C + S. +# B. To do a full case folding, use the mappings with status C + F. +# +# The mappings with status T can be used or omitted depending on the desired case-folding +# behavior. (The default option is to exclude them.) +# +# ================================================================= + +0041; C; 0061; # LATIN CAPITAL LETTER A +0042; C; 0062; # LATIN CAPITAL LETTER B +0043; C; 0063; # LATIN CAPITAL LETTER C +0044; C; 0064; # LATIN CAPITAL LETTER D +0045; C; 0065; # LATIN CAPITAL LETTER E +0046; C; 0066; # LATIN CAPITAL LETTER F +0047; C; 0067; # LATIN CAPITAL LETTER G +0048; C; 0068; # LATIN CAPITAL LETTER H +0049; C; 0069; # LATIN CAPITAL LETTER I +0049; T; 0131; # LATIN CAPITAL LETTER I +004A; C; 006A; # LATIN CAPITAL LETTER J +004B; C; 006B; # LATIN CAPITAL LETTER K +004C; C; 006C; # LATIN CAPITAL LETTER L +004D; C; 006D; # LATIN CAPITAL LETTER M +004E; C; 006E; # LATIN CAPITAL LETTER N +004F; C; 006F; # LATIN CAPITAL LETTER O +0050; C; 0070; # LATIN CAPITAL LETTER P +0051; C; 0071; # LATIN CAPITAL LETTER Q +0052; C; 0072; # LATIN CAPITAL LETTER R +0053; C; 0073; # LATIN CAPITAL LETTER S +0054; C; 0074; # LATIN CAPITAL LETTER T +0055; C; 0075; # LATIN CAPITAL LETTER U +0056; C; 0076; # LATIN CAPITAL LETTER V +0057; C; 0077; # LATIN CAPITAL LETTER W +0058; C; 0078; # LATIN CAPITAL LETTER X +0059; C; 0079; # LATIN CAPITAL LETTER Y +005A; C; 007A; # LATIN CAPITAL LETTER Z +00B5; C; 03BC; # MICRO SIGN +00C0; C; 00E0; # LATIN CAPITAL LETTER A WITH GRAVE +00C1; C; 00E1; # LATIN CAPITAL LETTER A WITH ACUTE +00C2; C; 00E2; # LATIN CAPITAL LETTER A WITH CIRCUMFLEX +00C3; C; 00E3; # LATIN CAPITAL LETTER A WITH TILDE +00C4; C; 00E4; # LATIN CAPITAL LETTER A WITH DIAERESIS +00C5; C; 00E5; # LATIN CAPITAL LETTER A WITH RING ABOVE +00C6; C; 00E6; # LATIN CAPITAL LETTER AE +00C7; C; 00E7; # LATIN CAPITAL LETTER C WITH CEDILLA +00C8; C; 00E8; # LATIN CAPITAL LETTER E WITH GRAVE +00C9; C; 00E9; # LATIN CAPITAL LETTER E WITH ACUTE +00CA; C; 00EA; # LATIN CAPITAL LETTER E WITH CIRCUMFLEX +00CB; C; 00EB; # LATIN CAPITAL LETTER E WITH DIAERESIS +00CC; C; 00EC; # LATIN CAPITAL LETTER I WITH GRAVE +00CD; C; 00ED; # LATIN CAPITAL LETTER I WITH ACUTE +00CE; C; 00EE; # LATIN CAPITAL LETTER I WITH CIRCUMFLEX +00CF; C; 00EF; # LATIN CAPITAL LETTER I WITH DIAERESIS +00D0; C; 00F0; # LATIN CAPITAL LETTER ETH +00D1; C; 00F1; # LATIN CAPITAL LETTER N WITH TILDE +00D2; C; 00F2; # LATIN CAPITAL LETTER O WITH GRAVE +00D3; C; 00F3; # LATIN CAPITAL LETTER O WITH ACUTE +00D4; C; 00F4; # LATIN CAPITAL LETTER O WITH CIRCUMFLEX +00D5; C; 00F5; # LATIN CAPITAL LETTER O WITH TILDE +00D6; C; 00F6; # LATIN CAPITAL LETTER O WITH DIAERESIS +00D8; C; 00F8; # LATIN CAPITAL LETTER O WITH STROKE +00D9; C; 00F9; # LATIN CAPITAL LETTER U WITH GRAVE +00DA; C; 00FA; # LATIN CAPITAL LETTER U WITH ACUTE +00DB; C; 00FB; # LATIN CAPITAL LETTER U WITH CIRCUMFLEX +00DC; C; 00FC; # LATIN CAPITAL LETTER U WITH DIAERESIS +00DD; C; 00FD; # LATIN CAPITAL LETTER Y WITH ACUTE +00DE; C; 00FE; # LATIN CAPITAL LETTER THORN +00DF; F; 0073 0073; # LATIN SMALL LETTER SHARP S +0100; C; 0101; # LATIN CAPITAL LETTER A WITH MACRON +0102; C; 0103; # LATIN CAPITAL LETTER A WITH BREVE +0104; C; 0105; # LATIN CAPITAL LETTER A WITH OGONEK +0106; C; 0107; # LATIN CAPITAL LETTER C WITH ACUTE +0108; C; 0109; # LATIN CAPITAL LETTER C WITH CIRCUMFLEX +010A; C; 010B; # LATIN CAPITAL LETTER C WITH DOT ABOVE +010C; C; 010D; # LATIN CAPITAL LETTER C WITH CARON +010E; C; 010F; # LATIN CAPITAL LETTER D WITH CARON +0110; C; 0111; # LATIN CAPITAL LETTER D WITH STROKE +0112; C; 0113; # LATIN CAPITAL LETTER E WITH MACRON +0114; C; 0115; # LATIN CAPITAL LETTER E WITH BREVE +0116; C; 0117; # LATIN CAPITAL LETTER E WITH DOT ABOVE +0118; C; 0119; # LATIN CAPITAL LETTER E WITH OGONEK +011A; C; 011B; # LATIN CAPITAL LETTER E WITH CARON +011C; C; 011D; # LATIN CAPITAL LETTER G WITH CIRCUMFLEX +011E; C; 011F; # LATIN CAPITAL LETTER G WITH BREVE +0120; C; 0121; # LATIN CAPITAL LETTER G WITH DOT ABOVE +0122; C; 0123; # LATIN CAPITAL LETTER G WITH CEDILLA +0124; C; 0125; # LATIN CAPITAL LETTER H WITH CIRCUMFLEX +0126; C; 0127; # LATIN CAPITAL LETTER H WITH STROKE +0128; C; 0129; # LATIN CAPITAL LETTER I WITH TILDE +012A; C; 012B; # LATIN CAPITAL LETTER I WITH MACRON +012C; C; 012D; # LATIN CAPITAL LETTER I WITH BREVE +012E; C; 012F; # LATIN CAPITAL LETTER I WITH OGONEK +0130; F; 0069 0307; # LATIN CAPITAL LETTER I WITH DOT ABOVE +0130; T; 0069; # LATIN CAPITAL LETTER I WITH DOT ABOVE +0132; C; 0133; # LATIN CAPITAL LIGATURE IJ +0134; C; 0135; # LATIN CAPITAL LETTER J WITH CIRCUMFLEX +0136; C; 0137; # LATIN CAPITAL LETTER K WITH CEDILLA +0139; C; 013A; # LATIN CAPITAL LETTER L WITH ACUTE +013B; C; 013C; # LATIN CAPITAL LETTER L WITH CEDILLA +013D; C; 013E; # LATIN CAPITAL LETTER L WITH CARON +013F; C; 0140; # LATIN CAPITAL LETTER L WITH MIDDLE DOT +0141; C; 0142; # LATIN CAPITAL LETTER L WITH STROKE +0143; C; 0144; # LATIN CAPITAL LETTER N WITH ACUTE +0145; C; 0146; # LATIN CAPITAL LETTER N WITH CEDILLA +0147; C; 0148; # LATIN CAPITAL LETTER N WITH CARON +0149; F; 02BC 006E; # LATIN SMALL LETTER N PRECEDED BY APOSTROPHE +014A; C; 014B; # LATIN CAPITAL LETTER ENG +014C; C; 014D; # LATIN CAPITAL LETTER O WITH MACRON +014E; C; 014F; # LATIN CAPITAL LETTER O WITH BREVE +0150; C; 0151; # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE +0152; C; 0153; # LATIN CAPITAL LIGATURE OE +0154; C; 0155; # LATIN CAPITAL LETTER R WITH ACUTE +0156; C; 0157; # LATIN CAPITAL LETTER R WITH CEDILLA +0158; C; 0159; # LATIN CAPITAL LETTER R WITH CARON +015A; C; 015B; # LATIN CAPITAL LETTER S WITH ACUTE +015C; C; 015D; # LATIN CAPITAL LETTER S WITH CIRCUMFLEX +015E; C; 015F; # LATIN CAPITAL LETTER S WITH CEDILLA +0160; C; 0161; # LATIN CAPITAL LETTER S WITH CARON +0162; C; 0163; # LATIN CAPITAL LETTER T WITH CEDILLA +0164; C; 0165; # LATIN CAPITAL LETTER T WITH CARON +0166; C; 0167; # LATIN CAPITAL LETTER T WITH STROKE +0168; C; 0169; # LATIN CAPITAL LETTER U WITH TILDE +016A; C; 016B; # LATIN CAPITAL LETTER U WITH MACRON +016C; C; 016D; # LATIN CAPITAL LETTER U WITH BREVE +016E; C; 016F; # LATIN CAPITAL LETTER U WITH RING ABOVE +0170; C; 0171; # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE +0172; C; 0173; # LATIN CAPITAL LETTER U WITH OGONEK +0174; C; 0175; # LATIN CAPITAL LETTER W WITH CIRCUMFLEX +0176; C; 0177; # LATIN CAPITAL LETTER Y WITH CIRCUMFLEX +0178; C; 00FF; # LATIN CAPITAL LETTER Y WITH DIAERESIS +0179; C; 017A; # LATIN CAPITAL LETTER Z WITH ACUTE +017B; C; 017C; # LATIN CAPITAL LETTER Z WITH DOT ABOVE +017D; C; 017E; # LATIN CAPITAL LETTER Z WITH CARON +017F; C; 0073; # LATIN SMALL LETTER LONG S +0181; C; 0253; # LATIN CAPITAL LETTER B WITH HOOK +0182; C; 0183; # LATIN CAPITAL LETTER B WITH TOPBAR +0184; C; 0185; # LATIN CAPITAL LETTER TONE SIX +0186; C; 0254; # LATIN CAPITAL LETTER OPEN O +0187; C; 0188; # LATIN CAPITAL LETTER C WITH HOOK +0189; C; 0256; # LATIN CAPITAL LETTER AFRICAN D +018A; C; 0257; # LATIN CAPITAL LETTER D WITH HOOK +018B; C; 018C; # LATIN CAPITAL LETTER D WITH TOPBAR +018E; C; 01DD; # LATIN CAPITAL LETTER REVERSED E +018F; C; 0259; # LATIN CAPITAL LETTER SCHWA +0190; C; 025B; # LATIN CAPITAL LETTER OPEN E +0191; C; 0192; # LATIN CAPITAL LETTER F WITH HOOK +0193; C; 0260; # LATIN CAPITAL LETTER G WITH HOOK +0194; C; 0263; # LATIN CAPITAL LETTER GAMMA +0196; C; 0269; # LATIN CAPITAL LETTER IOTA +0197; C; 0268; # LATIN CAPITAL LETTER I WITH STROKE +0198; C; 0199; # LATIN CAPITAL LETTER K WITH HOOK +019C; C; 026F; # LATIN CAPITAL LETTER TURNED M +019D; C; 0272; # LATIN CAPITAL LETTER N WITH LEFT HOOK +019F; C; 0275; # LATIN CAPITAL LETTER O WITH MIDDLE TILDE +01A0; C; 01A1; # LATIN CAPITAL LETTER O WITH HORN +01A2; C; 01A3; # LATIN CAPITAL LETTER OI +01A4; C; 01A5; # LATIN CAPITAL LETTER P WITH HOOK +01A6; C; 0280; # LATIN LETTER YR +01A7; C; 01A8; # LATIN CAPITAL LETTER TONE TWO +01A9; C; 0283; # LATIN CAPITAL LETTER ESH +01AC; C; 01AD; # LATIN CAPITAL LETTER T WITH HOOK +01AE; C; 0288; # LATIN CAPITAL LETTER T WITH RETROFLEX HOOK +01AF; C; 01B0; # LATIN CAPITAL LETTER U WITH HORN +01B1; C; 028A; # LATIN CAPITAL LETTER UPSILON +01B2; C; 028B; # LATIN CAPITAL LETTER V WITH HOOK +01B3; C; 01B4; # LATIN CAPITAL LETTER Y WITH HOOK +01B5; C; 01B6; # LATIN CAPITAL LETTER Z WITH STROKE +01B7; C; 0292; # LATIN CAPITAL LETTER EZH +01B8; C; 01B9; # LATIN CAPITAL LETTER EZH REVERSED +01BC; C; 01BD; # LATIN CAPITAL LETTER TONE FIVE +01C4; C; 01C6; # LATIN CAPITAL LETTER DZ WITH CARON +01C5; C; 01C6; # LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON +01C7; C; 01C9; # LATIN CAPITAL LETTER LJ +01C8; C; 01C9; # LATIN CAPITAL LETTER L WITH SMALL LETTER J +01CA; C; 01CC; # LATIN CAPITAL LETTER NJ +01CB; C; 01CC; # LATIN CAPITAL LETTER N WITH SMALL LETTER J +01CD; C; 01CE; # LATIN CAPITAL LETTER A WITH CARON +01CF; C; 01D0; # LATIN CAPITAL LETTER I WITH CARON +01D1; C; 01D2; # LATIN CAPITAL LETTER O WITH CARON +01D3; C; 01D4; # LATIN CAPITAL LETTER U WITH CARON +01D5; C; 01D6; # LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON +01D7; C; 01D8; # LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE +01D9; C; 01DA; # LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON +01DB; C; 01DC; # LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE +01DE; C; 01DF; # LATIN CAPITAL LETTER A WITH DIAERESIS AND MACRON +01E0; C; 01E1; # LATIN CAPITAL LETTER A WITH DOT ABOVE AND MACRON +01E2; C; 01E3; # LATIN CAPITAL LETTER AE WITH MACRON +01E4; C; 01E5; # LATIN CAPITAL LETTER G WITH STROKE +01E6; C; 01E7; # LATIN CAPITAL LETTER G WITH CARON +01E8; C; 01E9; # LATIN CAPITAL LETTER K WITH CARON +01EA; C; 01EB; # LATIN CAPITAL LETTER O WITH OGONEK +01EC; C; 01ED; # LATIN CAPITAL LETTER O WITH OGONEK AND MACRON +01EE; C; 01EF; # LATIN CAPITAL LETTER EZH WITH CARON +01F0; F; 006A 030C; # LATIN SMALL LETTER J WITH CARON +01F1; C; 01F3; # LATIN CAPITAL LETTER DZ +01F2; C; 01F3; # LATIN CAPITAL LETTER D WITH SMALL LETTER Z +01F4; C; 01F5; # LATIN CAPITAL LETTER G WITH ACUTE +01F6; C; 0195; # LATIN CAPITAL LETTER HWAIR +01F7; C; 01BF; # LATIN CAPITAL LETTER WYNN +01F8; C; 01F9; # LATIN CAPITAL LETTER N WITH GRAVE +01FA; C; 01FB; # LATIN CAPITAL LETTER A WITH RING ABOVE AND ACUTE +01FC; C; 01FD; # LATIN CAPITAL LETTER AE WITH ACUTE +01FE; C; 01FF; # LATIN CAPITAL LETTER O WITH STROKE AND ACUTE +0200; C; 0201; # LATIN CAPITAL LETTER A WITH DOUBLE GRAVE +0202; C; 0203; # LATIN CAPITAL LETTER A WITH INVERTED BREVE +0204; C; 0205; # LATIN CAPITAL LETTER E WITH DOUBLE GRAVE +0206; C; 0207; # LATIN CAPITAL LETTER E WITH INVERTED BREVE +0208; C; 0209; # LATIN CAPITAL LETTER I WITH DOUBLE GRAVE +020A; C; 020B; # LATIN CAPITAL LETTER I WITH INVERTED BREVE +020C; C; 020D; # LATIN CAPITAL LETTER O WITH DOUBLE GRAVE +020E; C; 020F; # LATIN CAPITAL LETTER O WITH INVERTED BREVE +0210; C; 0211; # LATIN CAPITAL LETTER R WITH DOUBLE GRAVE +0212; C; 0213; # LATIN CAPITAL LETTER R WITH INVERTED BREVE +0214; C; 0215; # LATIN CAPITAL LETTER U WITH DOUBLE GRAVE +0216; C; 0217; # LATIN CAPITAL LETTER U WITH INVERTED BREVE +0218; C; 0219; # LATIN CAPITAL LETTER S WITH COMMA BELOW +021A; C; 021B; # LATIN CAPITAL LETTER T WITH COMMA BELOW +021C; C; 021D; # LATIN CAPITAL LETTER YOGH +021E; C; 021F; # LATIN CAPITAL LETTER H WITH CARON +0220; C; 019E; # LATIN CAPITAL LETTER N WITH LONG RIGHT LEG +0222; C; 0223; # LATIN CAPITAL LETTER OU +0224; C; 0225; # LATIN CAPITAL LETTER Z WITH HOOK +0226; C; 0227; # LATIN CAPITAL LETTER A WITH DOT ABOVE +0228; C; 0229; # LATIN CAPITAL LETTER E WITH CEDILLA +022A; C; 022B; # LATIN CAPITAL LETTER O WITH DIAERESIS AND MACRON +022C; C; 022D; # LATIN CAPITAL LETTER O WITH TILDE AND MACRON +022E; C; 022F; # LATIN CAPITAL LETTER O WITH DOT ABOVE +0230; C; 0231; # LATIN CAPITAL LETTER O WITH DOT ABOVE AND MACRON +0232; C; 0233; # LATIN CAPITAL LETTER Y WITH MACRON +023B; C; 023C; # LATIN CAPITAL LETTER C WITH STROKE +023D; C; 019A; # LATIN CAPITAL LETTER L WITH BAR +0241; C; 0294; # LATIN CAPITAL LETTER GLOTTAL STOP +0345; C; 03B9; # COMBINING GREEK YPOGEGRAMMENI +0386; C; 03AC; # GREEK CAPITAL LETTER ALPHA WITH TONOS +0388; C; 03AD; # GREEK CAPITAL LETTER EPSILON WITH TONOS +0389; C; 03AE; # GREEK CAPITAL LETTER ETA WITH TONOS +038A; C; 03AF; # GREEK CAPITAL LETTER IOTA WITH TONOS +038C; C; 03CC; # GREEK CAPITAL LETTER OMICRON WITH TONOS +038E; C; 03CD; # GREEK CAPITAL LETTER UPSILON WITH TONOS +038F; C; 03CE; # GREEK CAPITAL LETTER OMEGA WITH TONOS +0390; F; 03B9 0308 0301; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS +0391; C; 03B1; # GREEK CAPITAL LETTER ALPHA +0392; C; 03B2; # GREEK CAPITAL LETTER BETA +0393; C; 03B3; # GREEK CAPITAL LETTER GAMMA +0394; C; 03B4; # GREEK CAPITAL LETTER DELTA +0395; C; 03B5; # GREEK CAPITAL LETTER EPSILON +0396; C; 03B6; # GREEK CAPITAL LETTER ZETA +0397; C; 03B7; # GREEK CAPITAL LETTER ETA +0398; C; 03B8; # GREEK CAPITAL LETTER THETA +0399; C; 03B9; # GREEK CAPITAL LETTER IOTA +039A; C; 03BA; # GREEK CAPITAL LETTER KAPPA +039B; C; 03BB; # GREEK CAPITAL LETTER LAMDA +039C; C; 03BC; # GREEK CAPITAL LETTER MU +039D; C; 03BD; # GREEK CAPITAL LETTER NU +039E; C; 03BE; # GREEK CAPITAL LETTER XI +039F; C; 03BF; # GREEK CAPITAL LETTER OMICRON +03A0; C; 03C0; # GREEK CAPITAL LETTER PI +03A1; C; 03C1; # GREEK CAPITAL LETTER RHO +03A3; C; 03C3; # GREEK CAPITAL LETTER SIGMA +03A4; C; 03C4; # GREEK CAPITAL LETTER TAU +03A5; C; 03C5; # GREEK CAPITAL LETTER UPSILON +03A6; C; 03C6; # GREEK CAPITAL LETTER PHI +03A7; C; 03C7; # GREEK CAPITAL LETTER CHI +03A8; C; 03C8; # GREEK CAPITAL LETTER PSI +03A9; C; 03C9; # GREEK CAPITAL LETTER OMEGA +03AA; C; 03CA; # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA +03AB; C; 03CB; # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA +03B0; F; 03C5 0308 0301; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS +03C2; C; 03C3; # GREEK SMALL LETTER FINAL SIGMA +03D0; C; 03B2; # GREEK BETA SYMBOL +03D1; C; 03B8; # GREEK THETA SYMBOL +03D5; C; 03C6; # GREEK PHI SYMBOL +03D6; C; 03C0; # GREEK PI SYMBOL +03D8; C; 03D9; # GREEK LETTER ARCHAIC KOPPA +03DA; C; 03DB; # GREEK LETTER STIGMA +03DC; C; 03DD; # GREEK LETTER DIGAMMA +03DE; C; 03DF; # GREEK LETTER KOPPA +03E0; C; 03E1; # GREEK LETTER SAMPI +03E2; C; 03E3; # COPTIC CAPITAL LETTER SHEI +03E4; C; 03E5; # COPTIC CAPITAL LETTER FEI +03E6; C; 03E7; # COPTIC CAPITAL LETTER KHEI +03E8; C; 03E9; # COPTIC CAPITAL LETTER HORI +03EA; C; 03EB; # COPTIC CAPITAL LETTER GANGIA +03EC; C; 03ED; # COPTIC CAPITAL LETTER SHIMA +03EE; C; 03EF; # COPTIC CAPITAL LETTER DEI +03F0; C; 03BA; # GREEK KAPPA SYMBOL +03F1; C; 03C1; # GREEK RHO SYMBOL +03F4; C; 03B8; # GREEK CAPITAL THETA SYMBOL +03F5; C; 03B5; # GREEK LUNATE EPSILON SYMBOL +03F7; C; 03F8; # GREEK CAPITAL LETTER SHO +03F9; C; 03F2; # GREEK CAPITAL LUNATE SIGMA SYMBOL +03FA; C; 03FB; # GREEK CAPITAL LETTER SAN +0400; C; 0450; # CYRILLIC CAPITAL LETTER IE WITH GRAVE +0401; C; 0451; # CYRILLIC CAPITAL LETTER IO +0402; C; 0452; # CYRILLIC CAPITAL LETTER DJE +0403; C; 0453; # CYRILLIC CAPITAL LETTER GJE +0404; C; 0454; # CYRILLIC CAPITAL LETTER UKRAINIAN IE +0405; C; 0455; # CYRILLIC CAPITAL LETTER DZE +0406; C; 0456; # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I +0407; C; 0457; # CYRILLIC CAPITAL LETTER YI +0408; C; 0458; # CYRILLIC CAPITAL LETTER JE +0409; C; 0459; # CYRILLIC CAPITAL LETTER LJE +040A; C; 045A; # CYRILLIC CAPITAL LETTER NJE +040B; C; 045B; # CYRILLIC CAPITAL LETTER TSHE +040C; C; 045C; # CYRILLIC CAPITAL LETTER KJE +040D; C; 045D; # CYRILLIC CAPITAL LETTER I WITH GRAVE +040E; C; 045E; # CYRILLIC CAPITAL LETTER SHORT U +040F; C; 045F; # CYRILLIC CAPITAL LETTER DZHE +0410; C; 0430; # CYRILLIC CAPITAL LETTER A +0411; C; 0431; # CYRILLIC CAPITAL LETTER BE +0412; C; 0432; # CYRILLIC CAPITAL LETTER VE +0413; C; 0433; # CYRILLIC CAPITAL LETTER GHE +0414; C; 0434; # CYRILLIC CAPITAL LETTER DE +0415; C; 0435; # CYRILLIC CAPITAL LETTER IE +0416; C; 0436; # CYRILLIC CAPITAL LETTER ZHE +0417; C; 0437; # CYRILLIC CAPITAL LETTER ZE +0418; C; 0438; # CYRILLIC CAPITAL LETTER I +0419; C; 0439; # CYRILLIC CAPITAL LETTER SHORT I +041A; C; 043A; # CYRILLIC CAPITAL LETTER KA +041B; C; 043B; # CYRILLIC CAPITAL LETTER EL +041C; C; 043C; # CYRILLIC CAPITAL LETTER EM +041D; C; 043D; # CYRILLIC CAPITAL LETTER EN +041E; C; 043E; # CYRILLIC CAPITAL LETTER O +041F; C; 043F; # CYRILLIC CAPITAL LETTER PE +0420; C; 0440; # CYRILLIC CAPITAL LETTER ER +0421; C; 0441; # CYRILLIC CAPITAL LETTER ES +0422; C; 0442; # CYRILLIC CAPITAL LETTER TE +0423; C; 0443; # CYRILLIC CAPITAL LETTER U +0424; C; 0444; # CYRILLIC CAPITAL LETTER EF +0425; C; 0445; # CYRILLIC CAPITAL LETTER HA +0426; C; 0446; # CYRILLIC CAPITAL LETTER TSE +0427; C; 0447; # CYRILLIC CAPITAL LETTER CHE +0428; C; 0448; # CYRILLIC CAPITAL LETTER SHA +0429; C; 0449; # CYRILLIC CAPITAL LETTER SHCHA +042A; C; 044A; # CYRILLIC CAPITAL LETTER HARD SIGN +042B; C; 044B; # CYRILLIC CAPITAL LETTER YERU +042C; C; 044C; # CYRILLIC CAPITAL LETTER SOFT SIGN +042D; C; 044D; # CYRILLIC CAPITAL LETTER E +042E; C; 044E; # CYRILLIC CAPITAL LETTER YU +042F; C; 044F; # CYRILLIC CAPITAL LETTER YA +0460; C; 0461; # CYRILLIC CAPITAL LETTER OMEGA +0462; C; 0463; # CYRILLIC CAPITAL LETTER YAT +0464; C; 0465; # CYRILLIC CAPITAL LETTER IOTIFIED E +0466; C; 0467; # CYRILLIC CAPITAL LETTER LITTLE YUS +0468; C; 0469; # CYRILLIC CAPITAL LETTER IOTIFIED LITTLE YUS +046A; C; 046B; # CYRILLIC CAPITAL LETTER BIG YUS +046C; C; 046D; # CYRILLIC CAPITAL LETTER IOTIFIED BIG YUS +046E; C; 046F; # CYRILLIC CAPITAL LETTER KSI +0470; C; 0471; # CYRILLIC CAPITAL LETTER PSI +0472; C; 0473; # CYRILLIC CAPITAL LETTER FITA +0474; C; 0475; # CYRILLIC CAPITAL LETTER IZHITSA +0476; C; 0477; # CYRILLIC CAPITAL LETTER IZHITSA WITH DOUBLE GRAVE ACCENT +0478; C; 0479; # CYRILLIC CAPITAL LETTER UK +047A; C; 047B; # CYRILLIC CAPITAL LETTER ROUND OMEGA +047C; C; 047D; # CYRILLIC CAPITAL LETTER OMEGA WITH TITLO +047E; C; 047F; # CYRILLIC CAPITAL LETTER OT +0480; C; 0481; # CYRILLIC CAPITAL LETTER KOPPA +048A; C; 048B; # CYRILLIC CAPITAL LETTER SHORT I WITH TAIL +048C; C; 048D; # CYRILLIC CAPITAL LETTER SEMISOFT SIGN +048E; C; 048F; # CYRILLIC CAPITAL LETTER ER WITH TICK +0490; C; 0491; # CYRILLIC CAPITAL LETTER GHE WITH UPTURN +0492; C; 0493; # CYRILLIC CAPITAL LETTER GHE WITH STROKE +0494; C; 0495; # CYRILLIC CAPITAL LETTER GHE WITH MIDDLE HOOK +0496; C; 0497; # CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER +0498; C; 0499; # CYRILLIC CAPITAL LETTER ZE WITH DESCENDER +049A; C; 049B; # CYRILLIC CAPITAL LETTER KA WITH DESCENDER +049C; C; 049D; # CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE +049E; C; 049F; # CYRILLIC CAPITAL LETTER KA WITH STROKE +04A0; C; 04A1; # CYRILLIC CAPITAL LETTER BASHKIR KA +04A2; C; 04A3; # CYRILLIC CAPITAL LETTER EN WITH DESCENDER +04A4; C; 04A5; # CYRILLIC CAPITAL LIGATURE EN GHE +04A6; C; 04A7; # CYRILLIC CAPITAL LETTER PE WITH MIDDLE HOOK +04A8; C; 04A9; # CYRILLIC CAPITAL LETTER ABKHASIAN HA +04AA; C; 04AB; # CYRILLIC CAPITAL LETTER ES WITH DESCENDER +04AC; C; 04AD; # CYRILLIC CAPITAL LETTER TE WITH DESCENDER +04AE; C; 04AF; # CYRILLIC CAPITAL LETTER STRAIGHT U +04B0; C; 04B1; # CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE +04B2; C; 04B3; # CYRILLIC CAPITAL LETTER HA WITH DESCENDER +04B4; C; 04B5; # CYRILLIC CAPITAL LIGATURE TE TSE +04B6; C; 04B7; # CYRILLIC CAPITAL LETTER CHE WITH DESCENDER +04B8; C; 04B9; # CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE +04BA; C; 04BB; # CYRILLIC CAPITAL LETTER SHHA +04BC; C; 04BD; # CYRILLIC CAPITAL LETTER ABKHASIAN CHE +04BE; C; 04BF; # CYRILLIC CAPITAL LETTER ABKHASIAN CHE WITH DESCENDER +04C1; C; 04C2; # CYRILLIC CAPITAL LETTER ZHE WITH BREVE +04C3; C; 04C4; # CYRILLIC CAPITAL LETTER KA WITH HOOK +04C5; C; 04C6; # CYRILLIC CAPITAL LETTER EL WITH TAIL +04C7; C; 04C8; # CYRILLIC CAPITAL LETTER EN WITH HOOK +04C9; C; 04CA; # CYRILLIC CAPITAL LETTER EN WITH TAIL +04CB; C; 04CC; # CYRILLIC CAPITAL LETTER KHAKASSIAN CHE +04CD; C; 04CE; # CYRILLIC CAPITAL LETTER EM WITH TAIL +04D0; C; 04D1; # CYRILLIC CAPITAL LETTER A WITH BREVE +04D2; C; 04D3; # CYRILLIC CAPITAL LETTER A WITH DIAERESIS +04D4; C; 04D5; # CYRILLIC CAPITAL LIGATURE A IE +04D6; C; 04D7; # CYRILLIC CAPITAL LETTER IE WITH BREVE +04D8; C; 04D9; # CYRILLIC CAPITAL LETTER SCHWA +04DA; C; 04DB; # CYRILLIC CAPITAL LETTER SCHWA WITH DIAERESIS +04DC; C; 04DD; # CYRILLIC CAPITAL LETTER ZHE WITH DIAERESIS +04DE; C; 04DF; # CYRILLIC CAPITAL LETTER ZE WITH DIAERESIS +04E0; C; 04E1; # CYRILLIC CAPITAL LETTER ABKHASIAN DZE +04E2; C; 04E3; # CYRILLIC CAPITAL LETTER I WITH MACRON +04E4; C; 04E5; # CYRILLIC CAPITAL LETTER I WITH DIAERESIS +04E6; C; 04E7; # CYRILLIC CAPITAL LETTER O WITH DIAERESIS +04E8; C; 04E9; # CYRILLIC CAPITAL LETTER BARRED O +04EA; C; 04EB; # CYRILLIC CAPITAL LETTER BARRED O WITH DIAERESIS +04EC; C; 04ED; # CYRILLIC CAPITAL LETTER E WITH DIAERESIS +04EE; C; 04EF; # CYRILLIC CAPITAL LETTER U WITH MACRON +04F0; C; 04F1; # CYRILLIC CAPITAL LETTER U WITH DIAERESIS +04F2; C; 04F3; # CYRILLIC CAPITAL LETTER U WITH DOUBLE ACUTE +04F4; C; 04F5; # CYRILLIC CAPITAL LETTER CHE WITH DIAERESIS +04F6; C; 04F7; # CYRILLIC CAPITAL LETTER GHE WITH DESCENDER +04F8; C; 04F9; # CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS +0500; C; 0501; # CYRILLIC CAPITAL LETTER KOMI DE +0502; C; 0503; # CYRILLIC CAPITAL LETTER KOMI DJE +0504; C; 0505; # CYRILLIC CAPITAL LETTER KOMI ZJE +0506; C; 0507; # CYRILLIC CAPITAL LETTER KOMI DZJE +0508; C; 0509; # CYRILLIC CAPITAL LETTER KOMI LJE +050A; C; 050B; # CYRILLIC CAPITAL LETTER KOMI NJE +050C; C; 050D; # CYRILLIC CAPITAL LETTER KOMI SJE +050E; C; 050F; # CYRILLIC CAPITAL LETTER KOMI TJE +0531; C; 0561; # ARMENIAN CAPITAL LETTER AYB +0532; C; 0562; # ARMENIAN CAPITAL LETTER BEN +0533; C; 0563; # ARMENIAN CAPITAL LETTER GIM +0534; C; 0564; # ARMENIAN CAPITAL LETTER DA +0535; C; 0565; # ARMENIAN CAPITAL LETTER ECH +0536; C; 0566; # ARMENIAN CAPITAL LETTER ZA +0537; C; 0567; # ARMENIAN CAPITAL LETTER EH +0538; C; 0568; # ARMENIAN CAPITAL LETTER ET +0539; C; 0569; # ARMENIAN CAPITAL LETTER TO +053A; C; 056A; # ARMENIAN CAPITAL LETTER ZHE +053B; C; 056B; # ARMENIAN CAPITAL LETTER INI +053C; C; 056C; # ARMENIAN CAPITAL LETTER LIWN +053D; C; 056D; # ARMENIAN CAPITAL LETTER XEH +053E; C; 056E; # ARMENIAN CAPITAL LETTER CA +053F; C; 056F; # ARMENIAN CAPITAL LETTER KEN +0540; C; 0570; # ARMENIAN CAPITAL LETTER HO +0541; C; 0571; # ARMENIAN CAPITAL LETTER JA +0542; C; 0572; # ARMENIAN CAPITAL LETTER GHAD +0543; C; 0573; # ARMENIAN CAPITAL LETTER CHEH +0544; C; 0574; # ARMENIAN CAPITAL LETTER MEN +0545; C; 0575; # ARMENIAN CAPITAL LETTER YI +0546; C; 0576; # ARMENIAN CAPITAL LETTER NOW +0547; C; 0577; # ARMENIAN CAPITAL LETTER SHA +0548; C; 0578; # ARMENIAN CAPITAL LETTER VO +0549; C; 0579; # ARMENIAN CAPITAL LETTER CHA +054A; C; 057A; # ARMENIAN CAPITAL LETTER PEH +054B; C; 057B; # ARMENIAN CAPITAL LETTER JHEH +054C; C; 057C; # ARMENIAN CAPITAL LETTER RA +054D; C; 057D; # ARMENIAN CAPITAL LETTER SEH +054E; C; 057E; # ARMENIAN CAPITAL LETTER VEW +054F; C; 057F; # ARMENIAN CAPITAL LETTER TIWN +0550; C; 0580; # ARMENIAN CAPITAL LETTER REH +0551; C; 0581; # ARMENIAN CAPITAL LETTER CO +0552; C; 0582; # ARMENIAN CAPITAL LETTER YIWN +0553; C; 0583; # ARMENIAN CAPITAL LETTER PIWR +0554; C; 0584; # ARMENIAN CAPITAL LETTER KEH +0555; C; 0585; # ARMENIAN CAPITAL LETTER OH +0556; C; 0586; # ARMENIAN CAPITAL LETTER FEH +0587; F; 0565 0582; # ARMENIAN SMALL LIGATURE ECH YIWN +10A0; C; 2D00; # GEORGIAN CAPITAL LETTER AN +10A1; C; 2D01; # GEORGIAN CAPITAL LETTER BAN +10A2; C; 2D02; # GEORGIAN CAPITAL LETTER GAN +10A3; C; 2D03; # GEORGIAN CAPITAL LETTER DON +10A4; C; 2D04; # GEORGIAN CAPITAL LETTER EN +10A5; C; 2D05; # GEORGIAN CAPITAL LETTER VIN +10A6; C; 2D06; # GEORGIAN CAPITAL LETTER ZEN +10A7; C; 2D07; # GEORGIAN CAPITAL LETTER TAN +10A8; C; 2D08; # GEORGIAN CAPITAL LETTER IN +10A9; C; 2D09; # GEORGIAN CAPITAL LETTER KAN +10AA; C; 2D0A; # GEORGIAN CAPITAL LETTER LAS +10AB; C; 2D0B; # GEORGIAN CAPITAL LETTER MAN +10AC; C; 2D0C; # GEORGIAN CAPITAL LETTER NAR +10AD; C; 2D0D; # GEORGIAN CAPITAL LETTER ON +10AE; C; 2D0E; # GEORGIAN CAPITAL LETTER PAR +10AF; C; 2D0F; # GEORGIAN CAPITAL LETTER ZHAR +10B0; C; 2D10; # GEORGIAN CAPITAL LETTER RAE +10B1; C; 2D11; # GEORGIAN CAPITAL LETTER SAN +10B2; C; 2D12; # GEORGIAN CAPITAL LETTER TAR +10B3; C; 2D13; # GEORGIAN CAPITAL LETTER UN +10B4; C; 2D14; # GEORGIAN CAPITAL LETTER PHAR +10B5; C; 2D15; # GEORGIAN CAPITAL LETTER KHAR +10B6; C; 2D16; # GEORGIAN CAPITAL LETTER GHAN +10B7; C; 2D17; # GEORGIAN CAPITAL LETTER QAR +10B8; C; 2D18; # GEORGIAN CAPITAL LETTER SHIN +10B9; C; 2D19; # GEORGIAN CAPITAL LETTER CHIN +10BA; C; 2D1A; # GEORGIAN CAPITAL LETTER CAN +10BB; C; 2D1B; # GEORGIAN CAPITAL LETTER JIL +10BC; C; 2D1C; # GEORGIAN CAPITAL LETTER CIL +10BD; C; 2D1D; # GEORGIAN CAPITAL LETTER CHAR +10BE; C; 2D1E; # GEORGIAN CAPITAL LETTER XAN +10BF; C; 2D1F; # GEORGIAN CAPITAL LETTER JHAN +10C0; C; 2D20; # GEORGIAN CAPITAL LETTER HAE +10C1; C; 2D21; # GEORGIAN CAPITAL LETTER HE +10C2; C; 2D22; # GEORGIAN CAPITAL LETTER HIE +10C3; C; 2D23; # GEORGIAN CAPITAL LETTER WE +10C4; C; 2D24; # GEORGIAN CAPITAL LETTER HAR +10C5; C; 2D25; # GEORGIAN CAPITAL LETTER HOE +1E00; C; 1E01; # LATIN CAPITAL LETTER A WITH RING BELOW +1E02; C; 1E03; # LATIN CAPITAL LETTER B WITH DOT ABOVE +1E04; C; 1E05; # LATIN CAPITAL LETTER B WITH DOT BELOW +1E06; C; 1E07; # LATIN CAPITAL LETTER B WITH LINE BELOW +1E08; C; 1E09; # LATIN CAPITAL LETTER C WITH CEDILLA AND ACUTE +1E0A; C; 1E0B; # LATIN CAPITAL LETTER D WITH DOT ABOVE +1E0C; C; 1E0D; # LATIN CAPITAL LETTER D WITH DOT BELOW +1E0E; C; 1E0F; # LATIN CAPITAL LETTER D WITH LINE BELOW +1E10; C; 1E11; # LATIN CAPITAL LETTER D WITH CEDILLA +1E12; C; 1E13; # LATIN CAPITAL LETTER D WITH CIRCUMFLEX BELOW +1E14; C; 1E15; # LATIN CAPITAL LETTER E WITH MACRON AND GRAVE +1E16; C; 1E17; # LATIN CAPITAL LETTER E WITH MACRON AND ACUTE +1E18; C; 1E19; # LATIN CAPITAL LETTER E WITH CIRCUMFLEX BELOW +1E1A; C; 1E1B; # LATIN CAPITAL LETTER E WITH TILDE BELOW +1E1C; C; 1E1D; # LATIN CAPITAL LETTER E WITH CEDILLA AND BREVE +1E1E; C; 1E1F; # LATIN CAPITAL LETTER F WITH DOT ABOVE +1E20; C; 1E21; # LATIN CAPITAL LETTER G WITH MACRON +1E22; C; 1E23; # LATIN CAPITAL LETTER H WITH DOT ABOVE +1E24; C; 1E25; # LATIN CAPITAL LETTER H WITH DOT BELOW +1E26; C; 1E27; # LATIN CAPITAL LETTER H WITH DIAERESIS +1E28; C; 1E29; # LATIN CAPITAL LETTER H WITH CEDILLA +1E2A; C; 1E2B; # LATIN CAPITAL LETTER H WITH BREVE BELOW +1E2C; C; 1E2D; # LATIN CAPITAL LETTER I WITH TILDE BELOW +1E2E; C; 1E2F; # LATIN CAPITAL LETTER I WITH DIAERESIS AND ACUTE +1E30; C; 1E31; # LATIN CAPITAL LETTER K WITH ACUTE +1E32; C; 1E33; # LATIN CAPITAL LETTER K WITH DOT BELOW +1E34; C; 1E35; # LATIN CAPITAL LETTER K WITH LINE BELOW +1E36; C; 1E37; # LATIN CAPITAL LETTER L WITH DOT BELOW +1E38; C; 1E39; # LATIN CAPITAL LETTER L WITH DOT BELOW AND MACRON +1E3A; C; 1E3B; # LATIN CAPITAL LETTER L WITH LINE BELOW +1E3C; C; 1E3D; # LATIN CAPITAL LETTER L WITH CIRCUMFLEX BELOW +1E3E; C; 1E3F; # LATIN CAPITAL LETTER M WITH ACUTE +1E40; C; 1E41; # LATIN CAPITAL LETTER M WITH DOT ABOVE +1E42; C; 1E43; # LATIN CAPITAL LETTER M WITH DOT BELOW +1E44; C; 1E45; # LATIN CAPITAL LETTER N WITH DOT ABOVE +1E46; C; 1E47; # LATIN CAPITAL LETTER N WITH DOT BELOW +1E48; C; 1E49; # LATIN CAPITAL LETTER N WITH LINE BELOW +1E4A; C; 1E4B; # LATIN CAPITAL LETTER N WITH CIRCUMFLEX BELOW +1E4C; C; 1E4D; # LATIN CAPITAL LETTER O WITH TILDE AND ACUTE +1E4E; C; 1E4F; # LATIN CAPITAL LETTER O WITH TILDE AND DIAERESIS +1E50; C; 1E51; # LATIN CAPITAL LETTER O WITH MACRON AND GRAVE +1E52; C; 1E53; # LATIN CAPITAL LETTER O WITH MACRON AND ACUTE +1E54; C; 1E55; # LATIN CAPITAL LETTER P WITH ACUTE +1E56; C; 1E57; # LATIN CAPITAL LETTER P WITH DOT ABOVE +1E58; C; 1E59; # LATIN CAPITAL LETTER R WITH DOT ABOVE +1E5A; C; 1E5B; # LATIN CAPITAL LETTER R WITH DOT BELOW +1E5C; C; 1E5D; # LATIN CAPITAL LETTER R WITH DOT BELOW AND MACRON +1E5E; C; 1E5F; # LATIN CAPITAL LETTER R WITH LINE BELOW +1E60; C; 1E61; # LATIN CAPITAL LETTER S WITH DOT ABOVE +1E62; C; 1E63; # LATIN CAPITAL LETTER S WITH DOT BELOW +1E64; C; 1E65; # LATIN CAPITAL LETTER S WITH ACUTE AND DOT ABOVE +1E66; C; 1E67; # LATIN CAPITAL LETTER S WITH CARON AND DOT ABOVE +1E68; C; 1E69; # LATIN CAPITAL LETTER S WITH DOT BELOW AND DOT ABOVE +1E6A; C; 1E6B; # LATIN CAPITAL LETTER T WITH DOT ABOVE +1E6C; C; 1E6D; # LATIN CAPITAL LETTER T WITH DOT BELOW +1E6E; C; 1E6F; # LATIN CAPITAL LETTER T WITH LINE BELOW +1E70; C; 1E71; # LATIN CAPITAL LETTER T WITH CIRCUMFLEX BELOW +1E72; C; 1E73; # LATIN CAPITAL LETTER U WITH DIAERESIS BELOW +1E74; C; 1E75; # LATIN CAPITAL LETTER U WITH TILDE BELOW +1E76; C; 1E77; # LATIN CAPITAL LETTER U WITH CIRCUMFLEX BELOW +1E78; C; 1E79; # LATIN CAPITAL LETTER U WITH TILDE AND ACUTE +1E7A; C; 1E7B; # LATIN CAPITAL LETTER U WITH MACRON AND DIAERESIS +1E7C; C; 1E7D; # LATIN CAPITAL LETTER V WITH TILDE +1E7E; C; 1E7F; # LATIN CAPITAL LETTER V WITH DOT BELOW +1E80; C; 1E81; # LATIN CAPITAL LETTER W WITH GRAVE +1E82; C; 1E83; # LATIN CAPITAL LETTER W WITH ACUTE +1E84; C; 1E85; # LATIN CAPITAL LETTER W WITH DIAERESIS +1E86; C; 1E87; # LATIN CAPITAL LETTER W WITH DOT ABOVE +1E88; C; 1E89; # LATIN CAPITAL LETTER W WITH DOT BELOW +1E8A; C; 1E8B; # LATIN CAPITAL LETTER X WITH DOT ABOVE +1E8C; C; 1E8D; # LATIN CAPITAL LETTER X WITH DIAERESIS +1E8E; C; 1E8F; # LATIN CAPITAL LETTER Y WITH DOT ABOVE +1E90; C; 1E91; # LATIN CAPITAL LETTER Z WITH CIRCUMFLEX +1E92; C; 1E93; # LATIN CAPITAL LETTER Z WITH DOT BELOW +1E94; C; 1E95; # LATIN CAPITAL LETTER Z WITH LINE BELOW +1E96; F; 0068 0331; # LATIN SMALL LETTER H WITH LINE BELOW +1E97; F; 0074 0308; # LATIN SMALL LETTER T WITH DIAERESIS +1E98; F; 0077 030A; # LATIN SMALL LETTER W WITH RING ABOVE +1E99; F; 0079 030A; # LATIN SMALL LETTER Y WITH RING ABOVE +1E9A; F; 0061 02BE; # LATIN SMALL LETTER A WITH RIGHT HALF RING +1E9B; C; 1E61; # LATIN SMALL LETTER LONG S WITH DOT ABOVE +1EA0; C; 1EA1; # LATIN CAPITAL LETTER A WITH DOT BELOW +1EA2; C; 1EA3; # LATIN CAPITAL LETTER A WITH HOOK ABOVE +1EA4; C; 1EA5; # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE +1EA6; C; 1EA7; # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE +1EA8; C; 1EA9; # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE +1EAA; C; 1EAB; # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE +1EAC; C; 1EAD; # LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW +1EAE; C; 1EAF; # LATIN CAPITAL LETTER A WITH BREVE AND ACUTE +1EB0; C; 1EB1; # LATIN CAPITAL LETTER A WITH BREVE AND GRAVE +1EB2; C; 1EB3; # LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE +1EB4; C; 1EB5; # LATIN CAPITAL LETTER A WITH BREVE AND TILDE +1EB6; C; 1EB7; # LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW +1EB8; C; 1EB9; # LATIN CAPITAL LETTER E WITH DOT BELOW +1EBA; C; 1EBB; # LATIN CAPITAL LETTER E WITH HOOK ABOVE +1EBC; C; 1EBD; # LATIN CAPITAL LETTER E WITH TILDE +1EBE; C; 1EBF; # LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE +1EC0; C; 1EC1; # LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE +1EC2; C; 1EC3; # LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE +1EC4; C; 1EC5; # LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE +1EC6; C; 1EC7; # LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW +1EC8; C; 1EC9; # LATIN CAPITAL LETTER I WITH HOOK ABOVE +1ECA; C; 1ECB; # LATIN CAPITAL LETTER I WITH DOT BELOW +1ECC; C; 1ECD; # LATIN CAPITAL LETTER O WITH DOT BELOW +1ECE; C; 1ECF; # LATIN CAPITAL LETTER O WITH HOOK ABOVE +1ED0; C; 1ED1; # LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE +1ED2; C; 1ED3; # LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE +1ED4; C; 1ED5; # LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE +1ED6; C; 1ED7; # LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE +1ED8; C; 1ED9; # LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW +1EDA; C; 1EDB; # LATIN CAPITAL LETTER O WITH HORN AND ACUTE +1EDC; C; 1EDD; # LATIN CAPITAL LETTER O WITH HORN AND GRAVE +1EDE; C; 1EDF; # LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE +1EE0; C; 1EE1; # LATIN CAPITAL LETTER O WITH HORN AND TILDE +1EE2; C; 1EE3; # LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW +1EE4; C; 1EE5; # LATIN CAPITAL LETTER U WITH DOT BELOW +1EE6; C; 1EE7; # LATIN CAPITAL LETTER U WITH HOOK ABOVE +1EE8; C; 1EE9; # LATIN CAPITAL LETTER U WITH HORN AND ACUTE +1EEA; C; 1EEB; # LATIN CAPITAL LETTER U WITH HORN AND GRAVE +1EEC; C; 1EED; # LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE +1EEE; C; 1EEF; # LATIN CAPITAL LETTER U WITH HORN AND TILDE +1EF0; C; 1EF1; # LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW +1EF2; C; 1EF3; # LATIN CAPITAL LETTER Y WITH GRAVE +1EF4; C; 1EF5; # LATIN CAPITAL LETTER Y WITH DOT BELOW +1EF6; C; 1EF7; # LATIN CAPITAL LETTER Y WITH HOOK ABOVE +1EF8; C; 1EF9; # LATIN CAPITAL LETTER Y WITH TILDE +1F08; C; 1F00; # GREEK CAPITAL LETTER ALPHA WITH PSILI +1F09; C; 1F01; # GREEK CAPITAL LETTER ALPHA WITH DASIA +1F0A; C; 1F02; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA +1F0B; C; 1F03; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA +1F0C; C; 1F04; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA +1F0D; C; 1F05; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA +1F0E; C; 1F06; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI +1F0F; C; 1F07; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI +1F18; C; 1F10; # GREEK CAPITAL LETTER EPSILON WITH PSILI +1F19; C; 1F11; # GREEK CAPITAL LETTER EPSILON WITH DASIA +1F1A; C; 1F12; # GREEK CAPITAL LETTER EPSILON WITH PSILI AND VARIA +1F1B; C; 1F13; # GREEK CAPITAL LETTER EPSILON WITH DASIA AND VARIA +1F1C; C; 1F14; # GREEK CAPITAL LETTER EPSILON WITH PSILI AND OXIA +1F1D; C; 1F15; # GREEK CAPITAL LETTER EPSILON WITH DASIA AND OXIA +1F28; C; 1F20; # GREEK CAPITAL LETTER ETA WITH PSILI +1F29; C; 1F21; # GREEK CAPITAL LETTER ETA WITH DASIA +1F2A; C; 1F22; # GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA +1F2B; C; 1F23; # GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA +1F2C; C; 1F24; # GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA +1F2D; C; 1F25; # GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA +1F2E; C; 1F26; # GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI +1F2F; C; 1F27; # GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI +1F38; C; 1F30; # GREEK CAPITAL LETTER IOTA WITH PSILI +1F39; C; 1F31; # GREEK CAPITAL LETTER IOTA WITH DASIA +1F3A; C; 1F32; # GREEK CAPITAL LETTER IOTA WITH PSILI AND VARIA +1F3B; C; 1F33; # GREEK CAPITAL LETTER IOTA WITH DASIA AND VARIA +1F3C; C; 1F34; # GREEK CAPITAL LETTER IOTA WITH PSILI AND OXIA +1F3D; C; 1F35; # GREEK CAPITAL LETTER IOTA WITH DASIA AND OXIA +1F3E; C; 1F36; # GREEK CAPITAL LETTER IOTA WITH PSILI AND PERISPOMENI +1F3F; C; 1F37; # GREEK CAPITAL LETTER IOTA WITH DASIA AND PERISPOMENI +1F48; C; 1F40; # GREEK CAPITAL LETTER OMICRON WITH PSILI +1F49; C; 1F41; # GREEK CAPITAL LETTER OMICRON WITH DASIA +1F4A; C; 1F42; # GREEK CAPITAL LETTER OMICRON WITH PSILI AND VARIA +1F4B; C; 1F43; # GREEK CAPITAL LETTER OMICRON WITH DASIA AND VARIA +1F4C; C; 1F44; # GREEK CAPITAL LETTER OMICRON WITH PSILI AND OXIA +1F4D; C; 1F45; # GREEK CAPITAL LETTER OMICRON WITH DASIA AND OXIA +1F50; F; 03C5 0313; # GREEK SMALL LETTER UPSILON WITH PSILI +1F52; F; 03C5 0313 0300; # GREEK SMALL LETTER UPSILON WITH PSILI AND VARIA +1F54; F; 03C5 0313 0301; # GREEK SMALL LETTER UPSILON WITH PSILI AND OXIA +1F56; F; 03C5 0313 0342; # GREEK SMALL LETTER UPSILON WITH PSILI AND PERISPOMENI +1F59; C; 1F51; # GREEK CAPITAL LETTER UPSILON WITH DASIA +1F5B; C; 1F53; # GREEK CAPITAL LETTER UPSILON WITH DASIA AND VARIA +1F5D; C; 1F55; # GREEK CAPITAL LETTER UPSILON WITH DASIA AND OXIA +1F5F; C; 1F57; # GREEK CAPITAL LETTER UPSILON WITH DASIA AND PERISPOMENI +1F68; C; 1F60; # GREEK CAPITAL LETTER OMEGA WITH PSILI +1F69; C; 1F61; # GREEK CAPITAL LETTER OMEGA WITH DASIA +1F6A; C; 1F62; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA +1F6B; C; 1F63; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA +1F6C; C; 1F64; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA +1F6D; C; 1F65; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA +1F6E; C; 1F66; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI +1F6F; C; 1F67; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI +1F80; F; 1F00 03B9; # GREEK SMALL LETTER ALPHA WITH PSILI AND YPOGEGRAMMENI +1F81; F; 1F01 03B9; # GREEK SMALL LETTER ALPHA WITH DASIA AND YPOGEGRAMMENI +1F82; F; 1F02 03B9; # GREEK SMALL LETTER ALPHA WITH PSILI AND VARIA AND YPOGEGRAMMENI +1F83; F; 1F03 03B9; # GREEK SMALL LETTER ALPHA WITH DASIA AND VARIA AND YPOGEGRAMMENI +1F84; F; 1F04 03B9; # GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA AND YPOGEGRAMMENI +1F85; F; 1F05 03B9; # GREEK SMALL LETTER ALPHA WITH DASIA AND OXIA AND YPOGEGRAMMENI +1F86; F; 1F06 03B9; # GREEK SMALL LETTER ALPHA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI +1F87; F; 1F07 03B9; # GREEK SMALL LETTER ALPHA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI +1F88; F; 1F00 03B9; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI +1F88; S; 1F80; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND PROSGEGRAMMENI +1F89; F; 1F01 03B9; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI +1F89; S; 1F81; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND PROSGEGRAMMENI +1F8A; F; 1F02 03B9; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI +1F8A; S; 1F82; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND VARIA AND PROSGEGRAMMENI +1F8B; F; 1F03 03B9; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI +1F8B; S; 1F83; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND VARIA AND PROSGEGRAMMENI +1F8C; F; 1F04 03B9; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI +1F8C; S; 1F84; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA AND PROSGEGRAMMENI +1F8D; F; 1F05 03B9; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI +1F8D; S; 1F85; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND OXIA AND PROSGEGRAMMENI +1F8E; F; 1F06 03B9; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +1F8E; S; 1F86; # GREEK CAPITAL LETTER ALPHA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +1F8F; F; 1F07 03B9; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +1F8F; S; 1F87; # GREEK CAPITAL LETTER ALPHA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +1F90; F; 1F20 03B9; # GREEK SMALL LETTER ETA WITH PSILI AND YPOGEGRAMMENI +1F91; F; 1F21 03B9; # GREEK SMALL LETTER ETA WITH DASIA AND YPOGEGRAMMENI +1F92; F; 1F22 03B9; # GREEK SMALL LETTER ETA WITH PSILI AND VARIA AND YPOGEGRAMMENI +1F93; F; 1F23 03B9; # GREEK SMALL LETTER ETA WITH DASIA AND VARIA AND YPOGEGRAMMENI +1F94; F; 1F24 03B9; # GREEK SMALL LETTER ETA WITH PSILI AND OXIA AND YPOGEGRAMMENI +1F95; F; 1F25 03B9; # GREEK SMALL LETTER ETA WITH DASIA AND OXIA AND YPOGEGRAMMENI +1F96; F; 1F26 03B9; # GREEK SMALL LETTER ETA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI +1F97; F; 1F27 03B9; # GREEK SMALL LETTER ETA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI +1F98; F; 1F20 03B9; # GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI +1F98; S; 1F90; # GREEK CAPITAL LETTER ETA WITH PSILI AND PROSGEGRAMMENI +1F99; F; 1F21 03B9; # GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI +1F99; S; 1F91; # GREEK CAPITAL LETTER ETA WITH DASIA AND PROSGEGRAMMENI +1F9A; F; 1F22 03B9; # GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI +1F9A; S; 1F92; # GREEK CAPITAL LETTER ETA WITH PSILI AND VARIA AND PROSGEGRAMMENI +1F9B; F; 1F23 03B9; # GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI +1F9B; S; 1F93; # GREEK CAPITAL LETTER ETA WITH DASIA AND VARIA AND PROSGEGRAMMENI +1F9C; F; 1F24 03B9; # GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI +1F9C; S; 1F94; # GREEK CAPITAL LETTER ETA WITH PSILI AND OXIA AND PROSGEGRAMMENI +1F9D; F; 1F25 03B9; # GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI +1F9D; S; 1F95; # GREEK CAPITAL LETTER ETA WITH DASIA AND OXIA AND PROSGEGRAMMENI +1F9E; F; 1F26 03B9; # GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +1F9E; S; 1F96; # GREEK CAPITAL LETTER ETA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +1F9F; F; 1F27 03B9; # GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +1F9F; S; 1F97; # GREEK CAPITAL LETTER ETA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +1FA0; F; 1F60 03B9; # GREEK SMALL LETTER OMEGA WITH PSILI AND YPOGEGRAMMENI +1FA1; F; 1F61 03B9; # GREEK SMALL LETTER OMEGA WITH DASIA AND YPOGEGRAMMENI +1FA2; F; 1F62 03B9; # GREEK SMALL LETTER OMEGA WITH PSILI AND VARIA AND YPOGEGRAMMENI +1FA3; F; 1F63 03B9; # GREEK SMALL LETTER OMEGA WITH DASIA AND VARIA AND YPOGEGRAMMENI +1FA4; F; 1F64 03B9; # GREEK SMALL LETTER OMEGA WITH PSILI AND OXIA AND YPOGEGRAMMENI +1FA5; F; 1F65 03B9; # GREEK SMALL LETTER OMEGA WITH DASIA AND OXIA AND YPOGEGRAMMENI +1FA6; F; 1F66 03B9; # GREEK SMALL LETTER OMEGA WITH PSILI AND PERISPOMENI AND YPOGEGRAMMENI +1FA7; F; 1F67 03B9; # GREEK SMALL LETTER OMEGA WITH DASIA AND PERISPOMENI AND YPOGEGRAMMENI +1FA8; F; 1F60 03B9; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI +1FA8; S; 1FA0; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND PROSGEGRAMMENI +1FA9; F; 1F61 03B9; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI +1FA9; S; 1FA1; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND PROSGEGRAMMENI +1FAA; F; 1F62 03B9; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI +1FAA; S; 1FA2; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND VARIA AND PROSGEGRAMMENI +1FAB; F; 1F63 03B9; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI +1FAB; S; 1FA3; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND VARIA AND PROSGEGRAMMENI +1FAC; F; 1F64 03B9; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI +1FAC; S; 1FA4; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND OXIA AND PROSGEGRAMMENI +1FAD; F; 1F65 03B9; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI +1FAD; S; 1FA5; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND OXIA AND PROSGEGRAMMENI +1FAE; F; 1F66 03B9; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +1FAE; S; 1FA6; # GREEK CAPITAL LETTER OMEGA WITH PSILI AND PERISPOMENI AND PROSGEGRAMMENI +1FAF; F; 1F67 03B9; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +1FAF; S; 1FA7; # GREEK CAPITAL LETTER OMEGA WITH DASIA AND PERISPOMENI AND PROSGEGRAMMENI +1FB2; F; 1F70 03B9; # GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI +1FB3; F; 03B1 03B9; # GREEK SMALL LETTER ALPHA WITH YPOGEGRAMMENI +1FB4; F; 03AC 03B9; # GREEK SMALL LETTER ALPHA WITH OXIA AND YPOGEGRAMMENI +1FB6; F; 03B1 0342; # GREEK SMALL LETTER ALPHA WITH PERISPOMENI +1FB7; F; 03B1 0342 03B9; # GREEK SMALL LETTER ALPHA WITH PERISPOMENI AND YPOGEGRAMMENI +1FB8; C; 1FB0; # GREEK CAPITAL LETTER ALPHA WITH VRACHY +1FB9; C; 1FB1; # GREEK CAPITAL LETTER ALPHA WITH MACRON +1FBA; C; 1F70; # GREEK CAPITAL LETTER ALPHA WITH VARIA +1FBB; C; 1F71; # GREEK CAPITAL LETTER ALPHA WITH OXIA +1FBC; F; 03B1 03B9; # GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI +1FBC; S; 1FB3; # GREEK CAPITAL LETTER ALPHA WITH PROSGEGRAMMENI +1FBE; C; 03B9; # GREEK PROSGEGRAMMENI +1FC2; F; 1F74 03B9; # GREEK SMALL LETTER ETA WITH VARIA AND YPOGEGRAMMENI +1FC3; F; 03B7 03B9; # GREEK SMALL LETTER ETA WITH YPOGEGRAMMENI +1FC4; F; 03AE 03B9; # GREEK SMALL LETTER ETA WITH OXIA AND YPOGEGRAMMENI +1FC6; F; 03B7 0342; # GREEK SMALL LETTER ETA WITH PERISPOMENI +1FC7; F; 03B7 0342 03B9; # GREEK SMALL LETTER ETA WITH PERISPOMENI AND YPOGEGRAMMENI +1FC8; C; 1F72; # GREEK CAPITAL LETTER EPSILON WITH VARIA +1FC9; C; 1F73; # GREEK CAPITAL LETTER EPSILON WITH OXIA +1FCA; C; 1F74; # GREEK CAPITAL LETTER ETA WITH VARIA +1FCB; C; 1F75; # GREEK CAPITAL LETTER ETA WITH OXIA +1FCC; F; 03B7 03B9; # GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI +1FCC; S; 1FC3; # GREEK CAPITAL LETTER ETA WITH PROSGEGRAMMENI +1FD2; F; 03B9 0308 0300; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND VARIA +1FD3; F; 03B9 0308 0301; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND OXIA +1FD6; F; 03B9 0342; # GREEK SMALL LETTER IOTA WITH PERISPOMENI +1FD7; F; 03B9 0308 0342; # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND PERISPOMENI +1FD8; C; 1FD0; # GREEK CAPITAL LETTER IOTA WITH VRACHY +1FD9; C; 1FD1; # GREEK CAPITAL LETTER IOTA WITH MACRON +1FDA; C; 1F76; # GREEK CAPITAL LETTER IOTA WITH VARIA +1FDB; C; 1F77; # GREEK CAPITAL LETTER IOTA WITH OXIA +1FE2; F; 03C5 0308 0300; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND VARIA +1FE3; F; 03C5 0308 0301; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND OXIA +1FE4; F; 03C1 0313; # GREEK SMALL LETTER RHO WITH PSILI +1FE6; F; 03C5 0342; # GREEK SMALL LETTER UPSILON WITH PERISPOMENI +1FE7; F; 03C5 0308 0342; # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND PERISPOMENI +1FE8; C; 1FE0; # GREEK CAPITAL LETTER UPSILON WITH VRACHY +1FE9; C; 1FE1; # GREEK CAPITAL LETTER UPSILON WITH MACRON +1FEA; C; 1F7A; # GREEK CAPITAL LETTER UPSILON WITH VARIA +1FEB; C; 1F7B; # GREEK CAPITAL LETTER UPSILON WITH OXIA +1FEC; C; 1FE5; # GREEK CAPITAL LETTER RHO WITH DASIA +1FF2; F; 1F7C 03B9; # GREEK SMALL LETTER OMEGA WITH VARIA AND YPOGEGRAMMENI +1FF3; F; 03C9 03B9; # GREEK SMALL LETTER OMEGA WITH YPOGEGRAMMENI +1FF4; F; 03CE 03B9; # GREEK SMALL LETTER OMEGA WITH OXIA AND YPOGEGRAMMENI +1FF6; F; 03C9 0342; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI +1FF7; F; 03C9 0342 03B9; # GREEK SMALL LETTER OMEGA WITH PERISPOMENI AND YPOGEGRAMMENI +1FF8; C; 1F78; # GREEK CAPITAL LETTER OMICRON WITH VARIA +1FF9; C; 1F79; # GREEK CAPITAL LETTER OMICRON WITH OXIA +1FFA; C; 1F7C; # GREEK CAPITAL LETTER OMEGA WITH VARIA +1FFB; C; 1F7D; # GREEK CAPITAL LETTER OMEGA WITH OXIA +1FFC; F; 03C9 03B9; # GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI +1FFC; S; 1FF3; # GREEK CAPITAL LETTER OMEGA WITH PROSGEGRAMMENI +2126; C; 03C9; # OHM SIGN +212A; C; 006B; # KELVIN SIGN +212B; C; 00E5; # ANGSTROM SIGN +2160; C; 2170; # ROMAN NUMERAL ONE +2161; C; 2171; # ROMAN NUMERAL TWO +2162; C; 2172; # ROMAN NUMERAL THREE +2163; C; 2173; # ROMAN NUMERAL FOUR +2164; C; 2174; # ROMAN NUMERAL FIVE +2165; C; 2175; # ROMAN NUMERAL SIX +2166; C; 2176; # ROMAN NUMERAL SEVEN +2167; C; 2177; # ROMAN NUMERAL EIGHT +2168; C; 2178; # ROMAN NUMERAL NINE +2169; C; 2179; # ROMAN NUMERAL TEN +216A; C; 217A; # ROMAN NUMERAL ELEVEN +216B; C; 217B; # ROMAN NUMERAL TWELVE +216C; C; 217C; # ROMAN NUMERAL FIFTY +216D; C; 217D; # ROMAN NUMERAL ONE HUNDRED +216E; C; 217E; # ROMAN NUMERAL FIVE HUNDRED +216F; C; 217F; # ROMAN NUMERAL ONE THOUSAND +24B6; C; 24D0; # CIRCLED LATIN CAPITAL LETTER A +24B7; C; 24D1; # CIRCLED LATIN CAPITAL LETTER B +24B8; C; 24D2; # CIRCLED LATIN CAPITAL LETTER C +24B9; C; 24D3; # CIRCLED LATIN CAPITAL LETTER D +24BA; C; 24D4; # CIRCLED LATIN CAPITAL LETTER E +24BB; C; 24D5; # CIRCLED LATIN CAPITAL LETTER F +24BC; C; 24D6; # CIRCLED LATIN CAPITAL LETTER G +24BD; C; 24D7; # CIRCLED LATIN CAPITAL LETTER H +24BE; C; 24D8; # CIRCLED LATIN CAPITAL LETTER I +24BF; C; 24D9; # CIRCLED LATIN CAPITAL LETTER J +24C0; C; 24DA; # CIRCLED LATIN CAPITAL LETTER K +24C1; C; 24DB; # CIRCLED LATIN CAPITAL LETTER L +24C2; C; 24DC; # CIRCLED LATIN CAPITAL LETTER M +24C3; C; 24DD; # CIRCLED LATIN CAPITAL LETTER N +24C4; C; 24DE; # CIRCLED LATIN CAPITAL LETTER O +24C5; C; 24DF; # CIRCLED LATIN CAPITAL LETTER P +24C6; C; 24E0; # CIRCLED LATIN CAPITAL LETTER Q +24C7; C; 24E1; # CIRCLED LATIN CAPITAL LETTER R +24C8; C; 24E2; # CIRCLED LATIN CAPITAL LETTER S +24C9; C; 24E3; # CIRCLED LATIN CAPITAL LETTER T +24CA; C; 24E4; # CIRCLED LATIN CAPITAL LETTER U +24CB; C; 24E5; # CIRCLED LATIN CAPITAL LETTER V +24CC; C; 24E6; # CIRCLED LATIN CAPITAL LETTER W +24CD; C; 24E7; # CIRCLED LATIN CAPITAL LETTER X +24CE; C; 24E8; # CIRCLED LATIN CAPITAL LETTER Y +24CF; C; 24E9; # CIRCLED LATIN CAPITAL LETTER Z +2C00; C; 2C30; # GLAGOLITIC CAPITAL LETTER AZU +2C01; C; 2C31; # GLAGOLITIC CAPITAL LETTER BUKY +2C02; C; 2C32; # GLAGOLITIC CAPITAL LETTER VEDE +2C03; C; 2C33; # GLAGOLITIC CAPITAL LETTER GLAGOLI +2C04; C; 2C34; # GLAGOLITIC CAPITAL LETTER DOBRO +2C05; C; 2C35; # GLAGOLITIC CAPITAL LETTER YESTU +2C06; C; 2C36; # GLAGOLITIC CAPITAL LETTER ZHIVETE +2C07; C; 2C37; # GLAGOLITIC CAPITAL LETTER DZELO +2C08; C; 2C38; # GLAGOLITIC CAPITAL LETTER ZEMLJA +2C09; C; 2C39; # GLAGOLITIC CAPITAL LETTER IZHE +2C0A; C; 2C3A; # GLAGOLITIC CAPITAL LETTER INITIAL IZHE +2C0B; C; 2C3B; # GLAGOLITIC CAPITAL LETTER I +2C0C; C; 2C3C; # GLAGOLITIC CAPITAL LETTER DJERVI +2C0D; C; 2C3D; # GLAGOLITIC CAPITAL LETTER KAKO +2C0E; C; 2C3E; # GLAGOLITIC CAPITAL LETTER LJUDIJE +2C0F; C; 2C3F; # GLAGOLITIC CAPITAL LETTER MYSLITE +2C10; C; 2C40; # GLAGOLITIC CAPITAL LETTER NASHI +2C11; C; 2C41; # GLAGOLITIC CAPITAL LETTER ONU +2C12; C; 2C42; # GLAGOLITIC CAPITAL LETTER POKOJI +2C13; C; 2C43; # GLAGOLITIC CAPITAL LETTER RITSI +2C14; C; 2C44; # GLAGOLITIC CAPITAL LETTER SLOVO +2C15; C; 2C45; # GLAGOLITIC CAPITAL LETTER TVRIDO +2C16; C; 2C46; # GLAGOLITIC CAPITAL LETTER UKU +2C17; C; 2C47; # GLAGOLITIC CAPITAL LETTER FRITU +2C18; C; 2C48; # GLAGOLITIC CAPITAL LETTER HERU +2C19; C; 2C49; # GLAGOLITIC CAPITAL LETTER OTU +2C1A; C; 2C4A; # GLAGOLITIC CAPITAL LETTER PE +2C1B; C; 2C4B; # GLAGOLITIC CAPITAL LETTER SHTA +2C1C; C; 2C4C; # GLAGOLITIC CAPITAL LETTER TSI +2C1D; C; 2C4D; # GLAGOLITIC CAPITAL LETTER CHRIVI +2C1E; C; 2C4E; # GLAGOLITIC CAPITAL LETTER SHA +2C1F; C; 2C4F; # GLAGOLITIC CAPITAL LETTER YERU +2C20; C; 2C50; # GLAGOLITIC CAPITAL LETTER YERI +2C21; C; 2C51; # GLAGOLITIC CAPITAL LETTER YATI +2C22; C; 2C52; # GLAGOLITIC CAPITAL LETTER SPIDERY HA +2C23; C; 2C53; # GLAGOLITIC CAPITAL LETTER YU +2C24; C; 2C54; # GLAGOLITIC CAPITAL LETTER SMALL YUS +2C25; C; 2C55; # GLAGOLITIC CAPITAL LETTER SMALL YUS WITH TAIL +2C26; C; 2C56; # GLAGOLITIC CAPITAL LETTER YO +2C27; C; 2C57; # GLAGOLITIC CAPITAL LETTER IOTATED SMALL YUS +2C28; C; 2C58; # GLAGOLITIC CAPITAL LETTER BIG YUS +2C29; C; 2C59; # GLAGOLITIC CAPITAL LETTER IOTATED BIG YUS +2C2A; C; 2C5A; # GLAGOLITIC CAPITAL LETTER FITA +2C2B; C; 2C5B; # GLAGOLITIC CAPITAL LETTER IZHITSA +2C2C; C; 2C5C; # GLAGOLITIC CAPITAL LETTER SHTAPIC +2C2D; C; 2C5D; # GLAGOLITIC CAPITAL LETTER TROKUTASTI A +2C2E; C; 2C5E; # GLAGOLITIC CAPITAL LETTER LATINATE MYSLITE +2C80; C; 2C81; # COPTIC CAPITAL LETTER ALFA +2C82; C; 2C83; # COPTIC CAPITAL LETTER VIDA +2C84; C; 2C85; # COPTIC CAPITAL LETTER GAMMA +2C86; C; 2C87; # COPTIC CAPITAL LETTER DALDA +2C88; C; 2C89; # COPTIC CAPITAL LETTER EIE +2C8A; C; 2C8B; # COPTIC CAPITAL LETTER SOU +2C8C; C; 2C8D; # COPTIC CAPITAL LETTER ZATA +2C8E; C; 2C8F; # COPTIC CAPITAL LETTER HATE +2C90; C; 2C91; # COPTIC CAPITAL LETTER THETHE +2C92; C; 2C93; # COPTIC CAPITAL LETTER IAUDA +2C94; C; 2C95; # COPTIC CAPITAL LETTER KAPA +2C96; C; 2C97; # COPTIC CAPITAL LETTER LAULA +2C98; C; 2C99; # COPTIC CAPITAL LETTER MI +2C9A; C; 2C9B; # COPTIC CAPITAL LETTER NI +2C9C; C; 2C9D; # COPTIC CAPITAL LETTER KSI +2C9E; C; 2C9F; # COPTIC CAPITAL LETTER O +2CA0; C; 2CA1; # COPTIC CAPITAL LETTER PI +2CA2; C; 2CA3; # COPTIC CAPITAL LETTER RO +2CA4; C; 2CA5; # COPTIC CAPITAL LETTER SIMA +2CA6; C; 2CA7; # COPTIC CAPITAL LETTER TAU +2CA8; C; 2CA9; # COPTIC CAPITAL LETTER UA +2CAA; C; 2CAB; # COPTIC CAPITAL LETTER FI +2CAC; C; 2CAD; # COPTIC CAPITAL LETTER KHI +2CAE; C; 2CAF; # COPTIC CAPITAL LETTER PSI +2CB0; C; 2CB1; # COPTIC CAPITAL LETTER OOU +2CB2; C; 2CB3; # COPTIC CAPITAL LETTER DIALECT-P ALEF +2CB4; C; 2CB5; # COPTIC CAPITAL LETTER OLD COPTIC AIN +2CB6; C; 2CB7; # COPTIC CAPITAL LETTER CRYPTOGRAMMIC EIE +2CB8; C; 2CB9; # COPTIC CAPITAL LETTER DIALECT-P KAPA +2CBA; C; 2CBB; # COPTIC CAPITAL LETTER DIALECT-P NI +2CBC; C; 2CBD; # COPTIC CAPITAL LETTER CRYPTOGRAMMIC NI +2CBE; C; 2CBF; # COPTIC CAPITAL LETTER OLD COPTIC OOU +2CC0; C; 2CC1; # COPTIC CAPITAL LETTER SAMPI +2CC2; C; 2CC3; # COPTIC CAPITAL LETTER CROSSED SHEI +2CC4; C; 2CC5; # COPTIC CAPITAL LETTER OLD COPTIC SHEI +2CC6; C; 2CC7; # COPTIC CAPITAL LETTER OLD COPTIC ESH +2CC8; C; 2CC9; # COPTIC CAPITAL LETTER AKHMIMIC KHEI +2CCA; C; 2CCB; # COPTIC CAPITAL LETTER DIALECT-P HORI +2CCC; C; 2CCD; # COPTIC CAPITAL LETTER OLD COPTIC HORI +2CCE; C; 2CCF; # COPTIC CAPITAL LETTER OLD COPTIC HA +2CD0; C; 2CD1; # COPTIC CAPITAL LETTER L-SHAPED HA +2CD2; C; 2CD3; # COPTIC CAPITAL LETTER OLD COPTIC HEI +2CD4; C; 2CD5; # COPTIC CAPITAL LETTER OLD COPTIC HAT +2CD6; C; 2CD7; # COPTIC CAPITAL LETTER OLD COPTIC GANGIA +2CD8; C; 2CD9; # COPTIC CAPITAL LETTER OLD COPTIC DJA +2CDA; C; 2CDB; # COPTIC CAPITAL LETTER OLD COPTIC SHIMA +2CDC; C; 2CDD; # COPTIC CAPITAL LETTER OLD NUBIAN SHIMA +2CDE; C; 2CDF; # COPTIC CAPITAL LETTER OLD NUBIAN NGI +2CE0; C; 2CE1; # COPTIC CAPITAL LETTER OLD NUBIAN NYI +2CE2; C; 2CE3; # COPTIC CAPITAL LETTER OLD NUBIAN WAU +FB00; F; 0066 0066; # LATIN SMALL LIGATURE FF +FB01; F; 0066 0069; # LATIN SMALL LIGATURE FI +FB02; F; 0066 006C; # LATIN SMALL LIGATURE FL +FB03; F; 0066 0066 0069; # LATIN SMALL LIGATURE FFI +FB04; F; 0066 0066 006C; # LATIN SMALL LIGATURE FFL +FB05; F; 0073 0074; # LATIN SMALL LIGATURE LONG S T +FB06; F; 0073 0074; # LATIN SMALL LIGATURE ST +FB13; F; 0574 0576; # ARMENIAN SMALL LIGATURE MEN NOW +FB14; F; 0574 0565; # ARMENIAN SMALL LIGATURE MEN ECH +FB15; F; 0574 056B; # ARMENIAN SMALL LIGATURE MEN INI +FB16; F; 057E 0576; # ARMENIAN SMALL LIGATURE VEW NOW +FB17; F; 0574 056D; # ARMENIAN SMALL LIGATURE MEN XEH +FF21; C; FF41; # FULLWIDTH LATIN CAPITAL LETTER A +FF22; C; FF42; # FULLWIDTH LATIN CAPITAL LETTER B +FF23; C; FF43; # FULLWIDTH LATIN CAPITAL LETTER C +FF24; C; FF44; # FULLWIDTH LATIN CAPITAL LETTER D +FF25; C; FF45; # FULLWIDTH LATIN CAPITAL LETTER E +FF26; C; FF46; # FULLWIDTH LATIN CAPITAL LETTER F +FF27; C; FF47; # FULLWIDTH LATIN CAPITAL LETTER G +FF28; C; FF48; # FULLWIDTH LATIN CAPITAL LETTER H +FF29; C; FF49; # FULLWIDTH LATIN CAPITAL LETTER I +FF2A; C; FF4A; # FULLWIDTH LATIN CAPITAL LETTER J +FF2B; C; FF4B; # FULLWIDTH LATIN CAPITAL LETTER K +FF2C; C; FF4C; # FULLWIDTH LATIN CAPITAL LETTER L +FF2D; C; FF4D; # FULLWIDTH LATIN CAPITAL LETTER M +FF2E; C; FF4E; # FULLWIDTH LATIN CAPITAL LETTER N +FF2F; C; FF4F; # FULLWIDTH LATIN CAPITAL LETTER O +FF30; C; FF50; # FULLWIDTH LATIN CAPITAL LETTER P +FF31; C; FF51; # FULLWIDTH LATIN CAPITAL LETTER Q +FF32; C; FF52; # FULLWIDTH LATIN CAPITAL LETTER R +FF33; C; FF53; # FULLWIDTH LATIN CAPITAL LETTER S +FF34; C; FF54; # FULLWIDTH LATIN CAPITAL LETTER T +FF35; C; FF55; # FULLWIDTH LATIN CAPITAL LETTER U +FF36; C; FF56; # FULLWIDTH LATIN CAPITAL LETTER V +FF37; C; FF57; # FULLWIDTH LATIN CAPITAL LETTER W +FF38; C; FF58; # FULLWIDTH LATIN CAPITAL LETTER X +FF39; C; FF59; # FULLWIDTH LATIN CAPITAL LETTER Y +FF3A; C; FF5A; # FULLWIDTH LATIN CAPITAL LETTER Z +10400; C; 10428; # DESERET CAPITAL LETTER LONG I +10401; C; 10429; # DESERET CAPITAL LETTER LONG E +10402; C; 1042A; # DESERET CAPITAL LETTER LONG A +10403; C; 1042B; # DESERET CAPITAL LETTER LONG AH +10404; C; 1042C; # DESERET CAPITAL LETTER LONG O +10405; C; 1042D; # DESERET CAPITAL LETTER LONG OO +10406; C; 1042E; # DESERET CAPITAL LETTER SHORT I +10407; C; 1042F; # DESERET CAPITAL LETTER SHORT E +10408; C; 10430; # DESERET CAPITAL LETTER SHORT A +10409; C; 10431; # DESERET CAPITAL LETTER SHORT AH +1040A; C; 10432; # DESERET CAPITAL LETTER SHORT O +1040B; C; 10433; # DESERET CAPITAL LETTER SHORT OO +1040C; C; 10434; # DESERET CAPITAL LETTER AY +1040D; C; 10435; # DESERET CAPITAL LETTER OW +1040E; C; 10436; # DESERET CAPITAL LETTER WU +1040F; C; 10437; # DESERET CAPITAL LETTER YEE +10410; C; 10438; # DESERET CAPITAL LETTER H +10411; C; 10439; # DESERET CAPITAL LETTER PEE +10412; C; 1043A; # DESERET CAPITAL LETTER BEE +10413; C; 1043B; # DESERET CAPITAL LETTER TEE +10414; C; 1043C; # DESERET CAPITAL LETTER DEE +10415; C; 1043D; # DESERET CAPITAL LETTER CHEE +10416; C; 1043E; # DESERET CAPITAL LETTER JEE +10417; C; 1043F; # DESERET CAPITAL LETTER KAY +10418; C; 10440; # DESERET CAPITAL LETTER GAY +10419; C; 10441; # DESERET CAPITAL LETTER EF +1041A; C; 10442; # DESERET CAPITAL LETTER VEE +1041B; C; 10443; # DESERET CAPITAL LETTER ETH +1041C; C; 10444; # DESERET CAPITAL LETTER THEE +1041D; C; 10445; # DESERET CAPITAL LETTER ES +1041E; C; 10446; # DESERET CAPITAL LETTER ZEE +1041F; C; 10447; # DESERET CAPITAL LETTER ESH +10420; C; 10448; # DESERET CAPITAL LETTER ZHEE +10421; C; 10449; # DESERET CAPITAL LETTER ER +10422; C; 1044A; # DESERET CAPITAL LETTER EL +10423; C; 1044B; # DESERET CAPITAL LETTER EM +10424; C; 1044C; # DESERET CAPITAL LETTER EN +10425; C; 1044D; # DESERET CAPITAL LETTER ENG +10426; C; 1044E; # DESERET CAPITAL LETTER OI +10427; C; 1044F; # DESERET CAPITAL LETTER EW Modified: trunk/extras/ignorecase.c =================================================================== --- trunk/extras/ignorecase.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/extras/ignorecase.c 2007-03-15 08:16:23 UTC (rev 840) @@ -28,6 +28,7 @@ */ /* I'm not screwing around with stricmp vs. strcasecmp... */ +/* !!! FIXME: this will NOT work with UTF-8 strings in physfs2.0 */ static int caseInsensitiveStringCompare(const char *x, const char *y) { int ux, uy; Added: trunk/extras/makecasefoldhashtable.pl =================================================================== --- trunk/extras/makecasefoldhashtable.pl (rev 0) +++ trunk/extras/makecasefoldhashtable.pl 2007-03-15 08:16:23 UTC (rev 840) @@ -0,0 +1,85 @@ +#!/usr/bin/perl -w + +use warnings; +use strict; + +print <<__EOF__; +/* + * This file is part of PhysicsFS (http://icculus.org/physfs/) + * + * This data generated by physfs/extras/makecasefoldhashtable.pl ... + * Do not manually edit this file! + * + * Please see the file LICENSE.txt in the source's root directory. + */ + +#ifndef __PHYSICSFS_INTERNAL__ +#error Do not include this header from your applications. +#endif + +__EOF__ + + +my @foldPairs; + +for (my $i = 0; $i < 256; $i++) { + $foldPairs[$i] = ''; +} + +open(FH,'<','casefolding.txt') or die("failed to open casefolding.txt: $!\n"); +while () { + chomp; + # strip comments from textfile... + s/\#.*\Z//; + + # strip whitespace... + s/\A\s+//; + s/\s+\Z//; + + next if not /\A([a-fA-F0-9]+)\;\s*(.)\;\s*(.+)\;/; + my ($code, $status, $mapping) = ($1, $2, $3); + my $hexxed = hex($code); + my $hashed = (($hexxed ^ ($hexxed >> 8)) & 0xFF); + #print("// code '$code' status '$status' mapping '$mapping'\n"); + #print("// hexxed '$hexxed' hashed '$hashed'\n"); + + if (($status eq 'C') or ($status eq 'F')) { + my ($map1, $map2, $map3) = ('0000', '0000', '0000'); + $map1 = $1 if $mapping =~ s/\A([a-fA-F0-9]+)(\s*|\Z)//; + $map2 = $1 if $mapping =~ s/\A([a-fA-F0-9]+)(\s*|\Z)//; + $map3 = $1 if $mapping =~ s/\A([a-fA-F0-9]+)(\s*|\Z)//; + die("mapping space too small for '$code'\n") if ($mapping ne ''); + $foldPairs[$hashed] .= " { 0x$code, 0x$map1, 0x$map2, 0x$map3 },\n"; + } +} +close(FH); + +for (my $i = 0; $i < 256; $i++) { + $foldPairs[$i] =~ s/,\n\Z//; + my $str = $foldPairs[$i]; + next if $str eq ''; + my $num = '000' . $i; + $num =~ s/\A.*?(\d\d\d)\Z/$1/; + my $sym = "case_fold_${num}"; + print("static const CaseFoldMapping ${sym}[] = {\n$str\n};\n\n"); +} + +print("\nstatic const CaseFoldHashBucket case_fold_hash[256] = {\n"); + +for (my $i = 0; $i < 256; $i++) { + my $str = $foldPairs[$i]; + if ($str eq '') { + print(" { 0, NULL },\n"); + } else { + my $num = '000' . $i; + $num =~ s/\A.*?(\d\d\d)\Z/$1/; + my $sym = "case_fold_${num}"; + print(" { __PHYSFS_ARRAYLEN($sym), $sym },\n"); + } +} +print("};\n\n"); + +exit 0; + +# end of makecashfoldhashtable.pl ... + Property changes on: trunk/extras/makecasefoldhashtable.pl ___________________________________________________________________ Name: svn:executable + * Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/physfs.c 2007-03-15 08:16:23 UTC (rev 840) @@ -426,14 +426,14 @@ /* Look for archivers with matching file extensions first... */ for (i = archivers; (*i != NULL) && (retval == NULL); i++) { - if (__PHYSFS_platformStricmp(ext, (*i)->info->extension) == 0) + if (__PHYSFS_stricmpASCII(ext, (*i)->info->extension) == 0) retval = tryOpenDir(*i, d, forWriting); } /* for */ /* failing an exact file extension match, try all the others... */ for (i = archivers; (*i != NULL) && (retval == NULL); i++) { - if (__PHYSFS_platformStricmp(ext, (*i)->info->extension) != 0) + if (__PHYSFS_stricmpASCII(ext, (*i)->info->extension) != 0) retval = tryOpenDir(*i, d, forWriting); } /* for */ } /* if */ @@ -1133,7 +1133,7 @@ if ((l > extlen) && ((*i)[l - extlen - 1] == '.')) { ext = (*i) + (l - extlen); - if (__PHYSFS_platformStricmp(ext, archiveExt) == 0) + if (__PHYSFS_stricmpASCII(ext, archiveExt) == 0) { const char *d = PHYSFS_getRealDir(*i); size_t allocsize = strlen(d) + strlen(dirsep) + l + 1; Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/physfs.h 2007-03-15 08:16:23 UTC (rev 840) @@ -2061,7 +2061,7 @@ * \param dst Buffer to store converted UTF-8 string. * \param len Size, in bytes, of destination buffer. */ -__EXPORT__ void PHYSFS_utf8fromucs4(const PHYSFS_uint32 *src, char *dst, +__EXPORT__ void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len); /** @@ -2083,7 +2083,7 @@ * \param dst Buffer to store converted UCS-4 string. * \param len Size, in bytes, of destination buffer. */ -__EXPORT__ void PHYSFS_utf8toucs4(const char *src, PHYSFS_uint32 *dst, +__EXPORT__ void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len); /** @@ -2109,7 +2109,7 @@ * \param dst Buffer to store converted UTF-8 string. * \param len Size, in bytes, of destination buffer. */ -__EXPORT__ void PHYSFS_utf8fromucs2(const PHYSFS_uint16 *src, char *dst, +__EXPORT__ void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len); /** @@ -2135,11 +2135,11 @@ * \param dst Buffer to store converted UCS-2 string. * \param len Size, in bytes, of destination buffer. */ -__EXPORT__ void PHYSFS_utf8toucs2(const char *src, PHYSFS_uint16 *dst, +__EXPORT__ void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len); /** - * \fn void PHYSFS_utf8fromlatin1(const char *src, char *dst, PHYSFS_uint64 len) + * \fn void PHYSFS_utf8FromLatin1(const char *src, char *dst, PHYSFS_uint64 len) * \brief Convert a UTF-8 string to a Latin1 string. * * Latin1 strings are 8-bits per character: a popular "high ASCII" @@ -2162,7 +2162,7 @@ * \param dst Buffer to store converted UTF-8 string. * \param len Size, in bytes, of destination buffer. */ -__EXPORT__ void PHYSFS_utf8fromlatin1(const char *src, char *dst, +__EXPORT__ void PHYSFS_utf8FromLatin1(const char *src, char *dst, PHYSFS_uint64 len); /* Everything above this line is part of the PhysicsFS 2.0 API. */ Added: trunk/physfs_casefolding.h =================================================================== --- trunk/physfs_casefolding.h (rev 0) +++ trunk/physfs_casefolding.h 2007-03-15 08:16:23 UTC (rev 840) @@ -0,0 +1,2013 @@ +/* + * This file is part of PhysicsFS (http://icculus.org/physfs/) + * + * This data generated by physfs/extras/makecasefoldhashtable.pl ... + * Do not manually edit this file! + * + * Please see the file LICENSE.txt in the source's root directory. + */ + +#ifndef __PHYSICSFS_INTERNAL__ +#error Do not include this header from your applications. +#endif + +static const CaseFoldMapping case_fold_000[] = { + { 0x0202, 0x0203, 0x0000, 0x0000 }, + { 0x0404, 0x0454, 0x0000, 0x0000 }, + { 0x1E1E, 0x1E1F, 0x0000, 0x0000 }, + { 0x2C2C, 0x2C5C, 0x0000, 0x0000 }, + { 0x10404, 0x1042C, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_001[] = { + { 0x0100, 0x0101, 0x0000, 0x0000 }, + { 0x0405, 0x0455, 0x0000, 0x0000 }, + { 0x0504, 0x0505, 0x0000, 0x0000 }, + { 0x2C2D, 0x2C5D, 0x0000, 0x0000 }, + { 0x10405, 0x1042D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_002[] = { + { 0x0200, 0x0201, 0x0000, 0x0000 }, + { 0x0406, 0x0456, 0x0000, 0x0000 }, + { 0x1E1C, 0x1E1D, 0x0000, 0x0000 }, + { 0x1F1D, 0x1F15, 0x0000, 0x0000 }, + { 0x2C2E, 0x2C5E, 0x0000, 0x0000 }, + { 0x10406, 0x1042E, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_003[] = { + { 0x0102, 0x0103, 0x0000, 0x0000 }, + { 0x0407, 0x0457, 0x0000, 0x0000 }, + { 0x0506, 0x0507, 0x0000, 0x0000 }, + { 0x1F1C, 0x1F14, 0x0000, 0x0000 }, + { 0x10407, 0x1042F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_004[] = { + { 0x0206, 0x0207, 0x0000, 0x0000 }, + { 0x0400, 0x0450, 0x0000, 0x0000 }, + { 0x1E1A, 0x1E1B, 0x0000, 0x0000 }, + { 0x1F1B, 0x1F13, 0x0000, 0x0000 }, + { 0x2C28, 0x2C58, 0x0000, 0x0000 }, + { 0x10400, 0x10428, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_005[] = { + { 0x0104, 0x0105, 0x0000, 0x0000 }, + { 0x0401, 0x0451, 0x0000, 0x0000 }, + { 0x0500, 0x0501, 0x0000, 0x0000 }, + { 0x1F1A, 0x1F12, 0x0000, 0x0000 }, + { 0x2C29, 0x2C59, 0x0000, 0x0000 }, + { 0x10401, 0x10429, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_006[] = { + { 0x0204, 0x0205, 0x0000, 0x0000 }, + { 0x0402, 0x0452, 0x0000, 0x0000 }, + { 0x1E18, 0x1E19, 0x0000, 0x0000 }, + { 0x1F19, 0x1F11, 0x0000, 0x0000 }, + { 0x2C2A, 0x2C5A, 0x0000, 0x0000 }, + { 0x10402, 0x1042A, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_007[] = { + { 0x0106, 0x0107, 0x0000, 0x0000 }, + { 0x0403, 0x0453, 0x0000, 0x0000 }, + { 0x0502, 0x0503, 0x0000, 0x0000 }, + { 0x1F18, 0x1F10, 0x0000, 0x0000 }, + { 0x2126, 0x03C9, 0x0000, 0x0000 }, + { 0x2C2B, 0x2C5B, 0x0000, 0x0000 }, + { 0x10403, 0x1042B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_008[] = { + { 0x020A, 0x020B, 0x0000, 0x0000 }, + { 0x040C, 0x045C, 0x0000, 0x0000 }, + { 0x1E16, 0x1E17, 0x0000, 0x0000 }, + { 0x2C24, 0x2C54, 0x0000, 0x0000 }, + { 0x1040C, 0x10434, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_009[] = { + { 0x0108, 0x0109, 0x0000, 0x0000 }, + { 0x040D, 0x045D, 0x0000, 0x0000 }, + { 0x050C, 0x050D, 0x0000, 0x0000 }, + { 0x2C25, 0x2C55, 0x0000, 0x0000 }, + { 0x1040D, 0x10435, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_010[] = { + { 0x0208, 0x0209, 0x0000, 0x0000 }, + { 0x040E, 0x045E, 0x0000, 0x0000 }, + { 0x1E14, 0x1E15, 0x0000, 0x0000 }, + { 0x212B, 0x00E5, 0x0000, 0x0000 }, + { 0x2C26, 0x2C56, 0x0000, 0x0000 }, + { 0x1040E, 0x10436, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_011[] = { + { 0x010A, 0x010B, 0x0000, 0x0000 }, + { 0x040F, 0x045F, 0x0000, 0x0000 }, + { 0x050E, 0x050F, 0x0000, 0x0000 }, + { 0x212A, 0x006B, 0x0000, 0x0000 }, + { 0x2C27, 0x2C57, 0x0000, 0x0000 }, + { 0x1040F, 0x10437, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_012[] = { + { 0x020E, 0x020F, 0x0000, 0x0000 }, + { 0x0408, 0x0458, 0x0000, 0x0000 }, + { 0x1E12, 0x1E13, 0x0000, 0x0000 }, + { 0x2C20, 0x2C50, 0x0000, 0x0000 }, + { 0x10408, 0x10430, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_013[] = { + { 0x010C, 0x010D, 0x0000, 0x0000 }, + { 0x0409, 0x0459, 0x0000, 0x0000 }, + { 0x0508, 0x0509, 0x0000, 0x0000 }, + { 0x2C21, 0x2C51, 0x0000, 0x0000 }, + { 0x10409, 0x10431, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_014[] = { + { 0x020C, 0x020D, 0x0000, 0x0000 }, + { 0x040A, 0x045A, 0x0000, 0x0000 }, + { 0x1E10, 0x1E11, 0x0000, 0x0000 }, + { 0x2C22, 0x2C52, 0x0000, 0x0000 }, + { 0x1040A, 0x10432, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_015[] = { + { 0x010E, 0x010F, 0x0000, 0x0000 }, + { 0x040B, 0x045B, 0x0000, 0x0000 }, + { 0x050A, 0x050B, 0x0000, 0x0000 }, + { 0x2C23, 0x2C53, 0x0000, 0x0000 }, + { 0x1040B, 0x10433, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_016[] = { + { 0x0212, 0x0213, 0x0000, 0x0000 }, + { 0x0414, 0x0434, 0x0000, 0x0000 }, + { 0x1E0E, 0x1E0F, 0x0000, 0x0000 }, + { 0x1F0F, 0x1F07, 0x0000, 0x0000 }, + { 0x10414, 0x1043C, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_017[] = { + { 0x0110, 0x0111, 0x0000, 0x0000 }, + { 0x0415, 0x0435, 0x0000, 0x0000 }, + { 0x1F0E, 0x1F06, 0x0000, 0x0000 }, + { 0x10415, 0x1043D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_018[] = { + { 0x0210, 0x0211, 0x0000, 0x0000 }, + { 0x0416, 0x0436, 0x0000, 0x0000 }, + { 0x1E0C, 0x1E0D, 0x0000, 0x0000 }, + { 0x1F0D, 0x1F05, 0x0000, 0x0000 }, + { 0x10416, 0x1043E, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_019[] = { + { 0x0112, 0x0113, 0x0000, 0x0000 }, + { 0x0417, 0x0437, 0x0000, 0x0000 }, + { 0x1F0C, 0x1F04, 0x0000, 0x0000 }, + { 0x10417, 0x1043F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_020[] = { + { 0x0216, 0x0217, 0x0000, 0x0000 }, + { 0x0410, 0x0430, 0x0000, 0x0000 }, + { 0x1E0A, 0x1E0B, 0x0000, 0x0000 }, + { 0x1F0B, 0x1F03, 0x0000, 0x0000 }, + { 0x10410, 0x10438, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_021[] = { + { 0x0114, 0x0115, 0x0000, 0x0000 }, + { 0x0411, 0x0431, 0x0000, 0x0000 }, + { 0x1F0A, 0x1F02, 0x0000, 0x0000 }, + { 0x10411, 0x10439, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_022[] = { + { 0x0214, 0x0215, 0x0000, 0x0000 }, + { 0x0412, 0x0432, 0x0000, 0x0000 }, + { 0x1E08, 0x1E09, 0x0000, 0x0000 }, + { 0x1F09, 0x1F01, 0x0000, 0x0000 }, + { 0x10412, 0x1043A, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_023[] = { + { 0x0116, 0x0117, 0x0000, 0x0000 }, + { 0x0413, 0x0433, 0x0000, 0x0000 }, + { 0x1F08, 0x1F00, 0x0000, 0x0000 }, + { 0x10413, 0x1043B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_024[] = { + { 0x021A, 0x021B, 0x0000, 0x0000 }, + { 0x041C, 0x043C, 0x0000, 0x0000 }, + { 0x1E06, 0x1E07, 0x0000, 0x0000 }, + { 0x1041C, 0x10444, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_025[] = { + { 0x0118, 0x0119, 0x0000, 0x0000 }, + { 0x041D, 0x043D, 0x0000, 0x0000 }, + { 0x1041D, 0x10445, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_026[] = { + { 0x0218, 0x0219, 0x0000, 0x0000 }, + { 0x041E, 0x043E, 0x0000, 0x0000 }, + { 0x1E04, 0x1E05, 0x0000, 0x0000 }, + { 0x1041E, 0x10446, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_027[] = { + { 0x011A, 0x011B, 0x0000, 0x0000 }, + { 0x041F, 0x043F, 0x0000, 0x0000 }, + { 0x1041F, 0x10447, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_028[] = { + { 0x021E, 0x021F, 0x0000, 0x0000 }, + { 0x0418, 0x0438, 0x0000, 0x0000 }, + { 0x1E02, 0x1E03, 0x0000, 0x0000 }, + { 0x10418, 0x10440, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_029[] = { + { 0x011C, 0x011D, 0x0000, 0x0000 }, + { 0x0419, 0x0439, 0x0000, 0x0000 }, + { 0x10419, 0x10441, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_030[] = { + { 0x021C, 0x021D, 0x0000, 0x0000 }, + { 0x041A, 0x043A, 0x0000, 0x0000 }, + { 0x1E00, 0x1E01, 0x0000, 0x0000 }, + { 0x1041A, 0x10442, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_031[] = { + { 0x011E, 0x011F, 0x0000, 0x0000 }, + { 0x041B, 0x043B, 0x0000, 0x0000 }, + { 0x1041B, 0x10443, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_032[] = { + { 0x0222, 0x0223, 0x0000, 0x0000 }, + { 0x0424, 0x0444, 0x0000, 0x0000 }, + { 0x1E3E, 0x1E3F, 0x0000, 0x0000 }, + { 0x1F3F, 0x1F37, 0x0000, 0x0000 }, + { 0x2C0C, 0x2C3C, 0x0000, 0x0000 }, + { 0x10424, 0x1044C, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_033[] = { + { 0x0120, 0x0121, 0x0000, 0x0000 }, + { 0x0425, 0x0445, 0x0000, 0x0000 }, + { 0x1F3E, 0x1F36, 0x0000, 0x0000 }, + { 0x2C0D, 0x2C3D, 0x0000, 0x0000 }, + { 0x10425, 0x1044D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_034[] = { + { 0x0220, 0x019E, 0x0000, 0x0000 }, + { 0x0426, 0x0446, 0x0000, 0x0000 }, + { 0x1E3C, 0x1E3D, 0x0000, 0x0000 }, + { 0x1F3D, 0x1F35, 0x0000, 0x0000 }, + { 0x2C0E, 0x2C3E, 0x0000, 0x0000 }, + { 0x10426, 0x1044E, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_035[] = { + { 0x0122, 0x0123, 0x0000, 0x0000 }, + { 0x0427, 0x0447, 0x0000, 0x0000 }, + { 0x1F3C, 0x1F34, 0x0000, 0x0000 }, + { 0x2C0F, 0x2C3F, 0x0000, 0x0000 }, + { 0x10427, 0x1044F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_036[] = { + { 0x0226, 0x0227, 0x0000, 0x0000 }, + { 0x0420, 0x0440, 0x0000, 0x0000 }, + { 0x1E3A, 0x1E3B, 0x0000, 0x0000 }, + { 0x1F3B, 0x1F33, 0x0000, 0x0000 }, + { 0x2C08, 0x2C38, 0x0000, 0x0000 }, + { 0x10420, 0x10448, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_037[] = { + { 0x0124, 0x0125, 0x0000, 0x0000 }, + { 0x0421, 0x0441, 0x0000, 0x0000 }, + { 0x1F3A, 0x1F32, 0x0000, 0x0000 }, + { 0x2C09, 0x2C39, 0x0000, 0x0000 }, + { 0x10421, 0x10449, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_038[] = { + { 0x0224, 0x0225, 0x0000, 0x0000 }, + { 0x0422, 0x0442, 0x0000, 0x0000 }, + { 0x1E38, 0x1E39, 0x0000, 0x0000 }, + { 0x1F39, 0x1F31, 0x0000, 0x0000 }, + { 0x2C0A, 0x2C3A, 0x0000, 0x0000 }, + { 0x10422, 0x1044A, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_039[] = { + { 0x0126, 0x0127, 0x0000, 0x0000 }, + { 0x0423, 0x0443, 0x0000, 0x0000 }, + { 0x1F38, 0x1F30, 0x0000, 0x0000 }, + { 0x2C0B, 0x2C3B, 0x0000, 0x0000 }, + { 0x10423, 0x1044B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_040[] = { + { 0x022A, 0x022B, 0x0000, 0x0000 }, + { 0x042C, 0x044C, 0x0000, 0x0000 }, + { 0x1E36, 0x1E37, 0x0000, 0x0000 }, + { 0x2C04, 0x2C34, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_041[] = { + { 0x0128, 0x0129, 0x0000, 0x0000 }, + { 0x042D, 0x044D, 0x0000, 0x0000 }, + { 0x2C05, 0x2C35, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_042[] = { + { 0x0228, 0x0229, 0x0000, 0x0000 }, + { 0x042E, 0x044E, 0x0000, 0x0000 }, + { 0x1E34, 0x1E35, 0x0000, 0x0000 }, + { 0x2C06, 0x2C36, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_043[] = { + { 0x012A, 0x012B, 0x0000, 0x0000 }, + { 0x042F, 0x044F, 0x0000, 0x0000 }, + { 0x2C07, 0x2C37, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_044[] = { + { 0x022E, 0x022F, 0x0000, 0x0000 }, + { 0x0428, 0x0448, 0x0000, 0x0000 }, + { 0x1E32, 0x1E33, 0x0000, 0x0000 }, + { 0x2C00, 0x2C30, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_045[] = { + { 0x012C, 0x012D, 0x0000, 0x0000 }, + { 0x0429, 0x0449, 0x0000, 0x0000 }, + { 0x2C01, 0x2C31, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_046[] = { + { 0x022C, 0x022D, 0x0000, 0x0000 }, + { 0x042A, 0x044A, 0x0000, 0x0000 }, + { 0x1E30, 0x1E31, 0x0000, 0x0000 }, + { 0x2C02, 0x2C32, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_047[] = { + { 0x012E, 0x012F, 0x0000, 0x0000 }, + { 0x042B, 0x044B, 0x0000, 0x0000 }, + { 0x2C03, 0x2C33, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_048[] = { + { 0x0232, 0x0233, 0x0000, 0x0000 }, + { 0x0535, 0x0565, 0x0000, 0x0000 }, + { 0x1E2E, 0x1E2F, 0x0000, 0x0000 }, + { 0x1F2F, 0x1F27, 0x0000, 0x0000 }, + { 0x2C1C, 0x2C4C, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_049[] = { + { 0x0130, 0x0069, 0x0307, 0x0000 }, + { 0x0534, 0x0564, 0x0000, 0x0000 }, + { 0x1F2E, 0x1F26, 0x0000, 0x0000 }, + { 0x2C1D, 0x2C4D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_050[] = { + { 0x0230, 0x0231, 0x0000, 0x0000 }, + { 0x0537, 0x0567, 0x0000, 0x0000 }, + { 0x1E2C, 0x1E2D, 0x0000, 0x0000 }, + { 0x1F2D, 0x1F25, 0x0000, 0x0000 }, + { 0x2C1E, 0x2C4E, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_051[] = { + { 0x0132, 0x0133, 0x0000, 0x0000 }, + { 0x0536, 0x0566, 0x0000, 0x0000 }, + { 0x1F2C, 0x1F24, 0x0000, 0x0000 }, + { 0x2C1F, 0x2C4F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_052[] = { + { 0x0531, 0x0561, 0x0000, 0x0000 }, + { 0x1E2A, 0x1E2B, 0x0000, 0x0000 }, + { 0x1F2B, 0x1F23, 0x0000, 0x0000 }, + { 0x2C18, 0x2C48, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_053[] = { + { 0x0134, 0x0135, 0x0000, 0x0000 }, + { 0x1F2A, 0x1F22, 0x0000, 0x0000 }, + { 0x2C19, 0x2C49, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_054[] = { + { 0x0533, 0x0563, 0x0000, 0x0000 }, + { 0x1E28, 0x1E29, 0x0000, 0x0000 }, + { 0x1F29, 0x1F21, 0x0000, 0x0000 }, + { 0x2C1A, 0x2C4A, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_055[] = { + { 0x0136, 0x0137, 0x0000, 0x0000 }, + { 0x0532, 0x0562, 0x0000, 0x0000 }, + { 0x1F28, 0x1F20, 0x0000, 0x0000 }, + { 0x2C1B, 0x2C4B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_056[] = { + { 0x0139, 0x013A, 0x0000, 0x0000 }, + { 0x053D, 0x056D, 0x0000, 0x0000 }, + { 0x1E26, 0x1E27, 0x0000, 0x0000 }, + { 0x2C14, 0x2C44, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_057[] = { + { 0x023B, 0x023C, 0x0000, 0x0000 }, + { 0x053C, 0x056C, 0x0000, 0x0000 }, + { 0x2C15, 0x2C45, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_058[] = { + { 0x013B, 0x013C, 0x0000, 0x0000 }, + { 0x053F, 0x056F, 0x0000, 0x0000 }, + { 0x1E24, 0x1E25, 0x0000, 0x0000 }, + { 0x2C16, 0x2C46, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_059[] = { + { 0x053E, 0x056E, 0x0000, 0x0000 }, + { 0x2C17, 0x2C47, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_060[] = { + { 0x013D, 0x013E, 0x0000, 0x0000 }, + { 0x0539, 0x0569, 0x0000, 0x0000 }, + { 0x1E22, 0x1E23, 0x0000, 0x0000 }, + { 0x2C10, 0x2C40, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_061[] = { + { 0x0538, 0x0568, 0x0000, 0x0000 }, + { 0x2C11, 0x2C41, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_062[] = { + { 0x013F, 0x0140, 0x0000, 0x0000 }, + { 0x053B, 0x056B, 0x0000, 0x0000 }, + { 0x1E20, 0x1E21, 0x0000, 0x0000 }, + { 0x2C12, 0x2C42, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_063[] = { + { 0x023D, 0x019A, 0x0000, 0x0000 }, + { 0x053A, 0x056A, 0x0000, 0x0000 }, + { 0x2C13, 0x2C43, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_064[] = { + { 0x0141, 0x0142, 0x0000, 0x0000 }, + { 0x0545, 0x0575, 0x0000, 0x0000 }, + { 0x1E5E, 0x1E5F, 0x0000, 0x0000 }, + { 0x1F5F, 0x1F57, 0x0000, 0x0000 }, + { 0x2161, 0x2171, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_065[] = { + { 0x0041, 0x0061, 0x0000, 0x0000 }, + { 0x0544, 0x0574, 0x0000, 0x0000 }, + { 0x2160, 0x2170, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_066[] = { + { 0x0042, 0x0062, 0x0000, 0x0000 }, + { 0x0143, 0x0144, 0x0000, 0x0000 }, + { 0x0547, 0x0577, 0x0000, 0x0000 }, + { 0x1E5C, 0x1E5D, 0x0000, 0x0000 }, + { 0x1F5D, 0x1F55, 0x0000, 0x0000 }, + { 0x2163, 0x2173, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_067[] = { + { 0x0043, 0x0063, 0x0000, 0x0000 }, + { 0x0241, 0x0294, 0x0000, 0x0000 }, + { 0x0546, 0x0576, 0x0000, 0x0000 }, + { 0x2162, 0x2172, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_068[] = { + { 0x0044, 0x0064, 0x0000, 0x0000 }, + { 0x0145, 0x0146, 0x0000, 0x0000 }, + { 0x0541, 0x0571, 0x0000, 0x0000 }, + { 0x1E5A, 0x1E5B, 0x0000, 0x0000 }, + { 0x1F5B, 0x1F53, 0x0000, 0x0000 }, + { 0x2165, 0x2175, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_069[] = { + { 0x0045, 0x0065, 0x0000, 0x0000 }, + { 0x0540, 0x0570, 0x0000, 0x0000 }, + { 0x2164, 0x2174, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_070[] = { + { 0x0046, 0x0066, 0x0000, 0x0000 }, + { 0x0147, 0x0148, 0x0000, 0x0000 }, + { 0x0345, 0x03B9, 0x0000, 0x0000 }, + { 0x0543, 0x0573, 0x0000, 0x0000 }, + { 0x1E58, 0x1E59, 0x0000, 0x0000 }, + { 0x1F59, 0x1F51, 0x0000, 0x0000 }, + { 0x2167, 0x2177, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_071[] = { + { 0x0047, 0x0067, 0x0000, 0x0000 }, + { 0x0542, 0x0572, 0x0000, 0x0000 }, + { 0x2166, 0x2176, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_072[] = { + { 0x0048, 0x0068, 0x0000, 0x0000 }, + { 0x0149, 0x02BC, 0x006E, 0x0000 }, + { 0x054D, 0x057D, 0x0000, 0x0000 }, + { 0x1E56, 0x1E57, 0x0000, 0x0000 }, + { 0x2169, 0x2179, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_073[] = { + { 0x0049, 0x0069, 0x0000, 0x0000 }, + { 0x054C, 0x057C, 0x0000, 0x0000 }, + { 0x1F56, 0x03C5, 0x0313, 0x0342 }, + { 0x2168, 0x2178, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_074[] = { + { 0x004A, 0x006A, 0x0000, 0x0000 }, + { 0x054F, 0x057F, 0x0000, 0x0000 }, + { 0x1E54, 0x1E55, 0x0000, 0x0000 }, + { 0x216B, 0x217B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_075[] = { + { 0x004B, 0x006B, 0x0000, 0x0000 }, + { 0x014A, 0x014B, 0x0000, 0x0000 }, + { 0x054E, 0x057E, 0x0000, 0x0000 }, + { 0x1F54, 0x03C5, 0x0313, 0x0301 }, + { 0x216A, 0x217A, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_076[] = { + { 0x004C, 0x006C, 0x0000, 0x0000 }, + { 0x0549, 0x0579, 0x0000, 0x0000 }, + { 0x1E52, 0x1E53, 0x0000, 0x0000 }, + { 0x216D, 0x217D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_077[] = { + { 0x004D, 0x006D, 0x0000, 0x0000 }, + { 0x014C, 0x014D, 0x0000, 0x0000 }, + { 0x0548, 0x0578, 0x0000, 0x0000 }, + { 0x1F52, 0x03C5, 0x0313, 0x0300 }, + { 0x216C, 0x217C, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_078[] = { + { 0x004E, 0x006E, 0x0000, 0x0000 }, + { 0x054B, 0x057B, 0x0000, 0x0000 }, + { 0x1E50, 0x1E51, 0x0000, 0x0000 }, + { 0x216F, 0x217F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_079[] = { + { 0x004F, 0x006F, 0x0000, 0x0000 }, + { 0x014E, 0x014F, 0x0000, 0x0000 }, + { 0x054A, 0x057A, 0x0000, 0x0000 }, + { 0x1F50, 0x03C5, 0x0313, 0x0000 }, + { 0x216E, 0x217E, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_080[] = { + { 0x0050, 0x0070, 0x0000, 0x0000 }, + { 0x0555, 0x0585, 0x0000, 0x0000 }, + { 0x1E4E, 0x1E4F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_081[] = { + { 0x0051, 0x0071, 0x0000, 0x0000 }, + { 0x0150, 0x0151, 0x0000, 0x0000 }, + { 0x0554, 0x0584, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_082[] = { + { 0x0052, 0x0072, 0x0000, 0x0000 }, + { 0x1E4C, 0x1E4D, 0x0000, 0x0000 }, + { 0x1F4D, 0x1F45, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_083[] = { + { 0x0053, 0x0073, 0x0000, 0x0000 }, + { 0x0152, 0x0153, 0x0000, 0x0000 }, + { 0x0556, 0x0586, 0x0000, 0x0000 }, + { 0x1F4C, 0x1F44, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_084[] = { + { 0x0054, 0x0074, 0x0000, 0x0000 }, + { 0x0551, 0x0581, 0x0000, 0x0000 }, + { 0x1E4A, 0x1E4B, 0x0000, 0x0000 }, + { 0x1F4B, 0x1F43, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_085[] = { + { 0x0055, 0x0075, 0x0000, 0x0000 }, + { 0x0154, 0x0155, 0x0000, 0x0000 }, + { 0x0550, 0x0580, 0x0000, 0x0000 }, + { 0x1F4A, 0x1F42, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_086[] = { + { 0x0056, 0x0076, 0x0000, 0x0000 }, + { 0x0553, 0x0583, 0x0000, 0x0000 }, + { 0x1E48, 0x1E49, 0x0000, 0x0000 }, + { 0x1F49, 0x1F41, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_087[] = { + { 0x0057, 0x0077, 0x0000, 0x0000 }, + { 0x0156, 0x0157, 0x0000, 0x0000 }, + { 0x0552, 0x0582, 0x0000, 0x0000 }, + { 0x1F48, 0x1F40, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_088[] = { + { 0x0058, 0x0078, 0x0000, 0x0000 }, + { 0x1E46, 0x1E47, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_089[] = { + { 0x0059, 0x0079, 0x0000, 0x0000 }, + { 0x0158, 0x0159, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_090[] = { + { 0x005A, 0x007A, 0x0000, 0x0000 }, + { 0x1E44, 0x1E45, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_091[] = { + { 0x015A, 0x015B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_092[] = { + { 0x1E42, 0x1E43, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_093[] = { + { 0x015C, 0x015D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_094[] = { + { 0x1E40, 0x1E41, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_095[] = { + { 0x015E, 0x015F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_096[] = { + { 0x0464, 0x0465, 0x0000, 0x0000 }, + { 0x1E7E, 0x1E7F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_097[] = { + { 0x0160, 0x0161, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_098[] = { + { 0x0466, 0x0467, 0x0000, 0x0000 }, + { 0x1E7C, 0x1E7D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_099[] = { + { 0x0162, 0x0163, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_100[] = { + { 0x0460, 0x0461, 0x0000, 0x0000 }, + { 0x1E7A, 0x1E7B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_101[] = { + { 0x0164, 0x0165, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_102[] = { + { 0x0462, 0x0463, 0x0000, 0x0000 }, + { 0x1E78, 0x1E79, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_103[] = { + { 0x0166, 0x0167, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_104[] = { + { 0x046C, 0x046D, 0x0000, 0x0000 }, + { 0x1E76, 0x1E77, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_105[] = { + { 0x0168, 0x0169, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_106[] = { + { 0x046E, 0x046F, 0x0000, 0x0000 }, + { 0x1E74, 0x1E75, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_107[] = { + { 0x016A, 0x016B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_108[] = { + { 0x0468, 0x0469, 0x0000, 0x0000 }, + { 0x1E72, 0x1E73, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_109[] = { + { 0x016C, 0x016D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_110[] = { + { 0x046A, 0x046B, 0x0000, 0x0000 }, + { 0x1E70, 0x1E71, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_111[] = { + { 0x016E, 0x016F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_112[] = { + { 0x0474, 0x0475, 0x0000, 0x0000 }, + { 0x1E6E, 0x1E6F, 0x0000, 0x0000 }, + { 0x1F6F, 0x1F67, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_113[] = { + { 0x0170, 0x0171, 0x0000, 0x0000 }, + { 0x1F6E, 0x1F66, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_114[] = { + { 0x0476, 0x0477, 0x0000, 0x0000 }, + { 0x1E6C, 0x1E6D, 0x0000, 0x0000 }, + { 0x1F6D, 0x1F65, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_115[] = { + { 0x0172, 0x0173, 0x0000, 0x0000 }, + { 0x1F6C, 0x1F64, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_116[] = { + { 0x0470, 0x0471, 0x0000, 0x0000 }, + { 0x1E6A, 0x1E6B, 0x0000, 0x0000 }, + { 0x1F6B, 0x1F63, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_117[] = { + { 0x0174, 0x0175, 0x0000, 0x0000 }, + { 0x1F6A, 0x1F62, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_118[] = { + { 0x0472, 0x0473, 0x0000, 0x0000 }, + { 0x1E68, 0x1E69, 0x0000, 0x0000 }, + { 0x1F69, 0x1F61, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_119[] = { + { 0x0176, 0x0177, 0x0000, 0x0000 }, + { 0x1F68, 0x1F60, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_120[] = { + { 0x0179, 0x017A, 0x0000, 0x0000 }, + { 0x047C, 0x047D, 0x0000, 0x0000 }, + { 0x1E66, 0x1E67, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_121[] = { + { 0x0178, 0x00FF, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_122[] = { + { 0x017B, 0x017C, 0x0000, 0x0000 }, + { 0x047E, 0x047F, 0x0000, 0x0000 }, + { 0x1E64, 0x1E65, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_124[] = { + { 0x017D, 0x017E, 0x0000, 0x0000 }, + { 0x0478, 0x0479, 0x0000, 0x0000 }, + { 0x1E62, 0x1E63, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_126[] = { + { 0x017F, 0x0073, 0x0000, 0x0000 }, + { 0x047A, 0x047B, 0x0000, 0x0000 }, + { 0x1E60, 0x1E61, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_128[] = { + { 0x0181, 0x0253, 0x0000, 0x0000 }, + { 0x1F9F, 0x1F27, 0x03B9, 0x0000 }, + { 0x2CAC, 0x2CAD, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_129[] = { + { 0x1F9E, 0x1F26, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_130[] = { + { 0x0587, 0x0565, 0x0582, 0x0000 }, + { 0x1F9D, 0x1F25, 0x03B9, 0x0000 }, + { 0x2CAE, 0x2CAF, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_131[] = { + { 0x0182, 0x0183, 0x0000, 0x0000 }, + { 0x1F9C, 0x1F24, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_132[] = { + { 0x0480, 0x0481, 0x0000, 0x0000 }, + { 0x1E9A, 0x0061, 0x02BE, 0x0000 }, + { 0x1F9B, 0x1F23, 0x03B9, 0x0000 }, + { 0x2CA8, 0x2CA9, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_133[] = { + { 0x0184, 0x0185, 0x0000, 0x0000 }, + { 0x0386, 0x03AC, 0x0000, 0x0000 }, + { 0x1E9B, 0x1E61, 0x0000, 0x0000 }, + { 0x1F9A, 0x1F22, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_134[] = { + { 0x0187, 0x0188, 0x0000, 0x0000 }, + { 0x1E98, 0x0077, 0x030A, 0x0000 }, + { 0x1F99, 0x1F21, 0x03B9, 0x0000 }, + { 0x2CAA, 0x2CAB, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_135[] = { + { 0x0186, 0x0254, 0x0000, 0x0000 }, + { 0x1E99, 0x0079, 0x030A, 0x0000 }, + { 0x1F98, 0x1F20, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_136[] = { + { 0x0189, 0x0256, 0x0000, 0x0000 }, + { 0x048C, 0x048D, 0x0000, 0x0000 }, + { 0x1E96, 0x0068, 0x0331, 0x0000 }, + { 0x1F97, 0x1F27, 0x03B9, 0x0000 }, + { 0x2CA4, 0x2CA5, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_137[] = { + { 0x038A, 0x03AF, 0x0000, 0x0000 }, + { 0x1E97, 0x0074, 0x0308, 0x0000 }, + { 0x1F96, 0x1F26, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_138[] = { + { 0x018B, 0x018C, 0x0000, 0x0000 }, + { 0x0389, 0x03AE, 0x0000, 0x0000 }, + { 0x048E, 0x048F, 0x0000, 0x0000 }, + { 0x1E94, 0x1E95, 0x0000, 0x0000 }, + { 0x1F95, 0x1F25, 0x03B9, 0x0000 }, + { 0x2CA6, 0x2CA7, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_139[] = { + { 0x018A, 0x0257, 0x0000, 0x0000 }, + { 0x0388, 0x03AD, 0x0000, 0x0000 }, + { 0x1F94, 0x1F24, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_140[] = { + { 0x038F, 0x03CE, 0x0000, 0x0000 }, + { 0x1E92, 0x1E93, 0x0000, 0x0000 }, + { 0x1F93, 0x1F23, 0x03B9, 0x0000 }, + { 0x2CA0, 0x2CA1, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_141[] = { + { 0x038E, 0x03CD, 0x0000, 0x0000 }, + { 0x1F92, 0x1F22, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_142[] = { + { 0x018F, 0x0259, 0x0000, 0x0000 }, + { 0x048A, 0x048B, 0x0000, 0x0000 }, + { 0x1E90, 0x1E91, 0x0000, 0x0000 }, + { 0x1F91, 0x1F21, 0x03B9, 0x0000 }, + { 0x2CA2, 0x2CA3, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_143[] = { + { 0x018E, 0x01DD, 0x0000, 0x0000 }, + { 0x038C, 0x03CC, 0x0000, 0x0000 }, + { 0x1F90, 0x1F20, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_144[] = { + { 0x0191, 0x0192, 0x0000, 0x0000 }, + { 0x0393, 0x03B3, 0x0000, 0x0000 }, + { 0x0494, 0x0495, 0x0000, 0x0000 }, + { 0x1E8E, 0x1E8F, 0x0000, 0x0000 }, + { 0x1F8F, 0x1F07, 0x03B9, 0x0000 }, + { 0x2CBC, 0x2CBD, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_145[] = { + { 0x0190, 0x025B, 0x0000, 0x0000 }, + { 0x0392, 0x03B2, 0x0000, 0x0000 }, + { 0x1F8E, 0x1F06, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_146[] = { + { 0x0193, 0x0260, 0x0000, 0x0000 }, + { 0x0391, 0x03B1, 0x0000, 0x0000 }, + { 0x0496, 0x0497, 0x0000, 0x0000 }, + { 0x1E8C, 0x1E8D, 0x0000, 0x0000 }, + { 0x1F8D, 0x1F05, 0x03B9, 0x0000 }, + { 0x24B6, 0x24D0, 0x0000, 0x0000 }, + { 0x2CBE, 0x2CBF, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_147[] = { + { 0x0390, 0x03B9, 0x0308, 0x0301 }, + { 0x1F8C, 0x1F04, 0x03B9, 0x0000 }, + { 0x24B7, 0x24D1, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_148[] = { + { 0x0397, 0x03B7, 0x0000, 0x0000 }, + { 0x0490, 0x0491, 0x0000, 0x0000 }, + { 0x1E8A, 0x1E8B, 0x0000, 0x0000 }, + { 0x1F8B, 0x1F03, 0x03B9, 0x0000 }, + { 0x2CB8, 0x2CB9, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_149[] = { + { 0x0194, 0x0263, 0x0000, 0x0000 }, + { 0x0396, 0x03B6, 0x0000, 0x0000 }, + { 0x1F8A, 0x1F02, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_150[] = { + { 0x0197, 0x0268, 0x0000, 0x0000 }, + { 0x0395, 0x03B5, 0x0000, 0x0000 }, + { 0x0492, 0x0493, 0x0000, 0x0000 }, + { 0x1E88, 0x1E89, 0x0000, 0x0000 }, + { 0x1F89, 0x1F01, 0x03B9, 0x0000 }, + { 0x2CBA, 0x2CBB, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_151[] = { + { 0x0196, 0x0269, 0x0000, 0x0000 }, + { 0x0394, 0x03B4, 0x0000, 0x0000 }, + { 0x1F88, 0x1F00, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_152[] = { + { 0x039B, 0x03BB, 0x0000, 0x0000 }, + { 0x049C, 0x049D, 0x0000, 0x0000 }, + { 0x1E86, 0x1E87, 0x0000, 0x0000 }, + { 0x1F87, 0x1F07, 0x03B9, 0x0000 }, + { 0x24BC, 0x24D6, 0x0000, 0x0000 }, + { 0x2CB4, 0x2CB5, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_153[] = { + { 0x0198, 0x0199, 0x0000, 0x0000 }, + { 0x039A, 0x03BA, 0x0000, 0x0000 }, + { 0x1F86, 0x1F06, 0x03B9, 0x0000 }, + { 0x24BD, 0x24D7, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_154[] = { + { 0x0399, 0x03B9, 0x0000, 0x0000 }, + { 0x049E, 0x049F, 0x0000, 0x0000 }, + { 0x1E84, 0x1E85, 0x0000, 0x0000 }, + { 0x1F85, 0x1F05, 0x03B9, 0x0000 }, + { 0x24BE, 0x24D8, 0x0000, 0x0000 }, + { 0x2CB6, 0x2CB7, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_155[] = { + { 0x0398, 0x03B8, 0x0000, 0x0000 }, + { 0x1F84, 0x1F04, 0x03B9, 0x0000 }, + { 0x24BF, 0x24D9, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_156[] = { + { 0x019D, 0x0272, 0x0000, 0x0000 }, + { 0x039F, 0x03BF, 0x0000, 0x0000 }, + { 0x0498, 0x0499, 0x0000, 0x0000 }, + { 0x1E82, 0x1E83, 0x0000, 0x0000 }, + { 0x1F83, 0x1F03, 0x03B9, 0x0000 }, + { 0x24B8, 0x24D2, 0x0000, 0x0000 }, + { 0x2CB0, 0x2CB1, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_157[] = { + { 0x019C, 0x026F, 0x0000, 0x0000 }, + { 0x039E, 0x03BE, 0x0000, 0x0000 }, + { 0x1F82, 0x1F02, 0x03B9, 0x0000 }, + { 0x24B9, 0x24D3, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_158[] = { + { 0x019F, 0x0275, 0x0000, 0x0000 }, + { 0x039D, 0x03BD, 0x0000, 0x0000 }, + { 0x049A, 0x049B, 0x0000, 0x0000 }, + { 0x1E80, 0x1E81, 0x0000, 0x0000 }, + { 0x1F81, 0x1F01, 0x03B9, 0x0000 }, + { 0x24BA, 0x24D4, 0x0000, 0x0000 }, + { 0x2CB2, 0x2CB3, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_159[] = { + { 0x039C, 0x03BC, 0x0000, 0x0000 }, + { 0x1F80, 0x1F00, 0x03B9, 0x0000 }, + { 0x24BB, 0x24D5, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_160[] = { + { 0x03A3, 0x03C3, 0x0000, 0x0000 }, + { 0x04A4, 0x04A5, 0x0000, 0x0000 }, + { 0x10B0, 0x2D10, 0x0000, 0x0000 }, + { 0x1EBE, 0x1EBF, 0x0000, 0x0000 }, + { 0x2C8C, 0x2C8D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_161[] = { + { 0x01A0, 0x01A1, 0x0000, 0x0000 }, + { 0x10B1, 0x2D11, 0x0000, 0x0000 }, + { 0x1FBE, 0x03B9, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_162[] = { + { 0x03A1, 0x03C1, 0x0000, 0x0000 }, + { 0x04A6, 0x04A7, 0x0000, 0x0000 }, + { 0x10B2, 0x2D12, 0x0000, 0x0000 }, + { 0x1EBC, 0x1EBD, 0x0000, 0x0000 }, + { 0x2C8E, 0x2C8F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_163[] = { + { 0x01A2, 0x01A3, 0x0000, 0x0000 }, + { 0x03A0, 0x03C0, 0x0000, 0x0000 }, + { 0x10B3, 0x2D13, 0x0000, 0x0000 }, + { 0x1FBC, 0x03B1, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_164[] = { + { 0x03A7, 0x03C7, 0x0000, 0x0000 }, + { 0x04A0, 0x04A1, 0x0000, 0x0000 }, + { 0x10B4, 0x2D14, 0x0000, 0x0000 }, + { 0x1EBA, 0x1EBB, 0x0000, 0x0000 }, + { 0x1FBB, 0x1F71, 0x0000, 0x0000 }, + { 0x2C88, 0x2C89, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_165[] = { + { 0x01A4, 0x01A5, 0x0000, 0x0000 }, + { 0x03A6, 0x03C6, 0x0000, 0x0000 }, + { 0x10B5, 0x2D15, 0x0000, 0x0000 }, + { 0x1FBA, 0x1F70, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_166[] = { + { 0x01A7, 0x01A8, 0x0000, 0x0000 }, + { 0x03A5, 0x03C5, 0x0000, 0x0000 }, + { 0x04A2, 0x04A3, 0x0000, 0x0000 }, + { 0x10B6, 0x2D16, 0x0000, 0x0000 }, + { 0x1EB8, 0x1EB9, 0x0000, 0x0000 }, + { 0x1FB9, 0x1FB1, 0x0000, 0x0000 }, + { 0x2C8A, 0x2C8B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_167[] = { + { 0x01A6, 0x0280, 0x0000, 0x0000 }, + { 0x03A4, 0x03C4, 0x0000, 0x0000 }, + { 0x10B7, 0x2D17, 0x0000, 0x0000 }, + { 0x1FB8, 0x1FB0, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_168[] = { + { 0x01A9, 0x0283, 0x0000, 0x0000 }, + { 0x03AB, 0x03CB, 0x0000, 0x0000 }, + { 0x04AC, 0x04AD, 0x0000, 0x0000 }, + { 0x10B8, 0x2D18, 0x0000, 0x0000 }, + { 0x1EB6, 0x1EB7, 0x0000, 0x0000 }, + { 0x1FB7, 0x03B1, 0x0342, 0x03B9 }, + { 0x2C84, 0x2C85, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_169[] = { + { 0x03AA, 0x03CA, 0x0000, 0x0000 }, + { 0x10B9, 0x2D19, 0x0000, 0x0000 }, + { 0x1FB6, 0x03B1, 0x0342, 0x0000 } +}; + +static const CaseFoldMapping case_fold_170[] = { + { 0x03A9, 0x03C9, 0x0000, 0x0000 }, + { 0x04AE, 0x04AF, 0x0000, 0x0000 }, + { 0x10BA, 0x2D1A, 0x0000, 0x0000 }, + { 0x1EB4, 0x1EB5, 0x0000, 0x0000 }, + { 0x2C86, 0x2C87, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_171[] = { + { 0x03A8, 0x03C8, 0x0000, 0x0000 }, + { 0x10BB, 0x2D1B, 0x0000, 0x0000 }, + { 0x1FB4, 0x03AC, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_172[] = { + { 0x04A8, 0x04A9, 0x0000, 0x0000 }, + { 0x10BC, 0x2D1C, 0x0000, 0x0000 }, + { 0x1EB2, 0x1EB3, 0x0000, 0x0000 }, + { 0x1FB3, 0x03B1, 0x03B9, 0x0000 }, + { 0x2C80, 0x2C81, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_173[] = { + { 0x01AC, 0x01AD, 0x0000, 0x0000 }, + { 0x10BD, 0x2D1D, 0x0000, 0x0000 }, + { 0x1FB2, 0x1F70, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_174[] = { + { 0x01AF, 0x01B0, 0x0000, 0x0000 }, + { 0x04AA, 0x04AB, 0x0000, 0x0000 }, + { 0x10BE, 0x2D1E, 0x0000, 0x0000 }, + { 0x1EB0, 0x1EB1, 0x0000, 0x0000 }, + { 0x2C82, 0x2C83, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_175[] = { + { 0x01AE, 0x0288, 0x0000, 0x0000 }, + { 0x10BF, 0x2D1F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_176[] = { + { 0x01B1, 0x028A, 0x0000, 0x0000 }, + { 0x04B4, 0x04B5, 0x0000, 0x0000 }, + { 0x10A0, 0x2D00, 0x0000, 0x0000 }, + { 0x1EAE, 0x1EAF, 0x0000, 0x0000 }, + { 0x1FAF, 0x1F67, 0x03B9, 0x0000 }, + { 0x2C9C, 0x2C9D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_177[] = { + { 0x10A1, 0x2D01, 0x0000, 0x0000 }, + { 0x1FAE, 0x1F66, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_178[] = { + { 0x01B3, 0x01B4, 0x0000, 0x0000 }, + { 0x04B6, 0x04B7, 0x0000, 0x0000 }, + { 0x10A2, 0x2D02, 0x0000, 0x0000 }, + { 0x1EAC, 0x1EAD, 0x0000, 0x0000 }, + { 0x1FAD, 0x1F65, 0x03B9, 0x0000 }, + { 0x2C9E, 0x2C9F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_179[] = { + { 0x01B2, 0x028B, 0x0000, 0x0000 }, + { 0x03B0, 0x03C5, 0x0308, 0x0301 }, + { 0x10A3, 0x2D03, 0x0000, 0x0000 }, + { 0x1FAC, 0x1F64, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_180[] = { + { 0x01B5, 0x01B6, 0x0000, 0x0000 }, + { 0x04B0, 0x04B1, 0x0000, 0x0000 }, + { 0x10A4, 0x2D04, 0x0000, 0x0000 }, + { 0x1EAA, 0x1EAB, 0x0000, 0x0000 }, + { 0x1FAB, 0x1F63, 0x03B9, 0x0000 }, + { 0x2C98, 0x2C99, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_181[] = { + { 0x00B5, 0x03BC, 0x0000, 0x0000 }, + { 0x10A5, 0x2D05, 0x0000, 0x0000 }, + { 0x1FAA, 0x1F62, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_182[] = { + { 0x01B7, 0x0292, 0x0000, 0x0000 }, + { 0x04B2, 0x04B3, 0x0000, 0x0000 }, + { 0x10A6, 0x2D06, 0x0000, 0x0000 }, + { 0x1EA8, 0x1EA9, 0x0000, 0x0000 }, + { 0x1FA9, 0x1F61, 0x03B9, 0x0000 }, + { 0x2C9A, 0x2C9B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_183[] = { + { 0x10A7, 0x2D07, 0x0000, 0x0000 }, + { 0x1FA8, 0x1F60, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_184[] = { + { 0x04BC, 0x04BD, 0x0000, 0x0000 }, + { 0x10A8, 0x2D08, 0x0000, 0x0000 }, + { 0x1EA6, 0x1EA7, 0x0000, 0x0000 }, + { 0x1FA7, 0x1F67, 0x03B9, 0x0000 }, + { 0x2C94, 0x2C95, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_185[] = { + { 0x01B8, 0x01B9, 0x0000, 0x0000 }, + { 0x10A9, 0x2D09, 0x0000, 0x0000 }, + { 0x1FA6, 0x1F66, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_186[] = { + { 0x04BE, 0x04BF, 0x0000, 0x0000 }, + { 0x10AA, 0x2D0A, 0x0000, 0x0000 }, + { 0x1EA4, 0x1EA5, 0x0000, 0x0000 }, + { 0x1FA5, 0x1F65, 0x03B9, 0x0000 }, + { 0x2C96, 0x2C97, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_187[] = { + { 0x10AB, 0x2D0B, 0x0000, 0x0000 }, + { 0x1FA4, 0x1F64, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_188[] = { + { 0x04B8, 0x04B9, 0x0000, 0x0000 }, + { 0x10AC, 0x2D0C, 0x0000, 0x0000 }, + { 0x1EA2, 0x1EA3, 0x0000, 0x0000 }, + { 0x1FA3, 0x1F63, 0x03B9, 0x0000 }, + { 0x2C90, 0x2C91, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_189[] = { + { 0x01BC, 0x01BD, 0x0000, 0x0000 }, + { 0x10AD, 0x2D0D, 0x0000, 0x0000 }, + { 0x1FA2, 0x1F62, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_190[] = { + { 0x04BA, 0x04BB, 0x0000, 0x0000 }, + { 0x10AE, 0x2D0E, 0x0000, 0x0000 }, + { 0x1EA0, 0x1EA1, 0x0000, 0x0000 }, + { 0x1FA1, 0x1F61, 0x03B9, 0x0000 }, + { 0x2C92, 0x2C93, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_191[] = { + { 0x10AF, 0x2D0F, 0x0000, 0x0000 }, + { 0x1FA0, 0x1F60, 0x03B9, 0x0000 } +}; + +static const CaseFoldMapping case_fold_192[] = { + { 0x00C0, 0x00E0, 0x0000, 0x0000 }, + { 0x1EDE, 0x1EDF, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_193[] = { + { 0x00C1, 0x00E1, 0x0000, 0x0000 }, + { 0x03C2, 0x03C3, 0x0000, 0x0000 }, + { 0x04C5, 0x04C6, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_194[] = { + { 0x00C2, 0x00E2, 0x0000, 0x0000 }, + { 0x1EDC, 0x1EDD, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_195[] = { + { 0x00C3, 0x00E3, 0x0000, 0x0000 }, + { 0x04C7, 0x04C8, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_196[] = { + { 0x00C4, 0x00E4, 0x0000, 0x0000 }, + { 0x01C5, 0x01C6, 0x0000, 0x0000 }, + { 0x1EDA, 0x1EDB, 0x0000, 0x0000 }, + { 0x1FDB, 0x1F77, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_197[] = { + { 0x00C5, 0x00E5, 0x0000, 0x0000 }, + { 0x01C4, 0x01C6, 0x0000, 0x0000 }, + { 0x04C1, 0x04C2, 0x0000, 0x0000 }, + { 0x1FDA, 0x1F76, 0x0000, 0x0000 }, + { 0xFF3A, 0xFF5A, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_198[] = { + { 0x00C6, 0x00E6, 0x0000, 0x0000 }, + { 0x01C7, 0x01C9, 0x0000, 0x0000 }, + { 0x1ED8, 0x1ED9, 0x0000, 0x0000 }, + { 0x1FD9, 0x1FD1, 0x0000, 0x0000 }, + { 0xFF39, 0xFF59, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_199[] = { + { 0x00C7, 0x00E7, 0x0000, 0x0000 }, + { 0x04C3, 0x04C4, 0x0000, 0x0000 }, + { 0x1FD8, 0x1FD0, 0x0000, 0x0000 }, + { 0xFF38, 0xFF58, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_200[] = { + { 0x00C8, 0x00E8, 0x0000, 0x0000 }, + { 0x1ED6, 0x1ED7, 0x0000, 0x0000 }, + { 0x1FD7, 0x03B9, 0x0308, 0x0342 }, + { 0xFF37, 0xFF57, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_201[] = { + { 0x00C9, 0x00E9, 0x0000, 0x0000 }, + { 0x01C8, 0x01C9, 0x0000, 0x0000 }, + { 0x04CD, 0x04CE, 0x0000, 0x0000 }, + { 0x1FD6, 0x03B9, 0x0342, 0x0000 }, + { 0xFF36, 0xFF56, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_202[] = { + { 0x00CA, 0x00EA, 0x0000, 0x0000 }, + { 0x01CB, 0x01CC, 0x0000, 0x0000 }, + { 0x1ED4, 0x1ED5, 0x0000, 0x0000 }, + { 0xFF35, 0xFF55, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_203[] = { + { 0x00CB, 0x00EB, 0x0000, 0x0000 }, + { 0x01CA, 0x01CC, 0x0000, 0x0000 }, + { 0xFF34, 0xFF54, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_204[] = { + { 0x00CC, 0x00EC, 0x0000, 0x0000 }, + { 0x01CD, 0x01CE, 0x0000, 0x0000 }, + { 0x1ED2, 0x1ED3, 0x0000, 0x0000 }, + { 0x1FD3, 0x03B9, 0x0308, 0x0301 }, + { 0x2CE0, 0x2CE1, 0x0000, 0x0000 }, + { 0xFF33, 0xFF53, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_205[] = { + { 0x00CD, 0x00ED, 0x0000, 0x0000 }, + { 0x04C9, 0x04CA, 0x0000, 0x0000 }, + { 0x1FD2, 0x03B9, 0x0308, 0x0300 }, + { 0xFF32, 0xFF52, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_206[] = { + { 0x00CE, 0x00EE, 0x0000, 0x0000 }, + { 0x01CF, 0x01D0, 0x0000, 0x0000 }, + { 0x1ED0, 0x1ED1, 0x0000, 0x0000 }, + { 0x2CE2, 0x2CE3, 0x0000, 0x0000 }, + { 0xFF31, 0xFF51, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_207[] = { + { 0x00CF, 0x00EF, 0x0000, 0x0000 }, + { 0x04CB, 0x04CC, 0x0000, 0x0000 }, + { 0xFF30, 0xFF50, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_208[] = { + { 0x00D0, 0x00F0, 0x0000, 0x0000 }, + { 0x01D1, 0x01D2, 0x0000, 0x0000 }, + { 0x04D4, 0x04D5, 0x0000, 0x0000 }, + { 0x10C0, 0x2D20, 0x0000, 0x0000 }, + { 0x1ECE, 0x1ECF, 0x0000, 0x0000 }, + { 0xFF2F, 0xFF4F, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_209[] = { + { 0x00D1, 0x00F1, 0x0000, 0x0000 }, + { 0x10C1, 0x2D21, 0x0000, 0x0000 }, + { 0xFF2E, 0xFF4E, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_210[] = { + { 0x00D2, 0x00F2, 0x0000, 0x0000 }, + { 0x01D3, 0x01D4, 0x0000, 0x0000 }, + { 0x03D1, 0x03B8, 0x0000, 0x0000 }, + { 0x04D6, 0x04D7, 0x0000, 0x0000 }, + { 0x10C2, 0x2D22, 0x0000, 0x0000 }, + { 0x1ECC, 0x1ECD, 0x0000, 0x0000 }, + { 0xFF2D, 0xFF4D, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_211[] = { + { 0x00D3, 0x00F3, 0x0000, 0x0000 }, + { 0x03D0, 0x03B2, 0x0000, 0x0000 }, + { 0x10C3, 0x2D23, 0x0000, 0x0000 }, + { 0x1FCC, 0x03B7, 0x03B9, 0x0000 }, + { 0xFF2C, 0xFF4C, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_212[] = { + { 0x00D4, 0x00F4, 0x0000, 0x0000 }, + { 0x01D5, 0x01D6, 0x0000, 0x0000 }, + { 0x04D0, 0x04D1, 0x0000, 0x0000 }, + { 0x10C4, 0x2D24, 0x0000, 0x0000 }, + { 0x1ECA, 0x1ECB, 0x0000, 0x0000 }, + { 0x1FCB, 0x1F75, 0x0000, 0x0000 }, + { 0xFF2B, 0xFF4B, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_213[] = { + { 0x00D5, 0x00F5, 0x0000, 0x0000 }, + { 0x03D6, 0x03C0, 0x0000, 0x0000 }, + { 0x10C5, 0x2D25, 0x0000, 0x0000 }, + { 0x1FCA, 0x1F74, 0x0000, 0x0000 }, + { 0xFF2A, 0xFF4A, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_214[] = { + { 0x00D6, 0x00F6, 0x0000, 0x0000 }, + { 0x01D7, 0x01D8, 0x0000, 0x0000 }, + { 0x03D5, 0x03C6, 0x0000, 0x0000 }, + { 0x04D2, 0x04D3, 0x0000, 0x0000 }, + { 0x1EC8, 0x1EC9, 0x0000, 0x0000 }, + { 0x1FC9, 0x1F73, 0x0000, 0x0000 }, + { 0xFF29, 0xFF49, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_215[] = { + { 0x1FC8, 0x1F72, 0x0000, 0x0000 }, + { 0xFF28, 0xFF48, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_216[] = { + { 0x00D8, 0x00F8, 0x0000, 0x0000 }, + { 0x01D9, 0x01DA, 0x0000, 0x0000 }, + { 0x04DC, 0x04DD, 0x0000, 0x0000 }, + { 0x1EC6, 0x1EC7, 0x0000, 0x0000 }, + { 0x1FC7, 0x03B7, 0x0342, 0x03B9 }, + { 0xFF27, 0xFF47, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_217[] = { + { 0x00D9, 0x00F9, 0x0000, 0x0000 }, + { 0x03DA, 0x03DB, 0x0000, 0x0000 }, + { 0x1FC6, 0x03B7, 0x0342, 0x0000 }, + { 0xFF26, 0xFF46, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_218[] = { + { 0x00DA, 0x00FA, 0x0000, 0x0000 }, + { 0x01DB, 0x01DC, 0x0000, 0x0000 }, + { 0x04DE, 0x04DF, 0x0000, 0x0000 }, + { 0x1EC4, 0x1EC5, 0x0000, 0x0000 }, + { 0xFF25, 0xFF45, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_219[] = { + { 0x00DB, 0x00FB, 0x0000, 0x0000 }, + { 0x03D8, 0x03D9, 0x0000, 0x0000 }, + { 0x1FC4, 0x03AE, 0x03B9, 0x0000 }, + { 0xFF24, 0xFF44, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_220[] = { + { 0x00DC, 0x00FC, 0x0000, 0x0000 }, + { 0x04D8, 0x04D9, 0x0000, 0x0000 }, + { 0x1EC2, 0x1EC3, 0x0000, 0x0000 }, + { 0x1FC3, 0x03B7, 0x03B9, 0x0000 }, + { 0xFF23, 0xFF43, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_221[] = { + { 0x00DD, 0x00FD, 0x0000, 0x0000 }, + { 0x03DE, 0x03DF, 0x0000, 0x0000 }, + { 0x1FC2, 0x1F74, 0x03B9, 0x0000 }, + { 0xFF22, 0xFF42, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_222[] = { + { 0x00DE, 0x00FE, 0x0000, 0x0000 }, + { 0x04DA, 0x04DB, 0x0000, 0x0000 }, + { 0x1EC0, 0x1EC1, 0x0000, 0x0000 }, + { 0xFF21, 0xFF41, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_223[] = { + { 0x00DF, 0x0073, 0x0073, 0x0000 }, + { 0x01DE, 0x01DF, 0x0000, 0x0000 }, + { 0x03DC, 0x03DD, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_224[] = { + { 0x04E4, 0x04E5, 0x0000, 0x0000 }, + { 0x24C4, 0x24DE, 0x0000, 0x0000 }, + { 0x2CCC, 0x2CCD, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_225[] = { + { 0x01E0, 0x01E1, 0x0000, 0x0000 }, + { 0x03E2, 0x03E3, 0x0000, 0x0000 }, + { 0x24C5, 0x24DF, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_226[] = { + { 0x04E6, 0x04E7, 0x0000, 0x0000 }, + { 0x24C6, 0x24E0, 0x0000, 0x0000 }, + { 0x2CCE, 0x2CCF, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_227[] = { + { 0x01E2, 0x01E3, 0x0000, 0x0000 }, + { 0x03E0, 0x03E1, 0x0000, 0x0000 }, + { 0x1FFC, 0x03C9, 0x03B9, 0x0000 }, + { 0x24C7, 0x24E1, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_228[] = { + { 0x04E0, 0x04E1, 0x0000, 0x0000 }, + { 0x1FFB, 0x1F7D, 0x0000, 0x0000 }, + { 0x24C0, 0x24DA, 0x0000, 0x0000 }, + { 0x2CC8, 0x2CC9, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_229[] = { + { 0x01E4, 0x01E5, 0x0000, 0x0000 }, + { 0x03E6, 0x03E7, 0x0000, 0x0000 }, + { 0x1FFA, 0x1F7C, 0x0000, 0x0000 }, + { 0x24C1, 0x24DB, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_230[] = { + { 0x04E2, 0x04E3, 0x0000, 0x0000 }, + { 0x1EF8, 0x1EF9, 0x0000, 0x0000 }, + { 0x1FF9, 0x1F79, 0x0000, 0x0000 }, + { 0x24C2, 0x24DC, 0x0000, 0x0000 }, + { 0x2CCA, 0x2CCB, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_231[] = { + { 0x01E6, 0x01E7, 0x0000, 0x0000 }, + { 0x03E4, 0x03E5, 0x0000, 0x0000 }, + { 0x1FF8, 0x1F78, 0x0000, 0x0000 }, + { 0x24C3, 0x24DD, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_232[] = { + { 0x04EC, 0x04ED, 0x0000, 0x0000 }, + { 0x1EF6, 0x1EF7, 0x0000, 0x0000 }, + { 0x1FF7, 0x03C9, 0x0342, 0x03B9 }, + { 0x24CC, 0x24E6, 0x0000, 0x0000 }, + { 0x2CC4, 0x2CC5, 0x0000, 0x0000 }, + { 0xFB13, 0x0574, 0x0576, 0x0000 } +}; + +static const CaseFoldMapping case_fold_233[] = { + { 0x01E8, 0x01E9, 0x0000, 0x0000 }, + { 0x03EA, 0x03EB, 0x0000, 0x0000 }, + { 0x1FF6, 0x03C9, 0x0342, 0x0000 }, + { 0x24CD, 0x24E7, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_234[] = { + { 0x04EE, 0x04EF, 0x0000, 0x0000 }, + { 0x1EF4, 0x1EF5, 0x0000, 0x0000 }, + { 0x24CE, 0x24E8, 0x0000, 0x0000 }, + { 0x2CC6, 0x2CC7, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_235[] = { + { 0x01EA, 0x01EB, 0x0000, 0x0000 }, + { 0x03E8, 0x03E9, 0x0000, 0x0000 }, + { 0x1FF4, 0x03CE, 0x03B9, 0x0000 }, + { 0x24CF, 0x24E9, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_236[] = { + { 0x04E8, 0x04E9, 0x0000, 0x0000 }, + { 0x1EF2, 0x1EF3, 0x0000, 0x0000 }, + { 0x1FF3, 0x03C9, 0x03B9, 0x0000 }, + { 0x24C8, 0x24E2, 0x0000, 0x0000 }, + { 0x2CC0, 0x2CC1, 0x0000, 0x0000 }, + { 0xFB17, 0x0574, 0x056D, 0x0000 } +}; + +static const CaseFoldMapping case_fold_237[] = { + { 0x01EC, 0x01ED, 0x0000, 0x0000 }, + { 0x03EE, 0x03EF, 0x0000, 0x0000 }, + { 0x1FF2, 0x1F7C, 0x03B9, 0x0000 }, + { 0x24C9, 0x24E3, 0x0000, 0x0000 }, + { 0xFB16, 0x057E, 0x0576, 0x0000 } +}; + +static const CaseFoldMapping case_fold_238[] = { + { 0x04EA, 0x04EB, 0x0000, 0x0000 }, + { 0x1EF0, 0x1EF1, 0x0000, 0x0000 }, + { 0x24CA, 0x24E4, 0x0000, 0x0000 }, + { 0x2CC2, 0x2CC3, 0x0000, 0x0000 }, + { 0xFB15, 0x0574, 0x056B, 0x0000 } +}; + +static const CaseFoldMapping case_fold_239[] = { + { 0x01EE, 0x01EF, 0x0000, 0x0000 }, + { 0x03EC, 0x03ED, 0x0000, 0x0000 }, + { 0x24CB, 0x24E5, 0x0000, 0x0000 }, + { 0xFB14, 0x0574, 0x0565, 0x0000 } +}; + +static const CaseFoldMapping case_fold_240[] = { + { 0x01F1, 0x01F3, 0x0000, 0x0000 }, + { 0x04F4, 0x04F5, 0x0000, 0x0000 }, + { 0x1EEE, 0x1EEF, 0x0000, 0x0000 }, + { 0x2CDC, 0x2CDD, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_241[] = { + { 0x01F0, 0x006A, 0x030C, 0x0000 } +}; + +static const CaseFoldMapping case_fold_242[] = { + { 0x03F1, 0x03C1, 0x0000, 0x0000 }, + { 0x04F6, 0x04F7, 0x0000, 0x0000 }, + { 0x1EEC, 0x1EED, 0x0000, 0x0000 }, + { 0x2CDE, 0x2CDF, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_243[] = { + { 0x01F2, 0x01F3, 0x0000, 0x0000 }, + { 0x03F0, 0x03BA, 0x0000, 0x0000 }, + { 0x1FEC, 0x1FE5, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_244[] = { + { 0x03F7, 0x03F8, 0x0000, 0x0000 }, + { 0x04F0, 0x04F1, 0x0000, 0x0000 }, + { 0x1EEA, 0x1EEB, 0x0000, 0x0000 }, + { 0x1FEB, 0x1F7B, 0x0000, 0x0000 }, + { 0x2CD8, 0x2CD9, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_245[] = { + { 0x01F4, 0x01F5, 0x0000, 0x0000 }, + { 0x1FEA, 0x1F7A, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_246[] = { + { 0x01F7, 0x01BF, 0x0000, 0x0000 }, + { 0x03F5, 0x03B5, 0x0000, 0x0000 }, + { 0x04F2, 0x04F3, 0x0000, 0x0000 }, + { 0x1EE8, 0x1EE9, 0x0000, 0x0000 }, + { 0x1FE9, 0x1FE1, 0x0000, 0x0000 }, + { 0x2CDA, 0x2CDB, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_247[] = { + { 0x01F6, 0x0195, 0x0000, 0x0000 }, + { 0x03F4, 0x03B8, 0x0000, 0x0000 }, + { 0x1FE8, 0x1FE0, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_248[] = { + { 0x1EE6, 0x1EE7, 0x0000, 0x0000 }, + { 0x1FE7, 0x03C5, 0x0308, 0x0342 }, + { 0x2CD4, 0x2CD5, 0x0000, 0x0000 }, + { 0xFB03, 0x0066, 0x0066, 0x0069 } +}; + +static const CaseFoldMapping case_fold_249[] = { + { 0x01F8, 0x01F9, 0x0000, 0x0000 }, + { 0x03FA, 0x03FB, 0x0000, 0x0000 }, + { 0x1FE6, 0x03C5, 0x0342, 0x0000 }, + { 0xFB02, 0x0066, 0x006C, 0x0000 } +}; + +static const CaseFoldMapping case_fold_250[] = { + { 0x03F9, 0x03F2, 0x0000, 0x0000 }, + { 0x1EE4, 0x1EE5, 0x0000, 0x0000 }, + { 0x2CD6, 0x2CD7, 0x0000, 0x0000 }, + { 0xFB01, 0x0066, 0x0069, 0x0000 } +}; + +static const CaseFoldMapping case_fold_251[] = { + { 0x01FA, 0x01FB, 0x0000, 0x0000 }, + { 0x1FE4, 0x03C1, 0x0313, 0x0000 }, + { 0xFB00, 0x0066, 0x0066, 0x0000 } +}; + +static const CaseFoldMapping case_fold_252[] = { + { 0x04F8, 0x04F9, 0x0000, 0x0000 }, + { 0x1EE2, 0x1EE3, 0x0000, 0x0000 }, + { 0x1FE3, 0x03C5, 0x0308, 0x0301 }, + { 0x2CD0, 0x2CD1, 0x0000, 0x0000 } +}; + +static const CaseFoldMapping case_fold_253[] = { + { 0x01FC, 0x01FD, 0x0000, 0x0000 }, + { 0x1FE2, 0x03C5, 0x0308, 0x0300 }, + { 0xFB06, 0x0073, 0x0074, 0x0000 } +}; + +static const CaseFoldMapping case_fold_254[] = { + { 0x1EE0, 0x1EE1, 0x0000, 0x0000 }, + { 0x2CD2, 0x2CD3, 0x0000, 0x0000 }, + { 0xFB05, 0x0073, 0x0074, 0x0000 } +}; + +static const CaseFoldMapping case_fold_255[] = { + { 0x01FE, 0x01FF, 0x0000, 0x0000 }, + { 0xFB04, 0x0066, 0x0066, 0x006C } +}; + + +static const CaseFoldHashBucket case_fold_hash[256] = { + { __PHYSFS_ARRAYLEN(case_fold_000), case_fold_000 }, + { __PHYSFS_ARRAYLEN(case_fold_001), case_fold_001 }, + { __PHYSFS_ARRAYLEN(case_fold_002), case_fold_002 }, + { __PHYSFS_ARRAYLEN(case_fold_003), case_fold_003 }, + { __PHYSFS_ARRAYLEN(case_fold_004), case_fold_004 }, + { __PHYSFS_ARRAYLEN(case_fold_005), case_fold_005 }, + { __PHYSFS_ARRAYLEN(case_fold_006), case_fold_006 }, + { __PHYSFS_ARRAYLEN(case_fold_007), case_fold_007 }, + { __PHYSFS_ARRAYLEN(case_fold_008), case_fold_008 }, + { __PHYSFS_ARRAYLEN(case_fold_009), case_fold_009 }, + { __PHYSFS_ARRAYLEN(case_fold_010), case_fold_010 }, + { __PHYSFS_ARRAYLEN(case_fold_011), case_fold_011 }, + { __PHYSFS_ARRAYLEN(case_fold_012), case_fold_012 }, + { __PHYSFS_ARRAYLEN(case_fold_013), case_fold_013 }, + { __PHYSFS_ARRAYLEN(case_fold_014), case_fold_014 }, + { __PHYSFS_ARRAYLEN(case_fold_015), case_fold_015 }, + { __PHYSFS_ARRAYLEN(case_fold_016), case_fold_016 }, + { __PHYSFS_ARRAYLEN(case_fold_017), case_fold_017 }, + { __PHYSFS_ARRAYLEN(case_fold_018), case_fold_018 }, + { __PHYSFS_ARRAYLEN(case_fold_019), case_fold_019 }, + { __PHYSFS_ARRAYLEN(case_fold_020), case_fold_020 }, + { __PHYSFS_ARRAYLEN(case_fold_021), case_fold_021 }, + { __PHYSFS_ARRAYLEN(case_fold_022), case_fold_022 }, + { __PHYSFS_ARRAYLEN(case_fold_023), case_fold_023 }, + { __PHYSFS_ARRAYLEN(case_fold_024), case_fold_024 }, + { __PHYSFS_ARRAYLEN(case_fold_025), case_fold_025 }, + { __PHYSFS_ARRAYLEN(case_fold_026), case_fold_026 }, + { __PHYSFS_ARRAYLEN(case_fold_027), case_fold_027 }, + { __PHYSFS_ARRAYLEN(case_fold_028), case_fold_028 }, + { __PHYSFS_ARRAYLEN(case_fold_029), case_fold_029 }, + { __PHYSFS_ARRAYLEN(case_fold_030), case_fold_030 }, + { __PHYSFS_ARRAYLEN(case_fold_031), case_fold_031 }, + { __PHYSFS_ARRAYLEN(case_fold_032), case_fold_032 }, + { __PHYSFS_ARRAYLEN(case_fold_033), case_fold_033 }, + { __PHYSFS_ARRAYLEN(case_fold_034), case_fold_034 }, + { __PHYSFS_ARRAYLEN(case_fold_035), case_fold_035 }, + { __PHYSFS_ARRAYLEN(case_fold_036), case_fold_036 }, + { __PHYSFS_ARRAYLEN(case_fold_037), case_fold_037 }, + { __PHYSFS_ARRAYLEN(case_fold_038), case_fold_038 }, + { __PHYSFS_ARRAYLEN(case_fold_039), case_fold_039 }, + { __PHYSFS_ARRAYLEN(case_fold_040), case_fold_040 }, + { __PHYSFS_ARRAYLEN(case_fold_041), case_fold_041 }, + { __PHYSFS_ARRAYLEN(case_fold_042), case_fold_042 }, + { __PHYSFS_ARRAYLEN(case_fold_043), case_fold_043 }, + { __PHYSFS_ARRAYLEN(case_fold_044), case_fold_044 }, + { __PHYSFS_ARRAYLEN(case_fold_045), case_fold_045 }, + { __PHYSFS_ARRAYLEN(case_fold_046), case_fold_046 }, + { __PHYSFS_ARRAYLEN(case_fold_047), case_fold_047 }, + { __PHYSFS_ARRAYLEN(case_fold_048), case_fold_048 }, + { __PHYSFS_ARRAYLEN(case_fold_049), case_fold_049 }, + { __PHYSFS_ARRAYLEN(case_fold_050), case_fold_050 }, + { __PHYSFS_ARRAYLEN(case_fold_051), case_fold_051 }, + { __PHYSFS_ARRAYLEN(case_fold_052), case_fold_052 }, + { __PHYSFS_ARRAYLEN(case_fold_053), case_fold_053 }, + { __PHYSFS_ARRAYLEN(case_fold_054), case_fold_054 }, + { __PHYSFS_ARRAYLEN(case_fold_055), case_fold_055 }, + { __PHYSFS_ARRAYLEN(case_fold_056), case_fold_056 }, + { __PHYSFS_ARRAYLEN(case_fold_057), case_fold_057 }, + { __PHYSFS_ARRAYLEN(case_fold_058), case_fold_058 }, + { __PHYSFS_ARRAYLEN(case_fold_059), case_fold_059 }, + { __PHYSFS_ARRAYLEN(case_fold_060), case_fold_060 }, + { __PHYSFS_ARRAYLEN(case_fold_061), case_fold_061 }, + { __PHYSFS_ARRAYLEN(case_fold_062), case_fold_062 }, + { __PHYSFS_ARRAYLEN(case_fold_063), case_fold_063 }, + { __PHYSFS_ARRAYLEN(case_fold_064), case_fold_064 }, + { __PHYSFS_ARRAYLEN(case_fold_065), case_fold_065 }, + { __PHYSFS_ARRAYLEN(case_fold_066), case_fold_066 }, + { __PHYSFS_ARRAYLEN(case_fold_067), case_fold_067 }, + { __PHYSFS_ARRAYLEN(case_fold_068), case_fold_068 }, + { __PHYSFS_ARRAYLEN(case_fold_069), case_fold_069 }, + { __PHYSFS_ARRAYLEN(case_fold_070), case_fold_070 }, + { __PHYSFS_ARRAYLEN(case_fold_071), case_fold_071 }, + { __PHYSFS_ARRAYLEN(case_fold_072), case_fold_072 }, + { __PHYSFS_ARRAYLEN(case_fold_073), case_fold_073 }, + { __PHYSFS_ARRAYLEN(case_fold_074), case_fold_074 }, + { __PHYSFS_ARRAYLEN(case_fold_075), case_fold_075 }, + { __PHYSFS_ARRAYLEN(case_fold_076), case_fold_076 }, + { __PHYSFS_ARRAYLEN(case_fold_077), case_fold_077 }, + { __PHYSFS_ARRAYLEN(case_fold_078), case_fold_078 }, + { __PHYSFS_ARRAYLEN(case_fold_079), case_fold_079 }, + { __PHYSFS_ARRAYLEN(case_fold_080), case_fold_080 }, + { __PHYSFS_ARRAYLEN(case_fold_081), case_fold_081 }, + { __PHYSFS_ARRAYLEN(case_fold_082), case_fold_082 }, + { __PHYSFS_ARRAYLEN(case_fold_083), case_fold_083 }, + { __PHYSFS_ARRAYLEN(case_fold_084), case_fold_084 }, + { __PHYSFS_ARRAYLEN(case_fold_085), case_fold_085 }, + { __PHYSFS_ARRAYLEN(case_fold_086), case_fold_086 }, + { __PHYSFS_ARRAYLEN(case_fold_087), case_fold_087 }, + { __PHYSFS_ARRAYLEN(case_fold_088), case_fold_088 }, + { __PHYSFS_ARRAYLEN(case_fold_089), case_fold_089 }, + { __PHYSFS_ARRAYLEN(case_fold_090), case_fold_090 }, + { __PHYSFS_ARRAYLEN(case_fold_091), case_fold_091 }, + { __PHYSFS_ARRAYLEN(case_fold_092), case_fold_092 }, + { __PHYSFS_ARRAYLEN(case_fold_093), case_fold_093 }, + { __PHYSFS_ARRAYLEN(case_fold_094), case_fold_094 }, + { __PHYSFS_ARRAYLEN(case_fold_095), case_fold_095 }, + { __PHYSFS_ARRAYLEN(case_fold_096), case_fold_096 }, + { __PHYSFS_ARRAYLEN(case_fold_097), case_fold_097 }, + { __PHYSFS_ARRAYLEN(case_fold_098), case_fold_098 }, + { __PHYSFS_ARRAYLEN(case_fold_099), case_fold_099 }, + { __PHYSFS_ARRAYLEN(case_fold_100), case_fold_100 }, + { __PHYSFS_ARRAYLEN(case_fold_101), case_fold_101 }, + { __PHYSFS_ARRAYLEN(case_fold_102), case_fold_102 }, + { __PHYSFS_ARRAYLEN(case_fold_103), case_fold_103 }, + { __PHYSFS_ARRAYLEN(case_fold_104), case_fold_104 }, + { __PHYSFS_ARRAYLEN(case_fold_105), case_fold_105 }, + { __PHYSFS_ARRAYLEN(case_fold_106), case_fold_106 }, + { __PHYSFS_ARRAYLEN(case_fold_107), case_fold_107 }, + { __PHYSFS_ARRAYLEN(case_fold_108), case_fold_108 }, + { __PHYSFS_ARRAYLEN(case_fold_109), case_fold_109 }, + { __PHYSFS_ARRAYLEN(case_fold_110), case_fold_110 }, + { __PHYSFS_ARRAYLEN(case_fold_111), case_fold_111 }, + { __PHYSFS_ARRAYLEN(case_fold_112), case_fold_112 }, + { __PHYSFS_ARRAYLEN(case_fold_113), case_fold_113 }, + { __PHYSFS_ARRAYLEN(case_fold_114), case_fold_114 }, + { __PHYSFS_ARRAYLEN(case_fold_115), case_fold_115 }, + { __PHYSFS_ARRAYLEN(case_fold_116), case_fold_116 }, + { __PHYSFS_ARRAYLEN(case_fold_117), case_fold_117 }, + { __PHYSFS_ARRAYLEN(case_fold_118), case_fold_118 }, + { __PHYSFS_ARRAYLEN(case_fold_119), case_fold_119 }, + { __PHYSFS_ARRAYLEN(case_fold_120), case_fold_120 }, + { __PHYSFS_ARRAYLEN(case_fold_121), case_fold_121 }, + { __PHYSFS_ARRAYLEN(case_fold_122), case_fold_122 }, + { 0, NULL }, + { __PHYSFS_ARRAYLEN(case_fold_124), case_fold_124 }, + { 0, NULL }, + { __PHYSFS_ARRAYLEN(case_fold_126), case_fold_126 }, + { 0, NULL }, + { __PHYSFS_ARRAYLEN(case_fold_128), case_fold_128 }, + { __PHYSFS_ARRAYLEN(case_fold_129), case_fold_129 }, + { __PHYSFS_ARRAYLEN(case_fold_130), case_fold_130 }, + { __PHYSFS_ARRAYLEN(case_fold_131), case_fold_131 }, + { __PHYSFS_ARRAYLEN(case_fold_132), case_fold_132 }, + { __PHYSFS_ARRAYLEN(case_fold_133), case_fold_133 }, + { __PHYSFS_ARRAYLEN(case_fold_134), case_fold_134 }, + { __PHYSFS_ARRAYLEN(case_fold_135), case_fold_135 }, + { __PHYSFS_ARRAYLEN(case_fold_136), case_fold_136 }, + { __PHYSFS_ARRAYLEN(case_fold_137), case_fold_137 }, + { __PHYSFS_ARRAYLEN(case_fold_138), case_fold_138 }, + { __PHYSFS_ARRAYLEN(case_fold_139), case_fold_139 }, + { __PHYSFS_ARRAYLEN(case_fold_140), case_fold_140 }, + { __PHYSFS_ARRAYLEN(case_fold_141), case_fold_141 }, + { __PHYSFS_ARRAYLEN(case_fold_142), case_fold_142 }, + { __PHYSFS_ARRAYLEN(case_fold_143), case_fold_143 }, + { __PHYSFS_ARRAYLEN(case_fold_144), case_fold_144 }, + { __PHYSFS_ARRAYLEN(case_fold_145), case_fold_145 }, + { __PHYSFS_ARRAYLEN(case_fold_146), case_fold_146 }, + { __PHYSFS_ARRAYLEN(case_fold_147), case_fold_147 }, + { __PHYSFS_ARRAYLEN(case_fold_148), case_fold_148 }, + { __PHYSFS_ARRAYLEN(case_fold_149), case_fold_149 }, + { __PHYSFS_ARRAYLEN(case_fold_150), case_fold_150 }, + { __PHYSFS_ARRAYLEN(case_fold_151), case_fold_151 }, + { __PHYSFS_ARRAYLEN(case_fold_152), case_fold_152 }, + { __PHYSFS_ARRAYLEN(case_fold_153), case_fold_153 }, + { __PHYSFS_ARRAYLEN(case_fold_154), case_fold_154 }, + { __PHYSFS_ARRAYLEN(case_fold_155), case_fold_155 }, + { __PHYSFS_ARRAYLEN(case_fold_156), case_fold_156 }, + { __PHYSFS_ARRAYLEN(case_fold_157), case_fold_157 }, + { __PHYSFS_ARRAYLEN(case_fold_158), case_fold_158 }, + { __PHYSFS_ARRAYLEN(case_fold_159), case_fold_159 }, + { __PHYSFS_ARRAYLEN(case_fold_160), case_fold_160 }, + { __PHYSFS_ARRAYLEN(case_fold_161), case_fold_161 }, + { __PHYSFS_ARRAYLEN(case_fold_162), case_fold_162 }, + { __PHYSFS_ARRAYLEN(case_fold_163), case_fold_163 }, + { __PHYSFS_ARRAYLEN(case_fold_164), case_fold_164 }, + { __PHYSFS_ARRAYLEN(case_fold_165), case_fold_165 }, + { __PHYSFS_ARRAYLEN(case_fold_166), case_fold_166 }, + { __PHYSFS_ARRAYLEN(case_fold_167), case_fold_167 }, + { __PHYSFS_ARRAYLEN(case_fold_168), case_fold_168 }, + { __PHYSFS_ARRAYLEN(case_fold_169), case_fold_169 }, + { __PHYSFS_ARRAYLEN(case_fold_170), case_fold_170 }, + { __PHYSFS_ARRAYLEN(case_fold_171), case_fold_171 }, + { __PHYSFS_ARRAYLEN(case_fold_172), case_fold_172 }, + { __PHYSFS_ARRAYLEN(case_fold_173), case_fold_173 }, + { __PHYSFS_ARRAYLEN(case_fold_174), case_fold_174 }, + { __PHYSFS_ARRAYLEN(case_fold_175), case_fold_175 }, + { __PHYSFS_ARRAYLEN(case_fold_176), case_fold_176 }, + { __PHYSFS_ARRAYLEN(case_fold_177), case_fold_177 }, + { __PHYSFS_ARRAYLEN(case_fold_178), case_fold_178 }, + { __PHYSFS_ARRAYLEN(case_fold_179), case_fold_179 }, + { __PHYSFS_ARRAYLEN(case_fold_180), case_fold_180 }, + { __PHYSFS_ARRAYLEN(case_fold_181), case_fold_181 }, + { __PHYSFS_ARRAYLEN(case_fold_182), case_fold_182 }, + { __PHYSFS_ARRAYLEN(case_fold_183), case_fold_183 }, + { __PHYSFS_ARRAYLEN(case_fold_184), case_fold_184 }, + { __PHYSFS_ARRAYLEN(case_fold_185), case_fold_185 }, + { __PHYSFS_ARRAYLEN(case_fold_186), case_fold_186 }, + { __PHYSFS_ARRAYLEN(case_fold_187), case_fold_187 }, + { __PHYSFS_ARRAYLEN(case_fold_188), case_fold_188 }, + { __PHYSFS_ARRAYLEN(case_fold_189), case_fold_189 }, + { __PHYSFS_ARRAYLEN(case_fold_190), case_fold_190 }, + { __PHYSFS_ARRAYLEN(case_fold_191), case_fold_191 }, + { __PHYSFS_ARRAYLEN(case_fold_192), case_fold_192 }, + { __PHYSFS_ARRAYLEN(case_fold_193), case_fold_193 }, + { __PHYSFS_ARRAYLEN(case_fold_194), case_fold_194 }, + { __PHYSFS_ARRAYLEN(case_fold_195), case_fold_195 }, + { __PHYSFS_ARRAYLEN(case_fold_196), case_fold_196 }, + { __PHYSFS_ARRAYLEN(case_fold_197), case_fold_197 }, + { __PHYSFS_ARRAYLEN(case_fold_198), case_fold_198 }, + { __PHYSFS_ARRAYLEN(case_fold_199), case_fold_199 }, + { __PHYSFS_ARRAYLEN(case_fold_200), case_fold_200 }, + { __PHYSFS_ARRAYLEN(case_fold_201), case_fold_201 }, + { __PHYSFS_ARRAYLEN(case_fold_202), case_fold_202 }, + { __PHYSFS_ARRAYLEN(case_fold_203), case_fold_203 }, + { __PHYSFS_ARRAYLEN(case_fold_204), case_fold_204 }, + { __PHYSFS_ARRAYLEN(case_fold_205), case_fold_205 }, + { __PHYSFS_ARRAYLEN(case_fold_206), case_fold_206 }, + { __PHYSFS_ARRAYLEN(case_fold_207), case_fold_207 }, + { __PHYSFS_ARRAYLEN(case_fold_208), case_fold_208 }, + { __PHYSFS_ARRAYLEN(case_fold_209), case_fold_209 }, + { __PHYSFS_ARRAYLEN(case_fold_210), case_fold_210 }, + { __PHYSFS_ARRAYLEN(case_fold_211), case_fold_211 }, + { __PHYSFS_ARRAYLEN(case_fold_212), case_fold_212 }, + { __PHYSFS_ARRAYLEN(case_fold_213), case_fold_213 }, + { __PHYSFS_ARRAYLEN(case_fold_214), case_fold_214 }, + { __PHYSFS_ARRAYLEN(case_fold_215), case_fold_215 }, + { __PHYSFS_ARRAYLEN(case_fold_216), case_fold_216 }, + { __PHYSFS_ARRAYLEN(case_fold_217), case_fold_217 }, + { __PHYSFS_ARRAYLEN(case_fold_218), case_fold_218 }, + { __PHYSFS_ARRAYLEN(case_fold_219), case_fold_219 }, + { __PHYSFS_ARRAYLEN(case_fold_220), case_fold_220 }, + { __PHYSFS_ARRAYLEN(case_fold_221), case_fold_221 }, + { __PHYSFS_ARRAYLEN(case_fold_222), case_fold_222 }, + { __PHYSFS_ARRAYLEN(case_fold_223), case_fold_223 }, + { __PHYSFS_ARRAYLEN(case_fold_224), case_fold_224 }, + { __PHYSFS_ARRAYLEN(case_fold_225), case_fold_225 }, + { __PHYSFS_ARRAYLEN(case_fold_226), case_fold_226 }, + { __PHYSFS_ARRAYLEN(case_fold_227), case_fold_227 }, + { __PHYSFS_ARRAYLEN(case_fold_228), case_fold_228 }, + { __PHYSFS_ARRAYLEN(case_fold_229), case_fold_229 }, + { __PHYSFS_ARRAYLEN(case_fold_230), case_fold_230 }, + { __PHYSFS_ARRAYLEN(case_fold_231), case_fold_231 }, + { __PHYSFS_ARRAYLEN(case_fold_232), case_fold_232 }, + { __PHYSFS_ARRAYLEN(case_fold_233), case_fold_233 }, + { __PHYSFS_ARRAYLEN(case_fold_234), case_fold_234 }, + { __PHYSFS_ARRAYLEN(case_fold_235), case_fold_235 }, + { __PHYSFS_ARRAYLEN(case_fold_236), case_fold_236 }, + { __PHYSFS_ARRAYLEN(case_fold_237), case_fold_237 }, + { __PHYSFS_ARRAYLEN(case_fold_238), case_fold_238 }, + { __PHYSFS_ARRAYLEN(case_fold_239), case_fold_239 }, + { __PHYSFS_ARRAYLEN(case_fold_240), case_fold_240 }, + { __PHYSFS_ARRAYLEN(case_fold_241), case_fold_241 }, + { __PHYSFS_ARRAYLEN(case_fold_242), case_fold_242 }, + { __PHYSFS_ARRAYLEN(case_fold_243), case_fold_243 }, + { __PHYSFS_ARRAYLEN(case_fold_244), case_fold_244 }, + { __PHYSFS_ARRAYLEN(case_fold_245), case_fold_245 }, + { __PHYSFS_ARRAYLEN(case_fold_246), case_fold_246 }, + { __PHYSFS_ARRAYLEN(case_fold_247), case_fold_247 }, + { __PHYSFS_ARRAYLEN(case_fold_248), case_fold_248 }, + { __PHYSFS_ARRAYLEN(case_fold_249), case_fold_249 }, + { __PHYSFS_ARRAYLEN(case_fold_250), case_fold_250 }, + { __PHYSFS_ARRAYLEN(case_fold_251), case_fold_251 }, + { __PHYSFS_ARRAYLEN(case_fold_252), case_fold_252 }, + { __PHYSFS_ARRAYLEN(case_fold_253), case_fold_253 }, + { __PHYSFS_ARRAYLEN(case_fold_254), case_fold_254 }, + { __PHYSFS_ARRAYLEN(case_fold_255), case_fold_255 }, +}; + Modified: trunk/physfs_internal.h =================================================================== --- trunk/physfs_internal.h 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/physfs_internal.h 2007-03-15 08:16:23 UTC (rev 840) @@ -16,6 +16,8 @@ #include "physfs.h" +#include /* make sure NULL is defined... */ + #ifdef HAVE_ASSERT_H #include #elif (!defined assert) @@ -1264,6 +1266,8 @@ #define GOTO_MACRO_MUTEX(e, m, g) { __PHYSFS_setError(e); __PHYSFS_platformReleaseMutex(m); goto g; } #define GOTO_IF_MACRO_MUTEX(c, e, m, g) if (c) { __PHYSFS_setError(e); __PHYSFS_platformReleaseMutex(m); goto g; } +#define __PHYSFS_ARRAYLEN(x) ( (sizeof (x)) / (sizeof (x[0])) ) + #ifdef __GNUC__ #define LONGLONGLITERAL(x) x##LL #else @@ -1283,6 +1287,39 @@ ) /* + * This is a strcasecmp() or stricmp() replacement that expects both strings + * to be in UTF-8 encoding. It will do "case folding" to decide if the + * Unicode codepoints in the strings match. + * + * It will report which string is "greater than" the other, but be aware that + * this doesn't necessarily mean anything: 'a' may be "less than" 'b', but + * a random Kanji codepoint has no meaningful alphabetically relationship to + * a Greek Lambda, but being able to assign a reliable "value" makes sorting + * algorithms possible, if not entirely sane. Most cases should treat the + * return value as "equal" or "not equal". + */ +int __PHYSFS_utf8strcasecmp(const char *s1, const char *s2); + +/* + * This works like __PHYSFS_utf8strcasecmp(), but takes a character (NOT BYTE + * COUNT) argument, like strcasencmp(). + */ +int __PHYSFS_utf8strnicmp(const char *s1, const char *s2, PHYSFS_uint32 l); + +/* + * stricmp() that guarantees to only work with low ASCII. The C runtime + * stricmp() might try to apply a locale/codepage/etc, which we don't want. + */ +int __PHYSFS_stricmpASCII(const char *s1, const char *s2); + +/* + * strnicmp() that guarantees to only work with low ASCII. The C runtime + * strnicmp() might try to apply a locale/codepage/etc, which we don't want. + */ +int __PHYSFS_strnicmpASCII(const char *s1, const char *s2, PHYSFS_uint32 l); + + +/* * The current allocator. Not valid before PHYSFS_init is called! */ extern PHYSFS_Allocator __PHYSFS_AllocatorHooks; @@ -1517,16 +1554,6 @@ PHYSFS_uint64 __PHYSFS_platformGetThreadID(void); /* - * This is a pass-through to whatever stricmp() is called on your platform. - */ -int __PHYSFS_platformStricmp(const char *str1, const char *str2); - -/* - * This is a pass-through to whatever strnicmp() is called on your platform. - */ -int __PHYSFS_platformStrnicmp(const char *s1, const char *s2, PHYSFS_uint32 l); - -/* * Return non-zero if filename (in platform-dependent notation) exists. * Symlinks should NOT be followed; at this stage, we do not care what the * symlink points to. Please call __PHYSFS_SetError() with the details of Modified: trunk/physfs_unicode.c =================================================================== --- trunk/physfs_unicode.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/physfs_unicode.c 2007-03-15 08:16:23 UTC (rev 840) @@ -185,7 +185,8 @@ return UNICODE_BOGUS_CHAR_VALUE; } /* utf8codepoint */ -void PHYSFS_utf8toucs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len) + +void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len) { len -= sizeof (PHYSFS_uint32); /* save room for null char. */ while (len >= sizeof (PHYSFS_uint32)) @@ -200,9 +201,10 @@ } /* while */ *dst = 0; -} /* PHYSFS_utf8toucs4 */ +} /* PHYSFS_utf8ToUcs4 */ -void PHYSFS_utf8toucs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len) + +void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len) { len -= sizeof (PHYSFS_uint16); /* save room for null char. */ while (len >= sizeof (PHYSFS_uint16)) @@ -222,7 +224,7 @@ } /* while */ *dst = 0; -} /* PHYSFS_utf8toucs2 */ +} /* PHYSFS_utf8ToUcs2 */ static void utf8fromcodepoint(PHYSFS_uint32 cp, char **_dst, PHYSFS_uint64 *_len) { @@ -312,23 +314,146 @@ } \ *dst = '\0'; \ -void PHYSFS_utf8fromucs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len) +void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len) { UTF8FROMTYPE(PHYSFS_uint32, src, dst, len); -} /* PHYSFS_utf8fromucs4 */ +} /* PHYSFS_utf8FromUcs4 */ -void PHYSFS_utf8fromucs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len) +void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len) { UTF8FROMTYPE(PHYSFS_uint64, src, dst, len); -} /* PHYSFS_utf8fromucs4 */ +} /* PHYSFS_utf8FromUcs4 */ /* latin1 maps to unicode codepoints directly, we just utf-8 encode it. */ -void PHYSFS_utf8fromlatin1(const char *src, char *dst, PHYSFS_uint64 len) +void PHYSFS_utf8FromLatin1(const char *src, char *dst, PHYSFS_uint64 len) { UTF8FROMTYPE(PHYSFS_uint8, src, dst, len); -} /* PHYSFS_utf8fromlatin1 */ +} /* PHYSFS_utf8FromLatin1 */ #undef UTF8FROMTYPE + +typedef struct CaseFoldMapping +{ + PHYSFS_uint32 from; + PHYSFS_uint32 to0; + PHYSFS_uint32 to1; + PHYSFS_uint32 to2; +} CaseFoldMapping; + +typedef struct CaseFoldHashBucket +{ + const PHYSFS_uint8 count; + const CaseFoldMapping *list; +} CaseFoldHashBucket; + +#include "physfs_casefolding.h" + +static void locate_case_fold_mapping(const PHYSFS_uint32 from, + PHYSFS_uint32 *to) +{ + PHYSFS_uint32 i; + const PHYSFS_uint8 hashed = ((from ^ (from >> 8)) & 0xFF); + const CaseFoldHashBucket *bucket = &case_fold_hash[hashed]; + const CaseFoldMapping *mapping = bucket->list; + + for (i = 0; i < bucket->count; i++, mapping++) + { + if (mapping->from == from) + { + to[0] = mapping->to0; + to[1] = mapping->to1; + to[2] = mapping->to2; + return; + } /* if */ + } /* for */ + + /* Not found...there's no remapping for this codepoint. */ + to[0] = from; + to[1] = 0; + to[2] = 0; +} /* locate_case_fold_mapping */ + + +static int utf8codepointcmp(const PHYSFS_uint32 cp1, const PHYSFS_uint32 cp2) +{ + PHYSFS_uint32 folded1[3], folded2[3]; + locate_case_fold_mapping(cp1, folded1); + locate_case_fold_mapping(cp2, folded2); + return ( (folded1[0] == folded2[0]) && + (folded1[1] == folded2[1]) && + (folded1[2] == folded2[2]) ); +} /* utf8codepointcmp */ + + +int __PHYSFS_utf8strcasecmp(const char *str1, const char *str2) +{ + while (1) + { + const PHYSFS_uint32 cp1 = utf8codepoint(&str1); + const PHYSFS_uint32 cp2 = utf8codepoint(&str2); + if (!utf8codepointcmp(cp1, cp2)) return 0; + if (cp1 == 0) return 1; + } /* while */ + + return 0; /* shouldn't hit this. */ +} /* __PHYSFS_utf8strcasecmp */ + + +int __PHYSFS_utf8strnicmp(const char *str1, const char *str2, PHYSFS_uint32 n) +{ + while (n > 0) + { + const PHYSFS_uint32 cp1 = utf8codepoint(&str1); + const PHYSFS_uint32 cp2 = utf8codepoint(&str2); + if (!utf8codepointcmp(cp1, cp2)) return 0; + if (cp1 == 0) return 1; + n--; + } /* while */ + + return 1; /* matched to n chars. */ +} /* __PHYSFS_utf8strnicmp */ + + +int __PHYSFS_stricmpASCII(const char *str1, const char *str2) +{ + while (1) + { + const char ch1 = *(str1++); + const char ch2 = *(str2++); + const char cp1 = ((ch1 >= 'A') && (ch1 <= 'Z')) ? (ch1+32) : ch1; + const char cp2 = ((ch2 >= 'A') && (ch2 <= 'Z')) ? (ch2+32) : ch2; + if (cp1 < cp2) + return -1; + else if (cp1 > cp2) + return 1; + else if (cp1 == 0) /* they're both null chars? */ + return 0; + } /* while */ + + return 0; /* shouldn't hit this. */ +} /* __PHYSFS_stricmpASCII */ + + +int __PHYSFS_strnicmpASCII(const char *str1, const char *str2, PHYSFS_uint32 n) +{ + while (n-- > 0) + { + const char ch1 = *(str1++); + const char ch2 = *(str2++); + const char cp1 = ((ch1 >= 'A') && (ch1 <= 'Z')) ? (ch1+32) : ch1; + const char cp2 = ((ch2 >= 'A') && (ch2 <= 'Z')) ? (ch2+32) : ch2; + if (cp1 < cp2) + return -1; + else if (cp1 > cp2) + return 1; + else if (cp1 == 0) /* they're both null chars? */ + return 0; + } /* while */ + + return 0; +} /* __PHYSFS_stricmpASCII */ + + /* end of physfs_unicode.c ... */ Modified: trunk/platform/os2.c =================================================================== --- trunk/platform/os2.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/platform/os2.c 2007-03-15 08:16:23 UTC (rev 840) @@ -145,7 +145,7 @@ { while (count == 1) /* while still entries to enumerate... */ { - if (__PHYSFS_platformStricmp(fb.achName, fname) == 0) + if (__PHYSFS_stricmpASCII(fb.achName, fname) == 0) { strcpy(fname, fb.achName); break; /* there it is. Overwrite and stop searching. */ @@ -297,50 +297,6 @@ } /* __PHYSFS_platformGetUserDir */ -int __PHYSFS_platformStricmp(const char *x, const char *y) -{ - int ux, uy; - - do - { - ux = toupper((int) *x); - uy = toupper((int) *y); - if (ux > uy) - return(1); - else if (ux < uy) - return(-1); - x++; - y++; - } while ((ux) && (uy)); - - return(0); -} /* __PHYSFS_platformStricmp */ - - -int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 len) -{ - int ux, uy; - - if (!len) - return(0); - - do - { - ux = toupper((int) *x); - uy = toupper((int) *y); - if (ux > uy) - return(1); - else if (ux < uy) - return(-1); - x++; - y++; - len--; - } while ((ux) && (uy) && (len)); - - return(0); -} /* __PHYSFS_platformStrnicmp */ - - int __PHYSFS_platformExists(const char *fname) { FILESTATUS3 fs; Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/platform/pocketpc.c 2007-03-15 08:16:23 UTC (rev 840) @@ -164,18 +164,6 @@ } /* __PHYSFS_platformGetThreadID */ -int __PHYSFS_platformStricmp(const char *x, const char *y) -{ - return(_stricmp(x, y)); -} /* __PHYSFS_platformStricmp */ - - -int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 len) -{ - return(_strnicmp(x, y, (int) len)); -} /* __PHYSFS_platformStrnicmp */ - - int __PHYSFS_platformExists(const char *fname) { int retval = 0; Modified: trunk/platform/posix.c =================================================================== --- trunk/platform/posix.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/platform/posix.c 2007-03-15 08:16:23 UTC (rev 840) @@ -120,47 +120,6 @@ } /* __PHYSFS_platformGetUserDir */ -/* -ansi and -pedantic flags prevent use of strcasecmp() on Linux. */ -int __PHYSFS_platformStricmp(const char *x, const char *y) -{ - int ux, uy; - - do - { - ux = toupper((int) *x); - uy = toupper((int) *y); - if (ux != uy) - return((ux > uy) ? 1 : -1); - x++; - y++; - } while ((ux) && (uy)); - - return(0); -} /* __PHYSFS_platformStricmp */ - - -int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 len) -{ - int ux, uy; - - if (!len) - return(0); - - do - { - ux = toupper((int) *x); - uy = toupper((int) *y); - if (ux != uy) - return((ux > uy) ? 1 : -1); - x++; - y++; - len--; - } while ((ux) && (uy) && (len)); - - return(0); -} /* __PHYSFS_platformStrnicmp */ - - #if (defined __PHYSFS_NO_SYMLINKS__) #define doStat stat #else Modified: trunk/platform/skeleton.c =================================================================== --- trunk/platform/skeleton.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/platform/skeleton.c 2007-03-15 08:16:23 UTC (rev 840) @@ -59,18 +59,6 @@ } /* __PHYSFS_platformGetThreadID */ -int __PHYSFS_platformStricmp(const char *x, const char *y) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); -} /* __PHYSFS_platformStricmp */ - - -int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 l) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); -} /* __PHYSFS_platformStrnicmp */ - - int __PHYSFS_platformExists(const char *fname) { BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-15 07:33:14 UTC (rev 839) +++ trunk/platform/windows.c 2007-03-15 08:16:23 UTC (rev 840) @@ -122,7 +122,7 @@ retval[buflen] = '\0'; /* does API always null-terminate this? */ /* make sure the string was not truncated. */ - if (__PHYSFS_platformStricmp(&retval[buflen - 4], ".exe") != 0) + if (__PHYSFS_stricmpASCII(&retval[buflen - 4], ".exe") != 0) __PHYSFS_setError(ERR_GETMODFN_TRUNC); else { @@ -324,59 +324,6 @@ } /* __PHYSFS_platformGetThreadID */ -/* ...make this Cygwin AND Visual C friendly... */ -int __PHYSFS_platformStricmp(const char *x, const char *y) -{ -#if (defined _MSC_VER) - return(stricmp(x, y)); -#else - int ux, uy; - - do - { - ux = toupper((int) *x); - uy = toupper((int) *y); - if (ux > uy) - return(1); - else if (ux < uy) - return(-1); - x++; - y++; - } while ((ux) && (uy)); - - return(0); -#endif -} /* __PHYSFS_platformStricmp */ - - -int __PHYSFS_platformStrnicmp(const char *x, const char *y, PHYSFS_uint32 len) -{ -#if (defined _MSC_VER) - return(strnicmp(x, y, (int) len)); -#else - int ux, uy; - - if (!len) - return(0); - - do - { - ux = toupper((int) *x); - uy = toupper((int) *y); - if (ux > uy) - return(1); - else if (ux < uy) - return(-1); - x++; - y++; - len--; - } while ((ux) && (uy) && (len)); - - return(0); -#endif -} /* __PHYSFS_platformStricmp */ - - int __PHYSFS_platformExists(const char *fname) { BAIL_IF_MACRO From DONOTREPLY at icculus.org Thu Mar 15 04:19:17 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 15 Mar 2007 04:19:17 -0400 Subject: r841 - trunk Message-ID: <20070315081917.21082.qmail@icculus.org> Author: icculus Date: 2007-03-15 04:19:17 -0400 (Thu, 15 Mar 2007) New Revision: 841 Modified: trunk/TODO.txt Log: Updated. Modified: trunk/TODO.txt =================================================================== --- trunk/TODO.txt 2007-03-15 08:16:23 UTC (rev 840) +++ trunk/TODO.txt 2007-03-15 08:19:17 UTC (rev 841) @@ -18,18 +18,13 @@ an installer/updater. - Stack allocate in stripAppleBundle() (platform/unix.c) instead of calloc(). - Reduce malloc() pressure all over the place. We fragment memory like mad. -- macclassic.c : - "/* (Hmm. Default behaviour is broken in the base library. :) ) */" - profile string list interpolation. - We have two different ways to find dir entries in zip.c. - Do symlinks in zip archiver work when they point to dirs? - Enable more warnings? - Use __cdecl in physfs.h? - Look for FIXMEs (many marked with "!!!" in comments). -- Cygwin should use unix/posix and not win32 platform code. -- Expose the archiver registration mechanism to the outside world. - Find some way to relax or remove the security model for external tools. -- mmap() in posix.c - OSX shouldn't use ~/.app for userdir. - fscanf and fprintf support in extras dir. - Why do we call it openArchive and dirClose? @@ -46,7 +41,7 @@ - Should file enumeration return an error or set error state? - Need "getmountpoint" command in test_physfs.c ... - Look for calloc() calls that aren't going through the allocation hooks. -- maybe other stuff. +- Write up a simple HOWTO on embedding physicsfs in another project. - Make mutexes recursive, so callbacks can call into the API. - Archivers need abstracted i/o to read from memory or files (archives in archives?) - Probably other stuff. Requests and recommendations are welcome. From DONOTREPLY at icculus.org Fri Mar 16 18:06:04 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 16 Mar 2007 18:06:04 -0400 Subject: r842 - trunk Message-ID: <20070316220604.22205.qmail@icculus.org> Author: icculus Date: 2007-03-16 18:06:04 -0400 (Fri, 16 Mar 2007) New Revision: 842 Modified: trunk/CHANGELOG.txt trunk/physfs.h Log: Changed PHYSFS_file from a typedef to a #define for legacy code. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-15 08:19:17 UTC (rev 841) +++ trunk/CHANGELOG.txt 2007-03-16 22:06:04 UTC (rev 842) @@ -2,6 +2,9 @@ * CHANGELOG. */ +03162007 - Changed PHYSFS_file from a typedef to a #define (in case it would + cause an aggressive compiler to think you're passing the wrong type + to a function) and added Doxygen comments to explain it. 03152007 - Bunch of work on Unicode...added case-folding stricmp, removed platform-specific stricmp implementations, changed appropriate calls to an ASCII-only stricmp that ignores locale. Fixed case on Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-03-15 08:19:17 UTC (rev 841) +++ trunk/physfs.h 2007-03-16 22:06:04 UTC (rev 842) @@ -339,9 +339,21 @@ void *opaque; /**< That's all you get. Don't touch. */ } PHYSFS_File; -typedef PHYSFS_File PHYSFS_file; /* for backwards compatibility with 1.0 */ +/** + * \def PHYSFS_file + * \brief 1.0 API compatibility define. + * + * PHYSFS_file is identical to PHYSFS_File. This #define is here for backwards + * compatibility with the 1.0 API, which had an inconsistent capitalization + * convention in this case. New code should use PHYSFS_File, as this #define + * may go away someday. + * + * \sa PHYSFS_File + */ +#define PHYSFS_file PHYSFS_File + /** * \struct PHYSFS_ArchiveInfo * \brief Information on various PhysicsFS-supported archives. From DONOTREPLY at icculus.org Fri Mar 16 19:48:19 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 16 Mar 2007 19:48:19 -0400 Subject: r843 - trunk Message-ID: <20070316234819.30308.qmail@icculus.org> Author: icculus Date: 2007-03-16 19:48:19 -0400 (Fri, 16 Mar 2007) New Revision: 843 Modified: trunk/physfs.h Log: Fixed Doxygen comments for UTF-8 functions. Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-03-16 22:06:04 UTC (rev 842) +++ trunk/physfs.h 2007-03-16 23:48:19 UTC (rev 843) @@ -162,9 +162,9 @@ * offers. If you are on Windows and build with Unicode support, your TCHAR * strings are two bytes per character (this is called "UCS-2 encoding"). You * should convert them to UTF-8 before handing them to PhysicsFS with - * PHYSFS_utf8fromucs2(). If you're using Unix or Mac OS X, your wchar_t + * PHYSFS_utf8FromUcs2(). If you're using Unix or Mac OS X, your wchar_t * strings are four bytes per character ("UCS-4 encoding"). Use - * PHYSFS_utf8fromucs4(). Mac OS X can give you UTF-8 directly from a + * PHYSFS_utf8FromUcs4(). Mac OS X can give you UTF-8 directly from a * CFString, and many Unixes generally give you C strings in UTF-8 format * everywhere. If you have a single-byte high ASCII charset, like so-many * European "codepages" you may be out of luck. We'll convert from "Latin1" @@ -173,7 +173,7 @@ * C string with high-ASCII data that isn't UTF-8 encoded will NOT do what * you expect! * - * Naturally, there's also PHYSFS_utf8toucs2() and PHYSFS_utf8toucs4() to get + * Naturally, there's also PHYSFS_utf8ToUcs2() and PHYSFS_utf8ToUcs4() to get * data back into a format you like. Behind the scenes, PhysicsFS will use * Unicode where possible: the UTF-8 strings on Windows will be converted * and used with the multibyte Windows APIs, for example. @@ -2055,7 +2055,7 @@ void *d); /** - * \fn void PHYSFS_utf8fromucs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len) + * \fn void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len) * \brief Convert a UCS-4 string to a UTF-8 string. * * UCS-4 strings are 32-bits per character: \c wchar_t on Unix. @@ -2077,7 +2077,7 @@ PHYSFS_uint64 len); /** - * \fn void PHYSFS_utf8toucs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len) + * \fn void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len) * \brief Convert a UTF-8 string to a UCS-4 string. * * UCS-4 strings are 32-bits per character: \c wchar_t on Unix. @@ -2099,7 +2099,7 @@ PHYSFS_uint64 len); /** - * \fn void PHYSFS_utf8fromucs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len) + * \fn void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len) * \brief Convert a UCS-2 string to a UTF-8 string. * * UCS-2 strings are 16-bits per character: \c TCHAR on Windows, when building @@ -2125,7 +2125,7 @@ PHYSFS_uint64 len); /** - * \fn PHYSFS_utf8toucs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len) + * \fn PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len) * \brief Convert a UTF-8 string to a UCS-2 string. * * UCS-2 strings are 16-bits per character: \c TCHAR on Windows, when building From DONOTREPLY at icculus.org Sun Mar 18 18:16:26 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 18 Mar 2007 18:16:26 -0400 Subject: r844 - trunk/platform Message-ID: <20070318221626.22798.qmail@icculus.org> Author: icculus Date: 2007-03-18 18:16:26 -0400 (Sun, 18 Mar 2007) New Revision: 844 Modified: trunk/platform/posix.c Log: Removed the strict-ANSI crap. Modified: trunk/platform/posix.c =================================================================== --- trunk/platform/posix.c 2007-03-16 23:48:19 UTC (rev 843) +++ trunk/platform/posix.c 2007-03-18 22:16:26 UTC (rev 844) @@ -11,27 +11,7 @@ #ifdef PHYSFS_PLATFORM_POSIX -#if (defined __STRICT_ANSI__) -#define __PHYSFS_DOING_STRICT_ANSI__ -#endif - -/* - * We cheat a little: I want the symlink version of stat() (lstat), and - * GCC/Linux will not declare it if compiled with the -ansi flag. - * If you are really lacking symlink support on your platform, - * you should #define __PHYSFS_NO_SYMLINKS__ before compiling this - * file. That will open a security hole, though, if you really DO have - * symlinks on your platform; it renders PHYSFS_permitSymbolicLinks(0) - * useless, since every symlink will be reported as a regular file/dir. - */ -#if (defined __PHYSFS_DOING_STRICT_ANSI__) -#undef __STRICT_ANSI__ -#endif #include -#if (defined __PHYSFS_DOING_STRICT_ANSI__) -#define __STRICT_ANSI__ -#endif - #include #include #include @@ -120,29 +100,19 @@ } /* __PHYSFS_platformGetUserDir */ -#if (defined __PHYSFS_NO_SYMLINKS__) -#define doStat stat -#else -#define doStat lstat -#endif - int __PHYSFS_platformExists(const char *fname) { struct stat statbuf; - BAIL_IF_MACRO(doStat(fname, &statbuf) == -1, strerror(errno), 0); + BAIL_IF_MACRO(lstat(fname, &statbuf) == -1, strerror(errno), 0); return(1); } /* __PHYSFS_platformExists */ int __PHYSFS_platformIsSymLink(const char *fname) { -#if (defined __PHYSFS_NO_SYMLINKS__) - return(0); -#else struct stat statbuf; BAIL_IF_MACRO(lstat(fname, &statbuf) == -1, strerror(errno), 0); return( (S_ISLNK(statbuf.st_mode)) ? 1 : 0 ); -#endif } /* __PHYSFS_platformIsSymlink */ From DONOTREPLY at icculus.org Mon Mar 19 00:30:11 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 19 Mar 2007 00:30:11 -0400 Subject: r845 - trunk Message-ID: <20070319043011.11800.qmail@icculus.org> Author: icculus Date: 2007-03-19 00:30:10 -0400 (Mon, 19 Mar 2007) New Revision: 845 Modified: trunk/CHANGELOG.txt trunk/CMakeLists.txt Log: Whoops, switched two strings in CMakeLists.txt Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-18 22:16:26 UTC (rev 844) +++ trunk/CHANGELOG.txt 2007-03-19 04:30:10 UTC (rev 845) @@ -2,6 +2,7 @@ * CHANGELOG. */ +03192007 - Fixed two switched strings in CMakeLists.txt 03162007 - Changed PHYSFS_file from a typedef to a #define (in case it would cause an aggressive compiler to think you're passing the wrong type to a function) and added Doxygen comments to explain it. Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-18 22:16:26 UTC (rev 844) +++ trunk/CMakeLists.txt 2007-03-19 04:30:10 UTC (rev 845) @@ -268,7 +268,7 @@ ADD_LIBRARY(physfs-static STATIC ${PHYSFS_SRCS}) SET_TARGET_PROPERTIES(physfs-static PROPERTIES OUTPUT_NAME "physfs") SET(PHYSFS_LIB_TARGET physfs-static) - SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs") + SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static") ENDIF(PHYSFS_BUILD_STATIC) OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE) @@ -278,7 +278,7 @@ SET_TARGET_PROPERTIES(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION}) TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS}) SET(PHYSFS_LIB_TARGET physfs) - SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static") + SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs") ENDIF(PHYSFS_BUILD_SHARED) IF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC) From DONOTREPLY at icculus.org Mon Mar 19 02:39:14 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 19 Mar 2007 02:39:14 -0400 Subject: r846 - trunk Message-ID: <20070319063914.32645.qmail@icculus.org> Author: icculus Date: 2007-03-19 02:39:14 -0400 (Mon, 19 Mar 2007) New Revision: 846 Modified: trunk/ Log: Updated svn:ignore for some CMake/cygwin output. Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - physfs.spec docs PhysicsFS.xcodeproj PhysicsFS.build build Debug Release CMakeScripts CMakeOutput.log CMakeCache.txt cmake_install.cmake install_manifest.txt test_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe + physfs.spec docs PhysicsFS.xcodeproj PhysicsFS.build build Debug Release CMakeScripts CMakeOutput.log CMakeCache.txt cmake_install.cmake install_manifest.txt test_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe progress.make CMakeError.log From DONOTREPLY at icculus.org Mon Mar 19 02:58:49 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 19 Mar 2007 02:58:49 -0400 Subject: r847 - trunk Message-ID: <20070319065849.7297.qmail@icculus.org> Author: icculus Date: 2007-03-19 02:58:49 -0400 (Mon, 19 Mar 2007) New Revision: 847 Modified: trunk/ Log: More svn:ignore for CMake Visual Studio output. Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - physfs.spec docs PhysicsFS.xcodeproj PhysicsFS.build build Debug Release CMakeScripts CMakeOutput.log CMakeCache.txt cmake_install.cmake install_manifest.txt test_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe progress.make CMakeError.log + physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb From DONOTREPLY at icculus.org Mon Mar 19 03:45:32 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 19 Mar 2007 03:45:32 -0400 Subject: r849 - trunk Message-ID: <20070319074532.27801.qmail@icculus.org> Author: icculus Date: 2007-03-19 03:45:28 -0400 (Mon, 19 Mar 2007) New Revision: 849 Modified: trunk/CHANGELOG.txt Log: Updated. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-19 07:44:04 UTC (rev 848) +++ trunk/CHANGELOG.txt 2007-03-19 07:45:28 UTC (rev 849) @@ -2,7 +2,8 @@ * CHANGELOG. */ -03192007 - Fixed two switched strings in CMakeLists.txt +03192007 - Fixed two switched strings in CMakeLists.txt ... patch to compile + with latest Windows Platform SDK. 03162007 - Changed PHYSFS_file from a typedef to a #define (in case it would cause an aggressive compiler to think you're passing the wrong type to a function) and added Doxygen comments to explain it. From DONOTREPLY at icculus.org Mon Mar 19 03:44:16 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 19 Mar 2007 03:44:16 -0400 Subject: r848 - in trunk: . archivers lzma platform Message-ID: <20070319074416.27297.qmail@icculus.org> Author: icculus Date: 2007-03-19 03:44:04 -0400 (Mon, 19 Mar 2007) New Revision: 848 Modified: trunk/ trunk/CMakeLists.txt trunk/archivers/lzma.c trunk/lzma/7zIn.c trunk/physfs_internal.h trunk/platform/windows.c Log: Patched to compile with latest Platform SDK. Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb + physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.vcproj.* *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb *.suo Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-19 06:58:49 UTC (rev 847) +++ trunk/CMakeLists.txt 2007-03-19 07:44:04 UTC (rev 848) @@ -62,6 +62,11 @@ ENDIF(PHYSFS_IS_GCC4) ENDIF(CMAKE_COMPILER_IS_GNUCC) +IF(MSVC) + # VS.NET 8.0 got really really anal about strcpy, etc, which even if we + # cleaned up our code, zlib, etc still use...so disable the warning. + ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1) +ENDIF(MSVC) # Basic chunks of source code ... Modified: trunk/archivers/lzma.c =================================================================== --- trunk/archivers/lzma.c 2007-03-19 06:58:49 UTC (rev 847) +++ trunk/archivers/lzma.c 2007-03-19 07:44:04 UTC (rev 848) @@ -86,7 +86,7 @@ PHYSFS_uint32 fileIndex; /* Index of file in archive */ PHYSFS_uint32 folderIndex; /* Index of folder in archive */ size_t offset; /* Offset in folder */ - PHYSFS_uint32 position; /* Current "virtual" position in file */ + PHYSFS_uint64 position; /* Current "virtual" position in file */ } LZMAentry; @@ -116,13 +116,13 @@ size_t *processedSize) { CFileInStream *s = (CFileInStream *)object; - size_t processedSizeLoc; + PHYSFS_sint64 processedSizeLoc; if (maxReqSize > kBufferSize) maxReqSize = kBufferSize; processedSizeLoc = __PHYSFS_platformRead(s->File, g_Buffer, 1, maxReqSize); *buffer = g_Buffer; - if (processedSize != 0) - *processedSize = processedSizeLoc; + if (processedSize != NULL) + *processedSize = (size_t) processedSizeLoc; return SZ_OK; } /* SzFileReadImp */ @@ -313,10 +313,11 @@ } /* if */ /* Copy wanted bytes over from cache to outBuffer */ - strncpy(outBuffer, +/* !!! FIXME: strncpy for non-string data? */ + strncpy(outBuffer, (void*) (entry->archive->folder[entry->folderIndex].cache + entry->offset + entry->position), - wantedSize); + (size_t) wantedSize); entry->position += wantedSize; return objCount; } /* LZMA_read */ @@ -465,7 +466,7 @@ * Init with 0 so we know when a folder is already cached * Values will be set by LZMA_read() */ - memset(archive->folder, 0, len); + memset(archive->folder, 0, (size_t) len); return(archive); } /* LZMA_openArchive */ Modified: trunk/lzma/7zIn.c =================================================================== --- trunk/lzma/7zIn.c 2007-03-19 06:58:49 UTC (rev 847) +++ trunk/lzma/7zIn.c 2007-03-19 07:44:04 UTC (rev 848) @@ -188,8 +188,9 @@ size -= processedSize; do { - *data++ = *(Byte*)inBuffer++; - } + *(data++) = *((Byte*)inBuffer); + inBuffer = ((Byte*) inBuffer) + 1; + } while (--processedSize != 0); } #else Modified: trunk/physfs_internal.h =================================================================== --- trunk/physfs_internal.h 2007-03-19 06:58:49 UTC (rev 847) +++ trunk/physfs_internal.h 2007-03-19 07:44:04 UTC (rev 848) @@ -24,6 +24,11 @@ #define assert(x) #endif +/* !!! FIXME: remove this when revamping stack allocation code... */ +#ifdef _MSC_VER +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -32,8 +37,8 @@ #define malloc(x) Do not use malloc() directly. #define realloc(x, y) Do not use realloc() directly. #define free(x) Do not use free() directly. +/* !!! FIXME: add alloca check here. */ - /* The LANG section. */ /* please send questions/translations to Ryan: icculus at icculus.org. */ Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-19 06:58:49 UTC (rev 847) +++ trunk/platform/windows.c 2007-03-19 07:44:04 UTC (rev 848) @@ -21,10 +21,12 @@ #include "physfs_internal.h" -#if (defined _MSC_VER) - #define alloca(x) _alloca(x) -#elif (defined __MINGW32__) /* scary...hopefully this is okay. */ - #define alloca(x) __builtin_alloca(x) +#if (!defined alloca) + #if ((defined _MSC_VER) + #define alloca(x) _alloca(x) + #elif (defined __MINGW32__) /* scary...hopefully this is okay. */ + #define alloca(x) __builtin_alloca(x) + #endif #endif #define LOWORDER_UINT64(pos) (PHYSFS_uint32) \ From DONOTREPLY at icculus.org Mon Mar 19 16:12:54 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 19 Mar 2007 16:12:54 -0400 Subject: r850 - trunk/platform Message-ID: <20070319201254.28132.qmail@icculus.org> Author: icculus Date: 2007-03-19 16:12:54 -0400 (Mon, 19 Mar 2007) New Revision: 850 Modified: trunk/platform/beos.cpp Log: Added a FIXME. Modified: trunk/platform/beos.cpp =================================================================== --- trunk/platform/beos.cpp 2007-03-19 07:45:28 UTC (rev 849) +++ trunk/platform/beos.cpp 2007-03-19 20:12:54 UTC (rev 850) @@ -208,6 +208,7 @@ } /* __PHYSFS_platformRealPath */ +/* !!! FIXME: semaphores are not mutexes... */ void *__PHYSFS_platformCreateMutex(void) { sem_id *retval = (sem_id *) allocator.Malloc(sizeof (sem_id)); From DONOTREPLY at icculus.org Mon Mar 19 16:13:37 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 19 Mar 2007 16:13:37 -0400 Subject: r851 - trunk Message-ID: <20070319201337.28575.qmail@icculus.org> Author: icculus Date: 2007-03-19 16:13:37 -0400 (Mon, 19 Mar 2007) New Revision: 851 Modified: trunk/physfs.c Log: PHYSFS_init() should fail if argv0 is NULL and we can't do without it. Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-19 20:12:54 UTC (rev 850) +++ trunk/physfs.c 2007-03-19 20:13:37 UTC (rev 851) @@ -662,6 +662,9 @@ if (retval != NULL) return(retval); + /* we need argv0 to be sane to go on. */ + BAIL_IF_MACRO(argv0 == NULL, ERR_INVALID_ARGUMENT, NULL); + /* * Determine if there's a path on argv0. If there is, that's the base dir. */ @@ -684,6 +687,8 @@ return(retval); } /* if */ + /* !!! FIXME: should probably just fail here instead of being heroic. */ + /* * Last ditch effort: it's the current working directory. (*shrug*) */ From DONOTREPLY at icculus.org Mon Mar 19 16:15:10 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 19 Mar 2007 16:15:10 -0400 Subject: r852 - trunk/platform Message-ID: <20070319201510.29710.qmail@icculus.org> Author: icculus Date: 2007-03-19 16:15:09 -0400 (Mon, 19 Mar 2007) New Revision: 852 Modified: trunk/platform/unix.c Log: Try to use /proc/self/exe to determine the base dir. This lets systems with a Linux-like /proc filesystem work with PHYSFS_init(NULL). Other cleanups in Unix basedir calculation. Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-19 20:13:37 UTC (rev 851) +++ trunk/platform/unix.c 2007-03-19 20:15:09 UTC (rev 852) @@ -307,18 +307,45 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0) { - /* If there isn't a path on argv0, then look through the $PATH for it. */ + const char *PROC_SELF_EXE = "/proc/self/exe"; + char *retval = NULL; + char *envr = NULL; + struct stat stbuf; - char *retval; - char *envr; + /* fast path: default behaviour can handle this. */ + if ( (argv0 != NULL) && (strchr(argv0, '/') != NULL) ) + return(NULL); /* higher level will parse out real path from argv0. */ - if (strchr(argv0, '/') != NULL) /* default behaviour can handle this. */ - return(NULL); + /* + * Try to avoid using argv0 unless forced to. If there's a Linux-like + * /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))) + { + 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 */ + } /* if */ - envr = __PHYSFS_platformCopyEnvironmentVariable("PATH"); - BAIL_IF_MACRO(!envr, NULL, NULL); - retval = findBinaryInPath(argv0, envr); - allocator.Free(envr); + if ((retval == NULL) && (argv0 != NULL)) + { + /* If there's no dirsep on argv0, then look through $PATH for it. */ + envr = __PHYSFS_platformCopyEnvironmentVariable("PATH"); + BAIL_IF_MACRO(!envr, NULL, NULL); + retval = findBinaryInPath(argv0, envr); + allocator.Free(envr); + } /* if */ + return(retval); } /* __PHYSFS_platformCalcBaseDir */ @@ -442,6 +469,7 @@ BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); strcpy(retval, resolved_path); +/* !!! FIXME: this shouldn't be here. */ #ifdef PHYSFS_PLATFORM_MACOSX stripAppleBundle(retval); #endif From DONOTREPLY at icculus.org Mon Mar 19 16:15:16 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 19 Mar 2007 16:15:16 -0400 Subject: r853 - trunk Message-ID: <20070319201516.29785.qmail@icculus.org> Author: icculus Date: 2007-03-19 16:15:16 -0400 (Mon, 19 Mar 2007) New Revision: 853 Modified: trunk/CHANGELOG.txt Log: Updated. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-19 20:15:09 UTC (rev 852) +++ trunk/CHANGELOG.txt 2007-03-19 20:15:16 UTC (rev 853) @@ -3,7 +3,12 @@ */ 03192007 - Fixed two switched strings in CMakeLists.txt ... patch to compile - with latest Windows Platform SDK. + with latest Windows Platform SDK. Explicitly check for NULL in + PHYSFS_init() when we can't go on without a real string here. + Removed ANSI-C workaround for missing lstat() nonsense in posix.c + (POSIX != ANSI, time to give up here). Try to use /proc/self/exe + to find the base dir on Unix, so we can do without argv[0] on + systems with a Linux-like /proc filesystem. 03162007 - Changed PHYSFS_file from a typedef to a #define (in case it would cause an aggressive compiler to think you're passing the wrong type to a function) and added Doxygen comments to explain it. From DONOTREPLY at icculus.org Tue Mar 20 07:11:36 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 20 Mar 2007 07:11:36 -0400 Subject: r854 - trunk/platform Message-ID: <20070320111136.21841.qmail@icculus.org> Author: icculus Date: 2007-03-20 07:11:36 -0400 (Tue, 20 Mar 2007) New Revision: 854 Removed: trunk/platform/skeleton.c Log: Removed skeleton.c from the repository...it's out of date. Deleted: trunk/platform/skeleton.c =================================================================== --- trunk/platform/skeleton.c 2007-03-19 20:15:16 UTC (rev 853) +++ trunk/platform/skeleton.c 2007-03-20 11:11:36 UTC (rev 854) @@ -1,262 +0,0 @@ -/* - * Skeleton platform-dependent support routines for PhysicsFS. - * - * Please see the file LICENSE.txt in the source's root directory. - * - * This file written by Ryan C. Gordon. - */ - -#error DO NOT COMPILE THIS. IT IS JUST A SKELETON EXAMPLE FILE. - -#define __PHYSICSFS_INTERNAL__ -#include "physfs_platforms.h" - -#ifdef PHYSFS_PLATFORM_SKELETON - -#include "physfs_internal.h" - -const char *__PHYSFS_platformDirSeparator = ":"; - - -int __PHYSFS_platformInit(void) -{ - return(1); /* always succeed. */ -} /* __PHYSFS_platformInit */ - - -int __PHYSFS_platformDeinit(void) -{ - return(1); /* always succeed. */ -} /* __PHYSFS_platformDeinit */ - - -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ -} /* __PHYSFS_platformDetectAvailableCDs */ - - -char *__PHYSFS_platformCalcBaseDir(const char *argv0) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL); -} /* __PHYSFS_platformCalcBaseDir */ - - -char *__PHYSFS_platformGetUserName(void) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL); -} /* __PHYSFS_platformGetUserName */ - - -char *__PHYSFS_platformGetUserDir(void) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL); -} /* __PHYSFS_platformGetUserDir */ - - -PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) -{ - return(1); /* single threaded. */ -} /* __PHYSFS_platformGetThreadID */ - - -int __PHYSFS_platformExists(const char *fname) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); -} /* __PHYSFS_platformExists */ - - -int __PHYSFS_platformIsSymLink(const char *fname) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); -} /* __PHYSFS_platformIsSymlink */ - - -int __PHYSFS_platformIsDirectory(const char *fname) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); -} /* __PHYSFS_platformIsDirectory */ - - -char *__PHYSFS_platformCvtToDependent(const char *prepend, - const char *dirName, - const char *append) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL); -} /* __PHYSFS_platformCvtToDependent */ - - -void __PHYSFS_platformTimeslice(void) -{ -} /* __PHYSFS_platformTimeslice */ - - -void __PHYSFS_platformEnumerateFiles(const char *dirname, - int omitSymLinks, - PHYSFS_EnumFilesCallback callback, - const char *origdir, - void *callbackdata) -{ -} /* __PHYSFS_platformEnumerateFiles */ - - -char *__PHYSFS_platformCurrentDir(void) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL); -} /* __PHYSFS_platformCurrentDir */ - - -char *__PHYSFS_platformRealPath(const char *path) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL); -} /* __PHYSFS_platformRealPath */ - - -int __PHYSFS_platformMkDir(const char *path) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); -} /* __PHYSFS_platformMkDir */ - - -void *__PHYSFS_platformOpenRead(const char *filename) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL); -} /* __PHYSFS_platformOpenRead */ - - -void *__PHYSFS_platformOpenWrite(const char *filename) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL); -} /* __PHYSFS_platformOpenWrite */ - - -void *__PHYSFS_platformOpenAppend(const char *filename) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL); -} /* __PHYSFS_platformOpenAppend */ - - -PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer, - PHYSFS_uint32 size, PHYSFS_uint32 count) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1); -} /* __PHYSFS_platformRead */ - - -PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer, - PHYSFS_uint32 size, PHYSFS_uint32 count) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1); -} /* __PHYSFS_platformWrite */ - - -int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1); -} /* __PHYSFS_platformSeek */ - - -PHYSFS_sint64 __PHYSFS_platformTell(void *opaque) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1); -} /* __PHYSFS_platformTell */ - - -PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1); -} /* __PHYSFS_platformFileLength */ - - -int __PHYSFS_platformEOF(void *opaque) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1); -} /* __PHYSFS_platformEOF */ - - -int __PHYSFS_platformFlush(void *opaque) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); -} /* __PHYSFS_platformFlush */ - - -int __PHYSFS_platformClose(void *opaque) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); -} /* __PHYSFS_platformClose */ - - -int __PHYSFS_platformDelete(const char *path) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, 0); -} /* __PHYSFS_platformDelete */ - - -void *__PHYSFS_platformCreateMutex(void) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, NULL); -} /* __PHYSFS_platformCreateMutex */ - - -void __PHYSFS_platformDestroyMutex(void *mutex) -{ -} /* __PHYSFS_platformDestroyMutex */ - - -int __PHYSFS_platformGrabMutex(void *mutex) -{ - /* not implemented, but can't call __PHYSFS_setError! */ - return(0); -} /* __PHYSFS_platformGrabMutex */ - - -void __PHYSFS_platformReleaseMutex(void *mutex) -{ - /* not implemented, but can't call __PHYSFS_setError! */ -} /* __PHYSFS_platformReleaseMutex */ - - -PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname) -{ - BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1); -} /* __PHYSFS_platformGetLastModTime */ - - -int __PHYSFS_platformAllocatorInit(void) -{ - return(1); /* always succeeds. */ -} /* __PHYSFS_platformAllocatorInit */ - - -void __PHYSFS_platformAllocatorDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformAllocatorInit */ - - -void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef malloc - return(malloc((size_t) s)); -} /* __PHYSFS_platformMalloc */ - - -void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef realloc - return(realloc(ptr, (size_t) s)); -} /* __PHYSFS_platformRealloc */ - - -void __PHYSFS_platformAllocatorFree(void *ptr) -{ - #undef free - free(ptr); -} /* __PHYSFS_platformAllocatorFree */ - -#endif /* PHYSFS_PLATFORM_SKELETON */ - - -/* end of skeleton.c ... */ - From DONOTREPLY at icculus.org Tue Mar 20 13:53:42 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 20 Mar 2007 13:53:42 -0400 Subject: r855 - trunk Message-ID: <20070320175342.20786.qmail@icculus.org> Author: icculus Date: 2007-03-20 13:53:42 -0400 (Tue, 20 Mar 2007) New Revision: 855 Modified: trunk/physfs.h Log: Fixed a FIXME in the documentation comments. Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-03-20 11:11:36 UTC (rev 854) +++ trunk/physfs.h 2007-03-20 17:53:42 UTC (rev 855) @@ -1948,19 +1948,19 @@ * (This is for limited, hardcore use. If you don't immediately see a need * for it, you can probably ignore this forever.) * - * !!! FIXME: don't promise C runtime malloc. + * By default, PhysicsFS will use whatever is reasonable for a platform + * to manage dynamic memory (usually ANSI C malloc/realloc/calloc/free, but + * some platforms might use something else), but in some uncommon cases, the + * app might want more control over the library's memory management. This + * lets you redirect PhysicsFS to use your own allocation routines instead. + * You can only call this function before PHYSFS_init(); if the library is + * initialized, it'll reject your efforts to change the allocator mid-stream. + * You may call this function after PHYSFS_deinit() if you are willing to + * shut down the library and restart it with a new allocator; this is a safe + * and supported operation. The allocator remains intact between deinit/init + * calls. If you want to return to the platform's default allocator, pass a + * NULL in here. * - * By default, PhysicsFS will use ANSI C malloc/realloc/calloc/free calls - * to manage dynamic memory, but in some uncommon cases, the app might want - * more control over the library's memory management. This lets you redirect - * physfs to use your own allocation routines instead. You can only call this - * function before PHYSFS_init(); if the library is initialized, it'll - * reject your efforts to change the allocator mid-stream. You may call this - * function after PHYSFS_deinit() if you are willing to shutdown the library - * and restart it with a new allocator; this is a safe and supported - * operation. The allocator remains intact between deinit/init calls. - * If you want to return to the default allocator, pass a NULL in here. - * * If you aren't immediately sure what to do with this function, you can * safely ignore it altogether. * From DONOTREPLY at icculus.org Tue Mar 20 13:57:45 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 20 Mar 2007 13:57:45 -0400 Subject: r856 - in trunk: . platform Message-ID: <20070320175745.23475.qmail@icculus.org> Author: icculus Date: 2007-03-20 13:57:45 -0400 (Tue, 20 Mar 2007) New Revision: 856 Modified: trunk/physfs_internal.h trunk/platform/beos.cpp trunk/platform/os2.c trunk/platform/pocketpc.c trunk/platform/unix.c trunk/platform/windows.c Log: Removed __PHYSFS_platformTimeslice()...we don't actually use this anymore. Modified: trunk/physfs_internal.h =================================================================== --- trunk/physfs_internal.h 2007-03-20 17:53:42 UTC (rev 855) +++ trunk/physfs_internal.h 2007-03-20 17:57:45 UTC (rev 856) @@ -1613,13 +1613,6 @@ /* - * Make the current thread give up a timeslice. This is called in a loop - * while waiting for various external forces to get back to us. - */ -void __PHYSFS_platformTimeslice(void); - - -/* * Enumerate a directory of files. This follows the rules for the * PHYSFS_Archiver->enumerateFiles() method (see above), except that the * (dirName) that is passed to this function is converted to Modified: trunk/platform/beos.cpp =================================================================== --- trunk/platform/beos.cpp 2007-03-20 17:53:42 UTC (rev 855) +++ trunk/platform/beos.cpp 2007-03-20 17:57:45 UTC (rev 856) @@ -189,13 +189,6 @@ } /* __PHYSFS_platformGetThreadID */ -/* Much like my college days, try to sleep for 10 milliseconds at a time... */ -void __PHYSFS_platformTimeslice(void) -{ - snooze(10000); /* put thread to sleep for 10 milliseconds. */ -} /* __PHYSFS_platformTimeslice */ - - char *__PHYSFS_platformRealPath(const char *path) { BPath normalized(path, NULL, true); /* force normalization of path. */ Modified: trunk/platform/os2.c =================================================================== --- trunk/platform/os2.c 2007-03-20 17:53:42 UTC (rev 855) +++ trunk/platform/os2.c 2007-03-20 17:57:45 UTC (rev 856) @@ -649,13 +649,6 @@ } /* __PHYSFS_platformGetLastModTime */ -/* Much like my college days, try to sleep for 10 milliseconds at a time... */ -void __PHYSFS_platformTimeslice(void) -{ - DosSleep(10); -} /* __PHYSFS_platformTimeslice(void) */ - - PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) { PTIB ptib; Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-20 17:53:42 UTC (rev 855) +++ trunk/platform/pocketpc.c 2007-03-20 17:57:45 UTC (rev 856) @@ -225,12 +225,6 @@ } /* __PHYSFS_platformCvtToDependent */ -void __PHYSFS_platformTimeslice(void) -{ - Sleep(10); -} /* __PHYSFS_platformTimeslice */ - - static int doEnumCallback(const wchar_t *w_fname) { const PHYSFS_uint64 len = (PHYSFS_uint64) ((wcslen(w_fname) * 4) + 1); Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-20 17:53:42 UTC (rev 855) +++ trunk/platform/unix.c 2007-03-20 17:57:45 UTC (rev 856) @@ -350,13 +350,6 @@ } /* __PHYSFS_platformCalcBaseDir */ -/* Much like my college days, try to sleep for 10 milliseconds at a time... */ -void __PHYSFS_platformTimeslice(void) -{ - usleep( 10 * 1000 ); /* don't care if it fails. */ -} /* __PHYSFS_platformTimeslice */ - - #ifdef PHYSFS_PLATFORM_MACOSX /* * This function is only for OSX. The problem is that Apple's applications Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-20 17:53:42 UTC (rev 855) +++ trunk/platform/windows.c 2007-03-20 17:57:45 UTC (rev 856) @@ -378,13 +378,6 @@ } /* __PHYSFS_platformCvtToDependent */ -/* Much like my college days, try to sleep for 10 milliseconds at a time... */ -void __PHYSFS_platformTimeslice(void) -{ - Sleep(10); -} /* __PHYSFS_platformTimeslice */ - - void __PHYSFS_platformEnumerateFiles(const char *dirname, int omitSymLinks, PHYSFS_EnumFilesCallback callback, From DONOTREPLY at icculus.org Tue Mar 20 14:33:56 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 20 Mar 2007 14:33:56 -0400 Subject: r857 - in trunk: . platform Message-ID: <20070320183356.14288.qmail@icculus.org> Author: icculus Date: 2007-03-20 14:33:56 -0400 (Tue, 20 Mar 2007) New Revision: 857 Modified: trunk/physfs.c trunk/physfs_internal.h trunk/platform/beos.cpp trunk/platform/os2.c trunk/platform/pocketpc.c trunk/platform/posix.c trunk/platform/unix.c trunk/platform/windows.c Log: Since all the platform layers were using the same cut-and-paste of the malloc/realloc/free allocator, I moved it into physfs.c as a default, which is used if the platform layer doesn't offer a platform-specific default allocator, which none do at this point, but will soon. Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-20 17:57:45 UTC (rev 856) +++ trunk/physfs.c 2007-03-20 18:33:56 UTC (rev 857) @@ -2029,14 +2029,40 @@ } /* PHYSFS_setAllocator */ +static void *mallocAllocatorMalloc(PHYSFS_uint64 s) +{ + BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); + #undef malloc + return(malloc((size_t) s)); +} /* mallocAllocatorMalloc */ + + +static void *mallocAllocatorRealloc(void *ptr, PHYSFS_uint64 s) +{ + BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); + #undef realloc + return(realloc(ptr, (size_t) s)); +} /* mallocAllocatorRealloc */ + + +static void mallocAllocatorFree(void *ptr) +{ + #undef free + free(ptr); +} /* mallocAllocatorFree */ + + static void setDefaultAllocator(void) { assert(!externalAllocator); - allocator.Init = __PHYSFS_platformAllocatorInit; - allocator.Deinit = __PHYSFS_platformAllocatorDeinit; - allocator.Malloc = __PHYSFS_platformAllocatorMalloc; - allocator.Realloc = __PHYSFS_platformAllocatorRealloc; - allocator.Free = __PHYSFS_platformAllocatorFree; + if (!__PHYSFS_platformSetDefaultAllocator(&allocator)) + { + allocator.Init = NULL; + allocator.Deinit = NULL; + allocator.Malloc = mallocAllocatorMalloc; + allocator.Realloc = mallocAllocatorRealloc; + allocator.Free = mallocAllocatorFree; + } /* if */ } /* setDefaultAllocator */ /* end of physfs.c ... */ Modified: trunk/physfs_internal.h =================================================================== --- trunk/physfs_internal.h 2007-03-20 17:57:45 UTC (rev 856) +++ trunk/physfs_internal.h 2007-03-20 18:33:56 UTC (rev 857) @@ -1719,40 +1719,19 @@ void __PHYSFS_platformReleaseMutex(void *mutex); /* - * Called during PHYSFS_init() to initialize the allocator, if the user + * Called at the start of PHYSFS_init() to prepare the allocator, if the user * hasn't selected their own allocator via PHYSFS_setAllocator(). - * Return zero on initialization error (which will make PHYSFS_init() fail, - * too), non-zero on success. + * If the platform has a custom allocator, it should fill in the fields of + * (a) with the proper function pointers and return non-zero. + * If the platform just wants to use malloc()/free()/etc, return zero + * immediately and the higher level will handle it. The Init and Deinit + * fields of (a) are optional...set them to NULL if you don't need them. + * Everything else must be implemented. All rules follow those for + * PHYSFS_setAllocator(). If Init isn't NULL, it will be called shortly + * after this function returns non-zero. */ -int __PHYSFS_platformAllocatorInit(void); +int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a); -/* - * Called during PHYSFS_deinit() to deinitialize the allocator, if the user - * hasn't selected their own allocator via PHYSFS_setAllocator(). - */ -void __PHYSFS_platformAllocatorDeinit(void); - -/* - * Implement malloc. It's safe to just pass through from the C runtime. - * This is used for allocation if the user hasn't selected their own - * allocator via PHYSFS_setAllocator(). - */ -void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s); - -/* - * Implement realloc. It's safe to just pass through from the C runtime. - * This is used for allocation if the user hasn't selected their own - * allocator via PHYSFS_setAllocator(). - */ -void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s); - -/* - * Implement free. It's safe to just pass through from the C runtime. - * This is used for deallocation if the user hasn't selected their own - * allocator via PHYSFS_setAllocator(). - */ -void __PHYSFS_platformAllocatorFree(void *ptr); - #ifdef __cplusplus } #endif Modified: trunk/platform/beos.cpp =================================================================== --- trunk/platform/beos.cpp 2007-03-20 17:57:45 UTC (rev 856) +++ trunk/platform/beos.cpp 2007-03-20 18:33:56 UTC (rev 857) @@ -240,6 +240,12 @@ release_sem(*((sem_id *) mutex)); } /* __PHYSFS_platformReleaseMutex */ + +int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a) +{ + return(0); /* just use malloc() and friends. */ +} /* __PHYSFS_platformSetDefaultAllocator */ + #endif /* PHYSFS_PLATFORM_BEOS */ /* end of beos.cpp ... */ Modified: trunk/platform/os2.c =================================================================== --- trunk/platform/os2.c 2007-03-20 17:57:45 UTC (rev 856) +++ trunk/platform/os2.c 2007-03-20 18:33:56 UTC (rev 857) @@ -690,40 +690,12 @@ } /* __PHYSFS_platformReleaseMutex */ -int __PHYSFS_platformAllocatorInit(void) +/* !!! FIXME: Don't use C runtime for allocators? */ +int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a) { - return(1); /* always succeeds. */ -} /* __PHYSFS_platformAllocatorInit */ + return(0); /* just use malloc() and friends. */ +} /* __PHYSFS_platformSetDefaultAllocator */ - -void __PHYSFS_platformAllocatorDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformAllocatorInit */ - - -void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef malloc - return(malloc((size_t) s)); -} /* __PHYSFS_platformMalloc */ - - -void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef realloc - return(realloc(ptr, (size_t) s)); -} /* __PHYSFS_platformRealloc */ - - -void __PHYSFS_platformAllocatorFree(void *ptr) -{ - #undef free - free(ptr); -} /* __PHYSFS_platformAllocatorFree */ - #endif /* PHYSFS_PLATFORM_OS2 */ /* end of os2.c ... */ Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-20 17:57:45 UTC (rev 856) +++ trunk/platform/pocketpc.c 2007-03-20 18:33:56 UTC (rev 857) @@ -576,40 +576,11 @@ /* !!! FIXME: Don't use C runtime for allocators? */ -int __PHYSFS_platformAllocatorInit(void) +int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a) { - return(1); /* always succeeds. */ -} /* __PHYSFS_platformAllocatorInit */ + return(0); /* just use malloc() and friends. */ +} /* __PHYSFS_platformSetDefaultAllocator */ - -void __PHYSFS_platformAllocatorDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformAllocatorInit */ - - -void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef malloc - return(malloc((size_t) s)); -} /* __PHYSFS_platformMalloc */ - - -void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef realloc - return(realloc(ptr, (size_t) s)); -} /* __PHYSFS_platformRealloc */ - - -void __PHYSFS_platformAllocatorFree(void *ptr) -{ - #undef free - free(ptr); -} /* __PHYSFS_platformAllocatorFree */ - #endif /* PHYSFS_PLATFORM_POCKETPC */ /* end of pocketpc.c ... */ Modified: trunk/platform/posix.c =================================================================== --- trunk/platform/posix.c 2007-03-20 17:57:45 UTC (rev 856) +++ trunk/platform/posix.c 2007-03-20 18:33:56 UTC (rev 857) @@ -429,41 +429,6 @@ return statbuf.st_mtime; } /* __PHYSFS_platformGetLastModTime */ - -int __PHYSFS_platformAllocatorInit(void) -{ - return(1); /* always succeeds. */ -} /* __PHYSFS_platformAllocatorInit */ - - -void __PHYSFS_platformAllocatorDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformAllocatorInit */ - - -void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef malloc - return(malloc((size_t) s)); -} /* __PHYSFS_platformMalloc */ - - -void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef realloc - return(realloc(ptr, (size_t) s)); -} /* __PHYSFS_platformRealloc */ - - -void __PHYSFS_platformAllocatorFree(void *ptr) -{ - #undef free - free(ptr); -} /* __PHYSFS_platformAllocatorFree */ - #endif /* PHYSFS_PLATFORM_POSIX */ /* end of posix.c ... */ Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-20 17:57:45 UTC (rev 856) +++ trunk/platform/unix.c 2007-03-20 18:33:56 UTC (rev 857) @@ -471,6 +471,12 @@ } /* __PHYSFS_platformRealPath */ +int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a) +{ + return(0); /* just use malloc() and friends. */ +} /* __PHYSFS_platformSetDefaultAllocator */ + + #if (defined PHYSFS_NO_PTHREADS_SUPPORT) PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) { return(0x0001); } Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-20 17:57:45 UTC (rev 856) +++ trunk/platform/windows.c 2007-03-20 18:33:56 UTC (rev 857) @@ -1051,40 +1051,11 @@ /* !!! FIXME: Don't use C runtime for allocators? */ -int __PHYSFS_platformAllocatorInit(void) +int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a) { - return(1); /* always succeeds. */ -} /* __PHYSFS_platformAllocatorInit */ + return(0); /* just use malloc() and friends. */ +} /* __PHYSFS_platformSetDefaultAllocator */ - -void __PHYSFS_platformAllocatorDeinit(void) -{ - /* no-op */ -} /* __PHYSFS_platformAllocatorInit */ - - -void *__PHYSFS_platformAllocatorMalloc(PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef malloc - return(malloc((size_t) s)); -} /* __PHYSFS_platformMalloc */ - - -void *__PHYSFS_platformAllocatorRealloc(void *ptr, PHYSFS_uint64 s) -{ - BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); - #undef realloc - return(realloc(ptr, (size_t) s)); -} /* __PHYSFS_platformRealloc */ - - -void __PHYSFS_platformAllocatorFree(void *ptr) -{ - #undef free - free(ptr); -} /* __PHYSFS_platformAllocatorFree */ - #endif /* PHYSFS_PLATFORM_WINDOWS */ /* end of windows.c ... */ From DONOTREPLY at icculus.org Wed Mar 21 00:31:13 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 21 Mar 2007 00:31:13 -0400 Subject: r858 - trunk/platform Message-ID: <20070321043113.15134.qmail@icculus.org> Author: icculus Date: 2007-03-21 00:31:13 -0400 (Wed, 21 Mar 2007) New Revision: 858 Modified: trunk/platform/unix.c Log: Replaced manual management of recursive pthread mutexes with PTHREAD_MUTEX_RECURSIVE. Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-20 18:33:56 UTC (rev 857) +++ trunk/platform/unix.c 2007-03-21 04:31:13 UTC (rev 858) @@ -477,6 +477,7 @@ } /* __PHYSFS_platformSetDefaultAllocator */ + #if (defined PHYSFS_NO_PTHREADS_SUPPORT) PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) { return(0x0001); } @@ -487,13 +488,6 @@ #else -typedef struct -{ - pthread_mutex_t mutex; - pthread_t owner; - PHYSFS_uint32 count; -} PthreadMutex; - /* Just in case; this is a panic value. */ #if ((!defined SIZEOF_INT) || (SIZEOF_INT <= 0)) # define SIZEOF_INT 4 @@ -517,62 +511,56 @@ void *__PHYSFS_platformCreateMutex(void) { + pthread_mutex_t *m = NULL; + pthread_mutexattr_t attr; int rc; - PthreadMutex *m = (PthreadMutex *) allocator.Malloc(sizeof (PthreadMutex)); - BAIL_IF_MACRO(m == NULL, ERR_OUT_OF_MEMORY, NULL); - rc = pthread_mutex_init(&m->mutex, NULL); + + rc = pthread_mutexattr_init(&attr); + if (rc == 0) + { + rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + if (rc == 0) + { + m = (pthread_mutex_t *) allocator.Malloc(sizeof (pthread_mutex_t)); + if (m == NULL) + rc = ENOMEM; + else + rc = pthread_mutex_init(m, &attr); + } /* if */ + pthread_mutexattr_destroy(&attr); + } /* if */ + if (rc != 0) { allocator.Free(m); BAIL_MACRO(strerror(rc), NULL); } /* if */ - m->count = 0; - m->owner = (pthread_t) 0xDEADBEEF; return((void *) m); } /* __PHYSFS_platformCreateMutex */ void __PHYSFS_platformDestroyMutex(void *mutex) { - PthreadMutex *m = (PthreadMutex *) mutex; - - /* Destroying a locked mutex is a bug, but we'll try to be helpful. */ - if ((m->owner == pthread_self()) && (m->count > 0)) - pthread_mutex_unlock(&m->mutex); - - pthread_mutex_destroy(&m->mutex); + pthread_mutex_t *m = (pthread_mutex_t *) mutex; + pthread_mutex_destroy(m); allocator.Free(m); } /* __PHYSFS_platformDestroyMutex */ int __PHYSFS_platformGrabMutex(void *mutex) { - PthreadMutex *m = (PthreadMutex *) mutex; - pthread_t tid = pthread_self(); - if (m->owner != tid) - { - if (pthread_mutex_lock(&m->mutex) != 0) - return(0); - m->owner = tid; - } /* if */ - - m->count++; + pthread_mutex_t *m = (pthread_mutex_t *) mutex; + if (pthread_mutex_lock(m) != 0) + return(0); return(1); } /* __PHYSFS_platformGrabMutex */ void __PHYSFS_platformReleaseMutex(void *mutex) { - PthreadMutex *m = (PthreadMutex *) mutex; - if (m->owner == pthread_self()) - { - if (--m->count == 0) - { - m->owner = (pthread_t) 0xDEADBEEF; - pthread_mutex_unlock(&m->mutex); - } /* if */ - } /* if */ + pthread_mutex_t *m = (pthread_mutex_t *) mutex; + pthread_mutex_unlock(m); } /* __PHYSFS_platformReleaseMutex */ #endif /* !PHYSFS_NO_PTHREADS_SUPPORT */ From DONOTREPLY at icculus.org Wed Mar 21 01:03:17 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 21 Mar 2007 01:03:17 -0400 Subject: r859 - in trunk: . platform Message-ID: <20070321050317.389.qmail@icculus.org> Author: icculus Date: 2007-03-21 01:03:17 -0400 (Wed, 21 Mar 2007) New Revision: 859 Added: trunk/platform/macosx.c Modified: trunk/CMakeLists.txt trunk/physfs_platforms.h trunk/platform/beos.cpp trunk/platform/posix.c trunk/platform/unix.c Log: Split out Mac OS X code from unix.c and added some Carbon-specific code... moved some stuff around and implemented a few things in BeOS and POSIX bits to accomodate this. Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2007-03-21 04:31:13 UTC (rev 858) +++ trunk/CMakeLists.txt 2007-03-21 05:03:17 UTC (rev 859) @@ -117,6 +117,7 @@ platform/pocketpc.c platform/posix.c platform/unix.c + platform/macosx.c platform/windows.c archivers/dir.c archivers/grp.c Modified: trunk/physfs_platforms.h =================================================================== --- trunk/physfs_platforms.h 2007-03-21 04:31:13 UTC (rev 858) +++ trunk/physfs_platforms.h 2007-03-21 05:03:17 UTC (rev 859) @@ -23,7 +23,6 @@ # define PHYSFS_PLATFORM_OS2 #elif ((defined __MACH__) && (defined __APPLE__)) # define PHYSFS_PLATFORM_MACOSX -# define PHYSFS_PLATFORM_UNIX # define PHYSFS_PLATFORM_POSIX #elif defined(macintosh) # error Classic Mac OS support was dropped from PhysicsFS 2.0. Move to OS X. Modified: trunk/platform/beos.cpp =================================================================== --- trunk/platform/beos.cpp 2007-03-21 04:31:13 UTC (rev 858) +++ trunk/platform/beos.cpp 2007-03-21 05:03:17 UTC (rev 859) @@ -30,9 +30,6 @@ #include "physfs_internal.h" -const char *__PHYSFS_platformDirSeparator = "/"; - - int __PHYSFS_platformInit(void) { return(1); /* always succeed. */ @@ -158,7 +155,7 @@ thread_id tid = find_thread(NULL); get_thread_info(tid, &info); return(info.team); -} /* getMyTeamID */ +} /* getTeamID */ char *__PHYSFS_platformCalcBaseDir(const char *argv0) @@ -201,6 +198,12 @@ } /* __PHYSFS_platformRealPath */ +char *__PHYSFS_platformCurrentDir(void) +{ + return(__PHYSFS_platformRealPath(".")); /* let BPath sort it out. */ +} /* __PHYSFS_platformCurrentDir */ + + /* !!! FIXME: semaphores are not mutexes... */ void *__PHYSFS_platformCreateMutex(void) { Added: trunk/platform/macosx.c =================================================================== --- trunk/platform/macosx.c (rev 0) +++ trunk/platform/macosx.c 2007-03-21 05:03:17 UTC (rev 859) @@ -0,0 +1,396 @@ +/* + * Mac OS X support routines for PhysicsFS. + * + * Please see the file LICENSE.txt in the source's root directory. + * + * This file written by Ryan C. Gordon. + */ + +#define __PHYSICSFS_INTERNAL__ +#include "physfs_platforms.h" + +#ifdef PHYSFS_PLATFORM_MACOSX + +#include +#include +#include +#include +#include + +/* Seems to get defined in some system header... */ +#ifdef Free +#undef Free +#endif + +#include "physfs_internal.h" + + +/* Wrap PHYSFS_Allocator in a CFAllocator... */ +static CFAllocatorRef cfallocator = NULL; + +CFStringRef cfallocDesc(const void *info) +{ + return(CFStringCreateWithCString(cfallocator, "PhysicsFS", + kCFStringEncodingASCII)); +} /* cfallocDesc */ + + +static void *cfallocMalloc(CFIndex allocSize, CFOptionFlags hint, void *info) +{ + return allocator.Malloc(allocSize); +} /* cfallocMalloc */ + + +static void cfallocFree(void *ptr, void *info) +{ + allocator.Free(ptr); +} /* cfallocFree */ + + +static void *cfallocRealloc(void *ptr, CFIndex newsize, + CFOptionFlags hint, void *info) +{ + if ((ptr == NULL) || (newsize <= 0)) + return NULL; /* ADC docs say you should always return NULL here. */ + return allocator.Realloc(ptr, newsize); +} /* cfallocRealloc */ + + +int __PHYSFS_platformInit(void) +{ + /* set up a CFAllocator, so Carbon can use the physfs allocator, too. */ + CFAllocatorContext ctx; + memset(&ctx, '\0', sizeof (ctx)); + ctx.copyDescription = cfallocDesc; + ctx.allocate = cfallocMalloc; + ctx.reallocate = cfallocRealloc; + ctx.deallocate = cfallocFree; + cfallocator = CFAllocatorCreate(kCFAllocatorUseContext, &ctx); + BAIL_IF_MACRO(cfallocator == NULL, ERR_OUT_OF_MEMORY, 0); + return(1); /* success. */ +} /* __PHYSFS_platformInit */ + + +int __PHYSFS_platformDeinit(void) +{ + CFRelease(cfallocator); + cfallocator = NULL; + return(1); /* always succeed. */ +} /* __PHYSFS_platformDeinit */ + + +/* CD-ROM detection code... */ + +/* + * Code based on sample from Apple Developer Connection: + * http://developer.apple.com/samplecode/Sample_Code/Devices_and_Hardware/Disks/VolumeToBSDNode/VolumeToBSDNode.c.htm + */ + +static int darwinIsWholeMedia(io_service_t service) +{ + int retval = 0; + CFTypeRef wholeMedia; + + if (!IOObjectConformsTo(service, kIOMediaClass)) + return(0); + + wholeMedia = IORegistryEntryCreateCFProperty(service, + CFSTR(kIOMediaWholeKey), + cfallocator, 0); + if (wholeMedia == NULL) + return(0); + + retval = CFBooleanGetValue(wholeMedia); + CFRelease(wholeMedia); + + return retval; +} /* darwinIsWholeMedia */ + + +static int darwinIsMountedDisc(char *bsdName, mach_port_t masterPort) +{ + int retval = 0; + CFMutableDictionaryRef matchingDict; + kern_return_t rc; + io_iterator_t iter; + io_service_t service; + + if ((matchingDict = IOBSDNameMatching(masterPort, 0, bsdName)) == NULL) + return(0); + + rc = IOServiceGetMatchingServices(masterPort, matchingDict, &iter); + if ((rc != KERN_SUCCESS) || (!iter)) + return(0); + + service = IOIteratorNext(iter); + IOObjectRelease(iter); + if (!service) + return(0); + + rc = IORegistryEntryCreateIterator(service, kIOServicePlane, + kIORegistryIterateRecursively | kIORegistryIterateParents, &iter); + + if (!iter) + return(0); + + if (rc != KERN_SUCCESS) + { + IOObjectRelease(iter); + return(0); + } /* if */ + + IOObjectRetain(service); /* add an extra object reference... */ + + do + { + if (darwinIsWholeMedia(service)) + { + if ( (IOObjectConformsTo(service, kIOCDMediaClass)) || + (IOObjectConformsTo(service, kIODVDMediaClass)) ) + { + retval = 1; + } /* if */ + } /* if */ + IOObjectRelease(service); + } while ((service = IOIteratorNext(iter)) && (!retval)); + + IOObjectRelease(iter); + IOObjectRelease(service); + + return(retval); +} /* darwinIsMountedDisc */ + + +void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) +{ + const char *devPrefix = "/dev/"; + const int prefixLen = strlen(devPrefix); + mach_port_t masterPort = 0; + struct statfs *mntbufp; + int i, mounts; + + if (IOMasterPort(MACH_PORT_NULL, &masterPort) != KERN_SUCCESS) + BAIL_MACRO(ERR_OS_ERROR, /*return void*/); + + mounts = getmntinfo(&mntbufp, MNT_WAIT); /* NOT THREAD SAFE! */ + for (i = 0; i < mounts; i++) + { + char *dev = mntbufp[i].f_mntfromname; + char *mnt = mntbufp[i].f_mntonname; + if (strncmp(dev, devPrefix, prefixLen) != 0) /* a virtual device? */ + continue; + + dev += prefixLen; + if (darwinIsMountedDisc(dev, masterPort)) + cb(data, mnt); + } /* for */ +} /* __PHYSFS_platformDetectAvailableCDs */ + + +static char *convertCFString(CFStringRef cfstr) +{ + CFIndex len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), + kCFStringEncodingUTF8) + 1; + char *retval = (char *) allocator.Malloc(len); + BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); + + if (CFStringGetCString(cfstr, retval, len, kCFStringEncodingUTF8)) + { + /* shrink overallocated buffer if possible... */ + CFIndex newlen = strlen(retval) + 1; + if (newlen < len) + { + void *ptr = allocator.Realloc(retval, newlen); + if (ptr != NULL) + retval = (char *) ptr; + } /* if */ + } /* if */ + + else /* probably shouldn't fail, but just in case... */ + { + allocator.Free(retval); + BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); + } /* else */ + + return(retval); +} /* convertCFString */ + + +char *__PHYSFS_platformCalcBaseDir(const char *argv0) +{ + ProcessSerialNumber psn = { 0, kCurrentProcess }; + FSRef fsref; + CFRange cfrange; + CFURLRef cfurl = NULL; + CFStringRef cfstr = NULL; + CFMutableStringRef cfmutstr = NULL; + char *retval = NULL; + + BAIL_IF_MACRO(GetProcessBundleLocation(&psn, &fsref) != noErr, NULL, NULL); + cfurl = CFURLCreateFromFSRef(cfallocator, &fsref); + BAIL_IF_MACRO(cfurl == NULL, NULL, NULL); + cfstr = CFURLCopyFileSystemPath(cfurl, kCFURLPOSIXPathStyle); + CFRelease(cfurl); + BAIL_IF_MACRO(cfstr == NULL, NULL, NULL); + cfmutstr = CFStringCreateMutableCopy(cfallocator, 0, cfstr); + CFRelease(cfstr); + BAIL_IF_MACRO(cfmutstr == NULL, NULL, NULL); + + /* Find last dirsep so we can chop the binary's filename from the path. */ + cfrange = CFStringFind(cfmutstr, CFSTR("/"), kCFCompareBackwards); + if (cfrange.location == kCFNotFound) + { + assert(0); /* shouldn't ever hit this... */ + CFRelease(cfmutstr); + return(NULL); + } /* if */ + + /* chop the "/exename" from the end of the path string... */ + cfrange.length = CFStringGetLength(cfmutstr) - cfrange.location; + CFStringDelete(cfmutstr, cfrange); + + /* If we're an Application Bundle, chop everything but the base. */ + cfrange = CFStringFind(cfmutstr, CFSTR("/Contents/MacOS"), + kCFCompareCaseInsensitive | + kCFCompareBackwards | + kCFCompareAnchored); + + if (cfrange.location != kCFNotFound) + CFStringDelete(cfmutstr, cfrange); /* chop that, too. */ + + retval = convertCFString(cfmutstr); + CFRelease(cfmutstr); + + return(retval); /* whew. */ +} /* __PHYSFS_platformCalcBaseDir */ + + +/* !!! FIXME */ +#define osxerr(x) x + +char *__PHYSFS_platformRealPath(const char *path) +{ + /* The symlink and relative path resolving happens in FSPathMakeRef() */ + FSRef fsref; + CFURLRef cfurl = NULL; + CFStringRef cfstr = NULL; + char *retval = NULL; + OSStatus rc = osxerr(FSPathMakeRef((UInt8 *) path, &fsref, NULL)); + BAIL_IF_MACRO(rc != noErr, NULL, NULL); + + /* Now get it to spit out a full path. */ + cfurl = CFURLCreateFromFSRef(cfallocator, &fsref); + BAIL_IF_MACRO(cfurl == NULL, ERR_OUT_OF_MEMORY, NULL); + cfstr = CFURLCopyFileSystemPath(cfurl, kCFURLPOSIXPathStyle); + CFRelease(cfurl); + BAIL_IF_MACRO(cfstr == NULL, ERR_OUT_OF_MEMORY, NULL); + retval = convertCFString(cfstr); + CFRelease(cfstr); + + return(retval); +} /* __PHYSFS_platformRealPath */ + + +char *__PHYSFS_platformCurrentDir(void) +{ + return(__PHYSFS_platformRealPath(".")); /* let CFURL sort it out. */ +} /* __PHYSFS_platformCurrentDir */ + + +/* Platform allocator uses default CFAllocator at PHYSFS_init() time. */ + +static CFAllocatorRef cfallocdef = NULL; + +static int macosxAllocatorInit(void) +{ + int retval = 0; + cfallocdef = CFAllocatorGetDefault(); + retval = (cfallocdef != NULL); + if (retval) + CFRetain(cfallocdef); + return(retval); +} /* macosxAllocatorInit */ + + +static void macosxAllocatorDeinit(void) +{ + if (cfallocdef != NULL) + { + CFRelease(cfallocdef); + cfallocdef = NULL; + } /* if */ +} /* macosxAllocatorDeinit */ + + +static void *macosxAllocatorMalloc(PHYSFS_uint64 s) +{ + BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); + return(CFAllocatorAllocate(cfallocdef, (CFIndex) s, 0)); +} /* macosxAllocatorMalloc */ + + +static void *macosxAllocatorRealloc(void *ptr, PHYSFS_uint64 s) +{ + BAIL_IF_MACRO(__PHYSFS_ui64FitsAddressSpace(s), ERR_OUT_OF_MEMORY, NULL); + return(CFAllocatorReallocate(cfallocdef, ptr, (CFIndex) s, 0)); +} /* macosxAllocatorRealloc */ + + +static void macosxAllocatorFree(void *ptr) +{ + CFAllocatorDeallocate(cfallocdef, ptr); +} /* macosxAllocatorFree */ + + +int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a) +{ + allocator.Init = macosxAllocatorInit; + allocator.Deinit = macosxAllocatorDeinit; + allocator.Malloc = macosxAllocatorMalloc; + allocator.Realloc = macosxAllocatorRealloc; + allocator.Free = macosxAllocatorFree; + return(1); /* return non-zero: we're supplying custom allocator. */ +} /* __PHYSFS_platformSetDefaultAllocator */ + + +PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) +{ + return( (PHYSFS_uint64) ((size_t) MPCurrentTaskID()) ); +} /* __PHYSFS_platformGetThreadID */ + + +void *__PHYSFS_platformCreateMutex(void) +{ + MPCriticalRegionID m = NULL; + if (osxerr(MPCreateCriticalRegion(&m)) != noErr) + return NULL; + return m; +} /* __PHYSFS_platformCreateMutex */ + + +void __PHYSFS_platformDestroyMutex(void *mutex) +{ + MPCriticalRegionID m = (MPCriticalRegionID) mutex; + MPDeleteCriticalRegion(m); +} /* __PHYSFS_platformDestroyMutex */ + + +int __PHYSFS_platformGrabMutex(void *mutex) +{ + MPCriticalRegionID m = (MPCriticalRegionID) mutex; + if (MPEnterCriticalRegion(m, kDurationForever) != noErr) + return(0); + return(1); +} /* __PHYSFS_platformGrabMutex */ + + +void __PHYSFS_platformReleaseMutex(void *mutex) +{ + MPCriticalRegionID m = (MPCriticalRegionID) mutex; + MPExitCriticalRegion(m); +} /* __PHYSFS_platformReleaseMutex */ + +#endif /* PHYSFS_PLATFORM_MACOSX */ + +/* end of macosx.c ... */ + Modified: trunk/platform/posix.c =================================================================== --- trunk/platform/posix.c 2007-03-21 04:31:13 UTC (rev 858) +++ trunk/platform/posix.c 2007-03-21 05:03:17 UTC (rev 859) @@ -30,6 +30,9 @@ #include "physfs_internal.h" +const char *__PHYSFS_platformDirSeparator = "/"; + + char *__PHYSFS_platformCopyEnvironmentVariable(const char *varname) { const char *envr = getenv(varname); @@ -224,43 +227,6 @@ } /* __PHYSFS_platformEnumerateFiles */ -char *__PHYSFS_platformCurrentDir(void) -{ - int allocSize = 0; - char *retval = NULL; - char *ptr; - - do - { - allocSize += 100; - ptr = (char *) allocator.Realloc(retval, allocSize); - if (ptr == NULL) - { - if (retval != NULL) - allocator.Free(retval); - BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); - } /* if */ - - retval = ptr; - ptr = getcwd(retval, allocSize); - } while (ptr == NULL && errno == ERANGE); - - if (ptr == NULL && errno) - { - /* - * getcwd() failed for some reason, for example current - * directory not existing. - */ - if (retval != NULL) - allocator.Free(retval); - BAIL_MACRO(ERR_NO_SUCH_FILE, NULL); - } /* if */ - - return(retval); -} /* __PHYSFS_platformCurrentDir */ - - - int __PHYSFS_platformMkDir(const char *path) { int rc; Modified: trunk/platform/unix.c =================================================================== --- trunk/platform/unix.c 2007-03-21 04:31:13 UTC (rev 858) +++ trunk/platform/unix.c 2007-03-21 05:03:17 UTC (rev 859) @@ -25,15 +25,6 @@ #include #include -#ifdef PHYSFS_PLATFORM_MACOSX -# include -# include -# include -# include -# include -# include -#endif - #if (!defined PHYSFS_NO_PTHREADS_SUPPORT) #include #endif @@ -51,14 +42,7 @@ #include "physfs_internal.h" -/* Seems to get defined in some system header... */ -#ifdef Free -#undef Free -#endif -const char *__PHYSFS_platformDirSeparator = "/"; - - int __PHYSFS_platformInit(void) { return(1); /* always succeed. */ @@ -78,113 +62,6 @@ { } /* __PHYSFS_platformDetectAvailableCDs */ - -#elif (defined PHYSFS_PLATFORM_MACOSX) /* "Big Nasty." */ -/* - * Code based on sample from Apple Developer Connection: - * http://developer.apple.com/samplecode/Sample_Code/Devices_and_Hardware/Disks/VolumeToBSDNode/VolumeToBSDNode.c.htm - */ - -static int darwinIsWholeMedia(io_service_t service) -{ - int retval = 0; - CFTypeRef wholeMedia; - - if (!IOObjectConformsTo(service, kIOMediaClass)) - return(0); - - wholeMedia = IORegistryEntryCreateCFProperty(service, - CFSTR(kIOMediaWholeKey), - kCFAllocatorDefault, 0); - if (wholeMedia == NULL) - return(0); - - retval = CFBooleanGetValue(wholeMedia); - CFRelease(wholeMedia); - - return retval; -} /* darwinIsWholeMedia */ - - -static int darwinIsMountedDisc(char *bsdName, mach_port_t masterPort) -{ - int retval = 0; - CFMutableDictionaryRef matchingDict; - kern_return_t rc; - io_iterator_t iter; - io_service_t service; - - if ((matchingDict = IOBSDNameMatching(masterPort, 0, bsdName)) == NULL) - return(0); - - rc = IOServiceGetMatchingServices(masterPort, matchingDict, &iter); - if ((rc != KERN_SUCCESS) || (!iter)) - return(0); - - service = IOIteratorNext(iter); - IOObjectRelease(iter); - if (!service) - return(0); - - rc = IORegistryEntryCreateIterator(service, kIOServicePlane, - kIORegistryIterateRecursively | kIORegistryIterateParents, &iter); - - if (!iter) - return(0); - - if (rc != KERN_SUCCESS) - { - IOObjectRelease(iter); - return(0); - } /* if */ - - IOObjectRetain(service); /* add an extra object reference... */ - - do - { - if (darwinIsWholeMedia(service)) - { - if ( (IOObjectConformsTo(service, kIOCDMediaClass)) || - (IOObjectConformsTo(service, kIODVDMediaClass)) ) - { - retval = 1; - } /* if */ - } /* if */ - IOObjectRelease(service); - } while ((service = IOIteratorNext(iter)) && (!retval)); - - IOObjectRelease(iter); - IOObjectRelease(service); - - return(retval); -} /* darwinIsMountedDisc */ - - -void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) -{ - const char *devPrefix = "/dev/"; - int prefixLen = strlen(devPrefix); - mach_port_t masterPort = 0; - struct statfs *mntbufp; - int i, mounts; - - if (IOMasterPort(MACH_PORT_NULL, &masterPort) != KERN_SUCCESS) - BAIL_MACRO(ERR_OS_ERROR, /*return void*/); - - mounts = getmntinfo(&mntbufp, MNT_WAIT); /* NOT THREAD SAFE! */ - for (i = 0; i < mounts; i++) - { - char *dev = mntbufp[i].f_mntfromname; - char *mnt = mntbufp[i].f_mntonname; - if (strncmp(dev, devPrefix, prefixLen) != 0) /* a virtual device? */ - continue; - - dev += prefixLen; - if (darwinIsMountedDisc(dev, masterPort)) - cb(data, mnt); - } /* for */ -} /* __PHYSFS_platformDetectAvailableCDs */ - #elif (defined PHYSFS_HAVE_SYS_UCRED_H) void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) @@ -350,107 +227,6 @@ } /* __PHYSFS_platformCalcBaseDir */ -#ifdef PHYSFS_PLATFORM_MACOSX -/* - * This function is only for OSX. The problem is that Apple's applications - * can actually be directory structures with the actual executable nested - * several levels down. PhysFS computes the base directory from the Unix - * executable, but this may not be the correct directory. Apple tries to - * hide everything from the user, so from Finder, the user never sees the - * Unix executable, and the directory package (bundle) is considered the - * "executable". This means that the correct base directory is at the - * level where the directory structure starts. - * A typical bundle seems to look like this: - * MyApp.app/ <-- top level...this is what the user sees in Finder - * Contents/ - * MacOS/ - * MyApp <-- the actual executable - * - * Since anything below the app folder is considered hidden, most - * application files need to be at the top level if you intend to - * write portable software. Thus if the application resides in: - * /Applications/MyProgram - * and the executable is the bundle MyApp.app, - * PhysFS computes the following as the base directory: - * /Applications/MyProgram/MyApp.app/Contents/MacOS/ - * We need to strip off the MyApp.app/Contents/MacOS/ - * - * However, there are corner cases. OSX applications can be traditional - * Unix executables without the bundle. Also, it is not entirely clear - * to me what kinds of permutations bundle structures can have. - * - * For now, this is a temporary hack until a better solution - * can be made. This function will try to find a "/Contents/MacOS" - * inside the path. If it succeeds, then the path will be truncated - * to correct the directory. If it is not found, the path will be - * left alone and will presume it is a traditional Unix execuatable. - * Most programs also include the .app extention in the top level - * folder, but it doesn't seem to be a requirement (Acrobat doesn't - * have it). MacOS looks like it can also be MacOSClassic. - * This function will test for MacOS and hope it captures any - * other permutations. - */ -static void stripAppleBundle(char *path) -{ - char *sub_str = "/contents/macos"; - char *found_ptr = NULL; - char *tempbuf = NULL; - size_t len = strlen(path) + 1; - int i; - - /* !!! FIXME: Can we stack-allocate this? --ryan. */ - tempbuf = (char *) allocator.Malloc(len); - if (!tempbuf) return; - memset(tempbuf, '\0', len); - - /* Unlike other Unix filesystems, HFS is case insensitive - * It wouldn be nice to use strcasestr, but it doesn't seem - * to be available in the OSX gcc library right now. - * So we should make a lower case copy of the path to - * compare against - */ - for(i=0; i=0; i--) - { - if('/' == path[i]) - { - break; - } - } - /* Safety check */ - if(i<1) - { - /* This probably shouldn't happen. */ - path[0] = '\0'; - } - else - { - /* Back up one more to remove trailing '/' and set the '\0' */ - path[i] = '\0'; - } - allocator.Free(tempbuf); - return; -} -#endif - - char *__PHYSFS_platformRealPath(const char *path) { char resolved_path[MAXPATHLEN]; @@ -462,15 +238,51 @@ BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); strcpy(retval, resolved_path); -/* !!! FIXME: this shouldn't be here. */ -#ifdef PHYSFS_PLATFORM_MACOSX - stripAppleBundle(retval); -#endif - return(retval); } /* __PHYSFS_platformRealPath */ +char *__PHYSFS_platformCurrentDir(void) +{ + /* + * This can't just do platformRealPath("."), since that would eventually + * just end up calling back into here. + */ + + int allocSize = 0; + char *retval = NULL; + char *ptr; + + do + { + allocSize += 100; + ptr = (char *) allocator.Realloc(retval, allocSize); + if (ptr == NULL) + { + if (retval != NULL) + allocator.Free(retval); + BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); + } /* if */ + + retval = ptr; + ptr = getcwd(retval, allocSize); + } while (ptr == NULL && errno == ERANGE); + + if (ptr == NULL && errno) + { + /* + * getcwd() failed for some reason, for example current + * directory not existing. + */ + if (retval != NULL) + allocator.Free(retval); + BAIL_MACRO(ERR_NO_SUCH_FILE, NULL); + } /* if */ + + return(retval); +} /* __PHYSFS_platformCurrentDir */ + + int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a) { return(0); /* just use malloc() and friends. */ From DONOTREPLY at icculus.org Wed Mar 21 01:22:48 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 21 Mar 2007 01:22:48 -0400 Subject: r860 - trunk Message-ID: <20070321052248.10181.qmail@icculus.org> Author: icculus Date: 2007-03-21 01:22:48 -0400 (Wed, 21 Mar 2007) New Revision: 860 Modified: trunk/physfs.c Log: Cleanups in calculateBaseDir. Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-21 05:03:17 UTC (rev 859) +++ trunk/physfs.c 2007-03-21 05:22:48 UTC (rev 860) @@ -651,35 +651,38 @@ static char *calculateBaseDir(const char *argv0) { - const char *dirsep = PHYSFS_getDirSeparator(); - char *retval; - char *ptr; + char *retval = NULL; + const char *dirsep = NULL; + char *ptr = NULL; - /* - * See if the platform driver wants to handle this for us... - */ + /* Give the platform layer first shot at this. */ retval = __PHYSFS_platformCalcBaseDir(argv0); if (retval != NULL) return(retval); - /* we need argv0 to be sane to go on. */ - BAIL_IF_MACRO(argv0 == NULL, ERR_INVALID_ARGUMENT, NULL); + /* We need argv0 to go on. */ + BAIL_IF_MACRO(argv0 == NULL, ERR_ARGV0_IS_NULL, NULL); - /* - * Determine if there's a path on argv0. If there is, that's the base dir. - */ - ptr = strstr(argv0, dirsep); - if (ptr != NULL) + dirsep = PHYSFS_getDirSeparator(); + if (strlen(dirsep) == 1) /* fast path. */ + ptr = strrchr(argv0, *dirsep); + else { - char *p = ptr; - size_t size; - while (p != NULL) + ptr = strstr(argv0, dirsep); + if (ptr != NULL) { - ptr = p; - p = strstr(p + 1, dirsep); - } /* while */ + char *p = ptr; + while (p != NULL) + { + ptr = p; + p = strstr(p + 1, dirsep); + } /* while */ + } /* if */ + } /* else */ - size = (size_t) (ptr - argv0); + if (ptr != NULL) + { + size_t size = (size_t) (ptr - argv0); retval = (char *) allocator.Malloc(size + 1); BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); memcpy(retval, argv0, size); @@ -687,23 +690,9 @@ return(retval); } /* if */ - /* !!! FIXME: should probably just fail here instead of being heroic. */ - - /* - * Last ditch effort: it's the current working directory. (*shrug*) - */ - retval = __PHYSFS_platformCurrentDir(); - if (retval != NULL) - return(retval); - - /* - * Ok, current directory doesn't exist, use the root directory. - * Not a good alternative, but it only happens if the current - * directory was deleted from under the program. - */ - retval = (char *) allocator.Malloc(strlen(dirsep) + 1); - strcpy(retval, dirsep); - return(retval); + /* argv0 wasn't helpful. */ + BAIL_MACRO(ERR_INVALID_ARGUMENT, NULL); + return(NULL); } /* calculateBaseDir */ @@ -752,6 +741,7 @@ baseDir = calculateBaseDir(argv0); BAIL_IF_MACRO(baseDir == NULL, NULL, 0); + /* !!! FIXME: only call this if we got this from argv0 (unreliable). */ ptr = __PHYSFS_platformRealPath(baseDir); allocator.Free(baseDir); BAIL_IF_MACRO(ptr == NULL, NULL, 0); From DONOTREPLY at icculus.org Wed Mar 21 16:06:30 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 21 Mar 2007 16:06:30 -0400 Subject: r861 - trunk Message-ID: <20070321200630.2366.qmail@icculus.org> Author: icculus Date: 2007-03-21 16:06:29 -0400 (Wed, 21 Mar 2007) New Revision: 861 Modified: trunk/CHANGELOG.txt Log: Updated. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-21 05:22:48 UTC (rev 860) +++ trunk/CHANGELOG.txt 2007-03-21 20:06:29 UTC (rev 861) @@ -2,6 +2,17 @@ * CHANGELOG. */ +03202007 - Removed platform/skeleton.c (it was out of date), added + platform/macosx.c (To further Macify the code and get the #ifdefs + out of unix.c), and refactored the platform layer to try and + make the unix/posix/macosx/beos sources try to find a split that + works. Moved the platform allocators to physfs.c, since all but + Mac OS X were using malloc()...there's now an interface for the + platform to supply a custom allocator if they don't want the malloc + version. Removed __PHYSFS_platformTimeslice(), as it's no longer + being used. Replaced manual management of pthread mutexes with + PTHREAD_MUTEX_RECURSIVE attribute...let's see what platforms + throw up on that. Handled documentation comment FIXME in physfs.h. 03192007 - Fixed two switched strings in CMakeLists.txt ... patch to compile with latest Windows Platform SDK. Explicitly check for NULL in PHYSFS_init() when we can't go on without a real string here. From DONOTREPLY at icculus.org Wed Mar 21 16:14:46 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 21 Mar 2007 16:14:46 -0400 Subject: r862 - trunk Message-ID: <20070321201446.6050.qmail@icculus.org> Author: icculus Date: 2007-03-21 16:14:46 -0400 (Wed, 21 Mar 2007) New Revision: 862 Modified: trunk/CHANGELOG.txt trunk/physfs_internal.h Log: Replaced LONGLONGLITERAL with __PHYSFS_UI64/__PHYSFS_SI64. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-21 20:06:29 UTC (rev 861) +++ trunk/CHANGELOG.txt 2007-03-21 20:14:46 UTC (rev 862) @@ -1,7 +1,7 @@ /* * CHANGELOG. */ - +03212007 - Replaced LONGLONGLITERAL with __PHYSFS_UI64/__PHYSFS_SI64 ... 03202007 - Removed platform/skeleton.c (it was out of date), added platform/macosx.c (To further Macify the code and get the #ifdefs out of unix.c), and refactored the platform layer to try and Modified: trunk/physfs_internal.h =================================================================== --- trunk/physfs_internal.h 2007-03-21 20:06:29 UTC (rev 861) +++ trunk/physfs_internal.h 2007-03-21 20:14:46 UTC (rev 862) @@ -1274,9 +1274,11 @@ #define __PHYSFS_ARRAYLEN(x) ( (sizeof (x)) / (sizeof (x[0])) ) #ifdef __GNUC__ -#define LONGLONGLITERAL(x) x##LL +#define __PHYSFS_SI64(x) x##LL +#define __PHYSFS_UI64(x) x##ULL #else -#define LONGLONGLITERAL(x) x +#define __PHYSFS_SI64(x) x +#define __PHYSFS_UI64(x) x #endif /* @@ -1288,7 +1290,7 @@ */ #define __PHYSFS_ui64FitsAddressSpace(s) ( \ (sizeof (PHYSFS_uint64) > sizeof (size_t)) && \ - ((s) > (LONGLONGLITERAL(0xFFFFFFFFFFFFFFFF) >> (64-(sizeof(size_t)*8)))) \ + ((s) > (__PHYSFS_UI64(0xFFFFFFFFFFFFFFFF) >> (64-(sizeof(size_t)*8)))) \ ) /* From DONOTREPLY at icculus.org Wed Mar 21 16:19:20 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 21 Mar 2007 16:19:20 -0400 Subject: r863 - trunk Message-ID: <20070321201920.8369.qmail@icculus.org> Author: icculus Date: 2007-03-21 16:19:20 -0400 (Wed, 21 Mar 2007) New Revision: 863 Modified: trunk/physfs_internal.h Log: Apparently this is how you do 64-bit literals in MSVC...untested. Modified: trunk/physfs_internal.h =================================================================== --- trunk/physfs_internal.h 2007-03-21 20:14:46 UTC (rev 862) +++ trunk/physfs_internal.h 2007-03-21 20:19:20 UTC (rev 863) @@ -1273,9 +1273,12 @@ #define __PHYSFS_ARRAYLEN(x) ( (sizeof (x)) / (sizeof (x[0])) ) -#ifdef __GNUC__ +#if (defined __GNUC__) #define __PHYSFS_SI64(x) x##LL #define __PHYSFS_UI64(x) x##ULL +#elif (defined _MSC_VER) +#define __PHYSFS_SI64(x) x##i64 +#define __PHYSFS_UI64(x) x##ui64 #else #define __PHYSFS_SI64(x) x #define __PHYSFS_UI64(x) x From DONOTREPLY at icculus.org Fri Mar 23 23:54:59 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 23 Mar 2007 23:54:59 -0400 Subject: r864 - in trunk: . archivers platform Message-ID: <20070324035459.8683.qmail@icculus.org> Author: icculus Date: 2007-03-23 23:54:58 -0400 (Fri, 23 Mar 2007) New Revision: 864 Modified: trunk/CHANGELOG.txt trunk/archivers/lzma.c trunk/archivers/qpak.c trunk/archivers/zip.c trunk/physfs.c trunk/physfs_internal.h trunk/platform/pocketpc.c trunk/platform/posix.c trunk/platform/windows.c Log: Replaced some Malloc and all the alloca() calls with __PHYSFS_smallAlloc(), which will stack allocate small (128 or less bytes) blocks and Malloc the rest...naturally these now have to be paired with __PHYSFS_smallFree() calls, so you can't be as lazy as a basic alloca() would let you be. The benefit is both less malloc pressure for those temporary allocations and better stack overflow safety (so if some jerk tries to push a 78 megabyte string through the library as a filename, we won't try to strcpy it to the stack). Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-21 20:19:20 UTC (rev 863) +++ trunk/CHANGELOG.txt 2007-03-24 03:54:58 UTC (rev 864) @@ -1,6 +1,18 @@ /* * CHANGELOG. */ + +03222007 - Replaced some Malloc and all the alloca() calls with + __PHYSFS_smallAlloc(), which will stack allocate small (128 or + less bytes) blocks and Malloc the rest...naturally these now have + to be paired with __PHYSFS_smallFree() calls, so you can't be as + lazy as a basic alloca() would let you be. The benefit is both less + malloc pressure for those temporary allocations and better stack + overflow safety (so if some jerk tries to push a 78 megabyte string + through the library as a filename, we won't try to strcpy it to + the stack). Hopefully some internal interfaces can now get + refactored to stop generating heap pointers and let the caller use + smallAlloc to further reduce malloc pressure. 03212007 - Replaced LONGLONGLITERAL with __PHYSFS_UI64/__PHYSFS_SI64 ... 03202007 - Removed platform/skeleton.c (it was out of date), added platform/macosx.c (To further Macify the code and get the #ifdefs Modified: trunk/archivers/lzma.c =================================================================== --- trunk/archivers/lzma.c 2007-03-21 20:19:20 UTC (rev 863) +++ trunk/archivers/lzma.c 2007-03-24 03:54:58 UTC (rev 864) @@ -479,13 +479,14 @@ static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata, const char *odir, const char *str, PHYSFS_sint32 ln) { - char *newstr = alloca(ln + 1); + char *newstr = __PHYSFS_smallAlloc(ln + 1); if (newstr == NULL) return; memcpy(newstr, str, ln); newstr[ln] = '\0'; cb(callbackdata, odir, newstr); + __PHYSFS_smallFree(newstr); } /* doEnumCallback */ Modified: trunk/archivers/qpak.c =================================================================== --- trunk/archivers/qpak.c 2007-03-21 20:19:20 UTC (rev 863) +++ trunk/archivers/qpak.c 2007-03-24 03:54:58 UTC (rev 864) @@ -378,13 +378,14 @@ static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata, const char *odir, const char *str, PHYSFS_sint32 ln) { - char *newstr = alloca(ln + 1); + char *newstr = __PHYSFS_smallAlloc(ln + 1); if (newstr == NULL) return; memcpy(newstr, str, ln); newstr[ln] = '\0'; cb(callbackdata, odir, newstr); + __PHYSFS_smallFree(newstr); } /* doEnumCallback */ Modified: trunk/archivers/zip.c =================================================================== --- trunk/archivers/zip.c 2007-03-21 20:19:20 UTC (rev 863) +++ trunk/archivers/zip.c 2007-03-24 03:54:58 UTC (rev 864) @@ -682,15 +682,15 @@ else /* symlink target path is compressed... */ { z_stream stream; - PHYSFS_uint32 compsize = entry->compressed_size; - PHYSFS_uint8 *compressed = (PHYSFS_uint8 *) allocator.Malloc(compsize); + PHYSFS_uint32 complen = entry->compressed_size; + PHYSFS_uint8 *compressed = (PHYSFS_uint8*) __PHYSFS_smallAlloc(complen); if (compressed != NULL) { - if (__PHYSFS_platformRead(in, compressed, compsize, 1) == 1) + if (__PHYSFS_platformRead(in, compressed, complen, 1) == 1) { initializeZStream(&stream); stream.next_in = compressed; - stream.avail_in = compsize; + stream.avail_in = complen; stream.next_out = (unsigned char *) path; stream.avail_out = size; if (zlib_err(inflateInit2(&stream, -MAX_WBITS)) == Z_OK) @@ -702,7 +702,7 @@ rc = ((rc == Z_OK) || (rc == Z_STREAM_END)); } /* if */ } /* if */ - allocator.Free(compressed); + __PHYSFS_smallFree(compressed); } /* if */ } /* else */ @@ -1177,13 +1177,14 @@ static void doEnumCallback(PHYSFS_EnumFilesCallback cb, void *callbackdata, const char *odir, const char *str, PHYSFS_sint32 ln) { - char *newstr = alloca(ln + 1); + char *newstr = __PHYSFS_smallAlloc(ln + 1); if (newstr == NULL) return; memcpy(newstr, str, ln); newstr[ln] = '\0'; cb(callbackdata, odir, newstr); + __PHYSFS_smallFree(newstr); } /* doEnumCallback */ Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-21 20:19:20 UTC (rev 863) +++ trunk/physfs.c 2007-03-24 03:54:58 UTC (rev 864) @@ -538,15 +538,17 @@ int forWriting) { DirHandle *dirHandle = NULL; + char *tmpmntpnt = NULL; GOTO_IF_MACRO(!newDir, ERR_INVALID_ARGUMENT, badDirHandle); if (mountPoint != NULL) { - char *mntpnt = (char *) alloca(strlen(mountPoint) + 1); - GOTO_IF_MACRO(!mntpnt, ERR_OUT_OF_MEMORY, badDirHandle); - if (!sanitizePlatformIndependentPath(mountPoint, mntpnt)) + const size_t len = strlen(mountPoint) + 1; + tmpmntpnt = (char *) __PHYSFS_smallAlloc(len); + GOTO_IF_MACRO(!tmpmntpnt, ERR_OUT_OF_MEMORY, badDirHandle); + if (!sanitizePlatformIndependentPath(mountPoint, tmpmntpnt)) goto badDirHandle; - mountPoint = mntpnt; /* sanitized version. */ + mountPoint = tmpmntpnt; /* sanitized version. */ } /* if */ dirHandle = openDirectory(newDir, forWriting); @@ -564,6 +566,7 @@ strcat(dirHandle->mountPoint, "/"); } /* if */ + __PHYSFS_smallFree(tmpmntpnt); return(dirHandle); badDirHandle: @@ -575,6 +578,7 @@ allocator.Free(dirHandle); } /* if */ + __PHYSFS_smallFree(tmpmntpnt); return(NULL); } /* createDirHandle */ @@ -620,8 +624,7 @@ else sprintf(retval, "%susers%s%s", baseDir, dirsep, str); - if (uname != NULL) - allocator.Free((void *) uname); + allocator.Free((void *) uname); } /* else */ return(retval); @@ -1053,6 +1056,22 @@ } /* PHYSFS_getSearchPathCallback */ +/* Split out to avoid stack allocation in a loop. */ +static void setSaneCfgAddPath(const char *i, const size_t l, const char *dirsep, + int archivesFirst) +{ + const char *d = PHYSFS_getRealDir(i); + const size_t allocsize = strlen(d) + strlen(dirsep) + l + 1; + char *str = (char *) __PHYSFS_smallAlloc(allocsize); + if (str != NULL) + { + sprintf(str, "%s%s%s", d, dirsep, i); + PHYSFS_addToSearchPath(str, archivesFirst == 0); + __PHYSFS_smallFree(str); + } /* if */ +} /* setSaneCfgAddPath */ + + int PHYSFS_setSaneConfig(const char *organization, const char *appName, const char *archiveExt, int includeCdRoms, int archivesFirst) @@ -1060,15 +1079,17 @@ const char *basedir = PHYSFS_getBaseDir(); const char *userdir = PHYSFS_getUserDir(); const char *dirsep = PHYSFS_getDirSeparator(); - char *str; + PHYSFS_uint64 len = 0; + char *str = NULL; BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0); /* set write dir... */ - str = (char *) allocator.Malloc( - strlen(userdir) + (strlen(organization) * 2) + + len = (strlen(userdir) + (strlen(organization) * 2) + (strlen(appName) * 2) + (strlen(dirsep) * 3) + 2); + str = (char *) __PHYSFS_smallAlloc(len); + BAIL_IF_MACRO(str == NULL, ERR_OUT_OF_MEMORY, 0); sprintf(str, "%s.%s%s%s", userdir, organization, dirsep, appName); @@ -1091,14 +1112,14 @@ if (no_write) { PHYSFS_setWriteDir(NULL); /* just in case. */ - allocator.Free(str); + __PHYSFS_smallFree(str); BAIL_MACRO(ERR_CANT_SET_WRITE_DIR, 0); } /* if */ } /* if */ /* Put write dir first in search path... */ PHYSFS_addToSearchPath(str, 0); - allocator.Free(str); + __PHYSFS_smallFree(str); /* Put base path on search path... */ PHYSFS_addToSearchPath(basedir, 1); @@ -1129,17 +1150,7 @@ { ext = (*i) + (l - extlen); if (__PHYSFS_stricmpASCII(ext, archiveExt) == 0) - { - const char *d = PHYSFS_getRealDir(*i); - size_t allocsize = strlen(d) + strlen(dirsep) + l + 1; - str = (char *) allocator.Malloc(allocsize); - if (str != NULL) - { - sprintf(str, "%s%s%s", d, dirsep, *i); - PHYSFS_addToSearchPath(str, archivesFirst == 0); - allocator.Free(str); - } /* if */ - } /* if */ + setSaneCfgAddPath(*i, l, dirsep, archivesFirst); } /* if */ } /* for */ @@ -1315,17 +1326,14 @@ } /* verifyPath */ -int PHYSFS_mkdir(const char *_dname) +static int doMkdir(const char *_dname, char *dname) { DirHandle *h; char *start; char *end; int retval = 0; int exists = 1; /* force existance check on first path element. */ - char *dname; - dname = ((_dname) ? (char *) alloca(strlen(_dname) + 1) : NULL); - BAIL_IF_MACRO(dname == NULL, ERR_INVALID_ARGUMENT, 0); BAIL_IF_MACRO(!sanitizePlatformIndependentPath(_dname, dname), NULL, 0); __PHYSFS_platformGrabMutex(stateLock); @@ -1359,16 +1367,29 @@ __PHYSFS_platformReleaseMutex(stateLock); return(retval); +} /* doMkdir */ + + +int PHYSFS_mkdir(const char *_dname) +{ + int retval = 0; + char *dname; + size_t len; + + BAIL_IF_MACRO(_dname == NULL, ERR_INVALID_ARGUMENT, 0); + len = strlen(_dname) + 1; + dname = (char *) __PHYSFS_smallAlloc(len); + BAIL_IF_MACRO(dname == NULL, ERR_OUT_OF_MEMORY, 0); + retval = doMkdir(_dname, dname); + __PHYSFS_smallFree(dname); + return(retval); } /* PHYSFS_mkdir */ -int PHYSFS_delete(const char *_fname) +static int doDelete(const char *_fname, char *fname) { int retval; DirHandle *h; - - char *fname = ((_fname) ? (char *) alloca(strlen(_fname) + 1) : NULL); - BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, 0); BAIL_IF_MACRO(!sanitizePlatformIndependentPath(_fname, fname), NULL, 0); __PHYSFS_platformGrabMutex(stateLock); @@ -1380,32 +1401,54 @@ __PHYSFS_platformReleaseMutex(stateLock); return(retval); +} /* doDelete */ + + +int PHYSFS_delete(const char *_fname) +{ + int retval; + char *fname; + size_t len; + + BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, 0); + len = strlen(_fname) + 1; + fname = (char *) __PHYSFS_smallAlloc(len); + BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, 0); + retval = doDelete(_fname, fname); + __PHYSFS_smallFree(fname); + return(retval); } /* PHYSFS_delete */ const char *PHYSFS_getRealDir(const char *_fname) { - DirHandle *i; const char *retval = NULL; + char *fname = NULL; + size_t len; - char *fname = ((_fname) ? (char *) alloca(strlen(_fname) + 1) : NULL); - BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, NULL); - BAIL_IF_MACRO(!sanitizePlatformIndependentPath(_fname, fname), NULL, NULL); - - __PHYSFS_platformGrabMutex(stateLock); - for (i = searchPath; ((i != NULL) && (retval == NULL)); i = i->next) + BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, NULL); + len = strlen(_fname) + 1; + fname = __PHYSFS_smallAlloc(len); + BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, NULL); + if (sanitizePlatformIndependentPath(_fname, fname)) { - char *arcfname = fname; - if (partOfMountPoint(i, arcfname)) - retval = i->dirName; - else if (verifyPath(i, &arcfname, 0)) + DirHandle *i; + __PHYSFS_platformGrabMutex(stateLock); + for (i = searchPath; ((i != NULL) && (retval == NULL)); i = i->next) { - if (i->funcs->exists(i->opaque, arcfname)) + char *arcfname = fname; + if (partOfMountPoint(i, arcfname)) retval = i->dirName; - } /* if */ - } /* for */ - __PHYSFS_platformReleaseMutex(stateLock); + else if (verifyPath(i, &arcfname, 0)) + { + if (i->funcs->exists(i->opaque, arcfname)) + retval = i->dirName; + } /* if */ + } /* for */ + __PHYSFS_platformReleaseMutex(stateLock); + } /* if */ + __PHYSFS_smallFree(fname); return(retval); } /* PHYSFS_getRealDir */ @@ -1491,54 +1534,69 @@ /* - * Broke out to seperate function so we can use alloca() gratuitously. + * Broke out to seperate function so we can use stack allocation gratuitously. */ static void enumerateFromMountPoint(DirHandle *i, const char *arcfname, PHYSFS_EnumFilesCallback callback, const char *_fname, void *data) { - size_t len = strlen(arcfname); + const size_t len = strlen(arcfname); char *ptr = NULL; char *end = NULL; - char *mountPoint = (char *) alloca(strlen(i->mountPoint) + 1); + const size_t slen = strlen(i->mountPoint) + 1; + char *mountPoint = (char *) __PHYSFS_smallAlloc(slen); + + if (mountPoint == NULL) + return; /* oh well. */ + strcpy(mountPoint, i->mountPoint); ptr = mountPoint + ((len) ? len + 1 : 0); end = strchr(ptr, '/'); assert(end); /* should always find a terminating '/'. */ *end = '\0'; callback(data, _fname, ptr); + __PHYSFS_smallFree(mountPoint); } /* enumerateFromMountPoint */ - +/* !!! FIXME: this should report error conditions. */ void PHYSFS_enumerateFilesCallback(const char *_fname, PHYSFS_EnumFilesCallback callback, void *data) { - DirHandle *i; - int noSyms; - char *fname = ((_fname) ? (char *) alloca(strlen(_fname) + 1) : NULL); - if ((fname == NULL) || (callback == NULL)) - return; /* oh well. */ + size_t len; + char *fname; - if (!sanitizePlatformIndependentPath(_fname, fname)) - return; + BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, /*0*/); + BAIL_IF_MACRO(callback == NULL, ERR_INVALID_ARGUMENT, /*0*/); - __PHYSFS_platformGrabMutex(stateLock); - noSyms = !allowSymLinks; - for (i = searchPath; i != NULL; i = i->next) + len = strlen(_fname) + 1; + fname = (char *) __PHYSFS_smallAlloc(len); + BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, /*0*/); + + if (sanitizePlatformIndependentPath(_fname, fname)) { - char *arcfname = fname; - if (partOfMountPoint(i, arcfname)) - enumerateFromMountPoint(i, arcfname, callback, _fname, data); + DirHandle *i; + int noSyms; - else if (verifyPath(i, &arcfname, 0)) + __PHYSFS_platformGrabMutex(stateLock); + noSyms = !allowSymLinks; + for (i = searchPath; i != NULL; i = i->next) { - i->funcs->enumerateFiles(i->opaque, arcfname, noSyms, - callback, _fname, data); - } /* else if */ - } /* for */ - __PHYSFS_platformReleaseMutex(stateLock); + char *arcfname = fname; + if (partOfMountPoint(i, arcfname)) + enumerateFromMountPoint(i, arcfname, callback, _fname, data); + + else if (verifyPath(i, &arcfname, 0)) + { + i->funcs->enumerateFiles(i->opaque, arcfname, noSyms, + callback, _fname, data); + } /* else if */ + } /* for */ + __PHYSFS_platformReleaseMutex(stateLock); + } /* if */ + + __PHYSFS_smallFree(fname); } /* PHYSFS_enumerateFilesCallback */ @@ -1550,130 +1608,178 @@ PHYSFS_sint64 PHYSFS_getLastModTime(const char *_fname) { - DirHandle *i; PHYSFS_sint64 retval = -1; - int fileExists = 0; + char *fname; + size_t len; - char *fname = ((_fname) ? (char *) alloca(strlen(_fname) + 1) : NULL); - BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, 0); - BAIL_IF_MACRO(!sanitizePlatformIndependentPath(_fname, fname), NULL, 0); + BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, -1); + len = strlen(_fname) + 1; + fname = (char *) __PHYSFS_smallAlloc(len); + BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, -1); - if (*fname == '\0') /* eh...punt if it's the root dir. */ - return(1); /* !!! FIXME: Maybe this should be an error? */ - - __PHYSFS_platformGrabMutex(stateLock); - for (i = searchPath; ((i != NULL) && (!fileExists)); i = i->next) + if (sanitizePlatformIndependentPath(_fname, fname)) { - char *arcfname = fname; - fileExists = partOfMountPoint(i, arcfname); - if (fileExists) - retval = 1; /* !!! FIXME: What's the right value? */ - else if (verifyPath(i, &arcfname, 0)) - retval = i->funcs->getLastModTime(i->opaque,arcfname,&fileExists); - } /* for */ - __PHYSFS_platformReleaseMutex(stateLock); + if (*fname == '\0') /* eh...punt if it's the root dir. */ + retval = 1; /* !!! FIXME: Maybe this should be an error? */ + else + { + DirHandle *i; + int exists = 0; + __PHYSFS_platformGrabMutex(stateLock); + for (i = searchPath; ((i != NULL) && (!exists)); i = i->next) + { + char *arcfname = fname; + exists = partOfMountPoint(i, arcfname); + if (exists) + retval = 1; /* !!! FIXME: What's the right value? */ + else if (verifyPath(i, &arcfname, 0)) + { + retval = i->funcs->getLastModTime(i->opaque, arcfname, + &exists); + } /* else if */ + } /* for */ + __PHYSFS_platformReleaseMutex(stateLock); + } /* else */ + } /* if */ + __PHYSFS_smallFree(fname); return(retval); } /* PHYSFS_getLastModTime */ int PHYSFS_isDirectory(const char *_fname) { - DirHandle *i; int retval = 0; - int fileExists = 0; + size_t len; + char *fname; - char *fname = ((_fname) ? (char *) alloca(strlen(_fname) + 1) : NULL); - BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, 0); - BAIL_IF_MACRO(!sanitizePlatformIndependentPath(_fname, fname), NULL, 0); - BAIL_IF_MACRO(*fname == '\0', NULL, 1); /* Root is always a dir. :) */ + BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, 0); + len = strlen(_fname) + 1; + fname = (char *) __PHYSFS_smallAlloc(len); + BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, 0); - __PHYSFS_platformGrabMutex(stateLock); - for (i = searchPath; ((i != NULL) && (!fileExists)); i = i->next) + if (!sanitizePlatformIndependentPath(_fname, fname)) + retval = 0; + + else if (*fname == '\0') + retval = 1; /* Root is always a dir. :) */ + + else { - char *arcfname = fname; - if ((fileExists = partOfMountPoint(i, arcfname)) != 0) - retval = 1; - else if (verifyPath(i, &arcfname, 0)) - retval = i->funcs->isDirectory(i->opaque, arcfname, &fileExists); - } /* for */ - __PHYSFS_platformReleaseMutex(stateLock); + DirHandle *i; + int exists = 0; + __PHYSFS_platformGrabMutex(stateLock); + for (i = searchPath; ((i != NULL) && (!exists)); i = i->next) + { + char *arcfname = fname; + if ((exists = partOfMountPoint(i, arcfname)) != 0) + retval = 1; + else if (verifyPath(i, &arcfname, 0)) + retval = i->funcs->isDirectory(i->opaque, arcfname, &exists); + } /* for */ + __PHYSFS_platformReleaseMutex(stateLock); + } /* else */ + + __PHYSFS_smallFree(fname); return(retval); } /* PHYSFS_isDirectory */ int PHYSFS_isSymbolicLink(const char *_fname) { - DirHandle *i; int retval = 0; - int fileExists = 0; + size_t len; char *fname; BAIL_IF_MACRO(!allowSymLinks, ERR_SYMLINK_DISALLOWED, 0); - fname = ((_fname) ? (char *) alloca(strlen(_fname) + 1) : NULL); - BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, 0); - BAIL_IF_MACRO(!sanitizePlatformIndependentPath(_fname, fname), NULL, 0); - BAIL_IF_MACRO(*fname == '\0', NULL, 0); /* Root is never a symlink */ + BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, 0); + len = strlen(_fname) + 1; + fname = (char *) __PHYSFS_smallAlloc(len); + BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, 0); - __PHYSFS_platformGrabMutex(stateLock); - for (i = searchPath; ((i != NULL) && (!fileExists)); i = i->next) + if (!sanitizePlatformIndependentPath(_fname, fname)) + retval = 0; + + else if (*fname == '\0') + retval = 1; /* Root is never a symlink. */ + + else { - char *arcfname = fname; - if ((fileExists = partOfMountPoint(i, arcfname)) != 0) - retval = 0; /* virtual dir...not a symlink. */ - else if (verifyPath(i, &arcfname, 0)) - retval = i->funcs->isSymLink(i->opaque, arcfname, &fileExists); - } /* for */ - __PHYSFS_platformReleaseMutex(stateLock); + DirHandle *i; + int fileExists = 0; + __PHYSFS_platformGrabMutex(stateLock); + for (i = searchPath; ((i != NULL) && (!fileExists)); i = i->next) + { + char *arcfname = fname; + if ((fileExists = partOfMountPoint(i, arcfname)) != 0) + retval = 0; /* virtual dir...not a symlink. */ + else if (verifyPath(i, &arcfname, 0)) + retval = i->funcs->isSymLink(i->opaque, arcfname, &fileExists); + } /* for */ + __PHYSFS_platformReleaseMutex(stateLock); + } /* else */ + + __PHYSFS_smallFree(fname); return(retval); } /* PHYSFS_isSymbolicLink */ static PHYSFS_File *doOpenWrite(const char *_fname, int appending) { - void *opaque = NULL; FileHandle *fh = NULL; - DirHandle *h = NULL; - const PHYSFS_Archiver *f; + size_t len; + char *fname; - char *fname = ((_fname) ? (char *) alloca(strlen(_fname) + 1) : NULL); - BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, 0); - BAIL_IF_MACRO(!sanitizePlatformIndependentPath(_fname, fname), NULL, 0); + BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, 0); + len = strlen(_fname) + 1; + fname = (char *) __PHYSFS_smallAlloc(len); + BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, 0); - __PHYSFS_platformGrabMutex(stateLock); - BAIL_IF_MACRO_MUTEX(!writeDir, ERR_NO_WRITE_DIR, stateLock, NULL); + if (sanitizePlatformIndependentPath(_fname, fname)) + { + void *opaque = NULL; + DirHandle *h = NULL; + const PHYSFS_Archiver *f; - h = writeDir; - BAIL_IF_MACRO_MUTEX(!verifyPath(h, &fname, 0), NULL, stateLock, NULL); + __PHYSFS_platformGrabMutex(stateLock); - f = h->funcs; - if (appending) - opaque = f->openAppend(h->opaque, fname); - else - opaque = f->openWrite(h->opaque, fname); + GOTO_IF_MACRO(!writeDir, ERR_NO_WRITE_DIR, doOpenWriteEnd); - BAIL_IF_MACRO_MUTEX(opaque == NULL, NULL, stateLock, NULL); + h = writeDir; + GOTO_IF_MACRO(!verifyPath(h, &fname, 0), NULL, doOpenWriteEnd); - fh = (FileHandle *) allocator.Malloc(sizeof (FileHandle)); - if (fh == NULL) - { - f->fileClose(opaque); - BAIL_MACRO_MUTEX(ERR_OUT_OF_MEMORY, stateLock, NULL); + f = h->funcs; + if (appending) + opaque = f->openAppend(h->opaque, fname); + else + opaque = f->openWrite(h->opaque, fname); + + GOTO_IF_MACRO(opaque == NULL, NULL, doOpenWriteEnd); + + fh = (FileHandle *) allocator.Malloc(sizeof (FileHandle)); + if (fh == NULL) + { + f->fileClose(opaque); + GOTO_MACRO(ERR_OUT_OF_MEMORY, doOpenWriteEnd); + } /* if */ + else + { + memset(fh, '\0', sizeof (FileHandle)); + fh->opaque = opaque; + fh->dirHandle = h; + fh->funcs = h->funcs; + fh->next = openWriteList; + openWriteList = fh; + } /* else */ + + doOpenWriteEnd: + __PHYSFS_platformReleaseMutex(stateLock); } /* if */ - else - { - memset(fh, '\0', sizeof (FileHandle)); - fh->opaque = opaque; - fh->dirHandle = h; - fh->funcs = h->funcs; - fh->next = openWriteList; - openWriteList = fh; - } /* else */ - __PHYSFS_platformReleaseMutex(stateLock); + __PHYSFS_smallFree(fname); return((PHYSFS_File *) fh); } /* doOpenWrite */ @@ -1693,51 +1799,62 @@ PHYSFS_File *PHYSFS_openRead(const char *_fname) { FileHandle *fh = NULL; - int fileExists = 0; - DirHandle *i = NULL; - fvoid *opaque = NULL; + char *fname; + size_t len; - char *fname = ((_fname) ? (char *) alloca(strlen(_fname) + 1) : NULL); - BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, 0); - BAIL_IF_MACRO(!sanitizePlatformIndependentPath(_fname, fname), NULL, 0); + BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, 0); + len = strlen(_fname) + 1; + fname = (char *) __PHYSFS_smallAlloc(len); + BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, 0); - __PHYSFS_platformGrabMutex(stateLock); + if (sanitizePlatformIndependentPath(_fname, fname)) + { + int fileExists = 0; + DirHandle *i = NULL; + fvoid *opaque = NULL; - BAIL_IF_MACRO_MUTEX(!searchPath, ERR_NO_SUCH_PATH, stateLock, NULL); + __PHYSFS_platformGrabMutex(stateLock); - /* !!! FIXME: Why aren't we using a for loop here? */ - i = searchPath; + GOTO_IF_MACRO(!searchPath, ERR_NO_SUCH_PATH, openReadEnd); - do - { - char *arcfname = fname; - if (verifyPath(i, &arcfname, 0)) + /* !!! FIXME: Why aren't we using a for loop here? */ + i = searchPath; + + do { - opaque = i->funcs->openRead(i->opaque, arcfname, &fileExists); - if (opaque) - break; + char *arcfname = fname; + if (verifyPath(i, &arcfname, 0)) + { + opaque = i->funcs->openRead(i->opaque, arcfname, &fileExists); + if (opaque) + break; + } /* if */ + i = i->next; + } while ((i != NULL) && (!fileExists)); + + /* !!! FIXME: may not set an error if openRead didn't fail. */ + GOTO_IF_MACRO(opaque == NULL, NULL, openReadEnd); + + fh = (FileHandle *) allocator.Malloc(sizeof (FileHandle)); + if (fh == NULL) + { + i->funcs->fileClose(opaque); + GOTO_MACRO(ERR_OUT_OF_MEMORY, openReadEnd); } /* if */ - i = i->next; - } while ((i != NULL) && (!fileExists)); - BAIL_IF_MACRO_MUTEX(opaque == NULL, NULL, stateLock, NULL); + memset(fh, '\0', sizeof (FileHandle)); + fh->opaque = opaque; + fh->forReading = 1; + fh->dirHandle = i; + fh->funcs = i->funcs; + fh->next = openReadList; + openReadList = fh; - fh = (FileHandle *) allocator.Malloc(sizeof (FileHandle)); - if (fh == NULL) - { - i->funcs->fileClose(opaque); - BAIL_MACRO_MUTEX(ERR_OUT_OF_MEMORY, stateLock, NULL); + openReadEnd: + __PHYSFS_platformReleaseMutex(stateLock); } /* if */ - memset(fh, '\0', sizeof (FileHandle)); - fh->opaque = opaque; - fh->forReading = 1; - fh->dirHandle = i; - fh->funcs = i->funcs; - fh->next = openReadList; - openReadList = fh; - __PHYSFS_platformReleaseMutex(stateLock); - + __PHYSFS_smallFree(fname); return((PHYSFS_File *) fh); } /* PHYSFS_openRead */ @@ -2055,5 +2172,37 @@ } /* if */ } /* setDefaultAllocator */ + +void *__PHYSFS_initSmallAlloc(void *ptr, PHYSFS_uint64 len) +{ + const char useHeap = ((ptr == NULL) ? 1 : 0); + if (useHeap) /* too large for stack allocation or alloca() failed. */ + ptr = allocator.Malloc(len+1); + + if (ptr != NULL) + { + char *retval = (char *) ptr; + /*printf("%s alloc'd (%d) bytes at (%p).\n", + useHeap ? "heap" : "stack", (int) len, ptr);*/ + *retval = useHeap; + return(retval+1); + } /* if */ + + return(NULL); /* allocation failed. */ +} /* __PHYSFS_initSmallAlloc */ + + +void __PHYSFS_smallFree(void *ptr) +{ + if (ptr != NULL) + { + char *block = ((char *) ptr) - 1; + const char useHeap = *block; + if (useHeap) + allocator.Free(block); + /*printf("%s free'd (%p).\n", useHeap ? "heap" : "stack", block);*/ + } /* if */ +} /* __PHYSFS_smallFree */ + /* end of physfs.c ... */ Modified: trunk/physfs_internal.h =================================================================== --- trunk/physfs_internal.h 2007-03-21 20:19:20 UTC (rev 863) +++ trunk/physfs_internal.h 2007-03-24 03:54:58 UTC (rev 864) @@ -33,6 +33,38 @@ extern "C" { #endif +/* + * Interface for small allocations. If you need a little scratch space for + * a throwaway buffer or string, use this. It will make small allocations + * on the stack if possible, and use allocator.Malloc() if they are too + * large. This helps reduce malloc pressure. + * There are some rules, though: + * NEVER return a pointer from this, as stack-allocated buffers go away + * when your function returns. + * NEVER allocate in a loop, as stack-allocated pointers will pile up. Call + * a function that uses smallAlloc from your loop, so the allocation can + * free each time. + * NEVER call smallAlloc with any complex expression (it's a macro that WILL + * have side effects...it references the argument multiple times). Use a + * variable or a literal. + * NEVER free a pointer from this with anything but smallFree. It will not + * be a valid pointer to the allocator, regardless of where the memory came + * from. + * NEVER realloc a pointer from this. + * NEVER forget to use smallFree: it may not be a pointer from the stack. + * NEVER forget to check for NULL...allocation can fail here, of course! + */ +#define __PHYSFS_SMALLALLOCTHRESHOLD 128 +void *__PHYSFS_initSmallAlloc(void *ptr, PHYSFS_uint64 len); + +#define __PHYSFS_smallAlloc(bytes) ( \ + __PHYSFS_initSmallAlloc(((bytes < __PHYSFS_SMALLALLOCTHRESHOLD) ? \ + alloca(bytes+1) : NULL), bytes) \ +) + +void __PHYSFS_smallFree(void *ptr); + + /* Use the allocation hooks. */ #define malloc(x) Do not use malloc() directly. #define realloc(x, y) Do not use realloc() directly. Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-21 20:19:20 UTC (rev 863) +++ trunk/platform/pocketpc.c 2007-03-24 03:54:58 UTC (rev 864) @@ -64,12 +64,14 @@ return((const char *) msgbuf); } /* win32strerror */ + +/* !!! FIXME: need to check all of these for NULLs. */ #define UTF8_TO_UNICODE_STACK_MACRO(w_assignto, str) { \ if (str == NULL) \ w_assignto = NULL; \ else { \ const PHYSFS_uint64 len = (PHYSFS_uint64) ((strlen(str) * 4) + 1); \ - w_assignto = (char *) alloca(len); \ + w_assignto = (char *) __PHYSFS_smallAlloc(len); \ PHYSFS_uc2fromutf8(str, (PHYSFS_uint16 *) w_assignto, len); \ } \ } \ @@ -86,6 +88,7 @@ retval[0] = _T('\0'); /* !!! FIXME: don't preallocate here? */ + /* !!! FIXME: use smallAlloc? */ buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1); if (buflen <= 0) __PHYSFS_setError(win32strerror()); @@ -172,6 +175,7 @@ UTF8_TO_UNICODE_STACK_MACRO(w_fname, fname); if (w_fname != NULL) retval = (GetFileAttributes(w_fname) != INVALID_FILE_ATTRIBUTES); + __PHYSFS_smallFree(w_fname); return(retval); } /* __PHYSFS_platformExists */ @@ -191,6 +195,7 @@ UTF8_TO_UNICODE_STACK_MACRO(w_fname, fname); if (w_fname != NULL) retval = ((GetFileAttributes(w_fname) & FILE_ATTRIBUTE_DIRECTORY) != 0); + __PHYSFS_smallFree(w_fname); return(retval); } /* __PHYSFS_platformIsDirectory */ @@ -228,9 +233,10 @@ static int doEnumCallback(const wchar_t *w_fname) { const PHYSFS_uint64 len = (PHYSFS_uint64) ((wcslen(w_fname) * 4) + 1); - char *str = (char *) alloca(len); + char *str = (char *) __PHYSFS_smallAlloc(len); PHYSFS_utf8fromucs2((const PHYSFS_uint16 *) w_fname, str, len); callback(callbackdata, origdir, str); + __PHYSFS_smallFree(str); return 1; } /* doEnumCallback */ @@ -248,7 +254,7 @@ size_t len = strlen(dirname); /* Allocate a new string for path, maybe '\\', "*", and NULL terminator */ - SearchPath = (char *) alloca(len + 3); + SearchPath = (char *) __PHYSFS_smallAlloc(len + 3); BAIL_IF_MACRO(SearchPath == NULL, ERR_OUT_OF_MEMORY, NULL); /* Copy current dirname */ @@ -265,7 +271,9 @@ strcat(SearchPath, "*"); UTF8_TO_UNICODE_STACK_MACRO(w_SearchPath, SearchPath); + __PHYSFS_smallFree(SearchPath); dir = FindFirstFile(w_SearchPath, &ent); + __PHYSFS_smallFree(w_SearchPath); if (dir == INVALID_HANDLE_VALUE) return; @@ -304,9 +312,15 @@ int __PHYSFS_platformMkDir(const char *path) { + int retval = 0; wchar_t *w_path = NULL; UTF8_TO_UNICODE_STACK_MACRO(w_path, path); - return ( (w_path != NULL) && (CreateDirectory(w_path, NULL)) ); + if (w_path != NULL) + { + retval = CreateDirectory(w_path, NULL); + __PHYSFS_smallFree(w_fname); + } /* if */ + return(retval); } /* __PHYSFS_platformMkDir */ @@ -317,9 +331,9 @@ 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); + __PHYSFS_smallFree(w_fname); BAIL_IF_MACRO(fileHandle == INVALID_HANDLE_VALUE, win32strerror(), NULL); @@ -533,11 +547,13 @@ if (GetFileAttributes(w_path) == FILE_ATTRIBUTE_DIRECTORY) { int retval = !RemoveDirectory(w_path); + __PHYSFS_smallFree(w_path); BAIL_IF_MACRO(retval, win32strerror(), 0); } /* if */ else { int retval = !DeleteFile(w_path); + __PHYSFS_smallFree(w_path); BAIL_IF_MACRO(retval, win32strerror(), 0); } /* else */ Modified: trunk/platform/posix.c =================================================================== --- trunk/platform/posix.c 2007-03-21 20:19:20 UTC (rev 863) +++ trunk/platform/posix.c 2007-03-24 03:54:58 UTC (rev 864) @@ -186,8 +186,7 @@ dir = opendir(dirname); if (dir == NULL) { - if (buf != NULL) - allocator.Free(buf); + allocator.Free(buf); return; } /* if */ @@ -220,9 +219,7 @@ callback(callbackdata, origdir, ent->d_name); } /* while */ - if (buf != NULL) - allocator.Free(buf); - + allocator.Free(buf); closedir(dir); } /* __PHYSFS_platformEnumerateFiles */ Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-21 20:19:20 UTC (rev 863) +++ trunk/platform/windows.c 2007-03-24 03:54:58 UTC (rev 864) @@ -21,14 +21,6 @@ #include "physfs_internal.h" -#if (!defined alloca) - #if ((defined _MSC_VER) - #define alloca(x) _alloca(x) - #elif (defined __MINGW32__) /* scary...hopefully this is okay. */ - #define alloca(x) __builtin_alloca(x) - #endif -#endif - #define LOWORDER_UINT64(pos) (PHYSFS_uint32) \ (pos & 0x00000000FFFFFFFF) #define HIGHORDER_UINT64(pos) (PHYSFS_uint32) \ @@ -116,6 +108,8 @@ BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); retval[0] = '\0'; + /* !!! FIXME: don't preallocate here? */ + /* !!! FIXME: use smallAlloc? */ buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1); if (buflen <= 0) __PHYSFS_setError(win32strerror()); @@ -390,7 +384,7 @@ char *SearchPath; /* Allocate a new string for path, maybe '\\', "*", and NULL terminator */ - SearchPath = (char *) alloca(len + 3); + SearchPath = (char *) __PHYSFS_smallAlloc(len + 3); if (SearchPath == NULL) return; @@ -408,6 +402,7 @@ strcat(SearchPath, "*"); dir = FindFirstFile(SearchPath, &ent); + __PHYSFS_smallFree(SearchPath); if (dir == INVALID_HANDLE_VALUE) return; From DONOTREPLY at icculus.org Sat Mar 24 01:13:55 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 24 Mar 2007 01:13:55 -0400 Subject: r865 - trunk/platform Message-ID: <20070324051355.22324.qmail@icculus.org> Author: icculus Date: 2007-03-24 01:13:54 -0400 (Sat, 24 Mar 2007) New Revision: 865 Modified: trunk/platform/pocketpc.c trunk/platform/windows.c Log: Added some FIXME comments. Modified: trunk/platform/pocketpc.c =================================================================== --- trunk/platform/pocketpc.c 2007-03-24 03:54:58 UTC (rev 864) +++ trunk/platform/pocketpc.c 2007-03-24 05:13:54 UTC (rev 865) @@ -561,6 +561,11 @@ } /* __PHYSFS_platformDelete */ +/* + * !!! FIXME: why aren't we using Critical Sections instead of Mutexes? + * !!! FIXME: mutexes on Windows are for cross-process sync. CritSects are + * !!! FIXME: mutexes for threads in a single process and are faster. + */ void *__PHYSFS_platformCreateMutex(void) { return((void *) CreateMutex(NULL, FALSE, NULL)); Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-24 03:54:58 UTC (rev 864) +++ trunk/platform/windows.c 2007-03-24 05:13:54 UTC (rev 865) @@ -903,6 +903,11 @@ } /* __PHYSFS_platformDelete */ +/* + * !!! FIXME: why aren't we using Critical Sections instead of Mutexes? + * !!! FIXME: mutexes on Windows are for cross-process sync. CritSects are + * !!! FIXME: mutexes for threads in a single process and are faster. + */ void *__PHYSFS_platformCreateMutex(void) { return((void *) CreateMutex(NULL, FALSE, NULL)); From DONOTREPLY at icculus.org Sat Mar 24 01:42:22 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 24 Mar 2007 01:42:22 -0400 Subject: r866 - in trunk: . platform Message-ID: <20070324054222.6575.qmail@icculus.org> Author: icculus Date: 2007-03-24 01:42:22 -0400 (Sat, 24 Mar 2007) New Revision: 866 Modified: trunk/CHANGELOG.txt trunk/platform/beos.cpp Log: Replaced BeOS mutex implementation. Now all platforms have recursive mutexes. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-24 05:13:54 UTC (rev 865) +++ trunk/CHANGELOG.txt 2007-03-24 05:42:22 UTC (rev 866) @@ -2,6 +2,11 @@ * CHANGELOG. */ +03242007 - Replaced BeOS semaphores with BLockers for the mutex implementation. + It's much simpler, it has "benaphores" built in behind the scenes + for faster performance, and it's recursive...also, we were + previously setting the PhysicsFS error state if BeOS mutex grabbing + failed (a big no no!), and that's now fixed. Good wins all around. 03222007 - Replaced some Malloc and all the alloca() calls with __PHYSFS_smallAlloc(), which will stack allocate small (128 or less bytes) blocks and Malloc the rest...naturally these now have Modified: trunk/platform/beos.cpp =================================================================== --- trunk/platform/beos.cpp 2007-03-24 05:13:54 UTC (rev 865) +++ trunk/platform/beos.cpp 2007-03-24 05:42:22 UTC (rev 866) @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -204,43 +205,27 @@ } /* __PHYSFS_platformCurrentDir */ -/* !!! FIXME: semaphores are not mutexes... */ void *__PHYSFS_platformCreateMutex(void) { - sem_id *retval = (sem_id *) allocator.Malloc(sizeof (sem_id)); - sem_id rc; - - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - rc = create_sem(1, "PhysicsFS semaphore"); - if (rc < B_OK) - { - allocator.Free(retval); - BAIL_MACRO(strerror(rc), NULL); - } // if - - *retval = rc; - return(retval); + return(new BLocker("PhysicsFS lock", true)); } /* __PHYSFS_platformCreateMutex */ void __PHYSFS_platformDestroyMutex(void *mutex) { - delete_sem( *((sem_id *) mutex) ); - allocator.Free(mutex); + delete ((BLocker *) mutex); } /* __PHYSFS_platformDestroyMutex */ int __PHYSFS_platformGrabMutex(void *mutex) { - status_t rc = acquire_sem(*((sem_id *) mutex)); - BAIL_IF_MACRO(rc < B_OK, strerror(rc), 0); - return(1); + return ((BLocker *) mutex)->Lock() ? 1 : 0; } /* __PHYSFS_platformGrabMutex */ void __PHYSFS_platformReleaseMutex(void *mutex) { - release_sem(*((sem_id *) mutex)); + ((BLocker *) mutex)->Unlock(); } /* __PHYSFS_platformReleaseMutex */ From DONOTREPLY at icculus.org Sat Mar 24 01:42:29 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 24 Mar 2007 01:42:29 -0400 Subject: r867 - trunk Message-ID: <20070324054229.6695.qmail@icculus.org> Author: icculus Date: 2007-03-24 01:42:29 -0400 (Sat, 24 Mar 2007) New Revision: 867 Modified: trunk/TODO.txt Log: Updated. Modified: trunk/TODO.txt =================================================================== --- trunk/TODO.txt 2007-03-24 05:42:22 UTC (rev 866) +++ trunk/TODO.txt 2007-03-24 05:42:29 UTC (rev 867) @@ -16,7 +16,6 @@ important, since streaming archives aren't of much value to games (which is why zipfiles are king: random access), but it could have uses for, say, an installer/updater. -- Stack allocate in stripAppleBundle() (platform/unix.c) instead of calloc(). - Reduce malloc() pressure all over the place. We fragment memory like mad. - profile string list interpolation. - We have two different ways to find dir entries in zip.c. @@ -42,7 +41,6 @@ - Need "getmountpoint" command in test_physfs.c ... - Look for calloc() calls that aren't going through the allocation hooks. - Write up a simple HOWTO on embedding physicsfs in another project. -- Make mutexes recursive, so callbacks can call into the API. - Archivers need abstracted i/o to read from memory or files (archives in archives?) - Probably other stuff. Requests and recommendations are welcome. From DONOTREPLY at icculus.org Sat Mar 24 20:38:15 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 24 Mar 2007 20:38:15 -0400 Subject: r868 - trunk/platform Message-ID: <20070325003815.12869.qmail@icculus.org> Author: icculus Date: 2007-03-24 20:38:14 -0400 (Sat, 24 Mar 2007) New Revision: 868 Modified: trunk/platform/windows.c Log: Pushed a bunch of FIXMEs into the Windows platform layer. Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-24 05:42:29 UTC (rev 867) +++ trunk/platform/windows.c 2007-03-25 00:38:14 UTC (rev 868) @@ -26,12 +26,15 @@ #define HIGHORDER_UINT64(pos) (PHYSFS_uint32) \ (((pos & 0xFFFFFFFF00000000) >> 32) & 0x00000000FFFFFFFF) + +/* !!! FIXME: unicode version. */ /* GetUserProfileDirectory() is only available on >= NT4 (no 9x/ME systems!) */ typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETUSERPROFILEDIR) ( HANDLE hToken, LPTSTR lpProfileDir, LPDWORD lpcchSize); +/* !!! FIXME: unicode version. */ /* GetFileAttributesEx() is only available on >= Win98 or WinNT4 ... */ typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETFILEATTRIBUTESEX) ( LPCTSTR lpFileName, @@ -73,6 +76,7 @@ static TCHAR msgbuf[255]; TCHAR *ptr = msgbuf; + /* !!! FIXME: unicode version. */ FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, @@ -84,7 +88,7 @@ NULL ); - /* chop off newlines. */ + /* chop off newlines. */ for (ptr = msgbuf; *ptr; ptr++) { if ((*ptr == '\n') || (*ptr == '\r')) @@ -94,6 +98,8 @@ } /* if */ } /* for */ + /* !!! FIXME: convert to UTF-8. */ + return((const char *) msgbuf); } /* win32strerror */ @@ -110,6 +116,7 @@ retval[0] = '\0'; /* !!! FIXME: don't preallocate here? */ /* !!! FIXME: use smallAlloc? */ + /* !!! FIXME: unicode version. */ buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1); if (buflen <= 0) __PHYSFS_setError(win32strerror()); @@ -137,10 +144,11 @@ if (!success) { - if (argv0 == NULL) + if (argv0 == NULL) /* !!! FIXME: default behaviour does this. */ __PHYSFS_setError(ERR_ARGV0_IS_NULL); else { + /* !!! FIXME: unicode version. */ buflen = SearchPath(NULL, argv0, NULL, MAX_PATH+1, retval, &ptr); if (buflen == 0) __PHYSFS_setError(win32strerror()); @@ -198,7 +206,7 @@ lib = LoadLibrary("userenv.dll"); if (lib) { - /* !!! FIXME: Handle Unicode? */ + /* !!! FIXME: unicode version. */ GetUserProfileDirectory = (LPFNGETUSERPROFILEDIR) GetProcAddress(lib, "GetUserProfileDirectoryA"); if (GetUserProfileDirectory) @@ -211,6 +219,7 @@ * psize. Also note that the second parameter can't be * NULL or the function fails. */ + /* !!! FIXME: unicode version. */ rc = GetUserProfileDirectory(accessToken, dummy, &psize); assert(!rc); /* success?! */ @@ -218,11 +227,16 @@ userDir = (char *) allocator.Malloc(psize); if (userDir != NULL) { - if (!GetUserProfileDirectory(accessToken, userDir, &psize)) + /* !!! FIXME: unicode version. */ + if (GetUserProfileDirectory(accessToken, userDir, &psize)) { + /* !!! FIXME: convert to UTF-8. */ + } /* if */ + else + { allocator.Free(userDir); userDir = NULL; - } /* if */ + } /* else */ } /* else */ } /* if */ @@ -237,6 +251,7 @@ /* Might just be a non-NT system; resort to the basedir. */ userDir = getExePath(NULL); BAIL_IF_MACRO(userDir == NULL, NULL, 0); /* STILL failed?! */ + /* !!! FIXME: convert to UTF-8. */ } /* if */ return(1); /* We made it: hit the showers. */ @@ -264,6 +279,8 @@ void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data) { + /* !!! FIXME: Can CD drives be non-drive letter paths? */ + /* !!! FIXME: (so can they be Unicode paths?) */ char drive_str[4] = "x:\\"; char ch; for (ch = 'A'; ch <= 'Z'; ch++) @@ -289,10 +306,12 @@ DWORD bufsize = 0; LPTSTR retval = NULL; + /* !!! FIXME: unicode version. */ if (GetUserName(NULL, &bufsize) == 0) /* This SHOULD fail. */ { retval = (LPTSTR) allocator.Malloc(bufsize); BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); + /* !!! FIXME: unicode version. */ if (GetUserName(retval, &bufsize) == 0) /* ?! */ { __PHYSFS_setError(win32strerror()); @@ -301,6 +320,11 @@ } /* if */ } /* if */ + if (retval != NULL) + { + /* !!! FIXME: convert to UTF-8. */ + } /* if */ + return((char *) retval); } /* __PHYSFS_platformGetUserName */ @@ -324,6 +348,7 @@ { BAIL_IF_MACRO ( + /* !!! FIXME: unicode version. */ GetFileAttributes(fname) == PHYSFS_INVALID_FILE_ATTRIBUTES, win32strerror(), 0 ); @@ -333,12 +358,14 @@ int __PHYSFS_platformIsSymLink(const char *fname) { + /* !!! FIXME: Vista has symlinks. Recheck this. */ return(0); /* no symlinks on win32. */ } /* __PHYSFS_platformIsSymlink */ int __PHYSFS_platformIsDirectory(const char *fname) { + /* !!! FIXME: unicode version. */ return((GetFileAttributes(fname) & FILE_ATTRIBUTE_DIRECTORY) != 0); } /* __PHYSFS_platformIsDirectory */ @@ -401,6 +428,7 @@ /* Append the "*" to the end of the string */ strcat(SearchPath, "*"); + /* !!! FIXME: unicode version. */ dir = FindFirstFile(SearchPath, &ent); __PHYSFS_smallFree(SearchPath); if (dir == INVALID_HANDLE_VALUE) @@ -408,9 +436,11 @@ do { + /* !!! FIXME: unicode version. */ if (strcmp(ent.cFileName, ".") == 0) continue; + /* !!! FIXME: unicode version. */ if (strcmp(ent.cFileName, "..") == 0) continue; @@ -426,9 +456,11 @@ LPTSTR retval; DWORD buflen = 0; + /* !!! FIXME: unicode version. */ buflen = GetCurrentDirectory(buflen, NULL); retval = (LPTSTR) allocator.Malloc(sizeof (TCHAR) * (buflen + 2)); BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); + /* !!! FIXME: unicode version. */ GetCurrentDirectory(buflen, retval); if (retval[buflen - 2] != '\\') @@ -441,6 +473,7 @@ /* this could probably use a cleanup. */ char *__PHYSFS_platformRealPath(const char *path) { + /* this function should be UTF-8 clean. */ char *retval = NULL; char *p = NULL; @@ -516,15 +549,15 @@ p = retval; while ( (p = strstr(p, "\\.")) != NULL) { - /* it's a "." entry that doesn't end the string. */ + /* it's a "." entry that doesn't end the string. */ if (p[2] == '\\') memmove(p + 1, p + 3, strlen(p + 3) + 1); - /* it's a "." entry that ends the string. */ + /* it's a "." entry that ends the string. */ else if (p[2] == '\0') p[0] = '\0'; - /* it's a ".." entry. */ + /* it's a ".." entry. */ else if (p[2] == '.') { char *prevEntry = p - 1; @@ -550,7 +583,7 @@ } /* else */ } /* while */ - /* shrink the retval's memory block if possible... */ + /* shrink the retval's memory block if possible... */ p = (char *) allocator.Realloc(retval, strlen(retval) + 1); if (p != NULL) retval = p; @@ -561,6 +594,7 @@ int __PHYSFS_platformMkDir(const char *path) { + /* !!! FIXME: unicode version. */ DWORD rc = CreateDirectory(path, NULL); BAIL_IF_MACRO(rc == 0, win32strerror(), 0); return(1); @@ -663,6 +697,7 @@ HANDLE fileHandle; win32file *retval; + /* !!! FIXME: unicode version. */ fileHandle = CreateFile(fname, mode, FILE_SHARE_READ, NULL, creation, FILE_ATTRIBUTE_NORMAL, NULL); @@ -892,10 +927,12 @@ /* If filename is a folder */ if (GetFileAttributes(path) == FILE_ATTRIBUTE_DIRECTORY) { + /* !!! FIXME: unicode version. */ BAIL_IF_MACRO(!RemoveDirectory(path), win32strerror(), 0); } /* if */ else { + /* !!! FIXME: unicode version. */ BAIL_IF_MACRO(!DeleteFile(path), win32strerror(), 0); } /* else */ @@ -1019,6 +1056,7 @@ /* GetFileAttributesEx didn't show up until Win98 and NT4. */ if (pGetFileAttributesEx != NULL) { + /* !!! FIXME: unicode version. */ if (pGetFileAttributesEx(fname, GetFileExInfoStandard, &attrData)) { /* 0 return value indicates an error or not supported */ From DONOTREPLY at icculus.org Sun Mar 25 00:59:12 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 25 Mar 2007 00:59:12 -0400 Subject: r869 - trunk Message-ID: <20070325045912.29957.qmail@icculus.org> Author: icculus Date: 2007-03-25 00:59:11 -0400 (Sun, 25 Mar 2007) New Revision: 869 Modified: trunk/physfs_internal.h Log: Patched to compile on MSVC. Modified: trunk/physfs_internal.h =================================================================== --- trunk/physfs_internal.h 2007-03-25 00:38:14 UTC (rev 868) +++ trunk/physfs_internal.h 2007-03-25 04:59:11 UTC (rev 869) @@ -58,8 +58,8 @@ void *__PHYSFS_initSmallAlloc(void *ptr, PHYSFS_uint64 len); #define __PHYSFS_smallAlloc(bytes) ( \ - __PHYSFS_initSmallAlloc(((bytes < __PHYSFS_SMALLALLOCTHRESHOLD) ? \ - alloca(bytes+1) : NULL), bytes) \ + __PHYSFS_initSmallAlloc((((bytes) < __PHYSFS_SMALLALLOCTHRESHOLD) ? \ + alloca((size_t)((bytes)+1)) : NULL), (bytes)) \ ) void __PHYSFS_smallFree(void *ptr); From DONOTREPLY at icculus.org Sun Mar 25 01:17:08 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 25 Mar 2007 01:17:08 -0400 Subject: r870 - in trunk: . platform Message-ID: <20070325051708.3631.qmail@icculus.org> Author: icculus Date: 2007-03-25 01:17:08 -0400 (Sun, 25 Mar 2007) New Revision: 870 Modified: trunk/CHANGELOG.txt trunk/platform/windows.c Log: Improved dynamic loader and initial Unicode work in windows.c ... Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-25 04:59:11 UTC (rev 869) +++ trunk/CHANGELOG.txt 2007-03-25 05:17:08 UTC (rev 870) @@ -2,6 +2,7 @@ * CHANGELOG. */ +03252007 - Improved dynamic loader and initial Unicode work in windows.c ... 03242007 - Replaced BeOS semaphores with BLockers for the mutex implementation. It's much simpler, it has "benaphores" built in behind the scenes for faster performance, and it's recursive...also, we were Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-25 04:59:11 UTC (rev 869) +++ trunk/platform/windows.c 2007-03-25 05:17:08 UTC (rev 870) @@ -26,20 +26,25 @@ #define HIGHORDER_UINT64(pos) (PHYSFS_uint32) \ (((pos & 0xFFFFFFFF00000000) >> 32) & 0x00000000FFFFFFFF) +/* + * Users without the platform SDK don't have this defined. The original docs + * for SetFilePointer() just said to compare with 0xFFFFFFFF, so this should + * work as desired. + */ +#define PHYSFS_INVALID_SET_FILE_POINTER 0xFFFFFFFF -/* !!! FIXME: unicode version. */ -/* GetUserProfileDirectory() is only available on >= NT4 (no 9x/ME systems!) */ -typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETUSERPROFILEDIR) ( - HANDLE hToken, - LPTSTR lpProfileDir, - LPDWORD lpcchSize); +/* just in case... */ +#define PHYSFS_INVALID_FILE_ATTRIBUTES 0xFFFFFFFF -/* !!! FIXME: unicode version. */ -/* GetFileAttributesEx() is only available on >= Win98 or WinNT4 ... */ -typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETFILEATTRIBUTESEX) ( - LPCTSTR lpFileName, - GET_FILEEX_INFO_LEVELS fInfoLevelId, - LPVOID lpFileInformation); +#define UTF8_TO_UNICODE_STACK_MACRO(w_assignto, str) { \ + if (str == NULL) \ + w_assignto = NULL; \ + else { \ + const PHYSFS_uint64 len = (PHYSFS_uint64) ((strlen(str) * 4) + 1); \ + w_assignto = (char *) __PHYSFS_smallAlloc(len); \ + PHYSFS_uc2fromutf8(str, (PHYSFS_uint16 *) w_assignto, len); \ + } \ +} \ typedef struct { @@ -48,22 +53,85 @@ } win32file; const char *__PHYSFS_platformDirSeparator = "\\"; -static LPFNGETFILEATTRIBUTESEX pGetFileAttributesEx = NULL; + + +/* pointers for APIs that may not exist on some Windows versions... */ static HANDLE libKernel32 = NULL; +static HANDLE libUserEnv = NULL; +static HANDLE libAdvApi32 = NULL; +static DWORD (WINAPI *pGetModuleFileNameA)(HMODULE, LPCH, DWORD); +static DWORD (WINAPI *pGetModuleFileNameW)(HMODULE, LPWCH, DWORD); +static BOOL (WINAPI *pGetUserProfileDirectoryW)(HANDLE, LPWSTR, LPDWORD); +static BOOL (WINAPI *pGetUserNameW)(LPWSTR, LPDWORD); +static DWORD (WINAPI *pGetFileAttributesW)(LPCWSTR); +static HANDLE (WINAPI *pFindFirstFileW)(LPCWSTR, LPWIN32_FIND_DATAW); +static BOOL (WINAPI *pFindNextFileW)(HANDLE, LPWIN32_FIND_DATAW); +static DWORD (WINAPI *pGetCurrentDirectoryW)(DWORD, LPWSTR); +static BOOL (WINAPI *pDeleteFileW)(LPCWSTR); +static BOOL (WINAPI *pRemoveDirectoryW)(LPCWSTR); +static BOOL (WINAPI *pCreateDirectoryW)(LPCWSTR, LPSECURITY_ATTRIBUTES); +static BOOL (WINAPI *pGetFileAttributesExA) + (LPCSTR, GET_FILEEX_INFO_LEVELS, LPVOID); +static BOOL (WINAPI *pGetFileAttributesExW) + (LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID); +static DWORD (WINAPI *pFormatMessageW) + (DWORD, LPCVOID, DWORD, DWORD, LPWSTR, DWORD, va_list *); +static DWORD (WINAPI *pSearchPathW) + (LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPWSTR, LPWSTR *); +static HANDLE (WINAPI *pCreateFileW) + (LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); + static char *userDir = NULL; -/* - * Users without the platform SDK don't have this defined. The original docs - * for SetFilePointer() just said to compare with 0xFFFFFFFF, so this should - * work as desired. - */ -#define PHYSFS_INVALID_SET_FILE_POINTER 0xFFFFFFFF -/* just in case... */ -#define PHYSFS_INVALID_FILE_ATTRIBUTES 0xFFFFFFFF +/* A blatant abuse of pointer casting... */ +static void symLookup(HMODULE dll, void **addr, const char *sym) +{ + *addr = GetProcAddress(dll, sym); +} /* symLookup */ +static int findApiSymbols(void) +{ + HMODULE dll = NULL; + #define LOOKUP(x) { symLookup(dll, (void **) &p##x, #x); } + + dll = libUserEnv = LoadLibrary("userenv.dll"); + if (dll != NULL) + LOOKUP(GetUserProfileDirectoryW); + + /* !!! FIXME: what do they call advapi32.dll on Win64? */ + dll = libAdvApi32 = LoadLibrary("advapi32.dll"); + if (dll != NULL) + LOOKUP(GetUserNameW); + + /* !!! FIXME: what do they call kernel32.dll on Win64? */ + dll = libKernel32 = LoadLibrary("kernel32.dll"); + if (dll != NULL) + { + LOOKUP(GetModuleFileNameA); + LOOKUP(GetModuleFileNameW); + LOOKUP(FormatMessageW); + LOOKUP(FindFirstFileW); + LOOKUP(FindNextFileW); + LOOKUP(GetFileAttributesW); + LOOKUP(GetFileAttributesExA); + LOOKUP(GetFileAttributesExW); + LOOKUP(GetCurrentDirectoryW); + LOOKUP(CreateDirectoryW); + LOOKUP(RemoveDirectoryW); + LOOKUP(CreateFileW); + LOOKUP(DeleteFileW); + LOOKUP(SearchPathW); + } /* if */ + + #undef LOOKUP + + return(1); +} /* findApiSymbols */ + + /* * Figure out what the last failing Win32 API call was, and * generate a human-readable string for the error message. @@ -175,7 +243,7 @@ /* - * Try to make use of GetUserProfileDirectory(), which isn't available on + * Try to make use of GetUserProfileDirectoryW(), which isn't available on * some common variants of Win32. If we can't use this, we just punt and * use the physfs base dir for the user dir, too. * @@ -186,64 +254,52 @@ */ static int determineUserDir(void) { - DWORD psize = 0; - char dummy[1]; - BOOL rc = 0; - HANDLE processHandle; /* Current process handle */ - HANDLE accessToken = NULL; /* Security handle to process */ - LPFNGETUSERPROFILEDIR GetUserProfileDirectory; - HMODULE lib; + if (userDir != NULL) + return(1); /* already good to go. */ - assert(userDir == NULL); - /* - * GetUserProfileDirectory() is only available on NT 4.0 and later. + * GetUserProfileDirectoryW() is only available on NT 4.0 and later. * This means Win95/98/ME (and CE?) users have to do without, so for * them, we'll default to the base directory when we can't get the - * function pointer. + * function pointer. Since this is originally an NT API, we don't + * offer a non-Unicode fallback. */ - - lib = LoadLibrary("userenv.dll"); - if (lib) + if (pGetUserProfileDirectoryW != NULL) { - /* !!! FIXME: unicode version. */ - GetUserProfileDirectory = (LPFNGETUSERPROFILEDIR) - GetProcAddress(lib, "GetUserProfileDirectoryA"); - if (GetUserProfileDirectory) + HANDLE accessToken = NULL; /* Security handle to process */ + HANDLE processHandle = GetCurrentProcess(); + if (OpenProcessToken(processHandle, TOKEN_QUERY, &accessToken)) { - processHandle = GetCurrentProcess(); - if (OpenProcessToken(processHandle, TOKEN_QUERY, &accessToken)) + DWORD psize = 0; + WCHAR dummy = 0; + LPWSTR wstr = NULL; + BOOL rc = 0; + + /* + * Should fail. Will write the size of the profile path in + * psize. Also note that the second parameter can't be + * NULL or the function fails. + */ + rc = pGetUserProfileDirectoryW(accessToken, &dummy, &psize); + assert(!rc); /* !!! FIXME: handle this gracefully. */ + + /* Allocate memory for the profile directory */ + wstr = (LPWSTR) __PHYSFS_smallAlloc(psize * sizeof (WCHAR)); + if (wstr != NULL) { - /* - * Should fail. Will write the size of the profile path in - * psize. Also note that the second parameter can't be - * NULL or the function fails. - */ - /* !!! FIXME: unicode version. */ - rc = GetUserProfileDirectory(accessToken, dummy, &psize); - assert(!rc); /* success?! */ - - /* Allocate memory for the profile directory */ - userDir = (char *) allocator.Malloc(psize); - if (userDir != NULL) + if (pGetUserProfileDirectoryW(accessToken, wstr, &psize)) { - /* !!! FIXME: unicode version. */ - if (GetUserProfileDirectory(accessToken, userDir, &psize)) - { - /* !!! FIXME: convert to UTF-8. */ - } /* if */ - else - { - allocator.Free(userDir); - userDir = NULL; - } /* else */ - } /* else */ - } /* if */ - - CloseHandle(accessToken); + const PHYSFS_uint64 buflen = psize * 6; + userDir = (char *) allocator.Malloc(buflen); + if (userDir != NULL) + PHYSFS_utf8FromUcs2((const PHYSFS_uint16 *) wstr, userDir, buflen); + /* !!! FIXME: shrink allocation... */ + } /* if */ + __PHYSFS_smallFree(wstr); + } /* else */ } /* if */ - FreeLibrary(lib); + CloseHandle(accessToken); } /* if */ if (userDir == NULL) /* couldn't get profile for some reason. */ @@ -251,7 +307,6 @@ /* Might just be a non-NT system; resort to the basedir. */ userDir = getExePath(NULL); BAIL_IF_MACRO(userDir == NULL, NULL, 0); /* STILL failed?! */ - /* !!! FIXME: convert to UTF-8. */ } /* if */ return(1); /* We made it: hit the showers. */ @@ -445,6 +500,8 @@ continue; callback(callbackdata, origdir, ent.cFileName); + + /* !!! FIXME: unicode version. */ } while (FindNextFile(dir, &ent) != 0); FindClose(dir); @@ -622,71 +679,30 @@ } /* getOSInfo */ -/* - * Some things we want/need are in external DLLs that may or may not be - * available, based on the operating system, etc. This function loads those - * libraries and hunts down the needed pointers. - * - * Libraries that are one-shot deals, or better loaded as needed, are loaded - * elsewhere (see determineUserDir()). - * - * Returns zero if a needed library couldn't load, non-zero if we have enough - * to go on (which means some useful but non-crucial libraries may _NOT_ be - * loaded; check the related module-scope variables). - */ -static int loadLibraries(void) -{ - /* If this get unwieldy, make it table driven. */ - - int allNeededLibrariesLoaded = 1; /* flip to zero as needed. */ - - libKernel32 = LoadLibrary("kernel32.dll"); - if (libKernel32) - { - pGetFileAttributesEx = (LPFNGETFILEATTRIBUTESEX) - GetProcAddress(libKernel32, "GetFileAttributesExA"); - } /* if */ - - /* add other DLLs here... */ - - - /* see if there's any reason to keep kernel32.dll around... */ - if (libKernel32) - { - if ((pGetFileAttributesEx == NULL) /* && (somethingElse == NULL) */ ) - { - FreeLibrary(libKernel32); - libKernel32 = NULL; - } /* if */ - } /* if */ - - return(allNeededLibrariesLoaded); -} /* loadLibraries */ - - int __PHYSFS_platformInit(void) { + BAIL_IF_MACRO(!findApiSymbols(), NULL, 0); BAIL_IF_MACRO(!getOSInfo(), NULL, 0); - BAIL_IF_MACRO(!loadLibraries(), NULL, 0); BAIL_IF_MACRO(!determineUserDir(), NULL, 0); - return(1); /* It's all good */ } /* __PHYSFS_platformInit */ int __PHYSFS_platformDeinit(void) { - if (userDir != NULL) - { - allocator.Free(userDir); - userDir = NULL; - } /* if */ + HANDLE *libs[] = { &libKernel32, &libUserEnv, &libAdvApi32, NULL }; + int i; - if (libKernel32) + allocator.Free(userDir); + userDir = NULL; + + for (i = 0; libs[i] != NULL; i++) { - FreeLibrary(libKernel32); - libKernel32 = NULL; - } /* if */ + const HANDLE lib = *(libs[i]); + if (lib) + FreeLibrary(lib); + *(libs[i]) = NULL; + } /* for */ return(1); /* It's all good */ } /* __PHYSFS_platformDeinit */ @@ -1054,10 +1070,10 @@ memset(&attrData, '\0', sizeof (attrData)); /* GetFileAttributesEx didn't show up until Win98 and NT4. */ - if (pGetFileAttributesEx != NULL) + if (pGetFileAttributesExA != NULL) { /* !!! FIXME: unicode version. */ - if (pGetFileAttributesEx(fname, GetFileExInfoStandard, &attrData)) + if (pGetFileAttributesExA(fname, GetFileExInfoStandard, &attrData)) { /* 0 return value indicates an error or not supported */ if ( (attrData.ftLastWriteTime.dwHighDateTime != 0) || From DONOTREPLY at icculus.org Sun Mar 25 02:26:53 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 25 Mar 2007 02:26:53 -0400 Subject: r871 - trunk/platform Message-ID: <20070325062653.31434.qmail@icculus.org> Author: icculus Date: 2007-03-25 02:26:53 -0400 (Sun, 25 Mar 2007) New Revision: 871 Modified: trunk/platform/windows.c Log: Reworked getExePath() to remove some FIXMEs and respect Unicode. Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-25 05:17:08 UTC (rev 870) +++ trunk/platform/windows.c 2007-03-25 06:26:53 UTC (rev 871) @@ -172,72 +172,73 @@ } /* win32strerror */ -static char *getExePath(const char *argv0) +static char *getExePath(void) { - DWORD buflen; + DWORD buflen = 64; int success = 0; - char *ptr = NULL; - char *retval = (char *) allocator.Malloc(sizeof (TCHAR) * (MAX_PATH + 1)); + LPWSTR modpath = NULL; + char *retval = NULL; - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - - retval[0] = '\0'; - /* !!! FIXME: don't preallocate here? */ - /* !!! FIXME: use smallAlloc? */ - /* !!! FIXME: unicode version. */ - buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1); - if (buflen <= 0) - __PHYSFS_setError(win32strerror()); - else + while (1) { - retval[buflen] = '\0'; /* does API always null-terminate this? */ + DWORD rc; + void *ptr; - /* make sure the string was not truncated. */ - if (__PHYSFS_stricmpASCII(&retval[buflen - 4], ".exe") != 0) - __PHYSFS_setError(ERR_GETMODFN_TRUNC); - else + if ( !(ptr = allocator.Realloc(modpath, buflen*sizeof(WCHAR))) ) { - ptr = strrchr(retval, '\\'); - if (ptr == NULL) - __PHYSFS_setError(ERR_GETMODFN_NO_DIR); - else - { - *(ptr + 1) = '\0'; /* chop off filename. */ - success = 1; - } /* else */ - } /* else */ - } /* else */ + allocator.Free(modpath); + BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL); + } /* if */ + modpath = (LPWSTR) ptr; - /* if any part of the previous approach failed, try SearchPath()... */ + rc = pGetModuleFileNameW(NULL, modpath, buflen); + if (rc == 0) + { + allocator.Free(modpath); + BAIL_MACRO(win32strerror(), NULL); + } /* if */ - if (!success) + if (rc < buflen) + { + buflen = rc; + break; + } /* if */ + + buflen *= 2; + } /* while */ + + if (buflen > 0) /* just in case... */ { - if (argv0 == NULL) /* !!! FIXME: default behaviour does this. */ - __PHYSFS_setError(ERR_ARGV0_IS_NULL); + WCHAR *ptr = (modpath + buflen) - 1; + while (ptr != modpath) + { + if (*ptr == '\\') + break; + ptr--; + } /* while */ + + if ((ptr == modpath) && (*ptr != '\\')) + __PHYSFS_setError(ERR_GETMODFN_NO_DIR); else { - /* !!! FIXME: unicode version. */ - buflen = SearchPath(NULL, argv0, NULL, MAX_PATH+1, retval, &ptr); - if (buflen == 0) - __PHYSFS_setError(win32strerror()); - else if (buflen > MAX_PATH) - __PHYSFS_setError(ERR_SEARCHPATH_TRUNC); + *(ptr + 1) = '\0'; /* chop off filename. */ + retval = (char *) allocator.Malloc(buflen * 6); + if (retval == NULL) + __PHYSFS_setError(ERR_OUT_OF_MEMORY); else - success = 1; + PHYSFS_utf8FromUcs2((const PHYSFS_uint16 *) modpath, retval, buflen * 6); } /* else */ - } /* if */ + } /* else */ + allocator.Free(modpath); - if (!success) + /* free up the bytes we didn't actually use. */ + if (retval != NULL) { - allocator.Free(retval); - return(NULL); /* physfs error message will be set, above. */ + void *ptr = allocator.Realloc(retval, strlen(retval) + 1); + if (ptr != NULL) + retval = (char *) ptr; } /* if */ - /* free up the bytes we didn't actually use. */ - ptr = (char *) allocator.Realloc(retval, strlen(retval) + 1); - if (ptr != NULL) - retval = ptr; - return(retval); /* w00t. */ } /* getExePath */ @@ -305,7 +306,7 @@ if (userDir == NULL) /* couldn't get profile for some reason. */ { /* Might just be a non-NT system; resort to the basedir. */ - userDir = getExePath(NULL); + userDir = getExePath(); BAIL_IF_MACRO(userDir == NULL, NULL, 0); /* STILL failed?! */ } /* if */ @@ -352,7 +353,7 @@ if ((argv0 != NULL) && (strchr(argv0, '\\') != NULL)) return(NULL); /* default behaviour can handle this. */ - return(getExePath(argv0)); + return(getExePath()); } /* __PHYSFS_platformCalcBaseDir */ From DONOTREPLY at icculus.org Mon Mar 26 02:34:55 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 26 Mar 2007 02:34:55 -0400 Subject: r872 - in branches/stable-1.0: . platform Message-ID: <20070326063455.30354.qmail@icculus.org> Author: icculus Date: 2007-03-26 02:34:55 -0400 (Mon, 26 Mar 2007) New Revision: 872 Modified: branches/stable-1.0/CHANGELOG branches/stable-1.0/platform/win32.c Log: Whoops, this should probably be chopping the string instead of turning the first newline it sees into a space character... Modified: branches/stable-1.0/CHANGELOG =================================================================== --- branches/stable-1.0/CHANGELOG 2007-03-25 06:26:53 UTC (rev 871) +++ branches/stable-1.0/CHANGELOG 2007-03-26 06:34:55 UTC (rev 872) @@ -4,6 +4,8 @@ -- stuff in the stable-1.0 branch, backported from 2.0.0 dev branch, etc --- +03262007 - Fixed minor cosmetic issue in Windows error messages where it would + leave whitespace and newlines at the end of the string. 09232006 - Fixed typo in doxygen comment. 03232006 - Added -fvisibility for gcc4 (http://gcc.gnu.org/wiki/Visibility) 01012006 - Added physfs.rc (thanks, Dennis!). Changed my email address. Modified: branches/stable-1.0/platform/win32.c =================================================================== --- branches/stable-1.0/platform/win32.c 2007-03-25 06:26:53 UTC (rev 871) +++ branches/stable-1.0/platform/win32.c 2007-03-26 06:34:55 UTC (rev 872) @@ -97,7 +97,7 @@ { if ((*ptr == '\n') || (*ptr == '\r')) { - *ptr = ' '; + *ptr = '\0'; break; } /* if */ } /* for */ From DONOTREPLY at icculus.org Mon Mar 26 02:36:39 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 26 Mar 2007 02:36:39 -0400 Subject: r873 - in trunk: . platform Message-ID: <20070326063639.30827.qmail@icculus.org> Author: icculus Date: 2007-03-26 02:36:39 -0400 (Mon, 26 Mar 2007) New Revision: 873 Modified: trunk/CHANGELOG.txt trunk/platform/windows.c Log: Tons of Unicode work in windows.c ... should now use UCS-2 on NT/XP/Vista/etc versions of the OS, and fallback to "ANSI" versions for 95/98/ME, tapdancing around the system codepage if it has to. Other minor Windows cleanups and corrections. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-26 06:34:55 UTC (rev 872) +++ trunk/CHANGELOG.txt 2007-03-26 06:36:39 UTC (rev 873) @@ -2,6 +2,15 @@ * CHANGELOG. */ +03262007 - Tons of Unicode work in windows.c ... should now use UCS-2 on + NT/XP/Vista/etc versions of the OS, and fallback to "ANSI" versions + for 95/98/ME, tapdancing around the system codepage if it has to. + Since the Unicode entry points are dynamically loaded, it won't + have issues with missing symbols on Win9x, nor does it need to be + built separately with #define UNICODE (although it will work the + same with or without this define, as it doesn't use TCHARs or + the non-[WA] versions of APIs. Other minor Windows cleanups and + corrections. 03252007 - Improved dynamic loader and initial Unicode work in windows.c ... 03242007 - Replaced BeOS semaphores with BLockers for the mutex implementation. It's much simpler, it has "benaphores" built in behind the scenes Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-26 06:34:55 UTC (rev 872) +++ trunk/platform/windows.c 2007-03-26 06:36:39 UTC (rev 873) @@ -11,6 +11,11 @@ #ifdef PHYSFS_PLATFORM_WINDOWS +/* Forcibly disable UNICODE, since we manage this ourselves. */ +#ifdef UNICODE +#undef UNICODE +#endif + #include #include #include @@ -41,25 +46,71 @@ w_assignto = NULL; \ else { \ const PHYSFS_uint64 len = (PHYSFS_uint64) ((strlen(str) * 4) + 1); \ - w_assignto = (char *) __PHYSFS_smallAlloc(len); \ - PHYSFS_uc2fromutf8(str, (PHYSFS_uint16 *) w_assignto, len); \ + w_assignto = (WCHAR *) __PHYSFS_smallAlloc(len); \ + if (w_assignto != NULL) \ + PHYSFS_utf8ToUcs2(str, (PHYSFS_uint16 *) w_assignto, len); \ } \ } \ +static PHYSFS_uint64 wStrLen(const WCHAR *wstr) +{ + PHYSFS_uint64 len = 0; + while (*(wstr++)) + len++; + return(len); +} /* wStrLen */ + +static char *unicodeToUtf8Heap(const WCHAR *w_str) +{ + char *retval = NULL; + if (w_str != NULL) + { + void *ptr = NULL; + const PHYSFS_uint64 len = (wStrLen(w_str) * 4) + 1; + retval = allocator.Malloc(len); + BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); + PHYSFS_utf8FromUcs2((const PHYSFS_uint16 *) w_str, retval, len); + ptr = allocator.Realloc(retval, strlen(retval) + 1); /* shrink. */ + if (ptr != NULL) + retval = (char *) ptr; + } /* if */ + return(retval); +} /* unicodeToUtf8Heap */ + + +static char *codepageToUtf8Heap(const char *cpstr) +{ + char *retval = NULL; + if (cpstr != NULL) + { + const int len = (int) (strlen(cpstr) + 1); + WCHAR *wbuf = (WCHAR *) __PHYSFS_smallAlloc(len * sizeof (WCHAR)); + BAIL_IF_MACRO(wbuf == NULL, ERR_OUT_OF_MEMORY, NULL); + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, cpstr, len, wbuf, len); + retval = (char *) allocator.Malloc(len * 4); + if (retval == NULL) + __PHYSFS_setError(ERR_OUT_OF_MEMORY); + else + PHYSFS_utf8FromUcs2(wbuf, retval, len * 4); + __PHYSFS_smallFree(wbuf); + } /* if */ + return(retval); +} /* codepageToUtf8Heap */ + + typedef struct { HANDLE handle; int readonly; -} win32file; +} WinApiFile; -const char *__PHYSFS_platformDirSeparator = "\\"; +static char *userDir = NULL; /* pointers for APIs that may not exist on some Windows versions... */ static HANDLE libKernel32 = NULL; static HANDLE libUserEnv = NULL; static HANDLE libAdvApi32 = NULL; -static DWORD (WINAPI *pGetModuleFileNameA)(HMODULE, LPCH, DWORD); static DWORD (WINAPI *pGetModuleFileNameW)(HMODULE, LPWCH, DWORD); static BOOL (WINAPI *pGetUserProfileDirectoryW)(HANDLE, LPWSTR, LPDWORD); static BOOL (WINAPI *pGetUserNameW)(LPWSTR, LPDWORD); @@ -76,18 +127,135 @@ (LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID); static DWORD (WINAPI *pFormatMessageW) (DWORD, LPCVOID, DWORD, DWORD, LPWSTR, DWORD, va_list *); -static DWORD (WINAPI *pSearchPathW) - (LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPWSTR, LPWSTR *); static HANDLE (WINAPI *pCreateFileW) (LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); -static char *userDir = NULL; +/* + * Fallbacks for missing Unicode functions on Win95/98/ME. These are filled + * into the function pointers if looking up the real Unicode entry points + * in the system DLLs fails, so they're never used on WinNT/XP/Vista/etc. + * They make an earnest effort to convert to/from UTF-8 and UCS-2 to + * the user's current codepage. + */ +static BOOL WINAPI fallbackGetUserNameW(LPWSTR buf, LPDWORD len) +{ + const DWORD cplen = *len; + char *cpstr = __PHYSFS_smallAlloc(cplen); + BOOL retval = GetUserNameA(cpstr, len); + if (buf != NULL) + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, cpstr, cplen, buf, *len); + __PHYSFS_smallFree(cpstr); + return(retval); +} /* fallbackGetUserNameW */ + +static DWORD WINAPI fallbackFormatMessageW(DWORD dwFlags, LPCVOID lpSource, + DWORD dwMessageId, DWORD dwLangId, + LPWSTR lpBuf, DWORD nSize, + va_list *Arguments) +{ + char *cpbuf = (char *) __PHYSFS_smallAlloc(nSize); + DWORD retval = FormatMessageA(dwFlags, lpSource, dwMessageId, dwLangId, + cpbuf, nSize, Arguments); + if (retval > 0) + MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,cpbuf,retval,lpBuf,nSize); + __PHYSFS_smallFree(cpbuf); + return(retval); +} /* fallbackFormatMessageW */ + +static DWORD WINAPI fallbackGetModuleFileNameW(HMODULE hMod, LPWCH lpBuf, + DWORD nSize) +{ + char *cpbuf = (char *) __PHYSFS_smallAlloc(nSize); + DWORD retval = GetModuleFileNameA(hMod, cpbuf, nSize); + if (retval > 0) + MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,cpbuf,retval,lpBuf,nSize); + __PHYSFS_smallFree(cpbuf); + return(retval); +} /* fallbackGetModuleFileNameW */ + +static DWORD WINAPI fallbackGetFileAttributesW(LPCWSTR fname) +{ + DWORD retval = 0; + const int buflen = (int) (wStrLen(fname) + 1); + char *cpstr = (char *) __PHYSFS_smallAlloc(buflen); + WideCharToMultiByte(CP_ACP, 0, fname, buflen, cpstr, buflen, NULL, NULL); + retval = GetFileAttributesA(cpstr); + __PHYSFS_smallFree(cpstr); + return(retval); +} /* fallbackGetFileAttributesW */ + +static DWORD WINAPI fallbackGetCurrentDirectoryW(DWORD buflen, LPWSTR buf) +{ + DWORD retval = 0; + char *cpbuf = NULL; + if (buf != NULL) + cpbuf = (char *) __PHYSFS_smallAlloc(buflen); + retval = GetCurrentDirectoryA(buflen, cpbuf); + if (cpbuf != NULL) + { + MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,cpbuf,retval,buf,buflen); + __PHYSFS_smallFree(cpbuf); + } /* if */ + return(retval); +} /* fallbackGetCurrentDirectoryW */ + +static BOOL WINAPI fallbackRemoveDirectoryW(LPCWSTR dname) +{ + BOOL retval = 0; + const int buflen = (int) (wStrLen(dname) + 1); + char *cpstr = (char *) __PHYSFS_smallAlloc(buflen); + WideCharToMultiByte(CP_ACP, 0, dname, buflen, cpstr, buflen, NULL, NULL); + retval = RemoveDirectoryA(cpstr); + __PHYSFS_smallFree(cpstr); + return(retval); +} /* fallbackRemoveDirectoryW */ + +static BOOL WINAPI fallbackCreateDirectoryW(LPCWSTR dname, + LPSECURITY_ATTRIBUTES attr) +{ + BOOL retval = 0; + const int buflen = (int) (wStrLen(dname) + 1); + char *cpstr = (char *) __PHYSFS_smallAlloc(buflen); + WideCharToMultiByte(CP_ACP, 0, dname, buflen, cpstr, buflen, NULL, NULL); + retval = CreateDirectoryA(cpstr, attr); + __PHYSFS_smallFree(cpstr); + return(retval); +} /* fallbackCreateDirectoryW */ + +static BOOL WINAPI fallbackDeleteFileW(LPCWSTR fname) +{ + BOOL retval = 0; + const int buflen = (int) (wStrLen(fname) + 1); + char *cpstr = (char *) __PHYSFS_smallAlloc(buflen); + WideCharToMultiByte(CP_ACP, 0, fname, buflen, cpstr, buflen, NULL, NULL); + retval = DeleteFileA(cpstr); + __PHYSFS_smallFree(cpstr); + return(retval); +} /* fallbackDeleteFileW */ + +static HANDLE WINAPI fallbackCreateFileW(LPCWSTR fname, + DWORD dwDesiredAccess, DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttrs, + DWORD dwCreationDisposition, + DWORD dwFlagsAndAttrs, HANDLE hTemplFile) +{ + HANDLE retval; + const int buflen = (int) (wStrLen(fname) + 1); + char *cpstr = (char *) __PHYSFS_smallAlloc(buflen); + WideCharToMultiByte(CP_ACP, 0, fname, buflen, cpstr, buflen, NULL, NULL); + retval = CreateFileA(cpstr, dwDesiredAccess, dwShareMode, lpSecurityAttrs, + dwCreationDisposition, dwFlagsAndAttrs, hTemplFile); + __PHYSFS_smallFree(cpstr); + return(retval); +} /* fallbackCreateFileW */ + + /* A blatant abuse of pointer casting... */ -static void symLookup(HMODULE dll, void **addr, const char *sym) +static int symLookup(HMODULE dll, void **addr, const char *sym) { - *addr = GetProcAddress(dll, sym); + return( (*addr = GetProcAddress(dll, sym)) != NULL ); } /* symLookup */ @@ -95,83 +263,87 @@ { HMODULE dll = NULL; - #define LOOKUP(x) { symLookup(dll, (void **) &p##x, #x); } + #define LOOKUP_NOFALLBACK(x) { symLookup(dll, (void **) &p##x, #x); } +// #define LOOKUP(x) { \ +// if (!symLookup(dll, (void **) &p##x, #x)) \ - dll = libUserEnv = LoadLibrary("userenv.dll"); + #define LOOKUP(x) { \ + p##x = fallback##x; \ + } + + dll = libUserEnv = LoadLibraryA("userenv.dll"); if (dll != NULL) - LOOKUP(GetUserProfileDirectoryW); + LOOKUP_NOFALLBACK(GetUserProfileDirectoryW); /* !!! FIXME: what do they call advapi32.dll on Win64? */ - dll = libAdvApi32 = LoadLibrary("advapi32.dll"); + dll = libAdvApi32 = LoadLibraryA("advapi32.dll"); if (dll != NULL) LOOKUP(GetUserNameW); /* !!! FIXME: what do they call kernel32.dll on Win64? */ - dll = libKernel32 = LoadLibrary("kernel32.dll"); + dll = libKernel32 = LoadLibraryA("kernel32.dll"); if (dll != NULL) { - LOOKUP(GetModuleFileNameA); + LOOKUP_NOFALLBACK(GetFileAttributesExA); +// LOOKUP_NOFALLBACK(GetFileAttributesExW); LOOKUP(GetModuleFileNameW); LOOKUP(FormatMessageW); - LOOKUP(FindFirstFileW); - LOOKUP(FindNextFileW); +// LOOKUP_NOFALLBACK(FindFirstFileW); +// LOOKUP_NOFALLBACK(FindNextFileW); LOOKUP(GetFileAttributesW); - LOOKUP(GetFileAttributesExA); - LOOKUP(GetFileAttributesExW); LOOKUP(GetCurrentDirectoryW); LOOKUP(CreateDirectoryW); LOOKUP(RemoveDirectoryW); LOOKUP(CreateFileW); LOOKUP(DeleteFileW); - LOOKUP(SearchPathW); } /* if */ + #undef LOOKUP_NOFALLBACK #undef LOOKUP return(1); } /* findApiSymbols */ +const char *__PHYSFS_platformDirSeparator = "\\"; + + /* - * Figure out what the last failing Win32 API call was, and + * Figure out what the last failing Windows API call was, and * generate a human-readable string for the error message. * * The return value is a static buffer that is overwritten with * each call to this function. */ -static const char *win32strerror(void) +static const char *winApiStrError(void) { - static TCHAR msgbuf[255]; - TCHAR *ptr = msgbuf; + static char utf8buf[255]; + WCHAR msgbuf[255]; + WCHAR *ptr; + DWORD rc = pFormatMessageW( + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + msgbuf, __PHYSFS_ARRAYLEN(msgbuf), + NULL); - /* !!! FIXME: unicode version. */ - FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ - msgbuf, - sizeof (msgbuf) / sizeof (TCHAR), - NULL - ); - /* chop off newlines. */ for (ptr = msgbuf; *ptr; ptr++) { if ((*ptr == '\n') || (*ptr == '\r')) { - *ptr = ' '; + *ptr = '\0'; break; } /* if */ } /* for */ - /* !!! FIXME: convert to UTF-8. */ + /* may truncate, but oh well. */ + PHYSFS_utf8FromUcs2((PHYSFS_uint16 *) msgbuf, utf8buf, sizeof (utf8buf)); + return((const char *) utf8buf); +} /* winApiStrError */ - return((const char *) msgbuf); -} /* win32strerror */ - static char *getExePath(void) { DWORD buflen = 64; @@ -195,7 +367,7 @@ if (rc == 0) { allocator.Free(modpath); - BAIL_MACRO(win32strerror(), NULL); + BAIL_MACRO(winApiStrError(), NULL); } /* if */ if (rc < buflen) @@ -222,23 +394,11 @@ else { *(ptr + 1) = '\0'; /* chop off filename. */ - retval = (char *) allocator.Malloc(buflen * 6); - if (retval == NULL) - __PHYSFS_setError(ERR_OUT_OF_MEMORY); - else - PHYSFS_utf8FromUcs2((const PHYSFS_uint16 *) modpath, retval, buflen * 6); + retval = unicodeToUtf8Heap(modpath); } /* else */ } /* else */ allocator.Free(modpath); - /* free up the bytes we didn't actually use. */ - if (retval != NULL) - { - void *ptr = allocator.Realloc(retval, strlen(retval) + 1); - if (ptr != NULL) - retval = (char *) ptr; - } /* if */ - return(retval); /* w00t. */ } /* getExePath */ @@ -289,13 +449,7 @@ if (wstr != NULL) { if (pGetUserProfileDirectoryW(accessToken, wstr, &psize)) - { - const PHYSFS_uint64 buflen = psize * 6; - userDir = (char *) allocator.Malloc(buflen); - if (userDir != NULL) - PHYSFS_utf8FromUcs2((const PHYSFS_uint16 *) wstr, userDir, buflen); - /* !!! FIXME: shrink allocation... */ - } /* if */ + userDir = unicodeToUtf8Heap(wstr); __PHYSFS_smallFree(wstr); } /* else */ } /* if */ @@ -324,7 +478,7 @@ oldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); /* If this function succeeds, there's media in the drive */ - retval = GetVolumeInformation(drive, NULL, 0, NULL, NULL, &tmp, NULL, 0); + retval = GetVolumeInformationA(drive, NULL, 0, NULL, NULL, &tmp, NULL, 0); /* Revert back to old windows error handler */ SetErrorMode(oldErrorMode); @@ -360,28 +514,20 @@ char *__PHYSFS_platformGetUserName(void) { DWORD bufsize = 0; - LPTSTR retval = NULL; - - /* !!! FIXME: unicode version. */ - if (GetUserName(NULL, &bufsize) == 0) /* This SHOULD fail. */ + char *retval = NULL; + + if (pGetUserNameW(NULL, &bufsize) == 0) /* This SHOULD fail. */ { - retval = (LPTSTR) allocator.Malloc(bufsize); - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - /* !!! FIXME: unicode version. */ - if (GetUserName(retval, &bufsize) == 0) /* ?! */ - { - __PHYSFS_setError(win32strerror()); - allocator.Free(retval); - retval = NULL; - } /* if */ + LPWSTR wbuf = (LPWSTR) __PHYSFS_smallAlloc(bufsize * sizeof (WCHAR)); + BAIL_IF_MACRO(wbuf == NULL, ERR_OUT_OF_MEMORY, NULL); + if (pGetUserNameW(wbuf, &bufsize) == 0) /* ?! */ + __PHYSFS_setError(winApiStrError()); + else + retval = unicodeToUtf8Heap(wbuf); + __PHYSFS_smallFree(wbuf); } /* if */ - if (retval != NULL) - { - /* !!! FIXME: convert to UTF-8. */ - } /* if */ - - return((char *) retval); + return(retval); } /* __PHYSFS_platformGetUserName */ @@ -400,15 +546,26 @@ } /* __PHYSFS_platformGetThreadID */ -int __PHYSFS_platformExists(const char *fname) +static int doPlatformExists(LPWSTR wpath) { BAIL_IF_MACRO ( - /* !!! FIXME: unicode version. */ - GetFileAttributes(fname) == PHYSFS_INVALID_FILE_ATTRIBUTES, - win32strerror(), 0 + pGetFileAttributesW(wpath) == PHYSFS_INVALID_FILE_ATTRIBUTES, + winApiStrError(), 0 ); return(1); +} /* doPlatformExists */ + + +int __PHYSFS_platformExists(const char *fname) +{ + int retval = 0; + LPWSTR wpath; + UTF8_TO_UNICODE_STACK_MACRO(wpath, fname); + BAIL_IF_MACRO(wpath == NULL, ERR_OUT_OF_MEMORY, 0); + retval = doPlatformExists(wpath); + __PHYSFS_smallFree(wpath); + return(retval); } /* __PHYSFS_platformExists */ @@ -421,8 +578,13 @@ int __PHYSFS_platformIsDirectory(const char *fname) { - /* !!! FIXME: unicode version. */ - return((GetFileAttributes(fname) & FILE_ATTRIBUTE_DIRECTORY) != 0); + int retval = 0; + LPWSTR wpath; + UTF8_TO_UNICODE_STACK_MACRO(wpath, fname); + BAIL_IF_MACRO(wpath == NULL, ERR_OUT_OF_MEMORY, 0); + retval = ((pGetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY) != 0); + __PHYSFS_smallFree(wpath); + return(retval); } /* __PHYSFS_platformIsDirectory */ @@ -461,49 +623,93 @@ const char *origdir, void *callbackdata) { - HANDLE dir; + const int unicode = (pFindFirstFileW != NULL) && (pFindNextFileW != NULL); + HANDLE dir = INVALID_HANDLE_VALUE; WIN32_FIND_DATA ent; + WIN32_FIND_DATAW entw; size_t len = strlen(dirname); - char *SearchPath; + char *searchPath = NULL; + WCHAR *wSearchPath = NULL; + char *utf8 = NULL; /* Allocate a new string for path, maybe '\\', "*", and NULL terminator */ - SearchPath = (char *) __PHYSFS_smallAlloc(len + 3); - if (SearchPath == NULL) + searchPath = (char *) __PHYSFS_smallAlloc(len + 3); + if (searchPath == NULL) return; /* Copy current dirname */ - strcpy(SearchPath, dirname); + strcpy(searchPath, dirname); /* if there's no '\\' at the end of the path, stick one in there. */ - if (SearchPath[len - 1] != '\\') + if (searchPath[len - 1] != '\\') { - SearchPath[len++] = '\\'; - SearchPath[len] = '\0'; + searchPath[len++] = '\\'; + searchPath[len] = '\0'; } /* if */ /* Append the "*" to the end of the string */ - strcat(SearchPath, "*"); + strcat(searchPath, "*"); - /* !!! FIXME: unicode version. */ - dir = FindFirstFile(SearchPath, &ent); - __PHYSFS_smallFree(SearchPath); + UTF8_TO_UNICODE_STACK_MACRO(wSearchPath, searchPath); + if (wSearchPath == NULL) + return; /* oh well. */ + + if (unicode) + dir = pFindFirstFileW(wSearchPath, &entw); + else + { + const int len = (int) (wStrLen(wSearchPath) + 1); + char *cp = (char *) __PHYSFS_smallAlloc(len); + if (cp != NULL) + { + WideCharToMultiByte(CP_ACP, 0, wSearchPath, len, cp, len, 0, 0); + dir = FindFirstFileA(cp, &ent); + __PHYSFS_smallFree(cp); + } /* if */ + } /* else */ + + __PHYSFS_smallFree(wSearchPath); + __PHYSFS_smallFree(searchPath); if (dir == INVALID_HANDLE_VALUE) return; - do + if (unicode) { - /* !!! FIXME: unicode version. */ - if (strcmp(ent.cFileName, ".") == 0) - continue; + do + { + const WCHAR *fn = entw.cFileName; + if ((fn[0] == '.') && (fn[1] == '\0')) + continue; + if ((fn[0] == '.') && (fn[1] == '.') && (fn[2] == '\0')) + continue; - /* !!! FIXME: unicode version. */ - if (strcmp(ent.cFileName, "..") == 0) - continue; + utf8 = unicodeToUtf8Heap(entw.cFileName); + if (utf8 != NULL) + { + callback(callbackdata, origdir, utf8); + allocator.Free(utf8); + } /* if */ + } while (pFindNextFileW(dir, &entw) != 0); + } /* if */ - callback(callbackdata, origdir, ent.cFileName); + else /* ANSI fallback. */ + { + do + { + const char *fn = ent.cFileName; + if ((fn[0] == '.') && (fn[1] == '\0')) + continue; + if ((fn[0] == '.') && (fn[1] == '.') && (fn[2] == '\0')) + continue; - /* !!! FIXME: unicode version. */ - } while (FindNextFile(dir, &ent) != 0); + utf8 = codepageToUtf8Heap(ent.cFileName); + if (utf8 != NULL) + { + callback(callbackdata, origdir, utf8); + allocator.Free(utf8); + } /* if */ + } while (FindNextFileA(dir, &ent) != 0); + } /* else */ FindClose(dir); } /* __PHYSFS_platformEnumerateFiles */ @@ -511,26 +717,33 @@ char *__PHYSFS_platformCurrentDir(void) { - LPTSTR retval; + char *retval = NULL; + WCHAR *wbuf = NULL; DWORD buflen = 0; - /* !!! FIXME: unicode version. */ - buflen = GetCurrentDirectory(buflen, NULL); - retval = (LPTSTR) allocator.Malloc(sizeof (TCHAR) * (buflen + 2)); - BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL); - /* !!! FIXME: unicode version. */ - GetCurrentDirectory(buflen, retval); + buflen = pGetCurrentDirectoryW(buflen, NULL); + wbuf = (WCHAR *) __PHYSFS_smallAlloc((buflen + 2) * sizeof (WCHAR)); + BAIL_IF_MACRO(wbuf == NULL, ERR_OUT_OF_MEMORY, NULL); + pGetCurrentDirectoryW(buflen, wbuf); - if (retval[buflen - 2] != '\\') - strcat(retval, "\\"); + if (wbuf[buflen - 2] == '\\') + wbuf[buflen-1] = '\0'; /* just in case... */ + else + { + wbuf[buflen - 1] = '\\'; + wbuf[buflen] = '\0'; + } /* else */ - return((char *) retval); + retval = unicodeToUtf8Heap(wbuf); + __PHYSFS_smallFree(wbuf); + return(retval); } /* __PHYSFS_platformCurrentDir */ /* this could probably use a cleanup. */ char *__PHYSFS_platformRealPath(const char *path) { + /* !!! FIXME: try GetFullPathName() instead? */ /* this function should be UTF-8 clean. */ char *retval = NULL; char *p = NULL; @@ -652,38 +865,19 @@ int __PHYSFS_platformMkDir(const char *path) { - /* !!! FIXME: unicode version. */ - DWORD rc = CreateDirectory(path, NULL); - BAIL_IF_MACRO(rc == 0, win32strerror(), 0); + WCHAR *wpath; + DWORD rc; + UTF8_TO_UNICODE_STACK_MACRO(wpath, path); + rc = pCreateDirectoryW(wpath, NULL); + __PHYSFS_smallFree(wpath); + BAIL_IF_MACRO(rc == 0, winApiStrError(), 0); return(1); } /* __PHYSFS_platformMkDir */ -/* - * Get OS info and save the important parts. - * - * Returns non-zero if successful, otherwise it returns zero on failure. - */ -static int getOSInfo(void) -{ -#if 0 /* we don't actually use this at the moment, but may in the future. */ - OSVERSIONINFO OSVersionInfo; /* Information about the OS */ - OSVersionInfo.dwOSVersionInfoSize = sizeof(OSVersionInfo); - BAIL_IF_MACRO(!GetVersionEx(&OSVersionInfo), win32strerror(), 0); - - /* Set to TRUE if we are runnign a WinNT based OS 4.0 or greater */ - runningNT = ((OSVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) && - (OSVersionInfo.dwMajorVersion >= 4)); -#endif - - return(1); -} /* getOSInfo */ - - int __PHYSFS_platformInit(void) { BAIL_IF_MACRO(!findApiSymbols(), NULL, 0); - BAIL_IF_MACRO(!getOSInfo(), NULL, 0); BAIL_IF_MACRO(!determineUserDir(), NULL, 0); return(1); /* It's all good */ } /* __PHYSFS_platformInit */ @@ -712,19 +906,22 @@ static void *doOpen(const char *fname, DWORD mode, DWORD creation, int rdonly) { HANDLE fileHandle; - win32file *retval; + WinApiFile *retval; + WCHAR *wfname; - /* !!! FIXME: unicode version. */ - fileHandle = CreateFile(fname, mode, FILE_SHARE_READ, NULL, - creation, FILE_ATTRIBUTE_NORMAL, NULL); + 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); + __PHYSFS_smallFree(wfname); BAIL_IF_MACRO ( fileHandle == INVALID_HANDLE_VALUE, - win32strerror(), NULL + winApiStrError(), NULL ); - retval = (win32file *) allocator.Malloc(sizeof (win32file)); + retval = (WinApiFile *) allocator.Malloc(sizeof (WinApiFile)); if (retval == NULL) { CloseHandle(fileHandle); @@ -754,11 +951,11 @@ void *retval = doOpen(filename, GENERIC_WRITE, OPEN_ALWAYS, 0); if (retval != NULL) { - HANDLE h = ((win32file *) retval)->handle; + HANDLE h = ((WinApiFile *) retval)->handle; DWORD rc = SetFilePointer(h, 0, NULL, FILE_END); if (rc == PHYSFS_INVALID_SET_FILE_POINTER) { - const char *err = win32strerror(); + const char *err = winApiStrError(); CloseHandle(h); allocator.Free(retval); BAIL_MACRO(err, NULL); @@ -772,7 +969,7 @@ PHYSFS_sint64 __PHYSFS_platformRead(void *opaque, void *buffer, PHYSFS_uint32 size, PHYSFS_uint32 count) { - HANDLE Handle = ((win32file *) opaque)->handle; + HANDLE Handle = ((WinApiFile *) opaque)->handle; DWORD CountOfBytesRead; PHYSFS_sint64 retval; @@ -780,7 +977,7 @@ /* !!! FIXME: uint32 might be a greater # than DWORD */ if(!ReadFile(Handle, buffer, count * size, &CountOfBytesRead, NULL)) { - BAIL_MACRO(win32strerror(), -1); + BAIL_MACRO(winApiStrError(), -1); } /* if */ else { @@ -796,7 +993,7 @@ PHYSFS_sint64 __PHYSFS_platformWrite(void *opaque, const void *buffer, PHYSFS_uint32 size, PHYSFS_uint32 count) { - HANDLE Handle = ((win32file *) opaque)->handle; + HANDLE Handle = ((WinApiFile *) opaque)->handle; DWORD CountOfBytesWritten; PHYSFS_sint64 retval; @@ -804,7 +1001,7 @@ /* !!! FIXME: uint32 might be a greater # than DWORD */ if(!WriteFile(Handle, buffer, count * size, &CountOfBytesWritten, NULL)) { - BAIL_MACRO(win32strerror(), -1); + BAIL_MACRO(winApiStrError(), -1); } /* if */ else { @@ -819,7 +1016,7 @@ int __PHYSFS_platformSeek(void *opaque, PHYSFS_uint64 pos) { - HANDLE Handle = ((win32file *) opaque)->handle; + HANDLE Handle = ((WinApiFile *) opaque)->handle; DWORD HighOrderPos; DWORD *pHighOrderPos; DWORD rc; @@ -848,7 +1045,7 @@ if ( (rc == PHYSFS_INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR) ) { - BAIL_MACRO(win32strerror(), 0); + BAIL_MACRO(winApiStrError(), 0); } /* if */ return(1); /* No error occured */ @@ -857,7 +1054,7 @@ PHYSFS_sint64 __PHYSFS_platformTell(void *opaque) { - HANDLE Handle = ((win32file *) opaque)->handle; + HANDLE Handle = ((WinApiFile *) opaque)->handle; DWORD HighPos = 0; DWORD LowPos; PHYSFS_sint64 retval; @@ -867,7 +1064,7 @@ if ( (LowPos == PHYSFS_INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR) ) { - BAIL_MACRO(win32strerror(), 0); + BAIL_MACRO(winApiStrError(), 0); } /* if */ else { @@ -882,7 +1079,7 @@ PHYSFS_sint64 __PHYSFS_platformFileLength(void *opaque) { - HANDLE Handle = ((win32file *) opaque)->handle; + HANDLE Handle = ((WinApiFile *) opaque)->handle; DWORD SizeHigh; DWORD SizeLow; PHYSFS_sint64 retval; @@ -891,7 +1088,7 @@ if ( (SizeLow == PHYSFS_INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR) ) { - BAIL_MACRO(win32strerror(), -1); + BAIL_MACRO(winApiStrError(), -1); } /* if */ else { @@ -922,9 +1119,9 @@ int __PHYSFS_platformFlush(void *opaque) { - win32file *fh = ((win32file *) opaque); + WinApiFile *fh = ((WinApiFile *) opaque); if (!fh->readonly) - BAIL_IF_MACRO(!FlushFileBuffers(fh->handle), win32strerror(), 0); + BAIL_IF_MACRO(!FlushFileBuffers(fh->handle), winApiStrError(), 0); return(1); } /* __PHYSFS_platformFlush */ @@ -932,28 +1129,38 @@ int __PHYSFS_platformClose(void *opaque) { - HANDLE Handle = ((win32file *) opaque)->handle; - BAIL_IF_MACRO(!CloseHandle(Handle), win32strerror(), 0); + HANDLE Handle = ((WinApiFile *) opaque)->handle; + BAIL_IF_MACRO(!CloseHandle(Handle), winApiStrError(), 0); allocator.Free(opaque); return(1); } /* __PHYSFS_platformClose */ -int __PHYSFS_platformDelete(const char *path) +static int doPlatformDelete(LPWSTR wpath) { /* If filename is a folder */ - if (GetFileAttributes(path) == FILE_ATTRIBUTE_DIRECTORY) + if (pGetFileAttributesW(wpath) == FILE_ATTRIBUTE_DIRECTORY) { - /* !!! FIXME: unicode version. */ - BAIL_IF_MACRO(!RemoveDirectory(path), win32strerror(), 0); + BAIL_IF_MACRO(!pRemoveDirectoryW(wpath), winApiStrError(), 0); } /* if */ else { - /* !!! FIXME: unicode version. */ - BAIL_IF_MACRO(!DeleteFile(path), win32strerror(), 0); + BAIL_IF_MACRO(!pDeleteFileW(wpath), winApiStrError(), 0); } /* else */ - return(1); /* if you got here, it worked. */ + return(1); /* if you made it here, it worked. */ +} /* doPlatformDelete */ + + +int __PHYSFS_platformDelete(const char *path) +{ + int retval = 0; + LPWSTR wpath; + UTF8_TO_UNICODE_STACK_MACRO(wpath, path); + BAIL_IF_MACRO(wpath == NULL, ERR_OUT_OF_MEMORY, 0); + retval = doPlatformDelete(wpath); + __PHYSFS_smallFree(wpath); + return(retval); } /* __PHYSFS_platformDelete */ @@ -995,11 +1202,11 @@ PHYSFS_sint64 retval; struct tm tm; - BAIL_IF_MACRO(!FileTimeToSystemTime(ft, &st_utc), win32strerror(), -1); + BAIL_IF_MACRO(!FileTimeToSystemTime(ft, &st_utc), winApiStrError(), -1); tzid = GetTimeZoneInformation(&tzi); - BAIL_IF_MACRO(tzid == TIME_ZONE_ID_INVALID, win32strerror(), -1); + BAIL_IF_MACRO(tzid == TIME_ZONE_ID_INVALID, winApiStrError(), -1); - /* (This API is unsupported and fails on non-NT systems. */ + /* (This API is unsupported and fails on non-NT systems. */ if (!SystemTimeToTzSpecificLocalTime(&tzi, &st_utc, &st_localtz)) { /* do it by hand. Grumble... */ @@ -1014,36 +1221,15 @@ tzi.Bias += tzi.DaylightBias; /* convert from minutes to 100-nanosecond increments... */ - #if 0 /* For compilers that puke on 64-bit math. */ - /* goddamn this is inefficient... */ - while (tzi.Bias > 0) - { - DWORD tmp = ui64.LowPart - 60000000; - if ((ui64.LowPart < tmp) && (tmp > 60000000)) - ui64.HighPart--; - ui64.LowPart = tmp; - tzi.Bias--; - } /* while */ + ui64.QuadPart -= (((LONGLONG) tzi.Bias) * (600000000)); - while (tzi.Bias < 0) - { - DWORD tmp = ui64.LowPart + 60000000; - if ((ui64.LowPart > tmp) && (tmp < 60000000)) - ui64.HighPart++; - ui64.LowPart = tmp; - tzi.Bias++; - } /* while */ - #else - ui64.QuadPart -= (((LONGLONG) tzi.Bias) * (600000000)); - #endif - /* Move it back into a FILETIME structure... */ new_ft.dwLowDateTime = ui64.LowPart; new_ft.dwHighDateTime = ui64.HighPart; /* Convert to something human-readable... */ if (!FileTimeToSystemTime(&new_ft, &st_localtz)) - BAIL_MACRO(win32strerror(), -1); + BAIL_MACRO(winApiStrError(), -1); } /* if */ /* Convert to a format that mktime() can grok... */ @@ -1067,34 +1253,55 @@ PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname) { PHYSFS_sint64 retval = -1; - WIN32_FILE_ATTRIBUTE_DATA attrData; - memset(&attrData, '\0', sizeof (attrData)); + WIN32_FILE_ATTRIBUTE_DATA attr; + int rc = 0; + memset(&attr, '\0', sizeof (attr)); + /* GetFileAttributesEx didn't show up until Win98 and NT4. */ - if (pGetFileAttributesExA != NULL) + if ((pGetFileAttributesExW != NULL) || (pGetFileAttributesExA != NULL)) { - /* !!! FIXME: unicode version. */ - if (pGetFileAttributesExA(fname, GetFileExInfoStandard, &attrData)) + WCHAR *wstr; + UTF8_TO_UNICODE_STACK_MACRO(wstr, fname); + if (wstr != NULL) /* if NULL, maybe the fallback will work. */ { - /* 0 return value indicates an error or not supported */ - if ( (attrData.ftLastWriteTime.dwHighDateTime != 0) || - (attrData.ftLastWriteTime.dwLowDateTime != 0) ) + if (pGetFileAttributesExW != NULL) /* NT/XP/Vista/etc system. */ + rc = pGetFileAttributesExW(wstr, GetFileExInfoStandard, &attr); + else /* Win98/ME system */ { - retval = FileTimeToPhysfsTime(&attrData.ftLastWriteTime); - } /* if */ + const int len = (int) (wStrLen(wstr) + 1); + char *cp = (char *) __PHYSFS_smallAlloc(len); + if (cp != NULL) + { + WideCharToMultiByte(CP_ACP, 0, wstr, len, cp, len, 0, 0); + rc = pGetFileAttributesExA(cp, GetFileExInfoStandard, &attr); + __PHYSFS_smallFree(cp); + } /* if */ + } /* else */ + __PHYSFS_smallFree(wstr); } /* if */ } /* if */ + if (rc) /* had API entry point and it worked. */ + { + /* 0 return value indicates an error or not supported */ + if ( (attr.ftLastWriteTime.dwHighDateTime != 0) || + (attr.ftLastWriteTime.dwLowDateTime != 0) ) + { + retval = FileTimeToPhysfsTime(&attr.ftLastWriteTime); + } /* if */ + } /* if */ + /* GetFileTime() has been in the Win32 API since the start. */ if (retval == -1) /* try a fallback... */ { FILETIME ft; BOOL rc; const char *err; - win32file *f = (win32file *) __PHYSFS_platformOpenRead(fname); + WinApiFile *f = (WinApiFile *) __PHYSFS_platformOpenRead(fname); BAIL_IF_MACRO(f == NULL, NULL, -1) rc = GetFileTime(f->handle, NULL, NULL, &ft); - err = win32strerror(); + err = winApiStrError(); CloseHandle(f->handle); allocator.Free(f); BAIL_IF_MACRO(!rc, err, -1); From DONOTREPLY at icculus.org Mon Mar 26 02:38:36 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 26 Mar 2007 02:38:36 -0400 Subject: r874 - trunk/platform Message-ID: <20070326063836.31501.qmail@icculus.org> Author: icculus Date: 2007-03-26 02:38:36 -0400 (Mon, 26 Mar 2007) New Revision: 874 Modified: trunk/platform/windows.c Log: Whoops, forgot to uncomment this from my testing... Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-26 06:36:39 UTC (rev 873) +++ trunk/platform/windows.c 2007-03-26 06:38:36 UTC (rev 874) @@ -264,10 +264,8 @@ HMODULE dll = NULL; #define LOOKUP_NOFALLBACK(x) { symLookup(dll, (void **) &p##x, #x); } -// #define LOOKUP(x) { \ -// if (!symLookup(dll, (void **) &p##x, #x)) \ - #define LOOKUP(x) { \ + if (!symLookup(dll, (void **) &p##x, #x)) \ p##x = fallback##x; \ } @@ -285,11 +283,11 @@ if (dll != NULL) { LOOKUP_NOFALLBACK(GetFileAttributesExA); -// LOOKUP_NOFALLBACK(GetFileAttributesExW); + LOOKUP_NOFALLBACK(GetFileAttributesExW); LOOKUP(GetModuleFileNameW); LOOKUP(FormatMessageW); -// LOOKUP_NOFALLBACK(FindFirstFileW); -// LOOKUP_NOFALLBACK(FindNextFileW); + LOOKUP_NOFALLBACK(FindFirstFileW); + LOOKUP_NOFALLBACK(FindNextFileW); LOOKUP(GetFileAttributesW); LOOKUP(GetCurrentDirectoryW); LOOKUP(CreateDirectoryW); From DONOTREPLY at icculus.org Mon Mar 26 02:46:03 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 26 Mar 2007 02:46:03 -0400 Subject: r875 - trunk Message-ID: <20070326064603.1353.qmail@icculus.org> Author: icculus Date: 2007-03-26 02:46:03 -0400 (Mon, 26 Mar 2007) New Revision: 875 Modified: trunk/ Log: Ignore Visual C++ 6.0 build files. Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.vcproj.* *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb *.suo + physfs.spec docs build Debug debug Release release CMakeScripts CMakeCache.txt install_manifest.txt test_physfs CMakeTmp CMakeFiles Makefile *.a *.so *.so.* *.dylib *.dll *.exe *.xcodeproj *.build *.vcproj *.vcproj.* *.sln *.cmake *.make *.log *.dsp *.dsw *.dir *.ncb *.suo *.plg *.rule From DONOTREPLY at icculus.org Mon Mar 26 03:52:11 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 26 Mar 2007 03:52:11 -0400 Subject: r876 - trunk/platform Message-ID: <20070326075211.24187.qmail@icculus.org> Author: icculus Date: 2007-03-26 03:51:57 -0400 (Mon, 26 Mar 2007) New Revision: 876 Modified: trunk/platform/windows.c Log: Man, I knew I would need getOSInfo() as soon as I deleted it! Apparently Win9x has the Unicode entry points, they just don't work, so only do a real lookup on NT-based platforms, and just force the fallbacks on 95/98/ME systems. Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-26 06:46:03 UTC (rev 875) +++ trunk/platform/windows.c 2007-03-26 07:51:57 UTC (rev 876) @@ -104,7 +104,9 @@ int readonly; } WinApiFile; + static char *userDir = NULL; +static int osHasUnicode = 0; /* pointers for APIs that may not exist on some Windows versions... */ @@ -263,37 +265,46 @@ { HMODULE dll = NULL; - #define LOOKUP_NOFALLBACK(x) { symLookup(dll, (void **) &p##x, #x); } - #define LOOKUP(x) { \ - if (!symLookup(dll, (void **) &p##x, #x)) \ + #define LOOKUP_NOFALLBACK(x, reallyLook) { \ + if (reallyLook) \ + symLookup(dll, (void **) &p##x, #x); \ + else \ + p##x = NULL; \ + } + + #define LOOKUP(x, reallyLook) { \ + if ((!reallyLook) || (!symLookup(dll, (void **) &p##x, #x))) \ p##x = fallback##x; \ } + /* Apparently Win9x HAS the Unicode entry points, they just don't WORK. */ + /* ...so don't look them up unless we're on NT+. (see osHasUnicode.) */ + dll = libUserEnv = LoadLibraryA("userenv.dll"); if (dll != NULL) - LOOKUP_NOFALLBACK(GetUserProfileDirectoryW); + LOOKUP_NOFALLBACK(GetUserProfileDirectoryW, osHasUnicode); /* !!! FIXME: what do they call advapi32.dll on Win64? */ dll = libAdvApi32 = LoadLibraryA("advapi32.dll"); if (dll != NULL) - LOOKUP(GetUserNameW); + LOOKUP(GetUserNameW, osHasUnicode); /* !!! FIXME: what do they call kernel32.dll on Win64? */ dll = libKernel32 = LoadLibraryA("kernel32.dll"); if (dll != NULL) { - LOOKUP_NOFALLBACK(GetFileAttributesExA); - LOOKUP_NOFALLBACK(GetFileAttributesExW); - LOOKUP(GetModuleFileNameW); - LOOKUP(FormatMessageW); - LOOKUP_NOFALLBACK(FindFirstFileW); - LOOKUP_NOFALLBACK(FindNextFileW); - LOOKUP(GetFileAttributesW); - LOOKUP(GetCurrentDirectoryW); - LOOKUP(CreateDirectoryW); - LOOKUP(RemoveDirectoryW); - LOOKUP(CreateFileW); - LOOKUP(DeleteFileW); + LOOKUP_NOFALLBACK(GetFileAttributesExA, 1); + LOOKUP_NOFALLBACK(GetFileAttributesExW, osHasUnicode); + LOOKUP_NOFALLBACK(FindFirstFileW, osHasUnicode); + LOOKUP_NOFALLBACK(FindNextFileW, osHasUnicode); + LOOKUP(GetModuleFileNameW, osHasUnicode); + LOOKUP(FormatMessageW, osHasUnicode); + LOOKUP(GetFileAttributesW, osHasUnicode); + LOOKUP(GetCurrentDirectoryW, osHasUnicode); + LOOKUP(CreateDirectoryW, osHasUnicode); + LOOKUP(RemoveDirectoryW, osHasUnicode); + LOOKUP(CreateFileW, osHasUnicode); + LOOKUP(DeleteFileW, osHasUnicode); } /* if */ #undef LOOKUP_NOFALLBACK @@ -873,8 +884,24 @@ } /* __PHYSFS_platformMkDir */ + /* + * Get OS info and save the important parts. + * + * Returns non-zero if successful, otherwise it returns zero on failure. + */ + static int getOSInfo(void) + { + OSVERSIONINFO osVerInfo; /* Information about the OS */ + osVerInfo.dwOSVersionInfoSize = sizeof(osVerInfo); + BAIL_IF_MACRO(!GetVersionEx(&osVerInfo), winApiStrError(), 0); + osHasUnicode = (osVerInfo.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS); + return(1); + } /* getOSInfo */ + + int __PHYSFS_platformInit(void) { + BAIL_IF_MACRO(!getOSInfo(), NULL, 0); BAIL_IF_MACRO(!findApiSymbols(), NULL, 0); BAIL_IF_MACRO(!determineUserDir(), NULL, 0); return(1); /* It's all good */ From DONOTREPLY at icculus.org Mon Mar 26 03:53:48 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 26 Mar 2007 03:53:48 -0400 Subject: r877 - in trunk: . test Message-ID: <20070326075348.24693.qmail@icculus.org> Author: icculus Date: 2007-03-26 03:53:43 -0400 (Mon, 26 Mar 2007) New Revision: 877 Modified: trunk/physfs.h trunk/test/test_physfs.c Log: Bumped version numbers. Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-03-26 07:51:57 UTC (rev 876) +++ trunk/physfs.h 2007-03-26 07:53:43 UTC (rev 877) @@ -401,7 +401,7 @@ #ifndef DOXYGEN_SHOULD_IGNORE_THIS #define PHYSFS_VER_MAJOR 1 #define PHYSFS_VER_MINOR 1 -#define PHYSFS_VER_PATCH 0 +#define PHYSFS_VER_PATCH 1 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ Modified: trunk/test/test_physfs.c =================================================================== --- trunk/test/test_physfs.c 2007-03-26 07:51:57 UTC (rev 876) +++ trunk/test/test_physfs.c 2007-03-26 07:53:43 UTC (rev 877) @@ -27,7 +27,7 @@ #define TEST_VERSION_MAJOR 1 #define TEST_VERSION_MINOR 1 -#define TEST_VERSION_PATCH 0 +#define TEST_VERSION_PATCH 1 static FILE *history_file = NULL; static PHYSFS_uint32 do_buffer_size = 0; From DONOTREPLY at icculus.org Wed Mar 28 13:29:53 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 28 Mar 2007 13:29:53 -0400 Subject: r878 - in trunk: . archivers Message-ID: <20070328172953.9459.qmail@icculus.org> Author: icculus Date: 2007-03-28 13:29:52 -0400 (Wed, 28 Mar 2007) New Revision: 878 Modified: trunk/CHANGELOG.txt trunk/archivers/grp.c trunk/archivers/hog.c trunk/archivers/mvl.c Log: Logic bug in MVL/HOG/GRP archivers: these archives never contain subdirs...but they only enumerated their files when looking in a directory other than the root, instead of enumerating only for the root. Thanks to Chris Taylor for the catch. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-26 07:53:43 UTC (rev 877) +++ trunk/CHANGELOG.txt 2007-03-28 17:29:52 UTC (rev 878) @@ -2,6 +2,9 @@ * CHANGELOG. */ +03282007 - Logic bug in MVL/HOG/GRP archivers: only enumerated files when + looking in a directory other than the root, instead of enumerating + only for the root (thanks, Chris!). 03262007 - Tons of Unicode work in windows.c ... should now use UCS-2 on NT/XP/Vista/etc versions of the OS, and fallback to "ANSI" versions for 95/98/ME, tapdancing around the system codepage if it has to. Modified: trunk/archivers/grp.c =================================================================== --- trunk/archivers/grp.c 2007-03-26 07:53:43 UTC (rev 877) +++ trunk/archivers/grp.c 2007-03-28 17:29:52 UTC (rev 878) @@ -295,7 +295,7 @@ const char *origdir, void *callbackdata) { /* no directories in GRP files. */ - if (*dname != '\0') + if (*dname == '\0') { GRPinfo *info = (GRPinfo *) opaque; GRPentry *entry = info->entries; Modified: trunk/archivers/hog.c =================================================================== --- trunk/archivers/hog.c 2007-03-26 07:53:43 UTC (rev 877) +++ trunk/archivers/hog.c 2007-03-28 17:29:52 UTC (rev 878) @@ -334,7 +334,7 @@ const char *origdir, void *callbackdata) { /* no directories in HOG files. */ - if (*dname != '\0') + if (*dname == '\0') { HOGinfo *info = (HOGinfo *) opaque; HOGentry *entry = info->entries; Modified: trunk/archivers/mvl.c =================================================================== --- trunk/archivers/mvl.c 2007-03-26 07:53:43 UTC (rev 877) +++ trunk/archivers/mvl.c 2007-03-28 17:29:52 UTC (rev 878) @@ -291,7 +291,7 @@ const char *origdir, void *callbackdata) { /* no directories in MVL files. */ - if (*dname != '\0') + if (*dname == '\0') { MVLinfo *info = ((MVLinfo *) opaque); MVLentry *entry = info->entries; From DONOTREPLY at icculus.org Thu Mar 29 01:39:16 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 29 Mar 2007 01:39:16 -0400 Subject: r879 - in trunk: . platform Message-ID: <20070329053916.1858.qmail@icculus.org> Author: icculus Date: 2007-03-29 01:39:16 -0400 (Thu, 29 Mar 2007) New Revision: 879 Modified: trunk/CHANGELOG.txt trunk/CREDITS.txt trunk/physfs.c trunk/platform/macosx.c Log: Don't put comments in BAIL_* macros where we want an empty argument... apparently it aggravates some compilers. Thanks to Chris Taylor for this one. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-28 17:29:52 UTC (rev 878) +++ trunk/CHANGELOG.txt 2007-03-29 05:39:16 UTC (rev 879) @@ -4,7 +4,9 @@ 03282007 - Logic bug in MVL/HOG/GRP archivers: only enumerated files when looking in a directory other than the root, instead of enumerating - only for the root (thanks, Chris!). + only for the root (thanks, Chris!). Minor fix for compilers that + don't like the BAIL_* macros with an empty argument + (thanks, Chris!) 03262007 - Tons of Unicode work in windows.c ... should now use UCS-2 on NT/XP/Vista/etc versions of the OS, and fallback to "ANSI" versions for 95/98/ME, tapdancing around the system codepage if it has to. Modified: trunk/CREDITS.txt =================================================================== --- trunk/CREDITS.txt 2007-03-28 17:29:52 UTC (rev 878) +++ trunk/CREDITS.txt 2007-03-29 05:39:16 UTC (rev 879) @@ -70,7 +70,8 @@ Pedro J. P?rez MacOS Classic fixes, -MPW support: +MPW support, +bug fixes: Chris Taylor Mingw support, Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-28 17:29:52 UTC (rev 878) +++ trunk/physfs.c 2007-03-29 05:39:16 UTC (rev 879) @@ -1567,12 +1567,12 @@ size_t len; char *fname; - BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, /*0*/); - BAIL_IF_MACRO(callback == NULL, ERR_INVALID_ARGUMENT, /*0*/); + BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, ) /*0*/; + BAIL_IF_MACRO(callback == NULL, ERR_INVALID_ARGUMENT, ) /*0*/; len = strlen(_fname) + 1; fname = (char *) __PHYSFS_smallAlloc(len); - BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, /*0*/); + BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, ) /*0*/; if (sanitizePlatformIndependentPath(_fname, fname)) { Modified: trunk/platform/macosx.c =================================================================== --- trunk/platform/macosx.c 2007-03-28 17:29:52 UTC (rev 878) +++ trunk/platform/macosx.c 2007-03-29 05:39:16 UTC (rev 879) @@ -170,7 +170,7 @@ int i, mounts; if (IOMasterPort(MACH_PORT_NULL, &masterPort) != KERN_SUCCESS) - BAIL_MACRO(ERR_OS_ERROR, /*return void*/); + BAIL_MACRO(ERR_OS_ERROR, ) /*return void*/; mounts = getmntinfo(&mntbufp, MNT_WAIT); /* NOT THREAD SAFE! */ for (i = 0; i < mounts; i++) From DONOTREPLY at icculus.org Sat Mar 31 02:34:51 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 31 Mar 2007 02:34:51 -0400 Subject: r880 - in trunk: . extras Message-ID: <20070331063451.884.qmail@icculus.org> Author: icculus Date: 2007-03-31 02:34:51 -0400 (Sat, 31 Mar 2007) New Revision: 880 Added: trunk/extras/physfsunpack.c Modified: trunk/CHANGELOG.txt Log: Added a simple unpacker example. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-29 05:39:16 UTC (rev 879) +++ trunk/CHANGELOG.txt 2007-03-31 06:34:51 UTC (rev 880) @@ -2,6 +2,7 @@ * CHANGELOG. */ +03312007 - Added a quick'n'dirty unpack utility to the extras directory. 03282007 - Logic bug in MVL/HOG/GRP archivers: only enumerated files when looking in a directory other than the root, instead of enumerating only for the root (thanks, Chris!). Minor fix for compilers that Added: trunk/extras/physfsunpack.c =================================================================== --- trunk/extras/physfsunpack.c (rev 0) +++ trunk/extras/physfsunpack.c 2007-03-31 06:34:51 UTC (rev 880) @@ -0,0 +1,181 @@ +#include +#include +#include +#include + +#include "physfs.h" + + +static int failure = 0; + +static void modTimeToStr(PHYSFS_sint64 modtime, char *modstr, size_t strsize) +{ + const char *str = "unknown modtime"; + if (modtime != -1) + { + time_t t = (time_t) modtime; + str = ctime(&t); + } /* if */ + + strncpy(modstr, str, strsize); + modstr[strsize-1] = '\0'; + strsize = strlen(modstr); + while ((modstr[strsize-1] == '\n') || (modstr[strsize-1] == '\r')) + modstr[--strsize] = '\0'; +} /* modTimeToStr */ + + +static void fail(const char *what, const char *why) +{ + if (why == NULL) + why = PHYSFS_getLastError(); + fprintf(stderr, "%s failed: %s\n", what, why); + failure = 1; +} /* fail */ + + +static void dumpFile(const char *fname) +{ + const int origfailure = failure; + PHYSFS_File *out = NULL; + PHYSFS_File *in = NULL; + + failure = 0; + + if ((in = PHYSFS_openRead(fname)) == NULL) + fail("\nPHYSFS_openRead", NULL); + else if ((out = PHYSFS_openWrite(fname)) == NULL) + fail("\nPHYSFS_openWrite", NULL); + else + { + char modstr[64]; + PHYSFS_sint64 size = PHYSFS_fileLength(in); + + printf("("); + if (size == -1) + printf("?"); + else + printf("%lld", (long long) size); + printf(" bytes"); + + modTimeToStr(PHYSFS_getLastModTime(fname), modstr, sizeof (modstr)); + printf(", %s)\n", modstr); + + while ( (!failure) && (!PHYSFS_eof(in)) ) + { + static char buf[64 * 1024]; + PHYSFS_sint64 br = PHYSFS_read(in, buf, 1, sizeof (buf)); + if (br == -1) + fail("PHYSFS_read", NULL); + else + { + PHYSFS_sint64 bw = PHYSFS_write(out, buf, 1, br); + if (bw != br) + fail("PHYSFS_write", NULL); + else + size -= bw; + } /* else */ + } /* while */ + + if ((!failure) && (size != 0)) + fail("PHYSFS_eof", "BUG! eof != PHYSFS_fileLength bytes!"); + } /* else */ + + if (in != NULL) + PHYSFS_close(in); + + if (out != NULL) + { + if (!PHYSFS_close(out)) + fail("PHYSFS_close", NULL); + } /* if */ + + if (failure) + PHYSFS_delete(fname); + else + failure = origfailure; +} /* dumpFile */ + + +static void unpackCallback(void *_depth, const char *origdir, const char *str) +{ + int depth = *((int *) _depth); + const int len = strlen(origdir) + strlen(str) + 2; + char *fname = (char *) malloc(len); + if (fname == NULL) + fail("malloc", "Out of memory!"); + else + { + if (strcmp(origdir, "/") == 0) + origdir = ""; + + snprintf(fname, len, "%s/%s", origdir, str); + + printf("%s ", fname); + if (PHYSFS_isDirectory(fname)) + { + depth++; + printf("(directory)\n"); + if (!PHYSFS_mkdir(fname)) + fail("PHYSFS_mkdir", NULL); + else + PHYSFS_enumerateFilesCallback(fname, unpackCallback, &depth); + } /* if */ + + else if (PHYSFS_isSymbolicLink(fname)) + { + printf("(symlink)\n"); + /* !!! FIXME: ? if (!symlink(fname, */ + } /* else if */ + + else /* ...file. */ + { + dumpFile(fname); + } /* else */ + + free(fname); + } /* else */ +} /* unpackCallback */ + + +int main(int argc, char **argv) +{ + int zero = 0; + + if (argc != 3) + { + fprintf(stderr, "USAGE: %s \n", argv[0]); + return 1; + } /* if */ + + if (!PHYSFS_init(argv[0])) + { + fprintf(stderr, "PHYSFS_init() failed: %s\n", PHYSFS_getLastError()); + return 2; + } /* if */ + + if (!PHYSFS_setWriteDir(argv[2])) + { + fprintf(stderr, "PHYSFS_setWriteDir('%s') failed: %s\n", + argv[2], PHYSFS_getLastError()); + return 3; + } /* if */ + + if (!PHYSFS_mount(argv[1], NULL, 1)) + { + fprintf(stderr, "PHYSFS_mount('%s') failed: %s\n", + argv[1], PHYSFS_getLastError()); + return 4; + } /* if */ + + PHYSFS_permitSymbolicLinks(1); + PHYSFS_enumerateFilesCallback("/", unpackCallback, &zero); + PHYSFS_deinit(); + if (failure) + return 5; + + return 0; +} /* main */ + +/* end of physfsunpack.c ... */ + From DONOTREPLY at icculus.org Sat Mar 31 02:52:27 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 31 Mar 2007 02:52:27 -0400 Subject: r881 - trunk Message-ID: <20070331065227.8227.qmail@icculus.org> Author: icculus Date: 2007-03-31 02:52:27 -0400 (Sat, 31 Mar 2007) New Revision: 881 Modified: trunk/CHANGELOG.txt trunk/physfs.c Log: Try the DIR archiver first, since there's no sense in trying to open a directory as a file in all the other archivers first. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-31 06:34:51 UTC (rev 880) +++ trunk/CHANGELOG.txt 2007-03-31 06:52:27 UTC (rev 881) @@ -2,7 +2,10 @@ * CHANGELOG. */ -03312007 - Added a quick'n'dirty unpack utility to the extras directory. +03312007 - Added a quick'n'dirty unpack utility to the extras directory. Moved + DIR archiver to start of the list, so we don't have to have every + other archiver fail to open a directory as a file before mounting + it. 03282007 - Logic bug in MVL/HOG/GRP archivers: only enumerated files when looking in a directory other than the root, instead of enumerating only for the root (thanks, Chris!). Minor fix for compilers that Modified: trunk/physfs.c =================================================================== --- trunk/physfs.c 2007-03-31 06:34:51 UTC (rev 880) +++ trunk/physfs.c 2007-03-31 06:52:27 UTC (rev 881) @@ -96,6 +96,7 @@ static const PHYSFS_Archiver *archivers[] = { + &__PHYSFS_Archiver_DIR, #if (defined PHYSFS_SUPPORTS_ZIP) &__PHYSFS_Archiver_ZIP, #endif @@ -117,7 +118,6 @@ #if (defined PHYSFS_SUPPORTS_WAD) &__PHYSFS_Archiver_WAD, #endif - &__PHYSFS_Archiver_DIR, NULL }; From DONOTREPLY at icculus.org Sat Mar 31 02:56:15 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 31 Mar 2007 02:56:15 -0400 Subject: r882 - branches/stable-1.0 Message-ID: <20070331065615.9945.qmail@icculus.org> Author: icculus Date: 2007-03-31 02:56:15 -0400 (Sat, 31 Mar 2007) New Revision: 882 Modified: branches/stable-1.0/CHANGELOG branches/stable-1.0/physfs.c Log: Backport of r880:881 from trunk: try DIR archiver first. Modified: branches/stable-1.0/CHANGELOG =================================================================== --- branches/stable-1.0/CHANGELOG 2007-03-31 06:52:27 UTC (rev 881) +++ branches/stable-1.0/CHANGELOG 2007-03-31 06:56:15 UTC (rev 882) @@ -4,6 +4,9 @@ -- stuff in the stable-1.0 branch, backported from 2.0.0 dev branch, etc --- +03312007 - Moved DIR archiver to start of the list, so we don't have to have + every other archiver fail to open a directory as a file before + adding it to the search path. 03262007 - Fixed minor cosmetic issue in Windows error messages where it would leave whitespace and newlines at the end of the string. 09232006 - Fixed typo in doxygen comment. Modified: branches/stable-1.0/physfs.c =================================================================== --- branches/stable-1.0/physfs.c 2007-03-31 06:52:27 UTC (rev 881) +++ branches/stable-1.0/physfs.c 2007-03-31 06:56:15 UTC (rev 882) @@ -108,12 +108,13 @@ &__PHYSFS_ArchiveInfo_WAD, #endif - NULL }; static const DirFunctions *dirFunctions[] = { + &__PHYSFS_DirFunctions_DIR, + #if (defined PHYSFS_SUPPORTS_ZIP) &__PHYSFS_DirFunctions_ZIP, #endif @@ -138,7 +139,6 @@ &__PHYSFS_DirFunctions_WAD, #endif - &__PHYSFS_DirFunctions_DIR, NULL }; From DONOTREPLY at icculus.org Sat Mar 31 02:58:38 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 31 Mar 2007 02:58:38 -0400 Subject: r883 - trunk Message-ID: <20070331065838.10966.qmail@icculus.org> Author: icculus Date: 2007-03-31 02:58:38 -0400 (Sat, 31 Mar 2007) New Revision: 883 Modified: trunk/makeos2.cmd Log: Fixed typos in export names. Modified: trunk/makeos2.cmd =================================================================== --- trunk/makeos2.cmd 2007-03-31 06:56:15 UTC (rev 882) +++ trunk/makeos2.cmd 2007-03-31 06:58:38 UTC (rev 883) @@ -112,11 +112,11 @@ @echo "_PHYSFS_getCdRomDirsCallback" >> bin\physfs.def @echo "_PHYSFS_getSearchPathCallback" >> bin\physfs.def @echo "_PHYSFS_enumerateFilesCallback" >> bin\physfs.def - at echo "_PHYSFS_utf8toucs2" >> bin\physfs.def - at echo "_PHYSFS_utf8fromucs2" >> bin\physfs.def - at echo "_PHYSFS_utf8toucs4" >> bin\physfs.def - at echo "_PHYSFS_utf8fromucs4" >> bin\physfs.def - at echo "_PHYSFS_utf8fromlatin1" >> bin\physfs.def + at echo "_PHYSFS_utf8ToUcs2" >> bin\physfs.def + at echo "_PHYSFS_utf8FromUcs2" >> bin\physfs.def + at echo "_PHYSFS_utf8ToUcs4" >> bin\physfs.def + at echo "_PHYSFS_utf8FromUcs4" >> bin\physfs.def + at echo "_PHYSFS_utf8FromLatin1" >> bin\physfs.def @echo Building export library... emximp -o bin/physfs.lib bin/physfs.def From DONOTREPLY at icculus.org Sat Mar 31 02:58:55 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 31 Mar 2007 02:58:55 -0400 Subject: r884 - trunk Message-ID: <20070331065855.11090.qmail@icculus.org> Author: icculus Date: 2007-03-31 02:58:55 -0400 (Sat, 31 Mar 2007) New Revision: 884 Modified: trunk/physfs.h Log: Fixed typo in documentation. Modified: trunk/physfs.h =================================================================== --- trunk/physfs.h 2007-03-31 06:58:38 UTC (rev 883) +++ trunk/physfs.h 2007-03-31 06:58:55 UTC (rev 884) @@ -2159,7 +2159,7 @@ * * To ensure that the destination buffer is large enough for the conversion, * please allocate a buffer that is double the size of the source buffer. - * UTF-8 expands latin1 codepoints over 127 from to 2 bytes, so the string + * UTF-8 expands latin1 codepoints over 127 from 1 to 2 bytes, so the string * may grow in some cases. * * Strings that don't fit in the destination buffer will be truncated, but From DONOTREPLY at icculus.org Sat Mar 31 02:59:02 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 31 Mar 2007 02:59:02 -0400 Subject: r885 - trunk Message-ID: <20070331065902.11187.qmail@icculus.org> Author: icculus Date: 2007-03-31 02:59:02 -0400 (Sat, 31 Mar 2007) New Revision: 885 Modified: trunk/CHANGELOG.txt Log: Updated. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-31 06:58:55 UTC (rev 884) +++ trunk/CHANGELOG.txt 2007-03-31 06:59:02 UTC (rev 885) @@ -5,7 +5,7 @@ 03312007 - Added a quick'n'dirty unpack utility to the extras directory. Moved DIR archiver to start of the list, so we don't have to have every other archiver fail to open a directory as a file before mounting - it. + it. Fixed typos in makeos2.cmd and the Doxygen comments. 03282007 - Logic bug in MVL/HOG/GRP archivers: only enumerated files when looking in a directory other than the root, instead of enumerating only for the root (thanks, Chris!). Minor fix for compilers that From DONOTREPLY at icculus.org Sat Mar 31 19:44:42 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 31 Mar 2007 19:44:42 -0400 Subject: r886 - in trunk: . platform Message-ID: <20070331234442.2617.qmail@icculus.org> Author: icculus Date: 2007-03-31 19:44:42 -0400 (Sat, 31 Mar 2007) New Revision: 886 Modified: trunk/CHANGELOG.txt trunk/platform/windows.c Log: Symlink support for Windows Vista. Untested code. Modified: trunk/CHANGELOG.txt =================================================================== --- trunk/CHANGELOG.txt 2007-03-31 06:59:02 UTC (rev 885) +++ trunk/CHANGELOG.txt 2007-03-31 23:44:42 UTC (rev 886) @@ -5,7 +5,8 @@ 03312007 - Added a quick'n'dirty unpack utility to the extras directory. Moved DIR archiver to start of the list, so we don't have to have every other archiver fail to open a directory as a file before mounting - it. Fixed typos in makeos2.cmd and the Doxygen comments. + it. Fixed typos in makeos2.cmd and the Doxygen comments. Added + symlink support to windows.c for use on Vista-based systems. 03282007 - Logic bug in MVL/HOG/GRP archivers: only enumerated files when looking in a directory other than the root, instead of enumerating only for the root (thanks, Chris!). Minor fix for compilers that Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-31 06:59:02 UTC (rev 885) +++ trunk/platform/windows.c 2007-03-31 23:44:42 UTC (rev 886) @@ -578,10 +578,43 @@ } /* __PHYSFS_platformExists */ +static int isSymlinkAttrs(DWORD attr, DWORD tag) +{ + return ( (attr & FILE_ATTRIBUTE_REPARSE_POINT) && + ((tag & IO_REPARSE_TAG_SYMLINK) == IO_REPARSE_TAG_SYMLINK) ); +} /* isSymlinkAttrs */ + + int __PHYSFS_platformIsSymLink(const char *fname) { - /* !!! FIXME: Vista has symlinks. Recheck this. */ - return(0); /* no symlinks on win32. */ + /* !!! FIXME: + * Windows Vista can have NTFS symlinks. Can older Windows releases have + * them when talking to a network file server? What happens when you + * mount a NTFS partition on XP that was plugged into a Vista install + * that made a symlink? + */ + + int retval = 0; + LPWSTR wpath; + HANDLE dir; + WIN32_FIND_DATAW entw; + + /* no unicode entry points? Probably no symlinks. */ + BAIL_IF_MACRO(pFindFirstFileW == NULL, NULL, 0); + + UTF8_TO_UNICODE_STACK_MACRO(wpath, fname); + BAIL_IF_MACRO(wpath == NULL, ERR_OUT_OF_MEMORY, 0); + + /* !!! FIXME: filter wildcard chars? */ + dir = pFindFirstFileW(wpath, &entw); + if (dir != INVALID_HANDLE_VALUE) + { + retval = isSymlinkAttrs(entw.dwFileAttributes, entw.dwReserved0); + FindClose(dir); + } /* if */ + + __PHYSFS_smallFree(wpath); + return(retval); } /* __PHYSFS_platformIsSymlink */ @@ -686,13 +719,17 @@ { do { + const DWORD attrs = entw.dwFileAttributes; + const DWORD tag = entw.dwReserved0; const WCHAR *fn = entw.cFileName; if ((fn[0] == '.') && (fn[1] == '\0')) continue; if ((fn[0] == '.') && (fn[1] == '.') && (fn[2] == '\0')) continue; + if ((omitSymLinks) && (isSymlinkAttrs(attr, tag))) + continue; - utf8 = unicodeToUtf8Heap(entw.cFileName); + utf8 = unicodeToUtf8Heap(fn); if (utf8 != NULL) { callback(callbackdata, origdir, utf8); @@ -705,13 +742,17 @@ { do { + const DWORD attrs = ent.dwFileAttributes; + const DWORD tag = ent.dwReserved0; const char *fn = ent.cFileName; if ((fn[0] == '.') && (fn[1] == '\0')) continue; if ((fn[0] == '.') && (fn[1] == '.') && (fn[2] == '\0')) continue; + if ((omitSymLinks) && (isSymlinkAttrs(attr, tag))) + continue; - utf8 = codepageToUtf8Heap(ent.cFileName); + utf8 = codepageToUtf8Heap(fn); if (utf8 != NULL) { callback(callbackdata, origdir, utf8); From DONOTREPLY at icculus.org Sat Mar 31 23:04:20 2007 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 31 Mar 2007 23:04:20 -0400 Subject: r887 - trunk/platform Message-ID: <20070401030420.14265.qmail@icculus.org> Author: icculus Date: 2007-03-31 23:04:20 -0400 (Sat, 31 Mar 2007) New Revision: 887 Modified: trunk/platform/windows.c Log: Patched to compile, and work with pre-Vista versions of the Platform SDK. Modified: trunk/platform/windows.c =================================================================== --- trunk/platform/windows.c 2007-03-31 23:44:42 UTC (rev 886) +++ trunk/platform/windows.c 2007-04-01 03:04:20 UTC (rev 887) @@ -41,6 +41,10 @@ /* just in case... */ #define PHYSFS_INVALID_FILE_ATTRIBUTES 0xFFFFFFFF +/* Not defined before the Vista SDK. */ +#define PHYSFS_IO_REPARSE_TAG_SYMLINK 0xA000000C + + #define UTF8_TO_UNICODE_STACK_MACRO(w_assignto, str) { \ if (str == NULL) \ w_assignto = NULL; \ @@ -578,10 +582,10 @@ } /* __PHYSFS_platformExists */ -static int isSymlinkAttrs(DWORD attr, DWORD tag) +static int isSymlinkAttrs(const DWORD attr, const DWORD tag) { - return ( (attr & FILE_ATTRIBUTE_REPARSE_POINT) && - ((tag & IO_REPARSE_TAG_SYMLINK) == IO_REPARSE_TAG_SYMLINK) ); + return ( (attr & FILE_ATTRIBUTE_REPARSE_POINT) && + (tag == PHYSFS_IO_REPARSE_TAG_SYMLINK) ); } /* isSymlinkAttrs */ @@ -719,7 +723,7 @@ { do { - const DWORD attrs = entw.dwFileAttributes; + const DWORD attr = entw.dwFileAttributes; const DWORD tag = entw.dwReserved0; const WCHAR *fn = entw.cFileName; if ((fn[0] == '.') && (fn[1] == '\0')) @@ -742,7 +746,7 @@ { do { - const DWORD attrs = ent.dwFileAttributes; + const DWORD attr = ent.dwFileAttributes; const DWORD tag = ent.dwReserved0; const char *fn = ent.cFileName; if ((fn[0] == '.') && (fn[1] == '\0'))