diff packages/language/c/libc/stdio/current/include/streambuf.inl @ 132:0ae0bc38e387 ecos-sw-2000-10-31

Merge from eCos master repository on 2000-10-31-00:30:36-GMT
author jlarmour
date Tue, 31 Oct 2000 20:53:09 +0000
parents 6ed91473a1cd
children b939e9cada46
line wrap: on
line diff
--- a/packages/language/c/libc/stdio/current/include/streambuf.inl
+++ b/packages/language/c/libc/stdio/current/include/streambuf.inl
@@ -61,6 +61,7 @@
 #include <stdio.h>                       // fpos_t and iobuf defines
 #include <stdlib.h>                      // free()
 #include <cyg/libc/stdio/streambuf.hxx>  // header for this file, just in case
+#include <limits.h>                      // INT_MAX
 
 // FUNCTIONS
     
@@ -129,7 +130,9 @@ Cyg_StdioStreamBuffer::set_bytes_read( c
 
     current_buffer_position += bytes;
 
-    CYG_ASSERT( (current_buffer_position <= buffer_top),
+    // INT_MAX is used by some callers to mean infinite.
+    CYG_ASSERT( (current_buffer_position <= buffer_top)
+                || (get_buffer_size() == INT_MAX),
                 "read too many bytes from buffer" );
 
     if (current_buffer_position == buffer_max)
@@ -154,7 +157,9 @@ Cyg_StdioStreamBuffer::set_bytes_written
 {
     buffer_top += bytes;
 
-    CYG_ASSERT( (buffer_top <= &buffer_bottom[ get_buffer_size() ]),
+    // INT_MAX is used by some callers to mean infinite.
+    CYG_ASSERT( (buffer_top <= &buffer_bottom[ get_buffer_size() ])
+                || (get_buffer_size() == INT_MAX),
                 "wrote too many bytes into buffer" );
 } // set_bytes_written()