698 #error Please define PHYSFS_LANG. |
698 #error Please define PHYSFS_LANG. |
699 #endif |
699 #endif |
700 |
700 |
701 /* end LANG section. */ |
701 /* end LANG section. */ |
702 |
702 |
703 |
|
704 struct __PHYSFS_DIRHANDLE__; |
703 struct __PHYSFS_DIRHANDLE__; |
705 struct __PHYSFS_FILEFUNCTIONS__; |
704 struct __PHYSFS_FILEFUNCTIONS__; |
706 |
705 |
707 |
706 |
708 typedef struct __PHYSFS_LINKEDSTRINGLIST__ |
707 typedef struct __PHYSFS_LINKEDSTRINGLIST__ |
980 LinkedStringList **prev, |
979 LinkedStringList **prev, |
981 const char *str, |
980 const char *str, |
982 PHYSFS_sint32 len); |
981 PHYSFS_sint32 len); |
983 |
982 |
984 |
983 |
|
984 /* |
|
985 * When sorting the entries in an archive, we use a modified QuickSort. |
|
986 * When there are less then PHYSFS_QUICKSORT_THRESHOLD entries left to sort, |
|
987 * we switch over to a BubbleSort for the remainder. Tweak to taste. |
|
988 * |
|
989 * You can override this setting by defining PHYSFS_QUICKSORT_THRESHOLD |
|
990 * before #including "physfs_internal.h". |
|
991 */ |
|
992 #ifndef PHYSFS_QUICKSORT_THRESHOLD |
|
993 #define PHYSFS_QUICKSORT_THRESHOLD 4 |
|
994 #endif |
|
995 |
|
996 /* |
|
997 * Sort an array (or whatever) of (max) elements. This uses a mixture of |
|
998 * a QuickSort and BubbleSort internally. |
|
999 * (cmpfn) is used to determine ordering, and (swapfn) does the actual |
|
1000 * swapping of elements in the list. |
|
1001 * |
|
1002 * See zip.c for an example. |
|
1003 */ |
|
1004 void __PHYSFS_sort(void *entries, PHYSFS_uint32 max, |
|
1005 int (*cmpfn)(void *, PHYSFS_uint32, PHYSFS_uint32), |
|
1006 void (*swapfn)(void *, PHYSFS_uint32, PHYSFS_uint32)); |
|
1007 |
985 |
1008 |
986 /* These get used all over for lessening code clutter. */ |
1009 /* These get used all over for lessening code clutter. */ |
987 #define BAIL_MACRO(e, r) { __PHYSFS_setError(e); return r; } |
1010 #define BAIL_MACRO(e, r) { __PHYSFS_setError(e); return r; } |
988 #define BAIL_IF_MACRO(c, e, r) if (c) { __PHYSFS_setError(e); return r; } |
1011 #define BAIL_IF_MACRO(c, e, r) if (c) { __PHYSFS_setError(e); return r; } |
989 #define BAIL_MACRO_MUTEX(e, m, r) { __PHYSFS_setError(e); __PHYSFS_platformReleaseMutex(m); return r; } |
1012 #define BAIL_MACRO_MUTEX(e, m, r) { __PHYSFS_setError(e); __PHYSFS_platformReleaseMutex(m); return r; } |