equal
deleted
inserted
replaced
11 #include <string.h> |
11 #include <string.h> |
12 #include <errno.h> |
12 #include <errno.h> |
13 #include <sys/stat.h> |
13 #include <sys/stat.h> |
14 #include <sys/types.h> |
14 #include <sys/types.h> |
15 #include <fcntl.h> |
15 #include <fcntl.h> |
16 #include <unistd.h> |
|
17 #include "physfs.h" |
16 #include "physfs.h" |
18 |
17 |
19 #define __PHYSICSFS_INTERNAL__ |
18 #define __PHYSICSFS_INTERNAL__ |
20 #include "physfs_internal.h" |
19 #include "physfs_internal.h" |
21 |
20 |
29 FILE *h = (FILE *) (handle->opaque); |
28 FILE *h = (FILE *) (handle->opaque); |
30 int retval; |
29 int retval; |
31 |
30 |
32 errno = 0; |
31 errno = 0; |
33 retval = fread(buffer, objSize, objCount, h); |
32 retval = fread(buffer, objSize, objCount, h); |
34 BAIL_IF_MACRO((retval < objCount) && (ferror(h)),strerror(errno),retval); |
33 BAIL_IF_MACRO((retval < (signed int) objCount) && (ferror(h)), |
|
34 strerror(errno),retval); |
35 |
35 |
36 return(retval); |
36 return(retval); |
37 } /* DIR_read */ |
37 } /* DIR_read */ |
38 |
38 |
39 |
39 |
43 FILE *h = (FILE *) (handle->opaque); |
43 FILE *h = (FILE *) (handle->opaque); |
44 int retval; |
44 int retval; |
45 |
45 |
46 errno = 0; |
46 errno = 0; |
47 retval = fwrite(buffer, objSize, objCount, h); |
47 retval = fwrite(buffer, objSize, objCount, h); |
48 if ( (retval < objCount) && (ferror(h)) ) |
48 if ( (retval < (signed int) objCount) && (ferror(h)) ) |
49 __PHYSFS_setError(strerror(errno)); |
49 __PHYSFS_setError(strerror(errno)); |
50 |
50 |
51 return(retval); |
51 return(retval); |
52 } /* DIR_write */ |
52 } /* DIR_write */ |
53 |
53 |
265 int retval; |
265 int retval; |
266 |
266 |
267 BAIL_IF_MACRO(f == NULL, NULL, 0); |
267 BAIL_IF_MACRO(f == NULL, NULL, 0); |
268 |
268 |
269 errno = 0; |
269 errno = 0; |
270 retval = (mkdir(f, S_IRWXU) == 0); |
270 retval = __PHYSFS_platformMkDir(f); |
271 if (!retval) |
271 if (!retval) |
272 __PHYSFS_setError(strerror(errno)); |
272 __PHYSFS_setError(strerror(errno)); |
273 |
273 |
274 free(f); |
274 free(f); |
275 return(retval); |
275 return(retval); |