Corrected some stdinc inline functions (thanks, Martin!).
authorRyan C. Gordon <icculus@icculus.org>
Thu, 04 Apr 2013 11:35:22 -0400
changeset 7057c1563f514b5b
parent 7056 a5699778d80f
child 7058 64a2c8c882e1
Corrected some stdinc inline functions (thanks, Martin!).

qsort() returns void, so remove the "return" keyword, plus some C++
const_casting magic.

Fixes Bugzilla #1785.
include/SDL_stdinc.h
     1.1 --- a/include/SDL_stdinc.h	Wed Apr 03 16:48:23 2013 -0700
     1.2 +++ b/include/SDL_stdinc.h	Thu Apr 04 11:35:22 2013 -0400
     1.3 @@ -30,7 +30,6 @@
     1.4  
     1.5  #include "SDL_config.h"
     1.6  
     1.7 -
     1.8  #ifdef HAVE_SYS_TYPES_H
     1.9  #include <sys/types.h>
    1.10  #endif
    1.11 @@ -282,7 +281,7 @@
    1.12  
    1.13  extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
    1.14  #ifdef HAVE_QSORT
    1.15 -SDL_FORCE_INLINE void SDL_qsort_inline(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) { return qsort(base, nmemb, size, compare); }
    1.16 +SDL_FORCE_INLINE void SDL_qsort_inline(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) { qsort(base, nmemb, size, compare); }
    1.17  #define SDL_qsort SDL_qsort_inline
    1.18  #endif
    1.19  
    1.20 @@ -512,10 +511,22 @@
    1.21  
    1.22  extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
    1.23  #ifdef HAVE_STRRCHR
    1.24 -SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return (char*)strrchr(str, c); }
    1.25 +SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
    1.26 +#ifdef __cplusplus
    1.27 +return const_cast<char*>(strrchr(str, c));
    1.28 +#else
    1.29 +return (char*)strrchr(str, c);
    1.30 +#endif
    1.31 +}
    1.32  #define SDL_strrchr SDL_strrchr_inline
    1.33  #elif defined(HAVE_RINDEX)  /* !!! FIXME: is there anywhere that has this but not strrchr? */
    1.34 -SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return (char*)rindex(str, c); }
    1.35 +SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
    1.36 +#ifdef __cplusplus
    1.37 +return const_cast<char*>(rindex(str, c));
    1.38 +#else
    1.39 +return (char*)rindex(str, c);
    1.40 +#endif
    1.41 +}
    1.42  #define SDL_strrchr SDL_strrchr_inline
    1.43  #endif
    1.44