fprintf(stderr, "ERROR -> failed to open %s for writing\n", name);
return 1;
}
- /* dont need name anymore */
+ /* don't need name anymore */
if( total > 256 ) {
free(name);
}
for (i = 0; i < w * h; i++) {
if (!fread(&value, 1, 1, f)) {
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
+ fclose(f);
return NULL;
}
image->comps[compno].data[i] = raw_cp->rawSigned?(char)value:value;
unsigned char temp;
if (!fread(&temp, 1, 1, f)) {
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
+ fclose(f);
return NULL;
}
value = temp << 8;
if (!fread(&temp, 1, 1, f)) {
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
+ fclose(f);
return NULL;
}
value += temp;
}
else {
fprintf(stderr,"OpenJPEG cannot encode raw components with bit depth higher than 16 bits.\n");
+ fclose(f);
return NULL;
}