-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 17-Oct-06, at 10:07 AM, John MacFarlane wrote:
I'm getting strange behavior with input-port-byte-position. ...
Thanks for the bug report. The problem is in the function ___device_file_seek_raw_virt in lib/os_io.c (the new position was not being returned). Please update that function as follows and recompile Gambit, and the system will be consistent with the documentation.
Marc
___HIDDEN ___SCMOBJ ___device_file_seek_raw_virt ___P((___device_stream *self, ___stream_index *pos, int whence), (self, pos, whence) ___device_stream *self; ___stream_index *pos; int whence;) { ___device_file *d = ___CAST(___device_file*,self);
if (d->base.base.read_stage == ___STAGE_OPEN || d->base.base.write_stage == ___STAGE_OPEN) { #ifndef USE_POSIX #ifndef USE_WIN32
int new_pos; FILE *stream = d->stream;
if (stream == 0) stream = stdout;
if (fseek (stream, *pos, whence) < 0 || (new_pos = ftell (stream)) < 0) return err_code_from_errno ();
*pos = new_pos; /************** ADD THIS *******************/
#endif #endif
#ifdef USE_POSIX
int new_pos;
if ((new_pos = lseek (d->fd, *pos, whence)) < 0) return err_code_from_errno ();
*pos = new_pos; /************** ADD THIS *******************/
#endif
#ifdef USE_WIN32
...
#endif }
return ___FIX(___NO_ERR); }