gallium: Avoid void pointer arithmetic.
authorChia-I Wu <olv@lunarg.com>
Thu, 29 Jul 2010 07:54:10 +0000 (15:54 +0800)
committerChia-I Wu <olv@lunarg.com>
Thu, 29 Jul 2010 07:55:14 +0000 (15:55 +0800)
This fixes fdo bug #29286.

src/gallium/drivers/i915/i915_context.c
src/gallium/drivers/llvmpipe/lp_draw_arrays.c
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/softpipe/sp_draw_arrays.c

index 496efc99da46dc2d9f37554e12d46ead8bf0cfa7..2beb9e3091f145d09b92b59c127d05a77b6cd1f8 100644 (file)
@@ -67,8 +67,8 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
     * Map index buffer, if present
     */
    if (info->indexed && i915->index_buffer.buffer) {
-      mapped_indices = i915_buffer(i915->index_buffer.buffer)->data;
-      mapped_indices += i915->index_buffer.offset;
+      char *indices = (char *) i915_buffer(i915->index_buffer.buffer)->data;
+      mapped_indices = (void *) (indices + i915->index_buffer.offset);
    }
 
    draw_set_mapped_element_buffer_range(draw, (mapped_indices) ?
index 22c2836e225b93e350e91d280b6c7e85ff96d98d..e73b431cb4d5af5da930b7204b5aaf2b12eba6c4 100644 (file)
@@ -69,8 +69,8 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
 
    /* Map index buffer, if present */
    if (info->indexed && lp->index_buffer.buffer) {
-      mapped_indices = llvmpipe_resource_data(lp->index_buffer.buffer);
-      mapped_indices += lp->index_buffer.offset;
+      char *indices = (char *) llvmpipe_resource_data(lp->index_buffer.buffer);
+      mapped_indices = (void *) (indices + lp->index_buffer.offset);
    }
 
    draw_set_mapped_element_buffer_range(draw, (mapped_indices) ?
index c179b07e86a52e9566cbeae2f6967215a60d4557..35d7756584f9ba501d09aad2411934cc20317aad 100644 (file)
@@ -692,7 +692,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
         indices = pipe_buffer_map(pipe, r300->index_buffer.buffer,
                                   PIPE_TRANSFER_READ, &ib_transfer);
         if (indices)
-            indices += r300->index_buffer.offset;
+            indices = (void *) ((char *) indices + r300->index_buffer.offset);
     }
 
     draw_set_mapped_element_buffer_range(r300->draw, (indices) ?
index 3a33cdef962bfcd2c09c32add0c61a6029d65df4..386c8acb8cee0123b86e187b99f1fe76716bad00 100644 (file)
@@ -139,8 +139,8 @@ softpipe_draw_vbo(struct pipe_context *pipe,
 
    /* Map index buffer, if present */
    if (info->indexed && sp->index_buffer.buffer) {
-      mapped_indices = softpipe_resource(sp->index_buffer.buffer)->data;
-      mapped_indices += sp->index_buffer.offset;
+      char *indices = (char *) softpipe_resource(sp->index_buffer.buffer)->data;
+      mapped_indices = (void *) (indices + sp->index_buffer.offset);
    }
 
    draw_set_mapped_element_buffer_range(draw, (mapped_indices) ?