diff --git a/global/par.c b/global/par.c index ac87c88..fecfe35 100644 --- a/global/par.c +++ b/global/par.c @@ -562,9 +562,9 @@ static Status get_varian_header(FILE *fp, String error_msg) return OK; } -static long get_varian_long(int offset) +static int get_varian_int(int offset) { - long x; + int x; if (swapped) { @@ -572,7 +572,7 @@ static long get_varian_long(int offset) SWAP(varian_header[offset+1], varian_header[offset+2], char); } - x = *((long *) (varian_header + offset)); + x = *((int *) (varian_header + offset)); return x; } @@ -591,7 +591,7 @@ static short get_varian_short(int offset) static Status check_varian_header(String error_msg) { - long nblocks, ntraces, np, ebytes, tbytes, /*bbytes,*/ d; + int nblocks, ntraces, np, ebytes, tbytes, /*bbytes,*/ d; short status; FILE *fp; @@ -605,17 +605,19 @@ static Status check_varian_header(String error_msg) FCLOSE(fp); /* numbers in parentheses are offsets into header */ - nblocks = get_varian_long(0); /* number of blocks in file */ - ntraces = get_varian_long(4); /* number of traces per block */ - np = get_varian_long(8); /* number of elements per trace */ - ebytes = get_varian_long(12); /* number of bytes per element */ - tbytes = get_varian_long(16); /* number of bytes per trace */ - /*bbytes = get_varian_long(20);*/ /* number of bytes per block */ + nblocks = get_varian_int(0); /* number of blocks in file */ + printf("nblocks = %d\n", nblocks); + ntraces = get_varian_int(4); /* number of traces per block */ + printf("ntraces = %d\n", ntraces); + np = get_varian_int(8); /* number of elements per trace */ + ebytes = get_varian_int(12); /* number of bytes per element */ + tbytes = get_varian_int(16); /* number of bytes per trace */ + /*bbytes = get_varian_int(20);*/ /* number of bytes per block */ /* short starting at 24 is software version */ status = get_varian_short(26); /* status of whole file */ /* long starting at 28 is number of block headers */ - if (ntraces != 1L) + if (ntraces != 1) RETURN_ERROR_MSG("can only process Varian data with #traces = 1"); if (np != npoints[0]) @@ -646,12 +648,12 @@ static Status check_varian_header(String error_msg) if (integer) { - if (ebytes == 2L) + if (ebytes == 2) { if (status & (1<<2)) RETURN_ERROR_MSG("Varian header has inconsistent byte information"); } - else if (ebytes == 4L) + else if (ebytes == 4) { if (!(status & (1<<2))) RETURN_ERROR_MSG("Varian header has inconsistent byte information"); @@ -666,7 +668,7 @@ static Status check_varian_header(String error_msg) } else /* !integer, i.e. floating point */ { - if (ebytes != 4L) + if (ebytes != 4) RETURN_ERROR_MSG("Varian header has inconsistent byte information"); }