fix calloc with negative values - missing size set initially!
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 1 Mar 2010 15:51:22 +0000 (15:51 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 1 Mar 2010 15:51:22 +0000 (15:51 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@46701 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/gl_common/evas_gl_image.c
src/modules/engines/gl_common/evas_gl_shader.c
src/modules/engines/gl_x11/evas_engine.c

index 0c97b5b..6dad8ba 100644 (file)
@@ -143,7 +143,7 @@ evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, int alpha, int cspac
    im = calloc(1, sizeof(Evas_GL_Image));
    if (!im) return NULL;
    im->references = 1;
-   im->im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get());
+   im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
    if (!im->im)
      {
        free(im);
@@ -153,10 +153,12 @@ evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, int alpha, int cspac
    im->im->cache_entry.flags.alpha = alpha ? 1 : 0;
    im->cs.space = cspace;
    im->alpha = im->im->cache_entry.flags.alpha;
+   im->im->cache_entry.w = w;
+   im->im->cache_entry.h = h;
    im->w = im->im->cache_entry.w;
    im->h = im->im->cache_entry.h;
    evas_cache_image_colorspace(&im->im->cache_entry, cspace);
-   im->im = (RGBA_Image *) evas_cache_image_size_set(&im->im->cache_entry, w, h);
+   im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, w, h);
    switch (cspace)
      {
       case EVAS_COLORSPACE_ARGB8888:
index f80c1be..4521ccc 100644 (file)
@@ -408,12 +408,15 @@ gl_compile_link_error(GLuint target, const char *action)
    char *logtxt;
    
    glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen);
-   logtxt = calloc(loglen, sizeof(char));
-   if (logtxt)
+   if (loglen > 0)
      {
-        glGetProgramInfoLog(target, loglen, &chars, logtxt);
-        printf("Failed to %s: %s\n", action, logtxt);
-        free(logtxt);
+        logtxt = calloc(loglen, sizeof(char));
+        if (logtxt)
+          {
+             glGetProgramInfoLog(target, loglen, &chars, logtxt);
+             printf("Failed to %s: %s\n", action, logtxt);
+             free(logtxt);
+          }
      }
 }
 
index cda5a1d..55b265b 100644 (file)
@@ -36,13 +36,12 @@ XID      (*glsym_glXCreatePixmap)    (Display *a, void *b, Pixmap c, const int *
 void     (*glsym_glXDestroyPixmap)   (Display *a, XID b) = NULL;
 void     (*glsym_glXQueryDrawable)   (Display *a, XID b, int c, unsigned int *d) = NULL;
 #endif
-                
+
 static void
 _sym_init(void)
 {
    static int done = 0;
    
-   
    if (done) return;
    
 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)