From bdffe196afee7ea2cd5bbdffa3514b4ae2b68196 Mon Sep 17 00:00:00 2001 From: Kent Mein Date: Thu, 9 Dec 2004 13:09:11 +0000 Subject: This fixes bug #1990 It moves targa, bmp, iris and png loading so that were not opening 2 file handles for each file, and made them like the jpeg stuff. Also cleaned up some minor other stuff. Kent --- source/blender/imbuf/intern/targa.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'source/blender/imbuf/intern/targa.c') diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index 0ad4d0ae77d..a20c9917c06 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -30,10 +30,6 @@ * $Id$ */ -#ifdef HAVE_CONFIG_H -#include -#endif - #ifdef WIN32 #include "BLI_winstuff.h" #include @@ -242,7 +238,7 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file) } -short imb_savetarga(struct ImBuf * ibuf, int file, int flags) +short imb_savetarga(struct ImBuf * ibuf, char *name, int flags) { char buf[20]; FILE *fildes; @@ -294,14 +290,16 @@ short imb_savetarga(struct ImBuf * ibuf, int file, int flags) if (ibuf->depth==32) { buf[17] |= 0x08; } + fildes = fopen(name,"ab"); + + + if (fwrite(buf, 1, 18,fildes) != 18) return (0); - if (write(file, buf, 18) != 18) return (0); if (ibuf->cmap){ for (i = 0 ; imaxcol ; i++){ - if (write(file,((uchar *)(ibuf->cmap + i)) + 1,3) != 3) return (0); + if (fwrite(((uchar *)(ibuf->cmap + i)) + 1,1,3,fildes) != 3) return (0); } } - fildes = fdopen(file,"ab"); if (ibuf->cmap && (flags & IB_cmap) == 0) IMB_converttocmap(ibuf); -- cgit v1.2.3