Mesa (master): gallium: Avoid void pointer arithmetic.
Chia-I Wu
olv at kemper.freedesktop.org
Thu Jul 29 08:21:24 UTC 2010
Module: Mesa
Branch: master
Commit: 92f9b05499de9f0e8eda11d1a75ba7955c9cc602
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=92f9b05499de9f0e8eda11d1a75ba7955c9cc602
Author: Chia-I Wu <olv at lunarg.com>
Date: Thu Jul 29 15:54:10 2010 +0800
gallium: Avoid void pointer arithmetic.
This fixes fdo bug #29286.
---
src/gallium/drivers/i915/i915_context.c | 4 ++--
src/gallium/drivers/llvmpipe/lp_draw_arrays.c | 4 ++--
src/gallium/drivers/r300/r300_render.c | 2 +-
src/gallium/drivers/softpipe/sp_draw_arrays.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 496efc9..2beb9e3 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -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) ?
diff --git a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c
index 22c2836..e73b431 100644
--- a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c
+++ b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c
@@ -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) ?
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index c179b07..35d7756 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -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) ?
diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c
index 3a33cde..386c8ac 100644
--- a/src/gallium/drivers/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -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) ?
More information about the mesa-commit
mailing list