metadata: Reduce stack usage in nfo parsing

64KB is a bit much for a stack buffer.  Use dynamic allocation instead.
This commit is contained in:
Justin Maggard
2017-05-17 13:54:05 -07:00
parent 4f926639b2
commit 46c692fc59
2 changed files with 27 additions and 18 deletions

View File

@ -730,7 +730,7 @@ image_downsize(image_s * pdest, image_s * psrc, int32_t width, int32_t height)
{
vcol = get_pix(psrc, ((int32_t)rx)-half_square_width+i,
((int32_t)ry)-half_square_height+j);
if(((j == 0) || (j == (half_square_height<<1)-1)) &&
((i == 0) || (i == (half_square_width<<1)-1)))
{
@ -762,12 +762,12 @@ image_downsize(image_s * pdest, image_s * psrc, int32_t width, int32_t height)
}
}
}
red /= width_scale*height_scale;
green /= width_scale*height_scale;
blue /= width_scale*height_scale;
alpha /= width_scale*height_scale;
/* on sature les valeurs */
red = (red > 255.0)? 255.0 : ((red < 0.0)? 0.0:red );
green = (green > 255.0)? 255.0 : ((green < 0.0)? 0.0:green);
@ -857,7 +857,7 @@ image_save_to_jpeg_file(image_s * pimage, char * path)
buf = image_save_to_jpeg_buf(pimage, &size);
if( !buf )
return NULL;
dst_file = fopen(path, "w");
dst_file = fopen(path, "w");
if( !dst_file )
{
free(buf);