Commit 618dce304ede09d4392093c53cc3932a87467796
1 parent
683f216a
removed warnings from Agilent reader
Showing
1 changed file
with
15 additions
and
3 deletions
Show diff stats
stim/envi/envi.h
... | ... | @@ -359,11 +359,23 @@ public: |
359 | 359 | |
360 | 360 | fseek(f, 9, SEEK_SET); //seek to the number of bands |
361 | 361 | short b; //allocate space for the number of bands |
362 | - fread(&b, sizeof(short), 1, f); //read the number of bands | |
362 | + size_t nread = fread(&b, sizeof(short), 1, f); //read the number of bands | |
363 | + if(nread != 1){ | |
364 | + std::cout<<"Error reading band number from Agilent file."<<std::endl; | |
365 | + exit(1); | |
366 | + } | |
363 | 367 | fseek(f, 13, SEEK_CUR); //skip the the x and y dimensions |
364 | 368 | short x, y; |
365 | - fread(&x, sizeof(short), 1, f); //read the image x and y size | |
366 | - fread(&y, sizeof(short), 1, f); | |
369 | + nread = fread(&x, sizeof(short), 1, f); //read the image x and y size | |
370 | + if(nread != 1){ | |
371 | + std::cout<<"Error reading X dimension from Agilent file."<<std::endl; | |
372 | + exit(1); | |
373 | + } | |
374 | + nread = fread(&y, sizeof(short), 1, f); | |
375 | + if(nread != 1){ | |
376 | + std::cout<<"Error reading Y dimension from Agilent file."<<std::endl; | |
377 | + exit(1); | |
378 | + } | |
367 | 379 | fclose(f); //close the file |
368 | 380 | |
369 | 381 | //store the information from the Agilent header in the ENVI header | ... | ... |