author | Ryan C. Gordon <icculus@icculus.org> |
Mon, 13 Jun 2005 01:16:13 +0000 | |
branch | stable-1.0 |
changeset 708 | cd874220351e |
parent 704 | f3c79a07201f |
permissions | -rw-r--r-- |
177 | 1 |
/** |
2 |
* PhysicsFS; a portable, flexible file i/o abstraction. |
|
3 |
* |
|
4 |
* Documentation is in physfs.h. It's verbose, honest. :) |
|
5 |
* |
|
6 |
* Please see the file LICENSE in the source's root directory. |
|
7 |
* |
|
8 |
* This file written by Ryan C. Gordon. |
|
9 |
*/ |
|
10 |
||
214
19846c18071b
Initial autoconf support.
Ryan C. Gordon <icculus@icculus.org>
parents:
201
diff
changeset
|
11 |
#if HAVE_CONFIG_H |
19846c18071b
Initial autoconf support.
Ryan C. Gordon <icculus@icculus.org>
parents:
201
diff
changeset
|
12 |
# include <config.h> |
19846c18071b
Initial autoconf support.
Ryan C. Gordon <icculus@icculus.org>
parents:
201
diff
changeset
|
13 |
#endif |
19846c18071b
Initial autoconf support.
Ryan C. Gordon <icculus@icculus.org>
parents:
201
diff
changeset
|
14 |
|
177 | 15 |
#include <stdio.h> |
16 |
#include <stdlib.h> |
|
321
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
17 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
18 |
#define __PHYSICSFS_INTERNAL__ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
19 |
#include "physfs_internal.h" |
177 | 20 |
|
21 |
/* This byteorder stuff was lifted from SDL. http://www.libsdl.org/ */ |
|
22 |
#define PHYSFS_LIL_ENDIAN 1234 |
|
23 |
#define PHYSFS_BIG_ENDIAN 4321 |
|
24 |
||
25 |
#if defined(__i386__) || defined(__ia64__) || defined(WIN32) || \ |
|
26 |
(defined(__alpha__) || defined(__alpha)) || \ |
|
566
1e640d4acab9
PocketPC fixes (thanks, David Hedbor!)
Ryan C. Gordon <icculus@icculus.org>
parents:
504
diff
changeset
|
27 |
defined(__arm__) || defined(ARM) || \ |
177 | 28 |
(defined(__mips__) && defined(__MIPSEL__)) || \ |
29 |
defined(__SYMBIAN32__) || \ |
|
497
40cc2b2f3a09
Added check for AMD's x86-64 ("Hammer") architecture.
Ryan C. Gordon <icculus@icculus.org>
parents:
321
diff
changeset
|
30 |
defined(__x86_64__) || \ |
177 | 31 |
defined(__LITTLE_ENDIAN__) |
32 |
#define PHYSFS_BYTEORDER PHYSFS_LIL_ENDIAN |
|
33 |
#else |
|
34 |
#define PHYSFS_BYTEORDER PHYSFS_BIG_ENDIAN |
|
35 |
#endif |
|
36 |
||
37 |
||
38 |
/* The macros used to swap values */ |
|
39 |
/* Try to use superfast macros on systems that support them */ |
|
40 |
#ifdef linux |
|
41 |
#include <asm/byteorder.h> |
|
42 |
#ifdef __arch__swab16 |
|
43 |
#define PHYSFS_Swap16 __arch__swab16 |
|
44 |
#endif |
|
45 |
#ifdef __arch__swab32 |
|
46 |
#define PHYSFS_Swap32 __arch__swab32 |
|
47 |
#endif |
|
48 |
#endif /* linux */ |
|
201
7ea2ae5d1a6c
Patched to stop -ansi bitching.
Ryan C. Gordon <icculus@icculus.org>
parents:
194
diff
changeset
|
49 |
|
704
f3c79a07201f
MacOS Classic fixes, MPW support, and removal of SITX for SIT (no SITX support
Ryan C. Gordon <icculus@icculus.org>
parents:
578
diff
changeset
|
50 |
#if (defined macintosh) && !(defined __MWERKS__) |
f3c79a07201f
MacOS Classic fixes, MPW support, and removal of SITX for SIT (no SITX support
Ryan C. Gordon <icculus@icculus.org>
parents:
578
diff
changeset
|
51 |
#define __inline__ |
f3c79a07201f
MacOS Classic fixes, MPW support, and removal of SITX for SIT (no SITX support
Ryan C. Gordon <icculus@icculus.org>
parents:
578
diff
changeset
|
52 |
#endif |
f3c79a07201f
MacOS Classic fixes, MPW support, and removal of SITX for SIT (no SITX support
Ryan C. Gordon <icculus@icculus.org>
parents:
578
diff
changeset
|
53 |
|
201
7ea2ae5d1a6c
Patched to stop -ansi bitching.
Ryan C. Gordon <icculus@icculus.org>
parents:
194
diff
changeset
|
54 |
#if (defined _MSC_VER) |
7ea2ae5d1a6c
Patched to stop -ansi bitching.
Ryan C. Gordon <icculus@icculus.org>
parents:
194
diff
changeset
|
55 |
#define __inline__ __inline |
7ea2ae5d1a6c
Patched to stop -ansi bitching.
Ryan C. Gordon <icculus@icculus.org>
parents:
194
diff
changeset
|
56 |
#endif |
7ea2ae5d1a6c
Patched to stop -ansi bitching.
Ryan C. Gordon <icculus@icculus.org>
parents:
194
diff
changeset
|
57 |
|
177 | 58 |
#ifndef PHYSFS_Swap16 |
201
7ea2ae5d1a6c
Patched to stop -ansi bitching.
Ryan C. Gordon <icculus@icculus.org>
parents:
194
diff
changeset
|
59 |
static __inline__ PHYSFS_uint16 PHYSFS_Swap16(PHYSFS_uint16 D) |
177 | 60 |
{ |
578
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
61 |
return((D<<8)|(D>>8)); |
177 | 62 |
} |
63 |
#endif |
|
64 |
#ifndef PHYSFS_Swap32 |
|
201
7ea2ae5d1a6c
Patched to stop -ansi bitching.
Ryan C. Gordon <icculus@icculus.org>
parents:
194
diff
changeset
|
65 |
static __inline__ PHYSFS_uint32 PHYSFS_Swap32(PHYSFS_uint32 D) |
177 | 66 |
{ |
578
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
67 |
return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24)); |
177 | 68 |
} |
69 |
#endif |
|
70 |
#ifndef PHYSFS_NO_64BIT_SUPPORT |
|
71 |
#ifndef PHYSFS_Swap64 |
|
201
7ea2ae5d1a6c
Patched to stop -ansi bitching.
Ryan C. Gordon <icculus@icculus.org>
parents:
194
diff
changeset
|
72 |
static __inline__ PHYSFS_uint64 PHYSFS_Swap64(PHYSFS_uint64 val) { |
578
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
73 |
PHYSFS_uint32 hi, lo; |
177 | 74 |
|
578
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
75 |
/* Separate into high and low 32-bit values and swap them */ |
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
76 |
lo = (PHYSFS_uint32)(val&0xFFFFFFFF); |
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
77 |
val >>= 32; |
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
78 |
hi = (PHYSFS_uint32)(val&0xFFFFFFFF); |
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
79 |
val = PHYSFS_Swap32(lo); |
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
80 |
val <<= 32; |
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
81 |
val |= PHYSFS_Swap32(hi); |
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
82 |
return(val); |
177 | 83 |
} |
84 |
#endif |
|
85 |
#else |
|
86 |
#ifndef PHYSFS_Swap64 |
|
87 |
/* This is mainly to keep compilers from complaining in PHYSFS code. |
|
88 |
If there is no real 64-bit datatype, then compilers will complain about |
|
89 |
the fake 64-bit datatype that PHYSFS provides when it compiles user code. |
|
90 |
*/ |
|
578
bff1af8455ca
Tabs-to-spaces patch by James Turk.
Ryan C. Gordon <icculus@icculus.org>
parents:
566
diff
changeset
|
91 |
#define PHYSFS_Swap64(X) (X) |
177 | 92 |
#endif |
93 |
#endif /* PHYSFS_NO_64BIT_SUPPORT */ |
|
94 |
||
95 |
||
96 |
/* Byteswap item from the specified endianness to the native endianness */ |
|
97 |
#if PHYSFS_BYTEORDER == PHYSFS_LIL_ENDIAN |
|
98 |
PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 x) { return(x); } |
|
99 |
PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 x) { return(x); } |
|
100 |
PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 x) { return(x); } |
|
101 |
PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 x) { return(x); } |
|
102 |
PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 x) { return(x); } |
|
103 |
PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 x) { return(x); } |
|
104 |
||
105 |
PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 x) { return(PHYSFS_Swap16(x)); } |
|
106 |
PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 x) { return(PHYSFS_Swap16(x)); } |
|
107 |
PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 x) { return(PHYSFS_Swap32(x)); } |
|
108 |
PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 x) { return(PHYSFS_Swap32(x)); } |
|
109 |
PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 x) { return(PHYSFS_Swap64(x)); } |
|
110 |
PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 x) { return(PHYSFS_Swap64(x)); } |
|
111 |
#else |
|
112 |
PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 x) { return(PHYSFS_Swap16(x)); } |
|
113 |
PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 x) { return(PHYSFS_Swap16(x)); } |
|
114 |
PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 x) { return(PHYSFS_Swap32(x)); } |
|
115 |
PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 x) { return(PHYSFS_Swap32(x)); } |
|
116 |
PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 x) { return(PHYSFS_Swap64(x)); } |
|
117 |
PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 x) { return(PHYSFS_Swap64(x)); } |
|
118 |
||
119 |
PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 x) { return(x); } |
|
120 |
PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 x) { return(x); } |
|
121 |
PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 x) { return(x); } |
|
122 |
PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 x) { return(x); } |
|
123 |
PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 x) { return(x); } |
|
124 |
PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 x) { return(x); } |
|
125 |
#endif |
|
126 |
||
321
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
127 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
128 |
int PHYSFS_readSLE16(PHYSFS_file *file, PHYSFS_sint16 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
129 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
130 |
PHYSFS_sint16 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
131 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
132 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
133 |
*val = PHYSFS_swapSLE16(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
134 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
135 |
} /* PHYSFS_readSLE16 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
136 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
137 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
138 |
int PHYSFS_readULE16(PHYSFS_file *file, PHYSFS_uint16 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
139 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
140 |
PHYSFS_uint16 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
141 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
142 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
143 |
*val = PHYSFS_swapULE16(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
144 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
145 |
} /* PHYSFS_readULE16 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
146 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
147 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
148 |
int PHYSFS_readSBE16(PHYSFS_file *file, PHYSFS_sint16 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
149 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
150 |
PHYSFS_sint16 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
151 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
152 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
153 |
*val = PHYSFS_swapSBE16(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
154 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
155 |
} /* PHYSFS_readSBE16 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
156 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
157 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
158 |
int PHYSFS_readUBE16(PHYSFS_file *file, PHYSFS_uint16 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
159 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
160 |
PHYSFS_uint16 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
161 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
162 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
163 |
*val = PHYSFS_swapUBE16(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
164 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
165 |
} /* PHYSFS_readUBE16 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
166 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
167 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
168 |
int PHYSFS_readSLE32(PHYSFS_file *file, PHYSFS_sint32 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
169 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
170 |
PHYSFS_sint32 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
171 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
172 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
173 |
*val = PHYSFS_swapSLE32(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
174 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
175 |
} /* PHYSFS_readSLE32 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
176 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
177 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
178 |
int PHYSFS_readULE32(PHYSFS_file *file, PHYSFS_uint32 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
179 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
180 |
PHYSFS_uint32 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
181 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
182 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
183 |
*val = PHYSFS_swapULE32(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
184 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
185 |
} /* PHYSFS_readULE32 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
186 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
187 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
188 |
int PHYSFS_readSBE32(PHYSFS_file *file, PHYSFS_sint32 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
189 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
190 |
PHYSFS_sint32 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
191 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
192 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
193 |
*val = PHYSFS_swapSBE32(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
194 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
195 |
} /* PHYSFS_readSBE32 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
196 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
197 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
198 |
int PHYSFS_readUBE32(PHYSFS_file *file, PHYSFS_uint32 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
199 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
200 |
PHYSFS_uint32 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
201 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
202 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
203 |
*val = PHYSFS_swapUBE32(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
204 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
205 |
} /* PHYSFS_readUBE32 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
206 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
207 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
208 |
int PHYSFS_readSLE64(PHYSFS_file *file, PHYSFS_sint64 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
209 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
210 |
PHYSFS_sint64 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
211 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
212 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
213 |
*val = PHYSFS_swapSLE64(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
214 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
215 |
} /* PHYSFS_readSLE64 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
216 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
217 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
218 |
int PHYSFS_readULE64(PHYSFS_file *file, PHYSFS_uint64 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
219 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
220 |
PHYSFS_uint64 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
221 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
222 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
223 |
*val = PHYSFS_swapULE64(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
224 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
225 |
} /* PHYSFS_readULE64 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
226 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
227 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
228 |
int PHYSFS_readSBE64(PHYSFS_file *file, PHYSFS_sint64 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
229 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
230 |
PHYSFS_sint64 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
231 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
232 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
233 |
*val = PHYSFS_swapSBE64(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
234 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
235 |
} /* PHYSFS_readSBE64 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
236 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
237 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
238 |
int PHYSFS_readUBE64(PHYSFS_file *file, PHYSFS_uint64 *val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
239 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
240 |
PHYSFS_uint64 in; |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
241 |
BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
242 |
BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
243 |
*val = PHYSFS_swapUBE64(in); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
244 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
245 |
} /* PHYSFS_readUBE64 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
246 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
247 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
248 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
249 |
int PHYSFS_writeSLE16(PHYSFS_file *file, PHYSFS_sint16 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
250 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
251 |
PHYSFS_sint16 out = PHYSFS_swapSLE16(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
252 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
253 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
254 |
} /* PHYSFS_writeSLE16 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
255 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
256 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
257 |
int PHYSFS_writeULE16(PHYSFS_file *file, PHYSFS_uint16 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
258 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
259 |
PHYSFS_uint16 out = PHYSFS_swapULE16(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
260 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
261 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
262 |
} /* PHYSFS_writeULE16 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
263 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
264 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
265 |
int PHYSFS_writeSBE16(PHYSFS_file *file, PHYSFS_sint16 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
266 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
267 |
PHYSFS_sint16 out = PHYSFS_swapSBE16(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
268 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
269 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
270 |
} /* PHYSFS_writeSBE16 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
271 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
272 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
273 |
int PHYSFS_writeUBE16(PHYSFS_file *file, PHYSFS_uint16 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
274 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
275 |
PHYSFS_uint16 out = PHYSFS_swapUBE16(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
276 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
277 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
278 |
} /* PHYSFS_writeUBE16 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
279 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
280 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
281 |
int PHYSFS_writeSLE32(PHYSFS_file *file, PHYSFS_sint32 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
282 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
283 |
PHYSFS_sint32 out = PHYSFS_swapSLE32(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
284 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
285 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
286 |
} /* PHYSFS_writeSLE32 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
287 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
288 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
289 |
int PHYSFS_writeULE32(PHYSFS_file *file, PHYSFS_uint32 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
290 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
291 |
PHYSFS_uint32 out = PHYSFS_swapULE32(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
292 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
293 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
294 |
} /* PHYSFS_writeULE32 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
295 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
296 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
297 |
int PHYSFS_writeSBE32(PHYSFS_file *file, PHYSFS_sint32 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
298 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
299 |
PHYSFS_sint32 out = PHYSFS_swapSBE32(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
300 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
301 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
302 |
} /* PHYSFS_writeSBE32 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
303 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
304 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
305 |
int PHYSFS_writeUBE32(PHYSFS_file *file, PHYSFS_uint32 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
306 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
307 |
PHYSFS_uint32 out = PHYSFS_swapUBE32(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
308 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
309 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
310 |
} /* PHYSFS_writeUBE32 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
311 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
312 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
313 |
int PHYSFS_writeSLE64(PHYSFS_file *file, PHYSFS_sint64 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
314 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
315 |
PHYSFS_sint64 out = PHYSFS_swapSLE64(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
316 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
317 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
318 |
} /* PHYSFS_writeSLE64 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
319 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
320 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
321 |
int PHYSFS_writeULE64(PHYSFS_file *file, PHYSFS_uint64 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
322 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
323 |
PHYSFS_uint64 out = PHYSFS_swapULE64(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
324 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
325 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
326 |
} /* PHYSFS_writeULE64 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
327 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
328 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
329 |
int PHYSFS_writeSBE64(PHYSFS_file *file, PHYSFS_sint64 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
330 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
331 |
PHYSFS_sint64 out = PHYSFS_swapSBE64(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
332 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
333 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
334 |
} /* PHYSFS_writeSBE64 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
335 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
336 |
|
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
337 |
int PHYSFS_writeUBE64(PHYSFS_file *file, PHYSFS_uint64 val) |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
338 |
{ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
339 |
PHYSFS_uint64 out = PHYSFS_swapUBE64(val); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
340 |
BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
341 |
return(1); |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
342 |
} /* PHYSFS_writeUBE64 */ |
50986060bee8
Added PHYSFS_(read|write)[SU][BL]E(16|32|64).
Ryan C. Gordon <icculus@icculus.org>
parents:
214
diff
changeset
|
343 |
|
177 | 344 |
/* end of physfs_byteorder.c ... */ |
345 |