diff --git a/fsliolib/fslio.c b/fsliolib/fslio.c index 44053fcf..27af6839 100644 --- a/fsliolib/fslio.c +++ b/fsliolib/fslio.c @@ -43,7 +43,7 @@ static int check_for_multiple_filenames(const char* filename); static int FslIgnoreMFQ=0; static int FslOverrideOutputType=-1; -#define FSLIOERR(x) { fprintf(stderr,"Error:: %s\n",(x)); fflush(stderr); exit(EXIT_FAILURE); } +#define FSLIOERR(x) do { fprintf(stderr,"Error:: %s\n",(x)); fflush(stderr); exit(EXIT_FAILURE); } while(0) /************************************************************ @@ -1992,7 +1992,7 @@ int FslClose(FSLIO *fslio) fprintf(stderr,"Error:: Could not write origin data to header file %s.\n", fslio->niftiptr->fname); return -1; - }; + } znzwrite(hdr,1,sizeof(struct dsr),hptr); znzclose(hptr); diff --git a/nifti2/nifti2_io.c b/nifti2/nifti2_io.c index 70c136e8..2b943f2a 100644 --- a/nifti2/nifti2_io.c +++ b/nifti2/nifti2_io.c @@ -8412,7 +8412,7 @@ static int unescape_string( char *str ) } else if( str[ii] == CR ) { /* is a carriage return */ if( str[ii+1] == LF ){ str[jj] = LF ; ii++ ; nn++ ; } /* CR LF */ - else { str[jj] = LF ; ; nn++ ; } /* CR only */ + else { str[jj] = LF ; nn++ ; } /* CR only */ } else { /* is a normal character, just copy to output */ diff --git a/niftilib/nifti1_io.c b/niftilib/nifti1_io.c index c9142554..2f17e91f 100644 --- a/niftilib/nifti1_io.c +++ b/niftilib/nifti1_io.c @@ -6276,7 +6276,7 @@ static int unescape_string( char *str ) } else if( str[ii] == CR ) { /* is a carriage return */ if( str[ii+1] == LF ){ str[jj] = LF ; ii++ ; nn++ ; } /* CR LF */ - else { str[jj] = LF ; ; nn++ ; } /* CR only */ + else { str[jj] = LF ; nn++ ; } /* CR only */ } else { /* is a normal character, just copy to output */ diff --git a/niftilib/nifti_tester001.c b/niftilib/nifti_tester001.c index 126e6bd6..ed86a87c 100644 --- a/niftilib/nifti_tester001.c +++ b/niftilib/nifti_tester001.c @@ -459,16 +459,16 @@ int main (int argc, const char *argv[]) /* * call nifti_datatype_string with all possible values */ -#define nifti_datatype_test(constant,string) \ - { \ - char buf[64]; \ - snprintf(buf,sizeof(buf),"nifti_datatype_string %s",string); \ - PrintTest( \ - buf, \ - strcmp(nifti_datatype_string(constant),string) != 0, \ - true, \ - &Errors); \ - } +#define nifti_datatype_test(constant,string) \ + do { \ + char buf[64]; \ + snprintf(buf,sizeof(buf),"nifti_datatype_string %s",string); \ + PrintTest( \ + buf, \ + strcmp(nifti_datatype_string(constant),string) != 0, \ + true, \ + &Errors); \ + } while(0) nifti_datatype_test(DT_UNKNOWN,"UNKNOWN"); nifti_datatype_test(DT_BINARY, "BINARY"); nifti_datatype_test(DT_INT8, "INT8"); @@ -486,16 +486,16 @@ int main (int argc, const char *argv[]) nifti_datatype_test(DT_COMPLEX128, "COMPLEX128"); nifti_datatype_test(DT_COMPLEX256, "COMPLEX256"); nifti_datatype_test(DT_RGB24, "RGB24"); -#define nifti_is_inttype_test(constant,rval) \ - { \ - char buf[64]; \ - snprintf(buf,sizeof(buf),"nifti_datatype_string %d",constant); \ - PrintTest( \ - buf, \ - nifti_is_inttype(constant) != (rval), \ - true, \ - &Errors); \ - } +#define nifti_is_inttype_test(constant,rval) \ + do { \ + char buf[64]; \ + snprintf(buf,sizeof(buf),"nifti_datatype_string %d",constant); \ + PrintTest( \ + buf, \ + nifti_is_inttype(constant) != (rval), \ + true, \ + &Errors); \ + } while(0) nifti_is_inttype_test(DT_UNKNOWN,0); nifti_is_inttype_test(DT_BINARY,0); nifti_is_inttype_test(DT_INT8,1); @@ -513,16 +513,16 @@ int main (int argc, const char *argv[]) nifti_is_inttype_test(DT_COMPLEX128,0); nifti_is_inttype_test(DT_COMPLEX256,0); nifti_is_inttype_test(DT_RGB24,1); -#define nifti_units_string_test(constant,string) \ - { \ - char buf[64]; \ - snprintf(buf,sizeof(buf),"nifti_units_string_test %s",string); \ - PrintTest( \ - buf, \ - strcmp(nifti_units_string(constant),string) != 0, \ - true, \ - &Errors); \ - } +#define nifti_units_string_test(constant,string) \ + do { \ + char buf[64]; \ + snprintf(buf,sizeof(buf),"nifti_units_string_test %s",string); \ + PrintTest( \ + buf, \ + strcmp(nifti_units_string(constant),string) != 0, \ + true, \ + &Errors); \ + } while(0) nifti_units_string_test(NIFTI_UNITS_METER,"m"); nifti_units_string_test(NIFTI_UNITS_MM,"mm"); nifti_units_string_test(NIFTI_UNITS_MICRON,"um"); @@ -532,16 +532,16 @@ int main (int argc, const char *argv[]) nifti_units_string_test(NIFTI_UNITS_HZ,"Hz"); nifti_units_string_test(NIFTI_UNITS_PPM,"ppm"); nifti_units_string_test(NIFTI_UNITS_RADS,"rad/s"); -#define nifti_intent_string_test(constant,string) \ - { \ - char buf[64]; \ - snprintf(buf,sizeof(buf),"nifti_intent_string %s",string); \ - PrintTest( \ - buf, \ - strcmp(nifti_intent_string(constant),string) != 0, \ - true, \ - &Errors); \ - } +#define nifti_intent_string_test(constant,string) \ + do { \ + char buf[64]; \ + snprintf(buf,sizeof(buf),"nifti_intent_string %s",string); \ + PrintTest( \ + buf, \ + strcmp(nifti_intent_string(constant),string) != 0, \ + true, \ + &Errors); \ + } while(0) nifti_intent_string_test(NIFTI_INTENT_CORREL,"Correlation statistic"); nifti_intent_string_test(NIFTI_INTENT_TTEST,"T-statistic"); nifti_intent_string_test(NIFTI_INTENT_FTEST,"F-statistic"); @@ -578,32 +578,32 @@ int main (int argc, const char *argv[]) nifti_intent_string_test(NIFTI_INTENT_DIMLESS,"Dimensionless number"); nifti_intent_string_test(-200,"Unknown"); -#define nifti_slice_string_test(constant,string) \ - { \ - char buf[64]; \ - snprintf(buf,sizeof(buf),"nifti_slice_string_test %s",string); \ - PrintTest( \ - buf, \ - strcmp(nifti_slice_string(constant),string) != 0, \ - true, \ - &Errors); \ - } +#define nifti_slice_string_test(constant,string) \ + do { \ + char buf[64]; \ + snprintf(buf,sizeof(buf),"nifti_slice_string_test %s",string); \ + PrintTest( \ + buf, \ + strcmp(nifti_slice_string(constant),string) != 0, \ + true, \ + &Errors); \ + } while(0) nifti_slice_string_test(NIFTI_SLICE_SEQ_INC,"sequential_increasing"); nifti_slice_string_test(NIFTI_SLICE_SEQ_DEC,"sequential_decreasing"); nifti_slice_string_test(NIFTI_SLICE_ALT_INC,"alternating_increasing"); nifti_slice_string_test(NIFTI_SLICE_ALT_DEC,"alternating_decreasing"); nifti_slice_string_test(NIFTI_SLICE_ALT_INC2,"alternating_increasing_2"); nifti_slice_string_test(NIFTI_SLICE_ALT_DEC2,"alternating_decreasing_2"); -#define nifti_orientation_string_test(constant,string) \ - { \ - char buf[64]; \ - snprintf(buf,sizeof(buf),"nifti_orientation_string_test %s",string); \ - PrintTest( \ - buf, \ - strcmp(nifti_orientation_string(constant),string) != 0, \ - true, \ - &Errors); \ - } +#define nifti_orientation_string_test(constant,string) \ + do { \ + char buf[64]; \ + snprintf(buf,sizeof(buf),"nifti_orientation_string_test %s",string); \ + PrintTest( \ + buf, \ + strcmp(nifti_orientation_string(constant),string) != 0, \ + true, \ + &Errors); \ + } while(0) nifti_orientation_string_test(NIFTI_L2R,"Left-to-Right"); nifti_orientation_string_test(NIFTI_R2L,"Right-to-Left"); nifti_orientation_string_test(NIFTI_P2A,"Posterior-to-Anterior"); @@ -611,19 +611,19 @@ int main (int argc, const char *argv[]) nifti_orientation_string_test(NIFTI_I2S,"Inferior-to-Superior"); nifti_orientation_string_test(NIFTI_S2I,"Superior-to-Inferior"); -#define nifti_datatype_sizes_test(constant,Nbyper,Swapsize) \ - { \ - int nbyper; \ - int swapsize; \ - char buf[64]; \ - snprintf(buf,sizeof(buf),"nifti_datatype_sizes_test %d",constant); \ - nifti_datatype_sizes(constant,&nbyper,&swapsize); \ - PrintTest( \ - buf, \ - nbyper != (Nbyper) || swapsize != (Swapsize), \ - true, \ - &Errors); \ - } +#define nifti_datatype_sizes_test(constant,Nbyper,Swapsize) \ + do { \ + int nbyper; \ + int swapsize; \ + char buf[64]; \ + snprintf(buf,sizeof(buf),"nifti_datatype_sizes_test %d",constant); \ + nifti_datatype_sizes(constant,&nbyper,&swapsize); \ + PrintTest( \ + buf, \ + nbyper != (Nbyper) || swapsize != (Swapsize), \ + true, \ + &Errors); \ + } while(0) nifti_datatype_sizes_test(DT_UINT8,1,0); nifti_datatype_sizes_test(DT_UINT16,2,2);