@@ -52,7 +52,7 @@ namespace std{
static char_type to_char_type(const int_type & i);
inline static int_type to_int_type(const char_type & c){
- return (short int)(unsigned char)c;
+ return static_cast<short int>(static_cast<unsigned char>(c));
}
inline static bool eq_int_type(const int_type & a, const int_type & b){
@@ -71,7 +71,7 @@ namespace std{
}
inline static char_type* move(char_type* s1, const char_type* s2, size_t n){
- return (char*) memmove(s1, s2, n);
+ return static_cast<char*>(memmove(s1, s2, n));
}
inline static char_type* copy(char_type* s1, const char_type* s2, size_t n){
@@ -82,7 +82,7 @@ namespace std{
}
inline static char_type* assign(char_type* s, size_t n, char_type a){
- return (char *)memset(s, a, n);
+ return static_cast<char *>(memset(s, a, n));
}
inline static int compare(const char_type* s1, const char_type* s2, size_t n){
@@ -63,15 +63,15 @@ public:
//Space for n Ts
pointer allocate(size_type n, typename allocator<void>::const_pointer = 0){
- return (T*)(::operator new( n * sizeof(T) ));
+ return static_cast<T*>(::operator new( n * sizeof(T) ));
}
void deallocate(pointer p, size_type){
::operator delete(p);
}
//Use placement new to engage the constructor
- void construct(pointer p, const T& val) { new((void*)p) T(val); }
- void destroy(pointer p){ ((T*)p)->~T(); } //Call destructor
+ void construct(pointer p, const T& val) { new(static_cast<void*>(p)) T(val); }
+ void destroy(pointer p){ (static_cast<T*>(p))->~T(); } //Call destructor
size_type max_size() const _UCXX_USE_NOEXCEPT;
template<class U> struct rebind { typedef allocator<U> other; };
@@ -70,7 +70,7 @@ public:
typedef typename vector<Ch, A>::reverse_iterator reverse_iterator;
typedef typename vector<Ch, A>::const_reverse_iterator const_reverse_iterator;
- static const size_type npos = (size_type)-1;
+ static const size_type npos = static_cast<size_type>(-1);
explicit _UCXXEXPORT basic_string(const A& al = A()) : vector<Ch, A>(al){ return; }
@@ -180,7 +180,7 @@ namespace std{
}
_UCXXEXPORT size_type max_size() const{
- return ((size_type)(-1)) / sizeof(T);
+ return static_cast<size_type>(-1) / sizeof(T);
}
void downsize(size_type sz);
Found with Clang's -Wold-style-cast Signed-off-by: Rosen Penev <rosenp@gmail.com> --- include/char_traits | 6 +++--- include/memory | 6 +++--- include/string | 2 +- include/vector | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)