fix calloc with negative values - missing size set initially!

SVN revision: 46701
This commit is contained in:
Carsten Haitzler 2010-03-01 15:51:22 +00:00
parent 61f65ae20a
commit bfd8514063
3 changed files with 13 additions and 9 deletions

View 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:

View 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);
}
}
}

View 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)