summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pack.c
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2012-09-03 19:44:00 -0700
committerMatt Turner <[email protected]>2012-09-05 22:28:50 -0700
commit2b7a972e3f36bfcdc6fbe2b59d7ffdcde49c9405 (patch)
tree4b9504b4799e9d29363690fb9083ac4bbcf78d51 /src/mesa/main/pack.c
parent812931f602ff913a51a608a9b1b6826b7f2bfae0 (diff)
Don't cast the return value of malloc/realloc
This patch has been generated by the following Coccinelle semantic patch: // Don't cast the return value of malloc/realloc. // // Casting the return value of malloc/realloc only stands to hide // errors. @@ type T; expression E1, E2; @@ - (T) ( _mesa_align_calloc(E1, E2) | _mesa_align_malloc(E1, E2) | calloc(E1, E2) | malloc(E1) | realloc(E1, E2) )
Diffstat (limited to 'src/mesa/main/pack.c')
-rw-r--r--src/mesa/main/pack.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 4c99199d9d1..a23bc998dd7 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -157,7 +157,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
/* Alloc dest storage */
bytes = ((width + 7) / 8 * height);
- buffer = (GLubyte *) malloc( bytes );
+ buffer = malloc( bytes );
if (!buffer)
return NULL;
@@ -1270,7 +1270,7 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
dstFormat == GL_LUMINANCE_ALPHA ||
dstFormat == GL_LUMINANCE_INTEGER_EXT ||
dstFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT) {
- luminance = (GLfloat *) malloc(n * sizeof(GLfloat));
+ luminance = malloc(n * sizeof(GLfloat));
if (!luminance) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
return;
@@ -4361,7 +4361,7 @@ _mesa_unpack_color_span_ubyte(struct gl_context *ctx,
{
GLint dstComponents;
GLint rDst, gDst, bDst, aDst, lDst, iDst;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+ GLfloat (*rgba)[4] = malloc(4 * n * sizeof(GLfloat));
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
@@ -4376,7 +4376,7 @@ _mesa_unpack_color_span_ubyte(struct gl_context *ctx,
* Extract image data and convert to RGBA floats
*/
if (srcFormat == GL_COLOR_INDEX) {
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+ GLuint *indexes = malloc(n * sizeof(GLuint));
if (!indexes) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
@@ -4555,7 +4555,7 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
{
GLint dstComponents;
GLint rDst, gDst, bDst, aDst, lDst, iDst;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+ GLfloat (*rgba)[4] = malloc(4 * n * sizeof(GLfloat));
GLboolean intFormat = _mesa_is_enum_format_integer(srcFormat);
if (!rgba) {
@@ -4578,7 +4578,7 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
* Extract image data and convert to RGBA floats
*/
if (srcFormat == GL_COLOR_INDEX) {
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+ GLuint *indexes = malloc(n * sizeof(GLuint));
if (!indexes) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
@@ -4691,7 +4691,7 @@ _mesa_unpack_color_span_uint(struct gl_context *ctx,
const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking)
{
- GLuint (*rgba)[4] = (GLuint (*)[4]) malloc(n * 4 * sizeof(GLfloat));
+ GLuint (*rgba)[4] = malloc(n * 4 * sizeof(GLfloat));
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
@@ -4869,7 +4869,7 @@ _mesa_unpack_dudv_span_byte( struct gl_context *ctx,
GLint dstComponents;
GLbyte *dst = dest;
GLuint i;
- GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+ GLfloat (*rgba)[4] = malloc(4 * n * sizeof(GLfloat));
if (!rgba) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
@@ -4956,7 +4956,7 @@ _mesa_unpack_index_span( struct gl_context *ctx, GLuint n,
/*
* general solution
*/
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+ GLuint *indexes = malloc(n * sizeof(GLuint));
if (!indexes) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
@@ -5007,7 +5007,7 @@ _mesa_pack_index_span( struct gl_context *ctx, GLuint n,
const struct gl_pixelstore_attrib *dstPacking,
GLbitfield transferOps )
{
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+ GLuint *indexes = malloc(n * sizeof(GLuint));
if (!indexes) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
@@ -5183,7 +5183,7 @@ _mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n,
/*
* general solution
*/
- GLuint *indexes = (GLuint *) malloc(n * sizeof(GLuint));
+ GLuint *indexes = malloc(n * sizeof(GLuint));
if (!indexes) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "stencil unpacking");
@@ -5253,7 +5253,7 @@ _mesa_pack_stencil_span( struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest, const GLubyte *source,
const struct gl_pixelstore_attrib *dstPacking )
{
- GLubyte *stencil = (GLubyte *) malloc(n * sizeof(GLubyte));
+ GLubyte *stencil = malloc(n * sizeof(GLubyte));
if (!stencil) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "stencil packing");
@@ -5475,7 +5475,7 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
depthValues = (GLfloat *) dest;
}
else {
- depthTemp = (GLfloat *) malloc(n * sizeof(GLfloat));
+ depthTemp = malloc(n * sizeof(GLfloat));
if (!depthTemp) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
return;
@@ -5656,7 +5656,7 @@ _mesa_pack_depth_span( struct gl_context *ctx, GLuint n, GLvoid *dest,
GLenum dstType, const GLfloat *depthSpan,
const struct gl_pixelstore_attrib *dstPacking )
{
- GLfloat *depthCopy = (GLfloat *) malloc(n * sizeof(GLfloat));
+ GLfloat *depthCopy = malloc(n * sizeof(GLfloat));
if (!depthCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel packing");
return;
@@ -5778,8 +5778,8 @@ _mesa_pack_depth_stencil_span(struct gl_context *ctx,GLuint n,
const GLubyte *stencilVals,
const struct gl_pixelstore_attrib *dstPacking)
{
- GLfloat *depthCopy = (GLfloat *) malloc(n * sizeof(GLfloat));
- GLubyte *stencilCopy = (GLubyte *) malloc(n * sizeof(GLubyte));
+ GLfloat *depthCopy = malloc(n * sizeof(GLfloat));
+ GLubyte *stencilCopy = malloc(n * sizeof(GLubyte));
GLuint i;
if (!depthCopy || !stencilCopy) {
@@ -5877,7 +5877,7 @@ _mesa_unpack_image( GLuint dimensions,
{
GLubyte *destBuffer
- = (GLubyte *) malloc(bytesPerRow * height * depth);
+ = malloc(bytesPerRow * height * depth);
GLubyte *dst;
GLint img, row;
if (!destBuffer)