Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/imbuf/intern/IMB_hamx.h2
-rw-r--r--source/blender/imbuf/intern/bmp.c1
-rw-r--r--source/blender/imbuf/intern/cspace.c8
-rw-r--r--source/blender/imbuf/intern/ham.c18
-rw-r--r--source/blender/imbuf/intern/hamx.c14
-rw-r--r--source/blender/imbuf/intern/iff.c2
-rw-r--r--source/blender/imbuf/intern/iris.c6
-rw-r--r--source/blender/imbuf/intern/jpeg.c12
-rw-r--r--source/blender/imbuf/intern/png.c1
-rw-r--r--source/blender/imbuf/intern/targa.c2
-rw-r--r--source/blender/imbuf/intern/writeimage.c3
11 files changed, 31 insertions, 38 deletions
diff --git a/source/blender/imbuf/intern/IMB_hamx.h b/source/blender/imbuf/intern/IMB_hamx.h
index 98cb1366b8b..d5b23d4e685 100644
--- a/source/blender/imbuf/intern/IMB_hamx.h
+++ b/source/blender/imbuf/intern/IMB_hamx.h
@@ -44,7 +44,7 @@ struct ImBuf;
struct ImBuf *imb_loadanim(int *iffmem, int flags);
short imb_enc_anim(struct ImBuf *ibuf, int file);
-void imb_convhamx(struct ImBuf *ibuf, unsigned char coltab[][4], short *deltab);
+void imb_convhamx(struct ImBuf *ibuf, unsigned char *coltab, short *deltab);
#endif
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c
index 004a01d0ded..31f2b66cd83 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -207,6 +207,7 @@ short imb_savebmp(struct ImBuf *ibuf, char *name, int flags) {
data = (uchar *) ibuf->rect;
ofile = fopen(name,"wb");
+ if (!ofile) return 0;
putShortLSB(19778,ofile); /* "BM" */
putIntLSB(0,ofile); /* This can be 0 for BI_RGB bitmaps */
diff --git a/source/blender/imbuf/intern/cspace.c b/source/blender/imbuf/intern/cspace.c
index 5cd2da5a998..f994755c823 100644
--- a/source/blender/imbuf/intern/cspace.c
+++ b/source/blender/imbuf/intern/cspace.c
@@ -74,15 +74,15 @@ static void cspfill(short *buf, short *fill, int x)
}
-static void cspadd(short *buf, short cont[][3], unsigned char *rect, int x)
+static void cspadd(short *buf, short *cont, unsigned char *rect, int x)
{
short i;
for (;x>0;x--){
i = *(rect);
rect += 4;
- buf[0] += cont[i][0];
- buf[1] += cont[i][1];
- buf[2] += cont[i][2];
+ buf[0] += cont[i*3];
+ buf[1] += cont[i*3 + 1];
+ buf[2] += cont[i*3 + 2];
buf += 3;
}
}
diff --git a/source/blender/imbuf/intern/ham.c b/source/blender/imbuf/intern/ham.c
index 383c79334bc..de1d504980e 100644
--- a/source/blender/imbuf/intern/ham.c
+++ b/source/blender/imbuf/intern/ham.c
@@ -92,7 +92,7 @@ static void addhamdither(short x, unsigned char *dit,
static void convhamscanl(short x, short y,
unsigned char *rgbbase,
- unsigned char coltab[][4],
+ unsigned char *coltab,
short *deltab,
short bits)
{
@@ -114,9 +114,9 @@ static void convhamscanl(short x, short y,
if ((hambase = (unsigned short *) malloc((x+4) * sizeof(unsigned short)))==0) return;
- lb = coltab[0][1];
- lg = coltab[0][2];
- lr = coltab[0][3];
+ lb = coltab[1];
+ lg = coltab[2];
+ lr = coltab[3];
type = col = 0;
ham = hambase;
@@ -190,9 +190,9 @@ static void convhamscanl(short x, short y,
lb = b;
break;
default:
- lb = coltab[col][1];
- lg = coltab[col][2];
- lr = coltab[col][3];
+ lb = coltab[col*4 + 1];
+ lg = coltab[col*4 + 2];
+ lr = coltab[col*4 + 3];
}
*ham = type + col;
} else *ham = HAMG + HAMFREE + g;
@@ -267,10 +267,10 @@ short imb_converttoham(struct ImBuf *ibuf)
IMB_dit2(ibuf, 2, 4);
IMB_dit2(ibuf, 1, 4);
IMB_dit2(ibuf, 0, 4);
- imb_convhamx(ibuf, coltab, deltab);
+ imb_convhamx(ibuf, (uchar *)coltab, deltab);
} else {
for(;y > 0; y--){
- convhamscanl(x, y, (uchar *)rect, coltab, deltab, ibuf->cbits);
+ convhamscanl(x, y, (uchar *)rect, (uchar *)coltab, deltab, ibuf->cbits);
rect += x;
}
}
diff --git a/source/blender/imbuf/intern/hamx.c b/source/blender/imbuf/intern/hamx.c
index d86b8b24bdf..4d75b0d86d6 100644
--- a/source/blender/imbuf/intern/hamx.c
+++ b/source/blender/imbuf/intern/hamx.c
@@ -207,7 +207,7 @@ float adat_distort = 1.0;
*
*/
-void imb_convhamx(struct ImBuf *ibuf, unsigned char coltab[][4], short *deltab)
+void imb_convhamx(struct ImBuf *ibuf, unsigned char *coltab, short *deltab)
{
short r,g,b,lr,lg,lb,dr,dg,db,col,fout,type,step;
int i;
@@ -225,9 +225,9 @@ void imb_convhamx(struct ImBuf *ibuf, unsigned char coltab[][4], short *deltab)
rect += 4*step;
i = ((ibuf->x * ibuf->y) + 2 - step - 1) / 2;
- lb = coltab[0][1];
- lg = coltab[0][2];
- lr = coltab[0][3];
+ lb = coltab[1];
+ lg = coltab[2];
+ lr = coltab[3];
type = col = 0;
for ( ;i>0;i--){
@@ -273,9 +273,9 @@ void imb_convhamx(struct ImBuf *ibuf, unsigned char coltab[][4], short *deltab)
default:
/*printf("%04x %5d %5d ", (b<<8) + (g<<4) + r, col, fout);*/
- lb = coltab[col][1];
- lg = coltab[col][2];
- lr = coltab[col][3];
+ lb = coltab[col*4 + 1];
+ lg = coltab[col*4 + 2];
+ lr = coltab[col*4 + 3];
/*printf("%01x%01x%01x %01x%01x%01x\n", b, g, r, lb, lg, lr);*/
col += 48;
}
diff --git a/source/blender/imbuf/intern/iff.c b/source/blender/imbuf/intern/iff.c
index 251799c9126..790f8344207 100644
--- a/source/blender/imbuf/intern/iff.c
+++ b/source/blender/imbuf/intern/iff.c
@@ -204,7 +204,7 @@ unsigned short imb_update_iff(int file, int code)
filelen -= 8;
if (buf[0] == code) break;
- skip = BIG_LONG(buf[1]) + 1 & ~1;
+ skip = (BIG_LONG(buf[1]) + 1) & ~1;
filelen -= skip;
lseek(file, skip, 1);
}
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index d9bb290ed74..37f695e34a9 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -489,12 +489,8 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, char
goodwrite = 1;
outf = fopen(name, "wb");
+ if(!outf) return 0;
- if(!outf) {
- perror("fopen");
- fprintf(stderr,"output_iris: can't open output file\n");
- return 0;
- }
tablen = ysize*zsize*sizeof(int);
image = (IMAGE *)malloc(sizeof(IMAGE));
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 7cc4e4fdefe..fda48bf18cc 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -351,10 +351,7 @@ ImBuf * imb_ibJpegImageFromFilename (char * filename, int flags)
FILE * infile;
ImBuf * ibuf;
- if ((infile = fopen(filename, "rb")) == NULL) {
- /*fprintf(stderr, "can't open %s\n", filename);*/
- return 0;
- }
+ if ((infile = fopen(filename, "rb")) == NULL) return 0;
cinfo->err = jpeg_std_error(&jerr);
jerr.error_exit = jpeg_error;
@@ -494,7 +491,7 @@ static int save_stdjpeg(char * name, struct ImBuf * ibuf)
struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo;
struct jpeg_error_mgr jerr;
- if ((outfile = fopen(name, "wb")) == NULL) return(-1);
+ if ((outfile = fopen(name, "wb")) == NULL) return 0;
jpeg_default_quality = 75;
cinfo->err = jpeg_std_error(&jerr);
@@ -518,7 +515,7 @@ static int save_vidjpeg(char * name, struct ImBuf * ibuf)
struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo;
struct jpeg_error_mgr jerr;
- if ((outfile = fopen(name, "wb")) == NULL) return(-1);
+ if ((outfile = fopen(name, "wb")) == NULL) return 0;
jpeg_default_quality = 90;
cinfo->err = jpeg_std_error(&jerr);
@@ -584,7 +581,7 @@ static int save_maxjpeg(char * name, struct ImBuf * ibuf)
struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo;
struct jpeg_error_mgr jerr;
- if ((outfile = fopen(name, "wb")) == NULL) return(-1);
+ if ((outfile = fopen(name, "wb")) == NULL) return 0;
jpeg_default_quality = 100;
cinfo->err = jpeg_std_error(&jerr);
@@ -607,7 +604,6 @@ static int save_maxjpeg(char * name, struct ImBuf * ibuf)
return(jpeg_failed);
}
-
int imb_savejpeg(struct ImBuf * ibuf, char * name, int flags)
{
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 27957a34351..501d4121ff8 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -192,6 +192,7 @@ short imb_savepng(struct ImBuf *ibuf, char *name, int flags)
Flush);
} else {
fp = fopen(name, "wb");
+ if (!fp) return 0;
png_init_io(png_ptr, fp);
}
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index 6b8427339d2..06e75673285 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -291,7 +291,7 @@ short imb_savetarga(struct ImBuf * ibuf, char *name, int flags)
buf[17] |= 0x08;
}
fildes = fopen(name,"wb");
-
+ if (!fildes) return 0;
if (fwrite(buf, 1, 18,fildes) != 18) return (0);
diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c
index ffc1c12d00d..150ab8aac26 100644
--- a/source/blender/imbuf/intern/writeimage.c
+++ b/source/blender/imbuf/intern/writeimage.c
@@ -65,8 +65,7 @@ short IMB_saveiff(struct ImBuf *ibuf,char *naam,int flags)
/* Put formats that take a filename here */
if (IS_jpg(ibuf)) {
- if(imb_savejpeg(ibuf, naam, flags)) return (0);
- else return (TRUE);
+ return imb_savejpeg(ibuf, naam, flags);
}
if (IS_png(ibuf)) {
return imb_savepng(ibuf,naam,flags);