[brlcad-commits] SF.net SVN: brlcad:[57563] brlcad/trunk/src/libicv/ppm.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <moh...@us...> - 2013-09-11 21:54:21
|
Revision: 57563 http://sourceforge.net/p/brlcad/code/57563 Author: mohitdaga Date: 2013-09-11 21:54:17 +0000 (Wed, 11 Sep 2013) Log Message: ----------- FIX fixed size buffer. Modified Paths: -------------- brlcad/trunk/src/libicv/ppm.c Modified: brlcad/trunk/src/libicv/ppm.c =================================================================== --- brlcad/trunk/src/libicv/ppm.c 2013-09-11 21:50:49 UTC (rev 57562) +++ brlcad/trunk/src/libicv/ppm.c 2013-09-11 21:54:17 UTC (rev 57563) @@ -55,9 +55,6 @@ FILE *fp; size_t ret, size; - /* FIXME: should not be introducing fixed size buffers */ - char buf[BUFSIZ] = {0}; - if (bif->color_space == ICV_COLOR_SPACE_GRAY) { icv_gray2rgb(bif); } else if (bif->color_space != ICV_COLOR_SPACE_RGB) { @@ -74,9 +71,8 @@ data = data2uchar(bif); size = (size_t) bif->width*bif->height*3; image_flip(data, bif->width, bif->height); - snprintf(buf, BUFSIZ, "P6 %d %d 255\n", bif->width, bif->height); + ret = fprintf(fp, "P6 %d %d 255\n", bif->width, bif->height); - ret = fwrite(buf, 1, strlen(buf),fp); ret = fwrite(data, 1, size, fp); fclose(fp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |