summaryrefslogtreecommitdiff
path: root/src/guichan/sdl
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-25 21:28:51 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-25 21:46:40 +0300
commit81db0022e50e25d922ac7d67d9ec6017b8856f13 (patch)
tree0ead8c5df5b8eb00cbe5e07e2f7dc36170786846 /src/guichan/sdl
parent6317f3e0c1e2c6d2e88dd99443e7f45f7bb77f44 (diff)
downloadplus-81db0022e50e25d922ac7d67d9ec6017b8856f13.tar.gz
plus-81db0022e50e25d922ac7d67d9ec6017b8856f13.tar.bz2
plus-81db0022e50e25d922ac7d67d9ec6017b8856f13.tar.xz
plus-81db0022e50e25d922ac7d67d9ec6017b8856f13.zip
Fix old casts.
Diffstat (limited to 'src/guichan/sdl')
-rw-r--r--src/guichan/sdl/sdlgraphics.cpp23
-rw-r--r--src/guichan/sdl/sdlimage.cpp4
2 files changed, 17 insertions, 10 deletions
diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp
index c8cec6370..ae61a0432 100644
--- a/src/guichan/sdl/sdlgraphics.cpp
+++ b/src/guichan/sdl/sdlgraphics.cpp
@@ -283,7 +283,8 @@ namespace gcn
SDL_LockSurface(mTarget);
- Uint8 *p = (Uint8 *)mTarget->pixels + y * mTarget->pitch + x1 * bpp;
+ Uint8 *p = static_cast<Uint8*>(mTarget->pixels)
+ + y * mTarget->pitch + x1 * bpp;
Uint32 pixel = SDL_MapRGB(mTarget->format,
mColor.r,
@@ -298,7 +299,7 @@ namespace gcn
case 2:
{
- Uint16* q = (Uint16*)p;
+ Uint16* q = reinterpret_cast<Uint16*>(p);
for (; x1 <= x2; ++x1)
*(q++) = pixel;
break;
@@ -329,7 +330,7 @@ namespace gcn
case 4:
{
- Uint32* q = (Uint32*)p;
+ Uint32 *q = reinterpret_cast<Uint32*>(p);
for (; x1 <= x2; ++x1)
{
if (mAlpha)
@@ -395,7 +396,8 @@ namespace gcn
SDL_LockSurface(mTarget);
- Uint8 *p = (Uint8 *)mTarget->pixels + y1 * mTarget->pitch + x * bpp;
+ Uint8 *p = static_cast<Uint8*>(mTarget->pixels)
+ + y1 * mTarget->pitch + x * bpp;
Uint32 pixel = SDL_MapRGB(mTarget->format, mColor.r,
mColor.g, mColor.b);
@@ -411,9 +413,9 @@ namespace gcn
break;
case 2:
- for (; y1 <= y2; ++y1)
+ for (; y1 <= y2; ++ y1)
{
- *(Uint16*)p = pixel;
+ *reinterpret_cast<Uint16*>(p) = pixel;
p += mTarget->pitch;
}
break;
@@ -445,9 +447,14 @@ namespace gcn
for (; y1 <= y2; ++y1)
{
if (mAlpha)
- *(Uint32*)p = SDLAlpha32(pixel, *(Uint32*)p, mColor.a);
+ {
+ *reinterpret_cast<Uint32*>(p) = SDLAlpha32(pixel,
+ *reinterpret_cast<Uint32*>(p), mColor.a);
+ }
else
- *(Uint32*)p = pixel;
+ {
+ *reinterpret_cast<Uint32*>(p) = pixel;
+ }
p += mTarget->pitch;
}
break;
diff --git a/src/guichan/sdl/sdlimage.cpp b/src/guichan/sdl/sdlimage.cpp
index 4f9b9565c..cf8505c4e 100644
--- a/src/guichan/sdl/sdlimage.cpp
+++ b/src/guichan/sdl/sdlimage.cpp
@@ -142,8 +142,8 @@ namespace gcn
{
Uint8 r, g, b, a;
- SDL_GetRGBA(((unsigned int*)mSurface->pixels)[i], mSurface->format,
- &r, &g, &b, &a);
+ SDL_GetRGBA((static_cast<unsigned int*>(mSurface->pixels)[i]),
+ mSurface->format, &r, &g, &b, &a);
if (a != 255)
{