Changeset 14512


Ignore:
Timestamp:
04/04/13 15:59:43 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added checks on fread to avoid compiler warnings on larsen

Location:
issm/trunk-jpl/src/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/IoModel.cpp

    r14453 r14512  
    338338
    339339                                /* Read the record length and the data type code: */
    340                                 fread(&record_length,sizeof(int),1,this->fid);
    341                                 fread(&record_code,sizeof(int),1,this->fid);
     340                                if(fread(&record_length,sizeof(int),1,this->fid)!=1) _error_("Cound not read record_length");
     341                                if(fread(&record_code  ,sizeof(int),1,this->fid)!=1) _error_("Cound not read record_code");
    342342
    343343                                #ifdef _HAVE_MPI_
     
    12881288
    12891289                        /*read the record length, and use it to skip this record: */
    1290                         fread(&record_length,sizeof(int),1,fid);
     1290                        if(fread(&record_length,sizeof(int),1,fid)!=1) _error_("Could not read record_length");
    12911291                        fseek(fid,record_length,SEEK_CUR);
    12921292                        lastindex=index;
     
    13351335                                /*Ok, we have found the correct string. Pass the record length, and read data type code: */
    13361336                                fseek(fid,sizeof(int),SEEK_CUR);
    1337                                 fread(&record_code,sizeof(int),1,fid);
     1337                                if(fread(&record_code,sizeof(int),1,fid)!=1) _error_("Could not read record_code");
    13381338
    13391339                                /*if record_code points to a vector, get its type (nodal or elementary): */
    1340                                 if(5<=record_code && record_code<=7)fread(&vector_type,sizeof(int),1,fid);
     1340                                if(5<=record_code && record_code<=7){
     1341                                        if(fread(&vector_type,sizeof(int),1,fid)!=1) _error_("Could not read vector_type");
     1342                                }
    13411343                                found=1;
    13421344                                break;
     
    13441346                        else{
    13451347                                /*This is not the correct string, read the record length, and use it to skip this record: */
    1346                                 fread(&record_length,sizeof(int),1,fid);
     1348                                if(fread(&record_length,sizeof(int),1,fid)!=1) _error_("Could not read record_length");
    13471349                                /*skip: */
    13481350                                fseek(fid,record_length,SEEK_CUR);
  • issm/trunk-jpl/src/c/shared/Exp/exp.h

    r14377 r14512  
    161161        if(pclosed) *pclosed=closed;
    162162        else         xDelete<bool>(closed);
     163
    163164} /*}}}*/
    164165/*DataSet* ExpRead(char* domainname){{{*/
  • issm/trunk-jpl/src/c/solutions/dakota_core.cpp

    r13787 r14512  
    5959        char*              dakota_output_file = NULL;
    6060        char*              dakota_error_file  = NULL;
     61        const char*        parallel_lib_string= "serial";
    6162        int                status=0;
    6263        Dakota::ModelLIter ml_iter;
     
    7576                // Instantiate/initialize the parallel library and problem description
    7677                // database objects.
    77                 Dakota::ParallelLibrary parallel_lib("serial"); //use our own ISSM Dakota library mode constructor, which only fires up Dakota on CPU 0.
     78                Dakota::ParallelLibrary parallel_lib(parallel_lib_string); //use our own ISSM Dakota library mode constructor, which only fires up Dakota on CPU 0.
    7879                Dakota::ProblemDescDB problem_db(parallel_lib);
    7980
Note: See TracChangeset for help on using the changeset viewer.