From e7849c20d77d72412494fd327cbe34c53c96fc03 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 9 Jul 2011 16:22:51 +0000 Subject: [PATCH] cleanup fseek() usage --- ChangeLog | 12 ++++++++++-- src/frontend/help/readhelp.c | 4 ++-- src/frontend/inp.c | 2 +- src/frontend/nutinp.c | 2 +- src/frontend/outitf.c | 4 ++-- src/ngsconvert.c | 4 ++-- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f90af4003..5f8f25ff0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,15 @@ +2011-07-09 Robert Larice + * src/ngsconvert.c , + * src/frontend/inp.c , + * src/frontend/nutinp.c , + * src/frontend/outitf.c , + * src/frontend/help/readhelp.c : + cleanup fseek() usage + 2011-07-08 Holger Vogt - * display.c: replace error message by appropriate warning, if compiled + * display.c: replace error message by appropriate warning, if compiled as console application under MS Windows - + 2011-07-04 Holger Vogt * input.c: add ssize_t as SSIZE_T for MS Visual Studio diff --git a/src/frontend/help/readhelp.c b/src/frontend/help/readhelp.c index e69e85029..d5e829037 100644 --- a/src/frontend/help/readhelp.c +++ b/src/frontend/help/readhelp.c @@ -81,7 +81,7 @@ hlp_read(fplace *place) /* get the title */ if (!place->fp) place->fp = hlp_fopen(place->filename); if (!place->fp) return(NULL); - fseek(place->fp, place->fpos, 0); + fseek(place->fp, place->fpos, SEEK_SET); (void) fgets(buf, BSIZE_SP, place->fp); /* skip subject */ (void) fgets(buf, BSIZE_SP, place->fp); for (s = buf; *s && (*s != '\n'); s++) @@ -305,7 +305,7 @@ getsubject(fplace *place) if (!place->fp) place->fp = hlp_fopen(place->filename); if (!place->fp) return(NULL); - fseek(place->fp, place->fpos, 0); + fseek(place->fp, place->fpos, SEEK_SET); (void) fgets(buf, BSIZE_SP, place->fp); for (s = buf; *s && (*s != '\n'); s++) ; diff --git a/src/frontend/inp.c b/src/frontend/inp.c index a9287cbc6..4e32c67dd 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -1065,7 +1065,7 @@ com_source(wordlist *wl) fclose(tp); wl = wl->wl_next; } - fseek(fp, (long) 0, 0); + fseek(fp, 0L, SEEK_SET); } else fp = inp_pathopen(wl->wl_word, "r"); if (fp == NULL) { diff --git a/src/frontend/nutinp.c b/src/frontend/nutinp.c index e360a74b2..35f1946b8 100644 --- a/src/frontend/nutinp.c +++ b/src/frontend/nutinp.c @@ -230,7 +230,7 @@ nutcom_source(wordlist *wl) (void) fclose(tp); wl = wl->wl_next; } - (void) fseek(fp, (long) 0, 0); + (void) fseek(fp, 0L, SEEK_SET); } else fp = inp_pathopen(wl->wl_word, "r"); if (fp == NULL) { diff --git a/src/frontend/outitf.c b/src/frontend/outitf.c index c8a08d795..d69781bae 100644 --- a/src/frontend/outitf.c +++ b/src/frontend/outitf.c @@ -906,10 +906,10 @@ fileEnd(runDesc *run) if (run->fp != stdout) { place = ftell(run->fp); - fseek(run->fp, run->pointPos, 0); + fseek(run->fp, run->pointPos, SEEK_SET); fprintf(run->fp, "%d", run->pointCount); fprintf(stdout, "\nNo. of Data Rows : %d\n", run->pointCount); - fseek(run->fp, place, 0); + fseek(run->fp, place, SEEK_SET); } else { /* Yet another hack-around */ fprintf(stderr, "@@@ %ld %d\n", run->pointPos, run->pointCount); diff --git a/src/ngsconvert.c b/src/ngsconvert.c index d5c6aacb3..df6e11d43 100644 --- a/src/ngsconvert.c +++ b/src/ngsconvert.c @@ -156,9 +156,9 @@ oldread(char *name) * the file. */ i = ftell(fp); - (void) fseek(fp, (long) 0, 2); + (void) fseek(fp, 0L, SEEK_END); j = ftell(fp); - (void) fseek(fp, i, 0); + (void) fseek(fp, i, SEEK_SET); i = j - i; if (i % 8) { /* Data points are always 8 bytes... */ fprintf(cp_err, "Error: alignment error in data\n");