comparison 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
comparison
equal deleted inserted replaced
131:8461114e4f19 132:0ae0bc38e387
59 #include <cyg/infra/cyg_ass.h> // Assertion support 59 #include <cyg/infra/cyg_ass.h> // Assertion support
60 #include <errno.h> // Cyg_ErrNo 60 #include <errno.h> // Cyg_ErrNo
61 #include <stdio.h> // fpos_t and iobuf defines 61 #include <stdio.h> // fpos_t and iobuf defines
62 #include <stdlib.h> // free() 62 #include <stdlib.h> // free()
63 #include <cyg/libc/stdio/streambuf.hxx> // header for this file, just in case 63 #include <cyg/libc/stdio/streambuf.hxx> // header for this file, just in case
64 #include <limits.h> // INT_MAX
64 65
65 // FUNCTIONS 66 // FUNCTIONS
66 67
67 inline 68 inline
68 Cyg_StdioStreamBuffer::Cyg_StdioStreamBuffer( cyg_ucount32 size=BUFSIZ, 69 Cyg_StdioStreamBuffer::Cyg_StdioStreamBuffer( cyg_ucount32 size=BUFSIZ,
127 { 128 {
128 cyg_uint8 *buffer_max = &buffer_bottom[ get_buffer_size() ]; 129 cyg_uint8 *buffer_max = &buffer_bottom[ get_buffer_size() ];
129 130
130 current_buffer_position += bytes; 131 current_buffer_position += bytes;
131 132
132 CYG_ASSERT( (current_buffer_position <= buffer_top), 133 // INT_MAX is used by some callers to mean infinite.
134 CYG_ASSERT( (current_buffer_position <= buffer_top)
135 || (get_buffer_size() == INT_MAX),
133 "read too many bytes from buffer" ); 136 "read too many bytes from buffer" );
134 137
135 if (current_buffer_position == buffer_max) 138 if (current_buffer_position == buffer_max)
136 current_buffer_position = buffer_top = &buffer_bottom[0]; 139 current_buffer_position = buffer_top = &buffer_bottom[0];
137 140
152 inline void 155 inline void
153 Cyg_StdioStreamBuffer::set_bytes_written( cyg_ucount32 bytes ) 156 Cyg_StdioStreamBuffer::set_bytes_written( cyg_ucount32 bytes )
154 { 157 {
155 buffer_top += bytes; 158 buffer_top += bytes;
156 159
157 CYG_ASSERT( (buffer_top <= &buffer_bottom[ get_buffer_size() ]), 160 // INT_MAX is used by some callers to mean infinite.
161 CYG_ASSERT( (buffer_top <= &buffer_bottom[ get_buffer_size() ])
162 || (get_buffer_size() == INT_MAX),
158 "wrote too many bytes into buffer" ); 163 "wrote too many bytes into buffer" );
159 } // set_bytes_written() 164 } // set_bytes_written()
160 165
161 166
162 inline void 167 inline void