Fixed some compiler warnings from the latest Clang, cleaned up some things.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 03 Feb 2014 14:45:38 -0500
changeset 8162b6083d2078c0
parent 8161 6c5d35c8b3dd
child 8163 52f8629bdef2
Fixed some compiler warnings from the latest Clang, cleaned up some things.
src/file/SDL_rwops.c
     1.1 --- a/src/file/SDL_rwops.c	Mon Feb 03 11:59:17 2014 -0500
     1.2 +++ b/src/file/SDL_rwops.c	Mon Feb 03 14:45:38 2014 -0500
     1.3 @@ -282,7 +282,7 @@
     1.4          context->hidden.windowsio.buffer.data = NULL;
     1.5          SDL_FreeRW(context);
     1.6      }
     1.7 -    return (0);
     1.8 +    return 0;
     1.9  }
    1.10  #endif /* __WIN32__ */
    1.11  
    1.12 @@ -318,7 +318,7 @@
    1.13      }
    1.14  #else
    1.15      if (fseek(context->hidden.stdio.fp, offset, whence) == 0) {
    1.16 -        return (ftell(context->hidden.stdio.fp));
    1.17 +        return ftell(context->hidden.stdio.fp);
    1.18      }
    1.19  #endif
    1.20      return SDL_Error(SDL_EFSEEK);
    1.21 @@ -333,7 +333,7 @@
    1.22      if (nread == 0 && ferror(context->hidden.stdio.fp)) {
    1.23          SDL_Error(SDL_EFREAD);
    1.24      }
    1.25 -    return (nread);
    1.26 +    return nread;
    1.27  }
    1.28  
    1.29  static size_t SDLCALL
    1.30 @@ -345,7 +345,7 @@
    1.31      if (nwrote == 0 && ferror(context->hidden.stdio.fp)) {
    1.32          SDL_Error(SDL_EFWRITE);
    1.33      }
    1.34 -    return (nwrote);
    1.35 +    return nwrote;
    1.36  }
    1.37  
    1.38  static int SDLCALL
    1.39 @@ -432,14 +432,14 @@
    1.40      }
    1.41      SDL_memcpy(context->hidden.mem.here, ptr, num * size);
    1.42      context->hidden.mem.here += num * size;
    1.43 -    return (num);
    1.44 +    return num;
    1.45  }
    1.46  
    1.47  static size_t SDLCALL
    1.48  mem_writeconst(SDL_RWops * context, const void *ptr, size_t size, size_t num)
    1.49  {
    1.50      SDL_SetError("Can't write to read-only memory");
    1.51 -    return (0);
    1.52 +    return 0;
    1.53  }
    1.54  
    1.55  static int SDLCALL
    1.56 @@ -448,7 +448,7 @@
    1.57      if (context) {
    1.58          SDL_FreeRW(context);
    1.59      }
    1.60 -    return (0);
    1.61 +    return 0;
    1.62  }
    1.63  
    1.64  
    1.65 @@ -535,7 +535,7 @@
    1.66      SDL_SetError("SDL not compiled with stdio support");
    1.67  #endif /* !HAVE_STDIO_H */
    1.68  
    1.69 -    return (rwops);
    1.70 +    return rwops;
    1.71  }
    1.72  
    1.73  #ifdef HAVE_STDIO_H
    1.74 @@ -555,7 +555,7 @@
    1.75          rwops->hidden.stdio.autoclose = autoclose;
    1.76          rwops->type = SDL_RWOPS_STDFILE;
    1.77      }
    1.78 -    return (rwops);
    1.79 +    return rwops;
    1.80  }
    1.81  #else
    1.82  SDL_RWops *
    1.83 @@ -572,11 +572,11 @@
    1.84      SDL_RWops *rwops = NULL;
    1.85      if (!mem) {
    1.86        SDL_InvalidParamError("mem");
    1.87 -      return (rwops);
    1.88 +      return rwops;
    1.89      }
    1.90      if (!size) {
    1.91        SDL_InvalidParamError("size");
    1.92 -      return (rwops);
    1.93 +      return rwops;
    1.94      }
    1.95  
    1.96      rwops = SDL_AllocRW();
    1.97 @@ -591,7 +591,7 @@
    1.98          rwops->hidden.mem.stop = rwops->hidden.mem.base + size;
    1.99          rwops->type = SDL_RWOPS_MEMORY;
   1.100      }
   1.101 -    return (rwops);
   1.102 +    return rwops;
   1.103  }
   1.104  
   1.105  SDL_RWops *
   1.106 @@ -600,11 +600,11 @@
   1.107      SDL_RWops *rwops = NULL;
   1.108      if (!mem) {
   1.109        SDL_InvalidParamError("mem");
   1.110 -      return (rwops);
   1.111 +      return rwops;
   1.112      }
   1.113      if (!size) {
   1.114        SDL_InvalidParamError("size");
   1.115 -      return (rwops);
   1.116 +      return rwops;
   1.117      }
   1.118  
   1.119      rwops = SDL_AllocRW();
   1.120 @@ -619,7 +619,7 @@
   1.121          rwops->hidden.mem.stop = rwops->hidden.mem.base + size;
   1.122          rwops->type = SDL_RWOPS_MEMORY_RO;
   1.123      }
   1.124 -    return (rwops);
   1.125 +    return rwops;
   1.126  }
   1.127  
   1.128  SDL_RWops *
   1.129 @@ -633,7 +633,7 @@
   1.130      } else {
   1.131          area->type = SDL_RWOPS_UNKNOWN;
   1.132      }
   1.133 -    return (area);
   1.134 +    return area;
   1.135  }
   1.136  
   1.137  void
   1.138 @@ -649,7 +649,7 @@
   1.139  {
   1.140      Uint8 value = 0;
   1.141  
   1.142 -    SDL_RWread(src, &value, (sizeof value), 1);
   1.143 +    SDL_RWread(src, &value, sizeof (value), 1);
   1.144      return value;
   1.145  }
   1.146  
   1.147 @@ -658,8 +658,8 @@
   1.148  {
   1.149      Uint16 value = 0;
   1.150  
   1.151 -    SDL_RWread(src, &value, (sizeof value), 1);
   1.152 -    return (SDL_SwapLE16(value));
   1.153 +    SDL_RWread(src, &value, sizeof (value), 1);
   1.154 +    return SDL_SwapLE16(value);
   1.155  }
   1.156  
   1.157  Uint16
   1.158 @@ -667,8 +667,8 @@
   1.159  {
   1.160      Uint16 value = 0;
   1.161  
   1.162 -    SDL_RWread(src, &value, (sizeof value), 1);
   1.163 -    return (SDL_SwapBE16(value));
   1.164 +    SDL_RWread(src, &value, sizeof (value), 1);
   1.165 +    return SDL_SwapBE16(value);
   1.166  }
   1.167  
   1.168  Uint32
   1.169 @@ -676,8 +676,8 @@
   1.170  {
   1.171      Uint32 value = 0;
   1.172  
   1.173 -    SDL_RWread(src, &value, (sizeof value), 1);
   1.174 -    return (SDL_SwapLE32(value));
   1.175 +    SDL_RWread(src, &value, sizeof (value), 1);
   1.176 +    return SDL_SwapLE32(value);
   1.177  }
   1.178  
   1.179  Uint32
   1.180 @@ -685,8 +685,8 @@
   1.181  {
   1.182      Uint32 value = 0;
   1.183  
   1.184 -    SDL_RWread(src, &value, (sizeof value), 1);
   1.185 -    return (SDL_SwapBE32(value));
   1.186 +    SDL_RWread(src, &value, sizeof (value), 1);
   1.187 +    return SDL_SwapBE32(value);
   1.188  }
   1.189  
   1.190  Uint64
   1.191 @@ -694,8 +694,8 @@
   1.192  {
   1.193      Uint64 value = 0;
   1.194  
   1.195 -    SDL_RWread(src, &value, (sizeof value), 1);
   1.196 -    return (SDL_SwapLE64(value));
   1.197 +    SDL_RWread(src, &value, sizeof (value), 1);
   1.198 +    return SDL_SwapLE64(value);
   1.199  }
   1.200  
   1.201  Uint64
   1.202 @@ -703,56 +703,56 @@
   1.203  {
   1.204      Uint64 value = 0;
   1.205  
   1.206 -    SDL_RWread(src, &value, (sizeof value), 1);
   1.207 -    return (SDL_SwapBE64(value));
   1.208 +    SDL_RWread(src, &value, sizeof (value), 1);
   1.209 +    return SDL_SwapBE64(value);
   1.210  }
   1.211  
   1.212  size_t
   1.213  SDL_WriteU8(SDL_RWops * dst, Uint8 value)
   1.214  {
   1.215 -    return (SDL_RWwrite(dst, &value, (sizeof value), 1));
   1.216 +    return SDL_RWwrite(dst, &value, sizeof (value), 1);
   1.217  }
   1.218  
   1.219  size_t
   1.220  SDL_WriteLE16(SDL_RWops * dst, Uint16 value)
   1.221  {
   1.222 -    value = SDL_SwapLE16(value);
   1.223 -    return (SDL_RWwrite(dst, &value, (sizeof value), 1));
   1.224 +    const Uint16 swapped = SDL_SwapLE16(value);
   1.225 +    return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
   1.226  }
   1.227  
   1.228  size_t
   1.229  SDL_WriteBE16(SDL_RWops * dst, Uint16 value)
   1.230  {
   1.231 -    value = SDL_SwapBE16(value);
   1.232 -    return (SDL_RWwrite(dst, &value, (sizeof value), 1));
   1.233 +    const Uint16 swapped = SDL_SwapBE16(value);
   1.234 +    return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
   1.235  }
   1.236  
   1.237  size_t
   1.238  SDL_WriteLE32(SDL_RWops * dst, Uint32 value)
   1.239  {
   1.240 -    value = SDL_SwapLE32(value);
   1.241 -    return (SDL_RWwrite(dst, &value, (sizeof value), 1));
   1.242 +    const Uint32 swapped = SDL_SwapLE32(value);
   1.243 +    return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
   1.244  }
   1.245  
   1.246  size_t
   1.247  SDL_WriteBE32(SDL_RWops * dst, Uint32 value)
   1.248  {
   1.249 -    value = SDL_SwapBE32(value);
   1.250 -    return (SDL_RWwrite(dst, &value, (sizeof value), 1));
   1.251 +    const Uint32 swapped = SDL_SwapBE32(value);
   1.252 +    return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
   1.253  }
   1.254  
   1.255  size_t
   1.256  SDL_WriteLE64(SDL_RWops * dst, Uint64 value)
   1.257  {
   1.258 -    value = SDL_SwapLE64(value);
   1.259 -    return (SDL_RWwrite(dst, &value, (sizeof value), 1));
   1.260 +    const Uint64 swapped = SDL_SwapLE64(value);
   1.261 +    return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
   1.262  }
   1.263  
   1.264  size_t
   1.265  SDL_WriteBE64(SDL_RWops * dst, Uint64 value)
   1.266  {
   1.267 -    value = SDL_SwapBE64(value);
   1.268 -    return (SDL_RWwrite(dst, &value, (sizeof value), 1));
   1.269 +    const Uint64 swapped = SDL_SwapBE64(value);
   1.270 +    return SDL_RWwrite(dst, &swapped, sizeof (swapped), 1);
   1.271  }
   1.272  
   1.273  /* vi: set ts=4 sw=4 expandtab: */