Browse Source

cleanup fseek() usage

rlar 15 years ago
parent
commit
e7849c20d7
  1. 12
      ChangeLog
  2. 4
      src/frontend/help/readhelp.c
  3. 2
      src/frontend/inp.c
  4. 2
      src/frontend/nutinp.c
  5. 4
      src/frontend/outitf.c
  6. 4
      src/ngsconvert.c

12
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

4
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++)
;

2
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) {

2
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) {

4
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);

4
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");

Loading…
Cancel
Save