* apply a patch by hamish (as part of GCI) that lets fseek() discard 
  characters pushed onto the stream via ungetc()

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40055 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2011-01-01 19:04:32 +00:00
parent cda7f65b32
commit bd2a7a1a44
2 changed files with 4 additions and 4 deletions
@@ -1028,14 +1028,14 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
{ {
/* Offset relative to start of main get area. */ /* Offset relative to start of main get area. */
_IO_off64_t rel_offset = (offset - fp->_offset _IO_off64_t rel_offset = (offset - fp->_offset
+ (fp->_IO_read_end - fp->_IO_read_base)); + (fp->_IO_read_end - fp->_IO_buf_base));
if (rel_offset >= 0) if (rel_offset >= 0)
{ {
#if 0 #if 0
if (_IO_in_backup (fp)) if (_IO_in_backup (fp))
_IO_switch_to_main_get_area (fp); _IO_switch_to_main_get_area (fp);
#endif #endif
if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base) if (rel_offset <= fp->_IO_read_end - fp->_IO_buf_base)
{ {
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset, _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
fp->_IO_read_end); fp->_IO_read_end);
@@ -638,14 +638,14 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
{ {
/* Offset relative to start of main get area. */ /* Offset relative to start of main get area. */
_IO_off64_t rel_offset = (offset - fp->_offset _IO_off64_t rel_offset = (offset - fp->_offset
+ (fp->_IO_read_end - fp->_IO_read_base)); + (fp->_IO_read_end - fp->_IO_buf_base));
if (rel_offset >= 0) if (rel_offset >= 0)
{ {
#if 0 #if 0
if (_IO_in_backup (fp)) if (_IO_in_backup (fp))
_IO_switch_to_main_get_area (fp); _IO_switch_to_main_get_area (fp);
#endif #endif
if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base) if (rel_offset <= fp->_IO_read_end - fp->_IO_buf_base)
{ {
enum __codecvt_result status; enum __codecvt_result status;
struct _IO_codecvt *cd = fp->_codecvt; struct _IO_codecvt *cd = fp->_codecvt;