vc++ sillyisms

This commit is contained in:
David Rose 2002-08-05 15:06:04 +00:00
parent ff61d64eb3
commit d068b1b24a

View File

@ -111,8 +111,8 @@ seekoff(streamoff off, ios::seek_dir dir, int mode) {
// egptr(). // egptr().
// Use this to determine the actual file position right now. // Use this to determine the actual file position right now.
streamsize n = egptr() - gptr(); size_t n = egptr() - gptr();
streampos cur_pos = _cur - n; streampos cur_pos = _cur - (streampos)n;
streampos new_pos = cur_pos; streampos new_pos = cur_pos;
// Now adjust the data pointer appropriately. // Now adjust the data pointer appropriately.
@ -126,7 +126,7 @@ seekoff(streamoff off, ios::seek_dir dir, int mode) {
break; break;
case ios::end: case ios::end:
if (_end == 0) { if (_end == (streampos)0) {
// If the end of the file is unspecified, we have to seek to // If the end of the file is unspecified, we have to seek to
// find it. // find it.
_source->seekg(off, ios::end); _source->seekg(off, ios::end);
@ -175,7 +175,7 @@ overflow(int c) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
int SubStreamBuf:: int SubStreamBuf::
sync() { sync() {
streamsize n = egptr() - gptr(); size_t n = egptr() - gptr();
gbump(n); gbump(n);
return 0; return 0;
@ -200,14 +200,14 @@ underflow() {
// Sometimes underflow() is called even if the buffer is not empty. // Sometimes underflow() is called even if the buffer is not empty.
if (gptr() >= egptr()) { if (gptr() >= egptr()) {
if (_end != 0 && _cur >= _end) { if (_end != (streampos)0 && _cur >= _end) {
// We're done. // We're done.
return EOF; return EOF;
} }
size_t buffer_size = egptr() - eback(); size_t buffer_size = egptr() - eback();
size_t num_bytes; size_t num_bytes;
if (_end == 0 || _end - _cur > (streampos)buffer_size) { if (_end == (streampos)0 || _end - _cur > (streampos)buffer_size) {
// We have enough bytes in the input stream to fill our buffer. // We have enough bytes in the input stream to fill our buffer.
num_bytes = buffer_size; num_bytes = buffer_size;
} else { } else {
@ -226,7 +226,7 @@ underflow() {
// Oops, we didn't read what we thought we would. // Oops, we didn't read what we thought we would.
if (read_count == 0) { if (read_count == 0) {
_unused = buffer_size; _unused = buffer_size;
if (_end != 0) { if (_end != (streampos)0) {
_end = _cur; _end = _cur;
} }
return EOF; return EOF;