Commit 618dce304ede09d4392093c53cc3932a87467796

Authored by David Mayerich
1 parent 683f216a

removed warnings from Agilent reader

Showing 1 changed file with 15 additions and 3 deletions   Show diff stats
@@ -359,11 +359,23 @@ public: @@ -359,11 +359,23 @@ public:
359 359
360 fseek(f, 9, SEEK_SET); //seek to the number of bands 360 fseek(f, 9, SEEK_SET); //seek to the number of bands
361 short b; //allocate space for the number of bands 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 fseek(f, 13, SEEK_CUR); //skip the the x and y dimensions 367 fseek(f, 13, SEEK_CUR); //skip the the x and y dimensions
364 short x, y; 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 fclose(f); //close the file 379 fclose(f); //close the file
368 380
369 //store the information from the Agilent header in the ENVI header 381 //store the information from the Agilent header in the ENVI header