Diffstat (limited to 'noncore/apps/opie-reader/ppm_expander.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/ppm_expander.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/ppm_expander.cpp b/noncore/apps/opie-reader/ppm_expander.cpp index 2a4318b..61ef90e 100644 --- a/noncore/apps/opie-reader/ppm_expander.cpp +++ b/noncore/apps/opie-reader/ppm_expander.cpp @@ -25,33 +25,33 @@ char stat_magic[STAT_MAGIC_SIZE]={'P','P','M','S'}; #include "ppm_expander.h" ppm_expander::~ppm_expander() { if (needppmend) ppm.PPM_End(); ppm.arith.Arith_DecodeEnd(); if (buf_in!=NULL) delete [] buf_in; if (buf_out!=NULL) delete [] buf_out; if (my_read_buf != NULL) delete my_read_buf; if (my_file_in != NULL) fclose(my_file_in); } int ppm_expander::OpenFile(const char* infile) { my_file_in=fopen(infile,"rb"); - my_read_buf = new PPM_ReadBuf(my_file_in); + my_read_buf = new PPM_ReadBuf(my_file_in, this); return home(); } void ppm_expander::sizes(unsigned long& file, unsigned long& text) { struct stat _stat; fstat(fileno(my_file_in),&_stat); file = _stat.st_size; text = numblocks*blocksize; } int ppm_expander::home() { fseek(my_file_in,0, SEEK_SET); unsigned char header[STAT_MAGIC_SIZE]; size_t len=fread(header,1,STAT_MAGIC_SIZE,my_file_in); @@ -94,22 +94,31 @@ void ppm_expander::locate(unsigned short block, unsigned int n) for (int i = 0; i < n; i++) getch(); } int ppm_expander::getch() { if (curblock >= numblocks) return EOF; int c=ppm.PPM_Decode(); if (c == SYM_EOF) { if (++curblock >= numblocks) return EOF; locate(curblock,0); c = ppm.PPM_Decode(); } outbytes++; return (c==SYM_EOF) ? EOF : c; } +UINT PPM_ReadBuf::readbuf(UCHAR *buf,UINT len) + { + UINT len1; + parent->unsuspend(); + len1=fread(buf,1,len,my_file_in); + return len1; + } + + #ifndef __STATIC extern "C" { CExpander* newcodec() { return new ppm_expander; } } #endif |