diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-08 16:23:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-08 16:23:58 +0400 |
commit | 4bc818d240566e18a073efaaf8924960522a6260 (patch) | |
tree | 5701b5655e42a4df4ccff33a657629166fb33c0c /intern/ghost | |
parent | d96275a5c344d82f2466b0a6f85d8ee716771179 (diff) |
code cleanup: quiet uninitialized memory use warning for X11 - harmless in this case but always gave warnings with memcheck (RGB color for alpha zero icon color wasnt initialized).
also some other minor changes.
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index cdb274b0e61..285fbe96638 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -419,8 +419,8 @@ GHOST_WindowX11( x_image = XCreateImage(display, m_visual->visual, 24, ZPixmap, 0, NULL, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 32, 0); mask_image = XCreateImage(display, m_visual->visual, 1, ZPixmap, 0, NULL, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 8, 0); - x_image->data = (char *)malloc(x_image->bytes_per_line * BLENDER_ICON_HEIGHT); - mask_image->data = (char *)malloc(mask_image->bytes_per_line * BLENDER_ICON_HEIGHT); + x_image->data = (char *)calloc(x_image->bytes_per_line * BLENDER_ICON_HEIGHT, 1); + mask_image->data = (char *)calloc(mask_image->bytes_per_line * BLENDER_ICON_HEIGHT, 1); /* copy the BLENDER_ICON_48x48x24 into the XImage */ unsigned char *col = BLENDER_ICON_48x48x24; @@ -429,7 +429,11 @@ GHOST_WindowX11( for (py = 0; py < BLENDER_ICON_HEIGHT; py++, col += 3) { /* mask out pink */ if (col[0] == 255 && col[1] == 0 && col[2] == 255) { +#if 0 + /* instead, use calloc above */ + XPutPixel(x_image, px, py, 0); /* avoid uninitialized memory, otherwise not needed */ XPutPixel(mask_image, px, py, 0); +#endif } else { XPutPixel(x_image, px, py, (col[0] << 16) + (col[1] << 8) + col[2]); @@ -1143,7 +1147,6 @@ GHOST_TSuccess GHOST_WindowX11::setState(GHOST_TWindowState state) } #include <iostream> -using namespace std; GHOST_TSuccess GHOST_WindowX11:: |