Cleaned up the const_cast mess a little.
--HG-- extra : rebase_source : d3ca36c9e2438c114afe339d1cbf704d318b6185
This commit is contained in:
parent
71b29b3822
commit
8069b5a7f3
1 changed files with 7 additions and 29 deletions
|
@ -93,9 +93,11 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
|
#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
|
||||||
#define SDL_static_cast(type, expression) static_cast<type>(expression)
|
#define SDL_static_cast(type, expression) static_cast<type>(expression)
|
||||||
|
#define SDL_const_cast(type, expression) const_cast<type>(expression)
|
||||||
#else
|
#else
|
||||||
#define SDL_reinterpret_cast(type, expression) ((type)(expression))
|
#define SDL_reinterpret_cast(type, expression) ((type)(expression))
|
||||||
#define SDL_static_cast(type, expression) ((type)(expression))
|
#define SDL_static_cast(type, expression) ((type)(expression))
|
||||||
|
#define SDL_const_cast(type, expression) ((type)(expression))
|
||||||
#endif
|
#endif
|
||||||
/*@}*//*Cast operators*/
|
/*@}*//*Cast operators*/
|
||||||
|
|
||||||
|
@ -502,49 +504,25 @@ SDL_FORCE_INLINE char *SDL_strlwr_inline(char *str) { return _strlwr(str); }
|
||||||
|
|
||||||
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
|
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
|
||||||
#ifdef HAVE_STRCHR
|
#ifdef HAVE_STRCHR
|
||||||
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) {
|
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return SDL_const_cast(char*,strchr(str, c)); }
|
||||||
#ifdef __cplusplus
|
|
||||||
return const_cast<char*>(strchr(str, c));
|
|
||||||
#else
|
|
||||||
return (char*)strchr(str, c);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#define SDL_strchr SDL_strchr_inline
|
#define SDL_strchr SDL_strchr_inline
|
||||||
#elif defined(HAVE_INDEX) /* !!! FIXME: is there anywhere that has this but not strchr? */
|
#elif defined(HAVE_INDEX) /* !!! FIXME: is there anywhere that has this but not strchr? */
|
||||||
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return index(str, c); }
|
SDL_FORCE_INLINE char *SDL_strchr_inline(const char *str, int c) { return SDL_const_cast(char*,index(str, c)); }
|
||||||
#define SDL_strchr SDL_strchr_inline
|
#define SDL_strchr SDL_strchr_inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
|
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
|
||||||
#ifdef HAVE_STRRCHR
|
#ifdef HAVE_STRRCHR
|
||||||
SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
|
SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return SDL_const_cast(char*,strrchr(str, c)); }
|
||||||
#ifdef __cplusplus
|
|
||||||
return const_cast<char*>(strrchr(str, c));
|
|
||||||
#else
|
|
||||||
return (char*)strrchr(str, c);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#define SDL_strrchr SDL_strrchr_inline
|
#define SDL_strrchr SDL_strrchr_inline
|
||||||
#elif defined(HAVE_RINDEX) /* !!! FIXME: is there anywhere that has this but not strrchr? */
|
#elif defined(HAVE_RINDEX) /* !!! FIXME: is there anywhere that has this but not strrchr? */
|
||||||
SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) {
|
SDL_FORCE_INLINE char *SDL_strrchr_inline(const char *str, int c) { return SDL_const_cast(char*,rindex(str, c)); }
|
||||||
#ifdef __cplusplus
|
|
||||||
return const_cast<char*>(rindex(str, c));
|
|
||||||
#else
|
|
||||||
return (char*)rindex(str, c);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#define SDL_strrchr SDL_strrchr_inline
|
#define SDL_strrchr SDL_strrchr_inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
|
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
|
||||||
#ifdef HAVE_STRSTR
|
#ifdef HAVE_STRSTR
|
||||||
SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) {
|
SDL_FORCE_INLINE char *SDL_strstr_inline(const char *haystack, const char *needle) { return SDL_const_cast(char*,strstr(haystack, needle)); }
|
||||||
#ifdef __cplusplus
|
|
||||||
return const_cast<char*>(strstr(haystack, needle));
|
|
||||||
#else
|
|
||||||
return (char*)strstr(haystack, needle);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#define SDL_strstr SDL_strstr_inline
|
#define SDL_strstr SDL_strstr_inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue