Mercurial > sdl-ios-xcode
comparison src/file/SDL_rwops.c @ 1354:22f39393668a
Fixed build problem with SDL_string.c
Officially deprecated SDL_byteorder.h, SDL_getenv.h and SDL_types.h
Moved endian-related SDL_rwops code into SDL_rwops.c
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 09 Feb 2006 09:38:05 +0000 |
parents | 604d73db6802 |
children | c71e05b4dc2e |
comparison
equal
deleted
inserted
replaced
1353:7ba544e2888d | 1354:22f39393668a |
---|---|
22 | 22 |
23 /* This file provides a general interface for SDL to read and write | 23 /* This file provides a general interface for SDL to read and write |
24 data sources. It can easily be extended to files, memory, etc. | 24 data sources. It can easily be extended to files, memory, etc. |
25 */ | 25 */ |
26 | 26 |
27 #include "SDL_stdlib.h" | |
28 #include "SDL_string.h" | |
29 #include "SDL_error.h" | 27 #include "SDL_error.h" |
28 #include "SDL_endian.h" | |
30 #include "SDL_rwops.h" | 29 #include "SDL_rwops.h" |
30 | |
31 | 31 |
32 #ifdef HAVE_STDIO_H | 32 #ifdef HAVE_STDIO_H |
33 | 33 |
34 /* Functions to read/write stdio file pointers */ | 34 /* Functions to read/write stdio file pointers */ |
35 | 35 |
301 | 301 |
302 void SDL_FreeRW(SDL_RWops *area) | 302 void SDL_FreeRW(SDL_RWops *area) |
303 { | 303 { |
304 SDL_free(area); | 304 SDL_free(area); |
305 } | 305 } |
306 | |
307 /* Functions for dynamically reading and writing endian-specific values */ | |
308 | |
309 Uint16 SDL_ReadLE16 (SDL_RWops *src) | |
310 { | |
311 Uint16 value; | |
312 | |
313 SDL_RWread(src, &value, (sizeof value), 1); | |
314 return(SDL_SwapLE16(value)); | |
315 } | |
316 Uint16 SDL_ReadBE16 (SDL_RWops *src) | |
317 { | |
318 Uint16 value; | |
319 | |
320 SDL_RWread(src, &value, (sizeof value), 1); | |
321 return(SDL_SwapBE16(value)); | |
322 } | |
323 Uint32 SDL_ReadLE32 (SDL_RWops *src) | |
324 { | |
325 Uint32 value; | |
326 | |
327 SDL_RWread(src, &value, (sizeof value), 1); | |
328 return(SDL_SwapLE32(value)); | |
329 } | |
330 Uint32 SDL_ReadBE32 (SDL_RWops *src) | |
331 { | |
332 Uint32 value; | |
333 | |
334 SDL_RWread(src, &value, (sizeof value), 1); | |
335 return(SDL_SwapBE32(value)); | |
336 } | |
337 Uint64 SDL_ReadLE64 (SDL_RWops *src) | |
338 { | |
339 Uint64 value; | |
340 | |
341 SDL_RWread(src, &value, (sizeof value), 1); | |
342 return(SDL_SwapLE64(value)); | |
343 } | |
344 Uint64 SDL_ReadBE64 (SDL_RWops *src) | |
345 { | |
346 Uint64 value; | |
347 | |
348 SDL_RWread(src, &value, (sizeof value), 1); | |
349 return(SDL_SwapBE64(value)); | |
350 } | |
351 | |
352 int SDL_WriteLE16 (SDL_RWops *dst, Uint16 value) | |
353 { | |
354 value = SDL_SwapLE16(value); | |
355 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
356 } | |
357 int SDL_WriteBE16 (SDL_RWops *dst, Uint16 value) | |
358 { | |
359 value = SDL_SwapBE16(value); | |
360 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
361 } | |
362 int SDL_WriteLE32 (SDL_RWops *dst, Uint32 value) | |
363 { | |
364 value = SDL_SwapLE32(value); | |
365 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
366 } | |
367 int SDL_WriteBE32 (SDL_RWops *dst, Uint32 value) | |
368 { | |
369 value = SDL_SwapBE32(value); | |
370 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
371 } | |
372 int SDL_WriteLE64 (SDL_RWops *dst, Uint64 value) | |
373 { | |
374 value = SDL_SwapLE64(value); | |
375 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
376 } | |
377 int SDL_WriteBE64 (SDL_RWops *dst, Uint64 value) | |
378 { | |
379 value = SDL_SwapBE64(value); | |
380 return(SDL_RWwrite(dst, &value, (sizeof value), 1)); | |
381 } |