changeset 2:a52de05d2e2b

changed malloc to VMS malloc
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Tue, 10 Jul 2012 11:42:46 +0200
parents 7e13c9ecc89c
children 42d636fee562
files VSs_tinyjpeg/loadjpeg.c VSs_tinyjpeg/tinyjpeg.c
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/VSs_tinyjpeg/loadjpeg.c	Thu Jul 05 04:15:38 2012 -0700
     1.2 +++ b/VSs_tinyjpeg/loadjpeg.c	Tue Jul 10 11:42:46 2012 +0200
     1.3 @@ -130,7 +130,7 @@
     1.4  	if (fp == NULL)
     1.5  		perror("Cannot open image");//exitmessage("Cannot open filename\n");
     1.6  	length_of_file = filesize(fp);
     1.7 -	buf = (unsigned char *)malloc(length_of_file + 4);
     1.8 +	buf = (unsigned char *)VMS_App__malloc(length_of_file + 4);
     1.9  	if (buf == NULL)
    1.10  		exitmessage("Not enough memory for loading file\n");
    1.11  	fread(buf, length_of_file, 1, fp);
    1.12 @@ -148,12 +148,12 @@
    1.13  	tinyjpeg_get_size(jdec, &width, &height);
    1.14  
    1.15  	// RGB stuff
    1.16 -	rgb_data = (uint8_t *)malloc(width * height * RGB_DEPTH);
    1.17 +	rgb_data = (uint8_t *)VMS_App__malloc(width * height * RGB_DEPTH);
    1.18  	jdec->components[0] = rgb_data;
    1.19  
    1.20  	// this jpeg decoder only supports full MCUs for simplicity
    1.21  	ntasks = (jdec->mcus_in_width * jdec->mcus_in_height)/ jdec->restart_interval;
    1.22 -	jdec_task = (struct jdec_private **) malloc ( ntasks * sizeof(struct jdec_private*));
    1.23 +	jdec_task = (struct jdec_private **) VMS_App__malloc ( ntasks * sizeof(struct jdec_private*));
    1.24  	
    1.25  
    1.26          //VSs setup
    1.27 @@ -191,9 +191,9 @@
    1.28  	    tinyjpeg_free(jdec_task[i]);
    1.29  	}
    1.30  	fclose(fp);		
    1.31 -	free(buf);
    1.32 -	free(rgb_data);
    1.33 -	free(jdec_task);
    1.34 +	VMS_App__free(buf);
    1.35 +	VMS_App__free(rgb_data);
    1.36 +	VMS_App__free(jdec_task);
    1.37  	return 0;
    1.38  }
    1.39  
     2.1 --- a/VSs_tinyjpeg/tinyjpeg.c	Thu Jul 05 04:15:38 2012 -0700
     2.2 +++ b/VSs_tinyjpeg/tinyjpeg.c	Tue Jul 10 11:42:46 2012 +0200
     2.3 @@ -440,9 +440,10 @@
     2.4  {
     2.5  	struct jdec_private *priv;
     2.6  
     2.7 -	priv = (struct jdec_private *)calloc(1, sizeof(struct jdec_private));
     2.8 +	priv = (struct jdec_private *)VMS_App__malloc(1* sizeof(struct jdec_private));
     2.9  	if (priv == NULL)
    2.10  		return NULL;
    2.11 +        memset(priv,0,sizeof(struct jdec_private));
    2.12  	return priv;
    2.13  }
    2.14  
    2.15 @@ -453,7 +454,7 @@
    2.16   */
    2.17  void tinyjpeg_free(struct jdec_private *priv)
    2.18  {
    2.19 -	free(priv);
    2.20 +	VMS_App__free(priv);
    2.21  }
    2.22  
    2.23