Fixed some compiler warnings from the latest Clang, cleaned up some things.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c
index aac044a..b372c3e 100644
--- a/src/file/SDL_rwops.c
+++ b/src/file/SDL_rwops.c
@@ -282,7 +282,7 @@ windows_file_close(SDL_RWops * context)
context->hidden.windowsio.buffer.data = NULL;
SDL_FreeRW(context);
}
- return (0);
+ return 0;
}
#endif /* __WIN32__ */
@@ -318,7 +318,7 @@ stdio_seek(SDL_RWops * context, Sint64 offset, int whence)
}
#else
if (fseek(context->hidden.stdio.fp, offset, whence) == 0) {
- return (ftell(context->hidden.stdio.fp));
+ return ftell(context->hidden.stdio.fp);
}
#endif
return SDL_Error(SDL_EFSEEK);
@@ -333,7 +333,7 @@ stdio_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
if (nread == 0 && ferror(context->hidden.stdio.fp)) {
SDL_Error(SDL_EFREAD);
}
- return (nread);
+ return nread;
}
static size_t SDLCALL
@@ -345,7 +345,7 @@ stdio_write(SDL_RWops * context, const void *ptr, size_t size, size_t num)
if (nwrote == 0 && ferror(context->hidden.stdio.fp)) {
SDL_Error(SDL_EFWRITE);
}
- return (nwrote);
+ return nwrote;
}
static int SDLCALL
@@ -432,14 +432,14 @@ mem_write(SDL_RWops * context, const void *ptr, size_t size, size_t num)
}
SDL_memcpy(context->hidden.mem.here, ptr, num * size);
context->hidden.mem.here += num * size;
- return (num);
+ return num;
}
static size_t SDLCALL
mem_writeconst(SDL_RWops * context, const void *ptr, size_t size, size_t num)
{
SDL_SetError("Can't write to read-only memory");
- return (0);
+ return 0;
}
static int SDLCALL
@@ -448,7 +448,7 @@ mem_close(SDL_RWops * context)
if (context) {
SDL_FreeRW(context);
}
- return (0);
+ return 0;
}
@@ -535,7 +535,7 @@ SDL_RWFromFile(const char *file, const char *mode)
SDL_SetError("SDL not compiled with stdio support");
#endif /* !HAVE_STDIO_H */
- return (rwops);
+ return rwops;
}
#ifdef HAVE_STDIO_H
@@ -555,7 +555,7 @@ SDL_RWFromFP(FILE * fp, SDL_bool autoclose)
rwops->hidden.stdio.autoclose = autoclose;
rwops->type = SDL_RWOPS_STDFILE;
}
- return (rwops);
+ return rwops;
}
#else
SDL_RWops *
@@ -572,11 +572,11 @@ SDL_RWFromMem(void *mem, int size)
SDL_RWops *rwops = NULL;
if (!mem) {
SDL_InvalidParamError("mem");
- return (rwops);
+ return rwops;
}
if (!size) {
SDL_InvalidParamError("size");
- return (rwops);
+ return rwops;
}
rwops = SDL_AllocRW();
@@ -591,7 +591,7 @@ SDL_RWFromMem(void *mem, int size)
rwops->hidden.mem.stop = rwops->hidden.mem.base + size;
rwops->type = SDL_RWOPS_MEMORY;
}
- return (rwops);
+ return rwops;
}
SDL_RWops *
@@ -600,11 +600,11 @@ SDL_RWFromConstMem(const void *mem, int size)
SDL_RWops *rwops = NULL;
if (!mem) {
SDL_InvalidParamError("mem");
- return (rwops);
+ return rwops;
}
if (!size) {
SDL_InvalidParamError("size");
- return (rwops);
+ return rwops;
}
rwops = SDL_AllocRW();
@@ -619,7 +619,7 @@ SDL_RWFromConstMem(const void *mem, int size)
rwops->hidden.mem.stop = rwops->hidden.mem.base + size;
rwops->type = SDL_RWOPS_MEMORY_RO;
}
- return (rwops);
+ return rwops;
}
SDL_RWops *
@@ -633,7 +633,7 @@ SDL_AllocRW(void)
} else {
area->type = SDL_RWOPS_UNKNOWN;
}
- return (area);
+ return area;
}
void
@@ -649,7 +649,7 @@ SDL_ReadU8(SDL_RWops * src)
{
Uint8 value = 0;
- SDL_RWread(src, &value, (sizeof value), 1);
+ SDL_RWread(src, &value, sizeof (value), 1);
return value;
}
@@ -658,8 +658,8 @@ SDL_ReadLE16(SDL_RWops * src)
{
Uint16 value = 0;
- SDL_RWread(src, &value, (sizeof value), 1);
- return (SDL_SwapLE16(value));
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapLE16(value);
}
Uint16
@@ -667,8 +667,8 @@ SDL_ReadBE16(SDL_RWops * src)
{
Uint16 value = 0;
- SDL_RWread(src, &value, (sizeof value), 1);
- return (SDL_SwapBE16(value));
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapBE16(value);
}
Uint32
@@ -676,8 +676,8 @@ SDL_ReadLE32(SDL_RWops * src)
{
Uint32 value = 0;
- SDL_RWread(src, &value, (sizeof value), 1);
- return (SDL_SwapLE32(value));
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapLE32(value);
}
Uint32
@@ -685,8 +685,8 @@ SDL_ReadBE32(SDL_RWops * src)
{
Uint32 value = 0;
- SDL_RWread(src, &value, (sizeof value), 1);
- return (SDL_SwapBE32(value));
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapBE32(value);
}
Uint64
@@ -694,8 +694,8 @@ SDL_ReadLE64(SDL_RWops * src)
{
Uint64 value = 0;
- SDL_RWread(src, &value, (sizeof value), 1);
- return (SDL_SwapLE64(value));
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapLE64(value);
}
Uint64
@@ -703,56 +703,56 @@ SDL_ReadBE64(SDL_RWops * src)
{
Uint64 value = 0;
- SDL_RWread(src, &value, (sizeof value), 1);
- return (SDL_SwapBE64(value));
+ SDL_RWread(src, &value, sizeof (value), 1);
+ return SDL_SwapBE64(value);
}
size_t
SDL_WriteU8(SDL_RWops * dst, Uint8 value)
{
- return (SDL_RWwrite(dst, &value, (sizeof value), 1));
+ return SDL_RWwrite(dst, &value, sizeof (value), 1);
}
size_t
SDL_WriteLE16(SDL_RWops * dst, Uint16 value)
{
- value = SDL_SwapLE16(value);
- return (SDL_RWwrite(dst, &value, (sizeof value), 1));
+ const Uint16 swapped = SDL_SwapLE16(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
}
size_t
SDL_WriteBE16(SDL_RWops * dst, Uint16 value)
{
- value = SDL_SwapBE16(value);
- return (SDL_RWwrite(dst, &value, (sizeof value), 1));
+ const Uint16 swapped = SDL_SwapBE16(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
}
size_t
SDL_WriteLE32(SDL_RWops * dst, Uint32 value)
{
- value = SDL_SwapLE32(value);
- return (SDL_RWwrite(dst, &value, (sizeof value), 1));
+ const Uint32 swapped = SDL_SwapLE32(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
}
size_t
SDL_WriteBE32(SDL_RWops * dst, Uint32 value)
{
- value = SDL_SwapBE32(value);
- return (SDL_RWwrite(dst, &value, (sizeof value), 1));
+ const Uint32 swapped = SDL_SwapBE32(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
}
size_t
SDL_WriteLE64(SDL_RWops * dst, Uint64 value)
{
- value = SDL_SwapLE64(value);
- return (SDL_RWwrite(dst, &value, (sizeof value), 1));
+ const Uint64 swapped = SDL_SwapLE64(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
}
size_t
SDL_WriteBE64(SDL_RWops * dst, Uint64 value)
{
- value = SDL_SwapBE64(value);
- return (SDL_RWwrite(dst, &value, (sizeof value), 1));
+ const Uint64 swapped = SDL_SwapBE64(value);
+ return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
}
/* vi: set ts=4 sw=4 expandtab: */