about summary refs log tree commit diff
path: root/libio/fileops.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-12-07 14:01:11 +0000
committerJakub Jelinek <jakub@redhat.com>2004-12-07 14:01:11 +0000
commit37756a838922d080448793aa5ab5e90c5aba78c1 (patch)
tree043efc2dbba1e4c350c65704af85bd5a628ea561 /libio/fileops.c
parent3b1744f208165b87fb8cd286d39b395c56257ee5 (diff)
downloadglibc-37756a838922d080448793aa5ab5e90c5aba78c1.tar.gz
glibc-37756a838922d080448793aa5ab5e90c5aba78c1.tar.xz
glibc-37756a838922d080448793aa5ab5e90c5aba78c1.zip
Updated to fedora-glibc-20041207T1331
Diffstat (limited to 'libio/fileops.c')
-rw-r--r--libio/fileops.c50
1 files changed, 8 insertions, 42 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index 2d787d296f..19151cf188 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -1035,54 +1035,20 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
   if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
       && !_IO_in_backup (fp))
     {
-      /* Offset relative to start of main get area. */
-      _IO_off64_t rel_offset = (offset - fp->_offset
-				+ (fp->_IO_read_end - fp->_IO_read_base));
-      if (rel_offset >= 0)
+      _IO_off64_t start_offset = (fp->_offset
+				  - (fp->_IO_read_end - fp->_IO_buf_base));
+      if (offset >= start_offset && offset < fp->_offset)
 	{
-#if 0
-	  if (_IO_in_backup (fp))
-	    _IO_switch_to_main_get_area (fp);
-#endif
-	  if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
-	    {
-	      _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
-			fp->_IO_read_end);
-	      _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
-	      {
-		_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
-		goto resync;
-	      }
-	    }
-#ifdef TODO
-	    /* If we have streammarkers, seek forward by reading ahead. */
-	    if (_IO_have_markers (fp))
-	      {
-		int to_skip = rel_offset
-		  - (fp->_IO_read_ptr - fp->_IO_read_base);
-		if (ignore (to_skip) != to_skip)
-		  goto dumb;
-		_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
-		goto resync;
-	      }
-#endif
-	}
-#ifdef TODO
-      if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
-	{
-	  if (!_IO_in_backup (fp))
-	    _IO_switch_to_backup_area (fp);
-	  gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
+	  _IO_setg (fp, fp->_IO_buf_base,
+		    fp->_IO_buf_base + (offset - start_offset),
+		    fp->_IO_read_end);
+	  _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+
 	  _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
 	  goto resync;
 	}
-#endif
     }
 
-#ifdef TODO
-  INTUSE(_IO_unsave_markers) (fp);
-#endif
-
   if (fp->_flags & _IO_NO_READS)
     goto dumb;