Replace reinterpret_cast with safer or no cast
When casting types to one another in C++, the weaker the cast,
the better.
This change replaces instances of reinterpret_cast with static_cast
or no cast where it safe and correct to do so.
BUG=angleproject:2683
Change-Id: I99c9033614a65282ae1d78cf0f4b80fabd75877a
Reviewed-on: https://chromium-review.googlesource.com/1109396
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 910e249..20ef5e9 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -3815,7 +3815,7 @@
Extents size(width, height, 1);
Texture *texture = getTargetTexture(TextureTargetToType(target));
handleError(texture->setImage(this, mGLState.getUnpackState(), target, level, internalformat,
- size, format, type, reinterpret_cast<const uint8_t *>(pixels)));
+ size, format, type, static_cast<const uint8_t *>(pixels)));
}
void Context::texImage2DRobust(TextureTarget target,
@@ -3849,7 +3849,7 @@
Texture *texture = getTargetTexture(target);
handleError(texture->setImage(this, mGLState.getUnpackState(),
NonCubeTextureTypeToTarget(target), level, internalformat, size,
- format, type, reinterpret_cast<const uint8_t *>(pixels)));
+ format, type, static_cast<const uint8_t *>(pixels)));
}
void Context::texImage3DRobust(TextureType target,
@@ -3888,7 +3888,7 @@
Box area(xoffset, yoffset, 0, width, height, 1);
Texture *texture = getTargetTexture(TextureTargetToType(target));
handleError(texture->setSubImage(this, mGLState.getUnpackState(), target, level, area, format,
- type, reinterpret_cast<const uint8_t *>(pixels)));
+ type, static_cast<const uint8_t *>(pixels)));
}
void Context::texSubImage2DRobust(TextureTarget target,
@@ -3929,7 +3929,7 @@
Texture *texture = getTargetTexture(target);
handleError(texture->setSubImage(this, mGLState.getUnpackState(),
NonCubeTextureTypeToTarget(target), level, area, format, type,
- reinterpret_cast<const uint8_t *>(pixels)));
+ static_cast<const uint8_t *>(pixels)));
}
void Context::texSubImage3DRobust(TextureType target,
@@ -3964,7 +3964,7 @@
Texture *texture = getTargetTexture(TextureTargetToType(target));
handleError(texture->setCompressedImage(this, mGLState.getUnpackState(), target, level,
internalformat, size, imageSize,
- reinterpret_cast<const uint8_t *>(data)));
+ static_cast<const uint8_t *>(data)));
}
void Context::compressedTexImage2DRobust(TextureTarget target,
@@ -3996,7 +3996,7 @@
Texture *texture = getTargetTexture(target);
handleError(texture->setCompressedImage(
this, mGLState.getUnpackState(), NonCubeTextureTypeToTarget(target), level, internalformat,
- size, imageSize, reinterpret_cast<const uint8_t *>(data)));
+ size, imageSize, static_cast<const uint8_t *>(data)));
}
void Context::compressedTexImage3DRobust(TextureType target,
@@ -4030,7 +4030,7 @@
Texture *texture = getTargetTexture(TextureTargetToType(target));
handleError(texture->setCompressedSubImage(this, mGLState.getUnpackState(), target, level, area,
format, imageSize,
- reinterpret_cast<const uint8_t *>(data)));
+ static_cast<const uint8_t *>(data)));
}
void Context::compressedTexSubImage2DRobust(TextureTarget target,
@@ -4072,7 +4072,7 @@
Texture *texture = getTargetTexture(target);
handleError(texture->setCompressedSubImage(
this, mGLState.getUnpackState(), NonCubeTextureTypeToTarget(target), level, area, format,
- imageSize, reinterpret_cast<const uint8_t *>(data)));
+ imageSize, static_cast<const uint8_t *>(data)));
}
void Context::compressedTexSubImage3DRobust(TextureType target,
@@ -6648,14 +6648,14 @@
void Context::eGLImageTargetTexture2D(TextureType target, GLeglImageOES image)
{
Texture *texture = getTargetTexture(target);
- egl::Image *imageObject = reinterpret_cast<egl::Image *>(image);
+ egl::Image *imageObject = static_cast<egl::Image *>(image);
handleError(texture->setEGLImageTarget(this, target, imageObject));
}
void Context::eGLImageTargetRenderbufferStorage(GLenum target, GLeglImageOES image)
{
Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
- egl::Image *imageObject = reinterpret_cast<egl::Image *>(image);
+ egl::Image *imageObject = static_cast<egl::Image *>(image);
handleError(renderbuffer->setStorageEGLImageTarget(this, imageObject));
}