diff options
author | Kent Mein <mein@cs.umn.edu> | 2004-12-09 16:09:11 +0300 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2004-12-09 16:09:11 +0300 |
commit | bdffe196afee7ea2cd5bbdffa3514b4ae2b68196 (patch) | |
tree | 80860cf841f227bafe614f068ee20c0b7ca36c48 /source/blender/imbuf/intern/targa.c | |
parent | eae5d39899652f86e2b9288a69395dfcec27c8b1 (diff) |
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
Diffstat (limited to 'source/blender/imbuf/intern/targa.c')
-rw-r--r-- | source/blender/imbuf/intern/targa.c | 14 |
1 files changed, 6 insertions, 8 deletions
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 <config.h> -#endif - #ifdef WIN32 #include "BLI_winstuff.h" #include <io.h> @@ -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 ; i<ibuf->maxcol ; 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); |