[trunk] Make sure to exit early instead of looping on every single pixels

This commit is contained in:
Mathieu Malaterre 2014-03-24 16:01:51 +00:00
parent 5a70e97f51
commit 18c5be69e9
1 changed files with 6 additions and 2 deletions

View File

@ -1867,8 +1867,12 @@ opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters) {
{
for(compno = 0; compno < numcomps; compno++)
{
if ( !fread(&c0, 1, 1, fp) )
fprintf(stderr, "\nError: fread return a number of element different from the expected.\n");
if ( !fread(&c0, 1, 1, fp) )
{
fprintf(stderr, "\nError: fread return a number of element different from the expected.\n");
opj_image_destroy(image);
return NULL;
}
if(one)
{
image->comps[compno].data[i] = c0;