Revision: 71993 http://sourceforge.net/p/brlcad/code/71993 Author: starseeker Date: 2018-11-08 20:23:59 +0000 (Thu, 08 Nov 2018) Log Message: ----------- Try reversing r71563 and see if we get back large file support in MSVC
Modified Paths: -------------- brlcad/trunk/bench/pixcmp.c brlcad/trunk/include/bu/file.h brlcad/trunk/src/anim/anim_sort.c brlcad/trunk/src/conv/asc/asc2g.c brlcad/trunk/src/conv/dxf/dxf-g.c brlcad/trunk/src/conv/fast4-g.c brlcad/trunk/src/conv/g-acad.c brlcad/trunk/src/conv/iges/findp.c brlcad/trunk/src/conv/iges/g-iges.c brlcad/trunk/src/conv/iges/readrec.c brlcad/trunk/src/conv/iges/recsize.c brlcad/trunk/src/conv/nastran-g.c brlcad/trunk/src/conv/vdeck/vdeck.c brlcad/trunk/src/fbed/char.c brlcad/trunk/src/lgt/char.c brlcad/trunk/src/lgt/ir.c brlcad/trunk/src/lgt/octree.c brlcad/trunk/src/libbu/file.c brlcad/trunk/src/libbu/vfont.c brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_read.c brlcad/trunk/src/libicv/rot.c brlcad/trunk/src/librt/db5_scan.c brlcad/trunk/src/librt/db_corrupt.c brlcad/trunk/src/librt/db_io.c brlcad/trunk/src/librt/db_scan.c brlcad/trunk/src/rt/do.c brlcad/trunk/src/rt/view.c brlcad/trunk/src/util/ap-pix.c brlcad/trunk/src/util/bwcrop.c brlcad/trunk/src/util/bwhisteq.c brlcad/trunk/src/util/bwrot.c brlcad/trunk/src/util/bwscale.c brlcad/trunk/src/util/hex.c brlcad/trunk/src/util/pixcrop.c brlcad/trunk/src/util/pixrot.c brlcad/trunk/src/util/pixscale.c brlcad/trunk/src/util/plot3rot.c Modified: brlcad/trunk/bench/pixcmp.c =================================================================== --- brlcad/trunk/bench/pixcmp.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/bench/pixcmp.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -215,7 +215,7 @@ } /* skip requested pixels/bytes in FILE1 */ - if (f1_skip && fseek(f1, f1_skip, SEEK_SET)) { + if (f1_skip && bu_fseek(f1, f1_skip, SEEK_SET)) { bu_log("ERROR: Unable to seek %zd %s%s in FILE1\n", f1_skip, print_bytes?"byte":"pixel", @@ -225,7 +225,7 @@ } /* skip requested pixels in FILE2 */ - if (f2_skip && fseek(f2, f2_skip, SEEK_SET)) { + if (f2_skip && bu_fseek(f2, f2_skip, SEEK_SET)) { bu_log("ERROR: Unable to seek %zd %s%s in FILE2\n", f1_skip, print_bytes?"byte":"pixel", Modified: brlcad/trunk/include/bu/file.h =================================================================== --- brlcad/trunk/include/bu/file.h 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/include/bu/file.h 2018-11-08 20:23:59 UTC (rev 71993) @@ -171,6 +171,11 @@ BU_EXPORT extern char *bu_file_realpath(const char *path, char *resolved_path); +/** NEW: Do not use. */ +BU_EXPORT extern int bu_fseek(FILE *stream, off_t offset, int origin); +/** NEW: Do not use. */ +BU_EXPORT extern off_t bu_ftell(FILE *stream); + /** @} */ __END_DECLS Modified: brlcad/trunk/src/anim/anim_sort.c =================================================================== --- brlcad/trunk/src/anim/anim_sort.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/anim/anim_sort.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -100,11 +100,11 @@ } /* copy any lines preceding the first "start" command */ - last_pos = ftell(stdin); + last_pos = bu_ftell(stdin); while (bu_fgets(line, MAXLEN, stdin)!=NULL) { if (bu_strncmp(line, "start", 5)) { printf("%s", line); - last_pos = ftell(stdin); + last_pos = bu_ftell(stdin); } else break; } @@ -134,9 +134,9 @@ number = -1; success = 0; /* tells whether or not any frames have been found which have the current frame number*/ if (incremental) { - fseek(stdin, 0, 0); + bu_fseek(stdin, 0, 0); } else { - fseek(stdin, last_pos, 0); + bu_fseek(stdin, last_pos, 0); } reserve = MAXLEN*MAXLINES; @@ -159,7 +159,7 @@ printf("%s", line); if (!suppressed) printf("clean;\n"); success = 1; - last_pos = ftell(stdin); + last_pos = bu_ftell(stdin); } /* print contents until next "end" */ while (bu_fgets(line, MAXLEN, stdin)!=NULL) { Modified: brlcad/trunk/src/conv/asc/asc2g.c =================================================================== --- brlcad/trunk/src/conv/asc/asc2g.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/conv/asc/asc2g.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -1049,7 +1049,7 @@ name = bu_strdup(cp); /* Count up the number of poly data lines which follow */ - startpos = ftell(ifp); + startpos = bu_ftell(ifp); for (nlines = 0;; nlines++) { if (bu_fgets(buf, BUFSIZE, ifp) == NULL) break; if (buf[0] != ID_P_DATA) break; /* 'Q' */ @@ -1065,7 +1065,7 @@ pg->max_npts = 0; /* Return to first 'Q' record */ - fseek(ifp, startpos, 0); + bu_fseek(ifp, startpos, 0); for (nlines = 0; nlines < pg->npoly; nlines++) { struct rt_pg_face_internal *fp = &pg->poly[nlines]; Modified: brlcad/trunk/src/conv/dxf/dxf-g.c =================================================================== --- brlcad/trunk/src/conv/dxf/dxf-g.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/conv/dxf/dxf-g.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -629,7 +629,7 @@ } else if (!bu_strncmp(line, "BLOCK", 5)) { /* start of a new block */ BU_ALLOC(curr_block, struct block_list); - curr_block->offset = ftell(dxf); + curr_block->offset = bu_ftell(dxf); BU_LIST_INSERT(&(block_head), &(curr_block->l)); break; } @@ -1109,7 +1109,7 @@ break; } bu_free((char *)tmp_state, "curr_state"); - fseek(dxf, curr_state->file_offset, SEEK_SET); + bu_fseek(dxf, curr_state->file_offset, SEEK_SET); curr_state->sub_state = UNKNOWN_ENTITY_STATE; if (verbose) { bu_log("Popped state at end of inserted block (seeked to %ld)\n", curr_state->file_offset); @@ -1223,7 +1223,7 @@ BU_LIST_PUSH(&state_stack, &(curr_state->l)); curr_state = new_state; new_state = NULL; - fseek(dxf, curr_state->curr_block->offset, SEEK_SET); + bu_fseek(dxf, curr_state->curr_block->offset, SEEK_SET); curr_state->state = ENTITIES_SECTION; curr_state->sub_state = UNKNOWN_ENTITY_STATE; if (verbose) { @@ -2504,7 +2504,7 @@ BU_LIST_PUSH(&state_stack, &(curr_state->l)); curr_state = new_state; new_state = NULL; - fseek(dxf, curr_state->curr_block->offset, SEEK_SET); + bu_fseek(dxf, curr_state->curr_block->offset, SEEK_SET); curr_state->state = ENTITIES_SECTION; curr_state->sub_state = UNKNOWN_ENTITY_STATE; if (verbose) { @@ -3083,7 +3083,7 @@ size_t line_len; static int line_num = 0; - curr_state->file_offset = ftell(dxf); + curr_state->file_offset = bu_ftell(dxf); if (bu_fgets(line, MAX_LINE_SIZE, dxf) == NULL) { return ERROR_FLAG; Modified: brlcad/trunk/src/conv/fast4-g.c =================================================================== --- brlcad/trunk/src/conv/fast4-g.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/conv/fast4-g.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -2075,7 +2075,7 @@ off_t section_start; /* skip to start of next section */ - section_start = ftell(fpin); + section_start = bu_ftell(fpin); if (section_start < 0) { bu_exit(1, "Error: couldn't get input file's current file position.\n"); } @@ -2086,7 +2086,7 @@ bu_strncmp(line, "WALL", 4) && bu_strncmp(line, "VEHICLE", 7)) { - section_start = ftell(fpin); + section_start = bu_ftell(fpin); if (section_start < 0) { bu_exit(1, "Error: couldn't get input file's current file position.\n"); } @@ -2095,7 +2095,7 @@ } } /* seek to start of the section */ - fseek(fpin, section_start, SEEK_SET); + bu_fseek(fpin, section_start, SEEK_SET); } Modified: brlcad/trunk/src/conv/g-acad.c =================================================================== --- brlcad/trunk/src/conv/g-acad.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/conv/g-acad.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -649,7 +649,7 @@ /* Write out number of facet entities to .facet file */ rewind(fp); - fseek(fp, 46, 0); /* Re-position pointer to 2nd line */ + bu_fseek(fp, 46, 0); /* Re-position pointer to 2nd line */ fprintf(fp, "%d\n", regions_written); /* Write out number of regions */ fclose(fp); Modified: brlcad/trunk/src/conv/iges/findp.c =================================================================== --- brlcad/trunk/src/conv/iges/findp.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/conv/iges/findp.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -44,13 +44,13 @@ saverec = currec; /* save current record number */ - if (fseek(fd, 0, 2)) { + if (bu_fseek(fd, 0, 2)) { /* go to end of file */ bu_log("Cannot seek to end of file\n"); perror("Findp"); bu_exit(1, NULL); } - offset = ftell(fd); /* get file length */ + offset = bu_ftell(fd); /* get file length */ rec2 = offset/reclen; /* calculate record number for last record */ Readrec(rec2); /* read last record into "card" buffer */ dstart = 0; Modified: brlcad/trunk/src/conv/iges/g-iges.c =================================================================== --- brlcad/trunk/src/conv/iges/g-iges.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/conv/iges/g-iges.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -402,7 +402,7 @@ if (!multi_file) { /* Copy the parameter section from the temporary file to the output file */ - if ((fseek(fp_param, 0, 0))) { + if ((bu_fseek(fp_param, 0, 0))) { perror("g-iges"); bu_exit(1, "Cannot seek to start of temporary file\n"); } @@ -619,7 +619,7 @@ char copy_buffer[CP_BUF_SIZE] = {0}; /* Copy the parameter section from the temporary file to the output file */ - if ((fseek(fp_param, 0, 0))) { + if ((bu_fseek(fp_param, 0, 0))) { perror("g-iges"); bu_exit(1, "Cannot seek to start of temporary file\n"); } Modified: brlcad/trunk/src/conv/iges/readrec.c =================================================================== --- brlcad/trunk/src/conv/iges/readrec.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/conv/iges/readrec.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -44,7 +44,7 @@ currec = recno; offset = (recno - 1) * reclen; - if (fseek(fd, offset, 0)) { + if (bu_fseek(fd, offset, 0)) { bu_log("Error in seek\n"); perror("Readrec"); bu_exit(1, NULL); Modified: brlcad/trunk/src/conv/iges/recsize.c =================================================================== --- brlcad/trunk/src/conv/iges/recsize.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/conv/iges/recsize.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -68,7 +68,7 @@ if (k == (-1)) /* We didn't encounter an early EOF */ k = NRECS; - if (fseek(fd, 0, 0)) { + if (bu_fseek(fd, 0, 0)) { /* rewind file */ bu_log("Cannot rewind file\n"); perror("Recsize"); Modified: brlcad/trunk/src/conv/nastran-g.c =================================================================== --- brlcad/trunk/src/conv/nastran-g.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/conv/nastran-g.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -161,7 +161,7 @@ for (i=0; i < 20; i++) prev_rec[i][0] = '\0'; - fseek(fpin, start_off, SEEK_SET); + bu_fseek(fpin, start_off, SEEK_SET); line_count = bulk_data_start_line; tmp = bu_fgets(next_line, MAX_LINE_SIZE, fpin); @@ -1193,7 +1193,7 @@ if (bu_strncmp(line, "BEGIN BULK", 10)) continue; - start_off = ftell(fpin); + start_off = bu_ftell(fpin); break; } @@ -1219,7 +1219,7 @@ nmg_model = (struct model *)NULL; /* count grid points */ - fseek(fptmp, 0, SEEK_SET); + bu_fseek(fptmp, 0, SEEK_SET); while (bu_fgets(line, MAX_LINE_SIZE, fptmp)) { if (!bu_strncmp(line, "GRID", 4)) grid_count++; @@ -1229,7 +1229,7 @@ } /* get default values and properties */ - fseek(fptmp, 0, SEEK_SET); + bu_fseek(fptmp, 0, SEEK_SET); while (get_next_record(fptmp, 1, 0)) { if (!bu_strncmp(curr_rec[0], "BAROR", 5)) { /* get BAR defaults */ @@ -1262,7 +1262,7 @@ g_pts = (struct grid_point *)bu_calloc(grid_count, sizeof(struct grid_point), "grid points"); /* get all grid points */ - fseek(fptmp, 0, SEEK_SET); + bu_fseek(fptmp, 0, SEEK_SET); while (get_next_record(fptmp, 1, 0)) { int gid; int cid; @@ -1287,7 +1287,7 @@ /* find coordinate systems */ - fseek(fptmp, 0, SEEK_SET); + bu_fseek(fptmp, 0, SEEK_SET); while (get_next_record(fptmp, 1, 0)) { if (bu_strncmp(curr_rec[0], "CORD", 4)) continue; @@ -1306,7 +1306,7 @@ mk_id(fpout, nastran_file); /* get elements */ - fseek(fptmp, 0, SEEK_SET); + bu_fseek(fptmp, 0, SEEK_SET); while (get_next_record(fptmp, 1, 0)) { if (!bu_strncmp(curr_rec[0], "CBAR", 4)) get_cbar(); Modified: brlcad/trunk/src/conv/vdeck/vdeck.c =================================================================== --- brlcad/trunk/src/conv/vdeck/vdeck.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/conv/vdeck/vdeck.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -1218,7 +1218,7 @@ ewrite(solfp, LF, 1); /* Save space for number of solids and regions. */ - savsol = ftell(solfp); + savsol = bu_ftell(solfp); if (savsol < 0) { perror("ftell"); } @@ -1272,7 +1272,7 @@ /* Go back, and add number of solids and regions on second card. */ if (savsol >= 0) - fseek(solfp, savsol, 0); + bu_fseek(solfp, savsol, 0); itoa(nns, buff, 5); ewrite(solfp, buff, 5); Modified: brlcad/trunk/src/fbed/char.c =================================================================== --- brlcad/trunk/src/fbed/char.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/fbed/char.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -70,7 +70,7 @@ char_id = (int) line[char_count] & 0377; /* locate the bitmap for the character in the file */ - if (fseek(font.ffdes, SWABV(font.dir[char_id].addr) + font.offset, 0) == EOF) { + if (bu_fseek(font.ffdes, SWABV(font.dir[char_id].addr) + font.offset, 0) == EOF) { fb_log("fseek() to %zd failed.\n", (SWABV(font.dir[char_id].addr) + font.offset)); return; Modified: brlcad/trunk/src/lgt/char.c =================================================================== --- brlcad/trunk/src/lgt/char.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/lgt/char.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -70,7 +70,7 @@ } /* locate the bitmap for the character in the file */ - if (fseek(font.ffdes, SWABV(font.dir[char_id].addr)+font.offset, 0) == EOF) { + if (bu_fseek(font.ffdes, SWABV(font.dir[char_id].addr)+font.offset, 0) == EOF) { bu_log("fseek() to %zd failed.\n", (SWABV(font.dir[char_id].addr) + font.offset) ); Modified: brlcad/trunk/src/lgt/ir.c =================================================================== --- brlcad/trunk/src/lgt/ir.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/lgt/ir.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -152,7 +152,7 @@ static int get_IR(int x, int y, int *fahp, FILE *fp) { - if (fseek(fp, (y*IR_DATA_WID + x)*sizeof(int), 0) != 0) + if (bu_fseek(fp, (y*IR_DATA_WID + x)*sizeof(int), 0) != 0) return 0; else if (fread((char *) fahp, (int) sizeof(int), 1, fp) != 1) Modified: brlcad/trunk/src/lgt/octree.c =================================================================== --- brlcad/trunk/src/lgt/octree.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/lgt/octree.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -311,7 +311,7 @@ { PtList *ptp; F_Hdr_Ptlist hdr_ptlist; - off_t addr = ftell(fp); + off_t addr = bu_ftell(fp); if (addr < 0) { bu_log("Error: couldn't get input file's current file position.\n"); @@ -337,7 +337,7 @@ } if (hdr_ptlist.f_length > 0) { /* Go back and fudge point count. */ - if (fseek(fp, addr, 0)) { + if (bu_fseek(fp, addr, 0)) { bu_log("\"%s\"(%d) Fseek failed.\n", __FILE__, __LINE__); return 0; } @@ -349,7 +349,7 @@ return 0; } /* Re-position write pointer to end-of-file. */ - if (fseek(fp, 0, 2)) { + if (bu_fseek(fp, 0, 2)) { bu_log("\"%s\"(%d) Fseek failed.\n", __FILE__, __LINE__); return 0; } Modified: brlcad/trunk/src/libbu/file.c =================================================================== --- brlcad/trunk/src/libbu/file.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/libbu/file.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -385,6 +385,37 @@ } +int +bu_fseek(FILE *stream, off_t offset, int origin) +{ + int ret; + +#if defined(HAVE__FSEEKI64) && defined(SIZEOF_VOID_P) && SIZEOF_VOID_P == 8 + ret = _fseeki64(stream, offset, origin); +#else + ret = fseek(stream, offset, origin); +#endif + + return ret; +} + + +off_t +bu_ftell(FILE *stream) +{ + off_t ret; + +#if defined(HAVE__FTELLI64) && defined(SIZEOF_VOID_P) && SIZEOF_VOID_P == 8 + /* windows 64bit */ + ret = _ftelli64(stream); +#else + ret = ftell(stream); +#endif + + return ret; +} + + /* * Local Variables: * mode: C Modified: brlcad/trunk/src/libbu/vfont.c =================================================================== --- brlcad/trunk/src/libbu/vfont.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/libbu/vfont.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -99,7 +99,7 @@ /* Addresses of characters in the file are relative to point in * the file after the directory, so grab the current position. */ - font.offset = ftell(font.ffdes); + font.offset = bu_ftell(font.ffdes); return font; } Modified: brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_read.c =================================================================== --- brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_read.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/libgcv/plugins/fastgen4/fastgen4_read.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -2169,7 +2169,7 @@ off_t section_start; /* skip to start of next section */ - section_start = ftell(pstate->fpin); + section_start = bu_ftell(pstate->fpin); if (section_start < 0) { bu_bomb("Error: couldn't get input file's current file position."); } @@ -2180,7 +2180,7 @@ bu_strncmp(pstate->line, "WALL", 4) && bu_strncmp(pstate->line, "vehicle", 7)) { - section_start = ftell(pstate->fpin); + section_start = bu_ftell(pstate->fpin); if (section_start < 0) { bu_bomb("Error: couldn't get input file's current file position."); } @@ -2189,7 +2189,7 @@ } } /* seek to start of the section */ - fseek(pstate->fpin, section_start, SEEK_SET); + bu_fseek(pstate->fpin, section_start, SEEK_SET); } Modified: brlcad/trunk/src/libicv/rot.c =================================================================== --- brlcad/trunk/src/libicv/rot.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/libicv/rot.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -351,7 +351,7 @@ xout = (nyin - 1) - lasty; outbyte = ((yout * nyin) + xout) * pixbytes; if (outplace != outbyte) { - if (fseek(ofp, outbyte, SEEK_SET) < 0) { + if (bu_fseek(ofp, outbyte, SEEK_SET) < 0) { ret = 3; perror("fseek"); bu_log("ERROR: %s can't seek on output (ofp=%p, outbyte=%zd)\n", argv[0], (void *)ofp, outbyte); @@ -381,7 +381,7 @@ xout = yin; outbyte = ((yout * nyin) + xout) * pixbytes; if (outplace != outbyte) { - if (fseek(ofp, outbyte, SEEK_SET) < 0) { + if (bu_fseek(ofp, outbyte, SEEK_SET) < 0) { ret = 3; perror("fseek"); bu_log("ERROR: %s can't seek on output (ofp=%p, outbyte=%zd)\n", argv[0], (void *)ofp, outbyte); @@ -403,7 +403,7 @@ yout = (nyin - 1) - y + 1; outbyte = yout * scanbytes; if (outplace != outbyte) { - if (fseek(ofp, outbyte, SEEK_SET) < 0) { + if (bu_fseek(ofp, outbyte, SEEK_SET) < 0) { ret = 3; perror("fseek"); bu_log("ERROR: %s can't seek on output (ofp=%p, outbyte=%zd)\n", argv[0], (void *)ofp, outbyte); Modified: brlcad/trunk/src/librt/db5_scan.c =================================================================== --- brlcad/trunk/src/librt/db5_scan.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/librt/db5_scan.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -85,7 +85,7 @@ goto fatal; } for (;;) { - addr = ftell(dbip->dbi_fp); + addr = bu_ftell(dbip->dbi_fp); if ((got = db5_get_raw_internal_fp(&raw, dbip->dbi_fp)) < 0) { if (got == -1) break; /* EOF */ goto fatal; @@ -97,7 +97,7 @@ raw.buf = NULL; } } - dbip->dbi_eof = ftell(dbip->dbi_fp); + dbip->dbi_eof = bu_ftell(dbip->dbi_fp); rewind(dbip->dbi_fp); } Modified: brlcad/trunk/src/librt/db_corrupt.c =================================================================== --- brlcad/trunk/src/librt/db_corrupt.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/librt/db_corrupt.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -54,7 +54,7 @@ RT_CK_DBI(dbip); /* get into position */ - ret = fseek(dbip->dbi_fp, offset, 0); + ret = bu_fseek(dbip->dbi_fp, offset, 0); if (ret) { bu_log("Database seek failure, unable to seek [%s]\n", name); return 0; Modified: brlcad/trunk/src/librt/db_io.c =================================================================== --- brlcad/trunk/src/librt/db_io.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/librt/db_io.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -78,7 +78,7 @@ } bu_semaphore_acquire(BU_SEM_SYSCALL); - ret = fseek(dbip->dbi_fp, offset, 0); + ret = bu_fseek(dbip->dbi_fp, offset, 0); if (ret) bu_bomb("db_read: fseek error\n"); got = (size_t)fread(addr, 1, count, dbip->dbi_fp); @@ -192,7 +192,7 @@ bu_semaphore_acquire(BU_SEM_SYSCALL); bu_interrupt_suspend(); - (void)fseek(dbip->dbi_fp, offset, 0); + (void)bu_fseek(dbip->dbi_fp, offset, 0); got = fwrite(addr, 1, count, dbip->dbi_fp); fflush(dbip->dbi_fp); Modified: brlcad/trunk/src/librt/db_scan.c =================================================================== --- brlcad/trunk/src/librt/db_scan.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/librt/db_scan.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -96,7 +96,7 @@ return -1; } rewind(dbip->dbi_fp); - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); if (next < 0) { perror("ftell"); next = 0; @@ -108,7 +108,7 @@ totrec = 0; while (1) { nrec = 0; - if (fseek(dbip->dbi_fp, next, 0) != 0) { + if (bu_fseek(dbip->dbi_fp, next, 0) != 0) { bu_log("db_scan: fseek(offset=%zd) failure\n", next); return -1; } @@ -117,7 +117,7 @@ if (fread((char *)&record, sizeof record, 1, dbip->dbi_fp) != 1 || feof(dbip->dbi_fp)) break; - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); if (next < 0) { perror("db_scan: ftell: "); return -1; @@ -143,18 +143,18 @@ break; case ID_ARS_A: while (1) { - here = ftell(dbip->dbi_fp); + here = bu_ftell(dbip->dbi_fp); if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; DEBUG_PR(here, rec2); if (rec2.u_id != ID_ARS_B) { - fseek(dbip->dbi_fp, here, 0); + bu_fseek(dbip->dbi_fp, here, 0); break; } nrec++; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); handler(dbip, record.a.a_name, addr, nrec, RT_DIR_SOLID, client_data); break; case ID_ARS_B: @@ -168,7 +168,7 @@ if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); handler(dbip, record.ss.ss_name, addr, nrec, RT_DIR_SOLID, client_data); break; case ID_MATERIAL: @@ -189,17 +189,17 @@ break; case ID_P_HEAD: while (1) { - here = ftell(dbip->dbi_fp); + here = bu_ftell(dbip->dbi_fp); if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; DEBUG_PR(here, rec2); if (rec2.u_id != ID_P_DATA) { - fseek(dbip->dbi_fp, here, 0); + bu_fseek(dbip->dbi_fp, here, 0); break; } nrec++; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); handler(dbip, record.p.p_name, addr, nrec, RT_DIR_SOLID, client_data); break; case ID_P_DATA: @@ -208,12 +208,12 @@ case ID_BSOLID: while (1) { /* Find and skip subsequent BSURFs */ - here = ftell(dbip->dbi_fp); + here = bu_ftell(dbip->dbi_fp); if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; DEBUG_PR(here, rec2); if (rec2.u_id != ID_BSURF) { - fseek(dbip->dbi_fp, here, 0); + bu_fseek(dbip->dbi_fp, here, 0); break; } @@ -224,7 +224,7 @@ if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); } handler(dbip, record.B.B_name, addr, nrec, RT_DIR_SOLID, client_data); break; @@ -246,7 +246,7 @@ if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); handler(dbip, record.n.n_name, addr, nrec, RT_DIR_SOLID, client_data); break; case DBID_PARTICLE: @@ -259,7 +259,7 @@ if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); handler(dbip, record.pwr.pwr_name, addr, nrec, RT_DIR_SOLID, client_data); break; case DBID_NMG: @@ -269,7 +269,7 @@ if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); handler(dbip, record.nmg.N_name, addr, nrec, RT_DIR_SOLID, client_data); break; case DBID_SKETCH: @@ -279,7 +279,7 @@ if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); handler(dbip, record.skt.skt_name, addr, nrec, RT_DIR_SOLID, client_data); break; case DBID_EXTR: @@ -289,7 +289,7 @@ if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); handler(dbip, record.extr.ex_name, addr, nrec, RT_DIR_SOLID, client_data); break; case DBID_CLINE: @@ -302,7 +302,7 @@ if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); handler(dbip, record.s.s_name, addr, nrec, RT_DIR_SOLID, client_data); break; case ID_MEMB: @@ -310,17 +310,17 @@ break; case ID_COMB: while (1) { - here = ftell(dbip->dbi_fp); + here = bu_ftell(dbip->dbi_fp); if (fread((char *)&rec2, sizeof(rec2), 1, dbip->dbi_fp) != 1) break; DEBUG_PR(here, rec2); if (rec2.u_id != ID_MEMB) { - fseek(dbip->dbi_fp, here, 0); + bu_fseek(dbip->dbi_fp, here, 0); break; } nrec++; } - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); switch (record.c.c_flags) { default: case DBV4_NON_REGION: @@ -343,7 +343,7 @@ totrec += nrec; } dbip->dbi_nrec = totrec; - next = ftell(dbip->dbi_fp); + next = bu_ftell(dbip->dbi_fp); if (next < 0) dbip->dbi_eof = -1; else Modified: brlcad/trunk/src/rt/do.c =================================================================== --- brlcad/trunk/src/rt/do.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/rt/do.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -613,7 +613,7 @@ } if (outfp) { bu_semaphore_acquire(BU_SEM_SYSCALL); - if (fseek(outfp, cur_pixel*clt_o[1], 0) != 0) + if (bu_fseek(outfp, cur_pixel*clt_o[1], 0) != 0) fprintf(stderr, "fseek error\n"); if (fwrite(pixelp, size, 1, outfp) != 1) bu_exit(EXIT_FAILURE, "pixel fwrite error"); Modified: brlcad/trunk/src/rt/view.c =================================================================== --- brlcad/trunk/src/rt/view.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/rt/view.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -306,7 +306,7 @@ icv_writepixel(bif, ap->a_x, ap->a_y, ap->a_color); } else if (outfp != NULL) { bu_semaphore_acquire(BU_SEM_SYSCALL); - if (fseek(outfp, (ap->a_y*width*pwidth) + (ap->a_x*pwidth), 0) != 0) + if (bu_fseek(outfp, (ap->a_y*width*pwidth) + (ap->a_x*pwidth), 0) != 0) fprintf(stderr, "fseek error\n"); if (fwrite(p, 3, 1, outfp) != 1) bu_exit(EXIT_FAILURE, "pixel fwrite error"); @@ -512,7 +512,7 @@ size_t count; bu_semaphore_acquire(BU_SEM_SYSCALL); - if (fseek(outfp, ap->a_y*width*pwidth, 0) != 0) + if (bu_fseek(outfp, ap->a_y*width*pwidth, 0) != 0) fprintf(stderr, "fseek error\n"); count = fwrite(scanline[ap->a_y].sl_buf, sizeof(char), width*pwidth, outfp); Modified: brlcad/trunk/src/util/ap-pix.c =================================================================== --- brlcad/trunk/src/util/ap-pix.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/util/ap-pix.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -80,9 +80,9 @@ bu_exit(2, "%s: can't open \"%s\"\n", argv0, argv[1]); } yelfp = fopen(argv[1], "r"); - fseek(yelfp, 50*sizeof(yelline), 0); + bu_fseek(yelfp, 50*sizeof(yelline), 0); cyafp = fopen(argv[1], "r"); - fseek(cyafp, 100*sizeof(cyaline), 0); + bu_fseek(cyafp, 100*sizeof(cyaline), 0); line = 0; while ((int)fread(&cyaline, sizeof(cyaline), 1, cyafp) > 0) { Modified: brlcad/trunk/src/util/bwcrop.c =================================================================== --- brlcad/trunk/src/util/bwcrop.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/util/bwcrop.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -103,7 +103,7 @@ if (buf_start < 0) buf_start = 0; - fseek(ifp, buf_start * scanlen, 0); + bu_fseek(ifp, buf_start * scanlen, 0); ret = fread(buffer, scanlen, buflines, ifp); if (ret == 0) perror("fread"); Modified: brlcad/trunk/src/util/bwhisteq.c =================================================================== --- brlcad/trunk/src/util/bwhisteq.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/util/bwhisteq.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -105,7 +105,7 @@ fprintf(stderr, "result[%d] = %d\n", i, result[i]); } - fseek(fp, 0, 0); + bu_fseek(fp, 0, 0); while ((n = fread(buf, 1, BUFSIZE, fp)) > 0) { for (i = 0; i < n; i++) { long idx = buf[i]; Modified: brlcad/trunk/src/util/bwrot.c =================================================================== --- brlcad/trunk/src/util/bwrot.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/util/bwrot.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -358,7 +358,7 @@ xout = (nyin - 1) - lasty; outbyte = ((yout * nyin) + xout) * pixbytes; if (outplace != outbyte) { - if (fseek(ofp, outbyte, SEEK_SET) < 0) { + if (bu_fseek(ofp, outbyte, SEEK_SET) < 0) { ret = 3; perror("fseek"); bu_log("ERROR: %s can't seek on output (ofp=%p, outbyte=%zd)\n", bu_getprogname(), (void *)ofp, outbyte); @@ -384,7 +384,7 @@ xout = yin; outbyte = ((yout * nyin) + xout) * pixbytes; if (outplace != outbyte) { - if (fseek(ofp, outbyte, SEEK_SET) < 0) { + if (bu_fseek(ofp, outbyte, SEEK_SET) < 0) { ret = 3; perror("fseek"); bu_log("ERROR: %s can't seek on output (ofp=%p, outbyte=%zd)\n", bu_getprogname(), (void *)ofp, outbyte); @@ -402,7 +402,7 @@ yout = (nyin - 1) - y + 1; outbyte = yout * scanbytes; if (outplace != outbyte) { - if (fseek(ofp, outbyte, SEEK_SET) < 0) { + if (bu_fseek(ofp, outbyte, SEEK_SET) < 0) { ret = 3; perror("fseek"); bu_log("ERROR: %s can't seek on output (ofp=%p, outbyte=%zd)\n", bu_getprogname(), (void *)ofp, outbyte); Modified: brlcad/trunk/src/util/bwscale.c =================================================================== --- brlcad/trunk/src/util/bwscale.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/util/bwscale.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -87,7 +87,7 @@ buf_start = y - buflines/2; if (buf_start < 0) buf_start = 0; - if (fseek(buffp, buf_start * scanlen, 0) < 0) { + if (bu_fseek(buffp, buf_start * scanlen, 0) < 0) { fprintf(stderr, "bwscale: Can't seek to input pixel!\n"); /* bu_exit (3, NULL); */ } Modified: brlcad/trunk/src/util/hex.c =================================================================== --- brlcad/trunk/src/util/hex.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/util/hex.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -63,7 +63,7 @@ if (offset != 0) { /* skip over "offset" bytes first */ - if (fseek(fd, offset, 0)) { + if (bu_fseek(fd, offset, 0)) { /* If fseek fails, try reading our way to the desired offset. * The fseek will fail if we're reading from a pipe. Modified: brlcad/trunk/src/util/pixcrop.c =================================================================== --- brlcad/trunk/src/util/pixcrop.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/util/pixcrop.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -102,7 +102,7 @@ buf_start = y - buflines/2; if (buf_start < 0) buf_start = 0; - fseek(ifp, 0, 0); + bu_fseek(ifp, 0, 0); ret = fread(buffer, scanlen, 3*buflines, ifp); if (ret == 0) perror("fread"); Modified: brlcad/trunk/src/util/pixrot.c =================================================================== --- brlcad/trunk/src/util/pixrot.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/util/pixrot.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -190,7 +190,7 @@ xout = (nyin - 1) - lasty; outbyte = ((yout * nyin) + xout) * pixbytes; if (outplace != outbyte) { - if (fseek(ofp, outbyte, 0) < 0) { + if (bu_fseek(ofp, outbyte, 0) < 0) { bu_exit(3, "pixrot: Can't seek on output, yet I need to!\n"); } outplace = outbyte; @@ -215,7 +215,7 @@ xout = yin; outbyte = ((yout * nyin) + xout) * pixbytes; if (outplace != outbyte) { - if (fseek(ofp, outbyte, 0) < 0) { + if (bu_fseek(ofp, outbyte, 0) < 0) { bu_exit(3, "pixrot: Can't seek on output, yet I need to!\n"); } outplace = outbyte; @@ -232,7 +232,7 @@ yout = (nyin - 1) - y; outbyte = yout * scanbytes; if (outplace != outbyte) { - if (fseek(ofp, outbyte, 0) < 0) { + if (bu_fseek(ofp, outbyte, 0) < 0) { bu_exit(3, "pixrot: Can't seek on output, yet I need to!\n"); } outplace = outbyte; Modified: brlcad/trunk/src/util/pixscale.c =================================================================== --- brlcad/trunk/src/util/pixscale.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/util/pixscale.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -90,7 +90,7 @@ if (buf_start < 0) buf_start = 0; if (file_pos != buf_start * scanlen) { - if (fseek(buffp, buf_start * scanlen, 0) < 0) { + if (bu_fseek(buffp, buf_start * scanlen, 0) < 0) { bu_exit(3, "pixscale: Can't seek to input pixel! y=%d\n", y); } file_pos = buf_start * scanlen; Modified: brlcad/trunk/src/util/plot3rot.c =================================================================== --- brlcad/trunk/src/util/plot3rot.c 2018-11-08 18:47:48 UTC (rev 71992) +++ brlcad/trunk/src/util/plot3rot.c 2018-11-08 20:23:59 UTC (rev 71993) @@ -525,7 +525,7 @@ bu_log("plot3rot: unrecognized command '%c' (0x%x)\n", (isprint(c)) ? c : '?', c); - bu_log("plot3rot: ftell = %ld\n", ftell(fp)); + bu_log("plot3rot: ftell = %ld\n", bu_ftell(fp)); putchar(c); break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits