src/file/SDL_rwops.c
changeset 8340 e470405f3ae9
parent 8337 4a67a3cca43d
parent 6655 6a3e741ea70d
child 8439 14d94a8a9fb6
     1.1 --- a/src/file/SDL_rwops.c	Sun Nov 04 13:22:40 2012 -0500
     1.2 +++ b/src/file/SDL_rwops.c	Mon Nov 12 13:25:44 2012 -0500
     1.3 @@ -643,10 +643,19 @@
     1.4  
     1.5  /* Functions for dynamically reading and writing endian-specific values */
     1.6  
     1.7 +Uint8
     1.8 +SDL_ReadU8(SDL_RWops * src)
     1.9 +{
    1.10 +    Uint8 value = 0;
    1.11 +
    1.12 +    SDL_RWread(src, &value, (sizeof value), 1);
    1.13 +    return value;
    1.14 +}
    1.15 +
    1.16  Uint16
    1.17  SDL_ReadLE16(SDL_RWops * src)
    1.18  {
    1.19 -    Uint16 value;
    1.20 +    Uint16 value = 0;
    1.21  
    1.22      SDL_RWread(src, &value, (sizeof value), 1);
    1.23      return (SDL_SwapLE16(value));
    1.24 @@ -655,7 +664,7 @@
    1.25  Uint16
    1.26  SDL_ReadBE16(SDL_RWops * src)
    1.27  {
    1.28 -    Uint16 value;
    1.29 +    Uint16 value = 0;
    1.30  
    1.31      SDL_RWread(src, &value, (sizeof value), 1);
    1.32      return (SDL_SwapBE16(value));
    1.33 @@ -664,7 +673,7 @@
    1.34  Uint32
    1.35  SDL_ReadLE32(SDL_RWops * src)
    1.36  {
    1.37 -    Uint32 value;
    1.38 +    Uint32 value = 0;
    1.39  
    1.40      SDL_RWread(src, &value, (sizeof value), 1);
    1.41      return (SDL_SwapLE32(value));
    1.42 @@ -673,7 +682,7 @@
    1.43  Uint32
    1.44  SDL_ReadBE32(SDL_RWops * src)
    1.45  {
    1.46 -    Uint32 value;
    1.47 +    Uint32 value = 0;
    1.48  
    1.49      SDL_RWread(src, &value, (sizeof value), 1);
    1.50      return (SDL_SwapBE32(value));
    1.51 @@ -682,7 +691,7 @@
    1.52  Uint64
    1.53  SDL_ReadLE64(SDL_RWops * src)
    1.54  {
    1.55 -    Uint64 value;
    1.56 +    Uint64 value = 0;
    1.57  
    1.58      SDL_RWread(src, &value, (sizeof value), 1);
    1.59      return (SDL_SwapLE64(value));
    1.60 @@ -691,13 +700,19 @@
    1.61  Uint64
    1.62  SDL_ReadBE64(SDL_RWops * src)
    1.63  {
    1.64 -    Uint64 value;
    1.65 +    Uint64 value = 0;
    1.66  
    1.67      SDL_RWread(src, &value, (sizeof value), 1);
    1.68      return (SDL_SwapBE64(value));
    1.69  }
    1.70  
    1.71  size_t
    1.72 +SDL_WriteU8(SDL_RWops * dst, Uint8 value)
    1.73 +{
    1.74 +    return (SDL_RWwrite(dst, &value, (sizeof value), 1));
    1.75 +}
    1.76 +
    1.77 +size_t
    1.78  SDL_WriteLE16(SDL_RWops * dst, Uint16 value)
    1.79  {
    1.80      value = SDL_SwapLE16(value);