fixed a bunch of g++ warnings/errors. Compiling with g++ can help find lots of poten...
[mesa.git] / src / mesa / main / image.c
index 89bfcc27596381f31f606b007106709d4c03ab3c..8fcb5562af7fd2025b1368026f22178de0b10acb 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.57 2001/03/03 20:33:27 brianp Exp $ */
+/* $Id: image.c,v 1.58 2001/03/07 05:06:11 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -620,9 +620,9 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
    width_in_bytes = CEILING( width, 8 );
    dst = buffer;
    for (row = 0; row < height; row++) {
-      GLubyte *src = _mesa_image_address( packing, pixels, width, height,
-                                          GL_COLOR_INDEX, GL_BITMAP,
-                                          0, row, 0 );
+      const GLubyte *src = (const GLubyte *)
+         _mesa_image_address(packing, pixels, width, height,
+                             GL_COLOR_INDEX, GL_BITMAP, 0, row, 0);
       if (!src) {
          FREE(buffer);
          return NULL;
@@ -640,7 +640,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
          if (packing->LsbFirst) {
             GLubyte srcMask = 1 << (packing->SkipPixels & 0x7);
             GLubyte dstMask = 128;
-            GLubyte *s = src;
+            const GLubyte *s = src;
             GLubyte *d = dst;
             *d = 0;
             for (i = 0; i < width; i++) {
@@ -667,7 +667,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
          else {
             GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7);
             GLubyte dstMask = 128;
-            GLubyte *s = src;
+            const GLubyte *s = src;
             GLubyte *d = dst;
             *d = 0;
             for (i = 0; i < width; i++) {
@@ -715,9 +715,8 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
    width_in_bytes = CEILING( width, 8 );
    src = source;
    for (row = 0; row < height; row++) {
-      GLubyte *dst = _mesa_image_address( packing, dest, width, height,
-                                          GL_COLOR_INDEX, GL_BITMAP,
-                                          0, row, 0 );
+      GLubyte *dst = (GLubyte *) _mesa_image_address( packing, dest,
+                       width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 );
       if (!dst)
          return;
 
@@ -1725,7 +1724,7 @@ _mesa_pack_rgba_span( GLcontext *ctx,
    }
    else if (transferOps == 0 && dstFormat == GL_RGB && dstType == CHAN_TYPE) {
       /* common simple case */
-      GLint i;
+      GLuint i;
       GLchan *dest = (GLchan *) dstAddr;
       for (i = 0; i < n; i++) {
          dest[0] = srcRgba[i][RCOMP];
@@ -3591,7 +3590,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest,
  * Pack an array of depth values.  The values are floats in [0,1].
  */
 void
-_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
+_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
                        GLenum dstType, const GLfloat *depthSpan,
                        const struct gl_pixelstore_attrib *dstPacking )
 {
@@ -3738,7 +3737,7 @@ _mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth,
    }
 
    {
-      GLubyte *destBuffer = MALLOC(bytesPerRow * height * depth);
+      GLubyte *destBuffer = (GLubyte *) MALLOC(bytesPerRow * height * depth);
       GLubyte *dst;
       GLint img, row;
       if (!destBuffer)