changeset 2306:d68e3769e3a1

* include/stdio.h: Make fpos_t be signed to allow negative SEEK_CUR offsets to fseek(). * include/stream.inl (set_position): If SEEK_CUR, then if having to reconcile difference between position and underlying file position, then requested seek position needs adjusting for buffer size. Both above reported and analysed by Ivan Djelic.
author jlarmour
date Wed, 27 Sep 2006 16:18:18 +0000
parents 94516b63a992
children 18b8ece95018
files packages/language/c/libc/stdio/current/ChangeLog packages/language/c/libc/stdio/current/include/stdio.h packages/language/c/libc/stdio/current/include/stream.inl
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/packages/language/c/libc/stdio/current/ChangeLog
+++ b/packages/language/c/libc/stdio/current/ChangeLog
@@ -1,3 +1,13 @@
+2006-09-27  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* include/stdio.h: Make fpos_t be signed to allow negative
+	SEEK_CUR offsets to fseek().
+	* include/stream.inl (set_position): If SEEK_CUR, then if
+	having to reconcile difference between position and underlying
+	file position, then requested seek position needs adjusting
+	for buffer size.
+	Both above reported and analysed by Ivan Djelic.
+
 2006-09-26  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* src/common/stream.cxx (read): Only update position after direct
--- a/packages/language/c/libc/stdio/current/include/stdio.h
+++ b/packages/language/c/libc/stdio/current/include/stdio.h
@@ -89,7 +89,7 @@
 
 // A type capable of specifying uniquely every file position - ISO C
 // standard chap 7.9.1
-typedef cyg_ucount32 fpos_t;
+typedef cyg_count32 fpos_t;
 
 
 // FILE is just cast to an address here. It is uncast internally to the
--- a/packages/language/c/libc/stdio/current/include/stream.inl
+++ b/packages/language/c/libc/stdio/current/include/stream.inl
@@ -442,6 +442,7 @@ Cyg_StdioStream::set_position( fpos_t po
 
         if (whence == SEEK_CUR) {
             position += bytesavail;
+            pos -= bytesavail;
         }
     } //endif (whence != SEEK_END)