Mesa (8.0): st/vega: fix uninitialized values

Dylan Noblesmith nobled at kemper.freedesktop.org
Sun Apr 29 11:25:20 UTC 2012


Module: Mesa
Branch: 8.0
Commit: fca35d2e5e84fad50b0a99463d072bbb221ac947
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fca35d2e5e84fad50b0a99463d072bbb221ac947

Author: Dylan Noblesmith <nobled at dreamwidth.org>
Date:   Sun Apr  1 19:48:21 2012 +0000

st/vega: fix uninitialized values

C still treats array arguments exactly like pointer arguments.
By sheer coincidence, this still worked fine on 64-bit
machines where 2 * sizeof(float) == sizeof(void*), but not
on 32-bit.

Noticed by clang:

text.c:76:51: warning: sizeof on array function parameter will
return size of 'const VGfloat *' (aka 'const float *') instead of
'const VGfloat [2]' [-Wsizeof-array-argument]
   memcpy(glyph->glyph_origin, glyphOrigin, sizeof(glyphOrigin));

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp at vmware.com>
(cherry picked from commit 6a491b5728fcfb928612182fa87212eeb2253917)

---

 src/gallium/state_trackers/vega/text.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/vega/text.c b/src/gallium/state_trackers/vega/text.c
index a183933..27d461c 100644
--- a/src/gallium/state_trackers/vega/text.c
+++ b/src/gallium/state_trackers/vega/text.c
@@ -73,8 +73,8 @@ static void add_glyph(struct vg_font *font,
    glyph = CALLOC_STRUCT(vg_glyph);
    glyph->object = obj;
    glyph->is_hinted = isHinted;
-   memcpy(glyph->glyph_origin, glyphOrigin, sizeof(glyphOrigin));
-   memcpy(glyph->escapement, escapement, sizeof(escapement));
+   memcpy(glyph->glyph_origin, glyphOrigin, sizeof(glyph->glyph_origin));
+   memcpy(glyph->escapement, escapement, sizeof(glyph->glyph_origin));
 
    cso_hash_insert(font->glyphs, (unsigned) glyphIndex, glyph);
 }




More information about the mesa-commit mailing list