comparison include/SDL_rwops.h @ 2160:00adbaed3910

Updated to use size_t instead of int for amounts of data.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 10 Jul 2007 05:25:19 +0000
parents dd4753e47ed4
children e635db5b45ef
comparison
equal deleted inserted replaced
2159:dd4753e47ed4 2160:00adbaed3910
44 /* This is the read/write operation structure -- very basic */ 44 /* This is the read/write operation structure -- very basic */
45 45
46 typedef struct SDL_RWops 46 typedef struct SDL_RWops
47 { 47 {
48 /* Seek to 'offset' relative to whence, one of stdio's whence values: 48 /* Seek to 'offset' relative to whence, one of stdio's whence values:
49 SEEK_SET, SEEK_CUR, SEEK_END 49 RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
50 Returns the final offset in the data source. 50 Returns the final offset in the data source.
51 */ 51 */
52 int (SDLCALL * seek) (struct SDL_RWops * context, int offset, int whence); 52 long (SDLCALL * seek) (struct SDL_RWops * context, long offset,
53 int whence);
53 54
54 /* Read up to 'num' objects each of size 'objsize' from the data 55 /* Read up to 'num' objects each of size 'objsize' from the data
55 source to the area pointed at by 'ptr'. 56 source to the area pointed at by 'ptr'.
56 Returns the number of objects read, or -1 if the read failed. 57 Returns the number of objects read, or 0 at error or end of file.
57 */ 58 */
58 int (SDLCALL * read) (struct SDL_RWops * context, void *ptr, int size, 59 size_t(SDLCALL * read) (struct SDL_RWops * context, void *ptr,
59 int maxnum); 60 size_t size, size_t maxnum);
60 61
61 /* Write exactly 'num' objects each of size 'objsize' from the area 62 /* Write exactly 'num' objects each of size 'objsize' from the area
62 pointed at by 'ptr' to data source. 63 pointed at by 'ptr' to data source.
63 Returns 'num', or -1 if the write failed. 64 Returns the number of objects written, or 0 at error or end of file.
64 */ 65 */
65 int (SDLCALL * write) (struct SDL_RWops * context, const void *ptr, 66 size_t(SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
66 int size, int num); 67 size_t size, size_t num);
67 68
68 /* Close and free an allocated SDL_FSops structure */ 69 /* Close and free an allocated SDL_RWops structure.
70 Returns 0 if successful or -1 on write error when flushing data.
71 */
69 int (SDLCALL * close) (struct SDL_RWops * context); 72 int (SDLCALL * close) (struct SDL_RWops * context);
70 73
71 Uint32 type; 74 Uint32 type;
72 union 75 union
73 { 76 {
74 #ifdef __WIN32__ 77 #ifdef __WIN32__
75 struct 78 struct
76 { 79 {
77 int append; 80 SDL_bool append;
78 void *h; 81 void *h;
79 struct 82 struct
80 { 83 {
81 void *data; 84 void *data;
82 int size; 85 int size;
85 } win32io; 88 } win32io;
86 #endif 89 #endif
87 #ifdef HAVE_STDIO_H 90 #ifdef HAVE_STDIO_H
88 struct 91 struct
89 { 92 {
90 int autoclose; 93 SDL_bool autoclose;
91 FILE *fp; 94 FILE *fp;
92 } stdio; 95 } stdio;
93 #endif 96 #endif
94 struct 97 struct
95 { 98 {