Change in pnmtoimage if image->comps[].data is NULL
This commit is contained in:
parent
0e6a5553cf
commit
8142cab0a0
|
@ -2021,7 +2021,7 @@ int imagetopnm(opj_image_t * image, const char *outfile, int force_split)
|
||||||
int *red, *green, *blue, *alpha;
|
int *red, *green, *blue, *alpha;
|
||||||
int wr, hr, max;
|
int wr, hr, max;
|
||||||
int i;
|
int i;
|
||||||
unsigned int compno, ncomp;
|
unsigned int compno, ncomp, ui;
|
||||||
int adjustR, adjustG, adjustB, adjustA;
|
int adjustR, adjustG, adjustB, adjustA;
|
||||||
int fails, two, want_gray, has_alpha, triple;
|
int fails, two, want_gray, has_alpha, triple;
|
||||||
int prec, v;
|
int prec, v;
|
||||||
|
@ -2029,6 +2029,18 @@ int imagetopnm(opj_image_t * image, const char *outfile, int force_split)
|
||||||
const char *tmp = outfile;
|
const char *tmp = outfile;
|
||||||
char *destname;
|
char *destname;
|
||||||
|
|
||||||
|
fails = 0;
|
||||||
|
ncomp = image->numcomps;
|
||||||
|
for(ui = 0; ui < ncomp; ++ui) {
|
||||||
|
if(image->comps[ui].data == NULL) {
|
||||||
|
fprintf(stderr, "imagetopnm data[%u] == NULL\n",ui);
|
||||||
|
fails = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(fails) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
alpha = NULL;
|
alpha = NULL;
|
||||||
|
|
||||||
if ((prec = (int)image->comps[0].prec) > 16) {
|
if ((prec = (int)image->comps[0].prec) > 16) {
|
||||||
|
|
|
@ -539,11 +539,16 @@ static int infile_format(const char *fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
s = fname + strlen(fname) - 4;
|
s = fname + strlen(fname) - 4;
|
||||||
|
while(*s) {
|
||||||
fputs("\n===========================================\n", stderr);
|
if(*s == '.') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++s;
|
||||||
|
}
|
||||||
|
fputs("\n===============================================\n", stderr);
|
||||||
fprintf(stderr, "The extension of this file is incorrect.\n"
|
fprintf(stderr, "The extension of this file is incorrect.\n"
|
||||||
"FOUND %s. SHOULD BE %s\n", s, magic_s);
|
" FOUND '%s'. SHOULD BE '%s'", s, magic_s);
|
||||||
fputs("===========================================\n", stderr);
|
fputs("\n===============================================\n", stderr);
|
||||||
|
|
||||||
return magic_format;
|
return magic_format;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue