update substream.patch.

This commit is contained in:
small_leek 2020-12-17 10:23:44 +08:00 committed by Gitee
parent d247e5b800
commit 0000d6e140

View File

@ -4,20 +4,14 @@
} }
int read(void *buffer, size_t size, size_t count) { int read(void *buffer, size_t size, size_t count) {
- if(substream) return substream->read(buffer, size, count);
+ //if(substream) return substream->read(buffer, size, count);
return _io->read_proc(buffer, (unsigned)size, (unsigned)count, _handle); return _io->read_proc(buffer, (unsigned)size, (unsigned)count, _handle);
} }
int seek(INT64 offset, int origin) { int seek(INT64 offset, int origin) {
- if(substream) return substream->seek(offset, origin);
+ //if(substream) return substream->seek(offset, origin);
return _io->seek_proc(_handle, (long)offset, origin); return _io->seek_proc(_handle, (long)offset, origin);
} }
INT64 tell() { INT64 tell() {
- if(substream) return substream->tell();
+ //if(substream) return substream->tell();
return _io->tell_proc(_handle); return _io->tell_proc(_handle);
} }
@ -25,15 +19,11 @@
int get_char() { int get_char() {
int c = 0; int c = 0;
- if(substream) return substream->get_char();
+ //if(substream) return substream->get_char();
if(!_io->read_proc(&c, 1, 1, _handle)) return -1; if(!_io->read_proc(&c, 1, 1, _handle)) return -1;
return c; return c;
} }
char* gets(char *buffer, int length) { char* gets(char *buffer, int length) {
- if (substream) return substream->gets(buffer, length);
+ //if (substream) return substream->gets(buffer, length);
memset(buffer, 0, length); memset(buffer, 0, length);
for(int i = 0; i < length; i++) { for(int i = 0; i < length; i++) {
if(!_io->read_proc(&buffer[i], 1, 1, _handle)) if(!_io->read_proc(&buffer[i], 1, 1, _handle))
@ -41,8 +31,6 @@
std::string buffer; std::string buffer;
char element = 0; char element = 0;
bool bDone = false; bool bDone = false;
- if(substream) return substream->scanf_one(fmt,val);
+ //if(substream) return substream->scanf_one(fmt,val);
do { do {
if(_io->read_proc(&element, 1, 1, _handle) == 1) { if(_io->read_proc(&element, 1, 1, _handle) == 1) {
switch(element) { switch(element) {
@ -50,8 +38,6 @@
} }
int eof() { int eof() {
- if(substream) return substream->eof();
+ //if(substream) return substream->eof();
return (_io->tell_proc(_handle) >= _eof); return (_io->tell_proc(_handle) >= _eof);
} }