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 | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/noncore/apps/opie-reader/ppm_expander.cpp b/noncore/apps/opie-reader/ppm_expander.cpp index fe2745c..ea5b955 100644 --- a/noncore/apps/opie-reader/ppm_expander.cpp +++ b/noncore/apps/opie-reader/ppm_expander.cpp @@ -7,8 +7,9 @@ //#include <unistd.h> #include <stdio.h> #include <string.h> #include <time.h> +#include "static.h" /*************************************************************************** * Interface avec les routines de compression */ @@ -64,28 +65,28 @@ int ppm_expander::home() if (fread(&maxnode,sizeof(maxnode),1,my_file_in) != 1) return 1; if (fread(&blocksize,sizeof(blocksize),1,my_file_in) != 1) return 1; if (fread(&numblocks,sizeof(numblocks),1,my_file_in) != 1) return 1; //fprintf(stderr,"<%u,%u,%u>\n",maxnode,blocksize,numblocks); - int err = locate(0,0); + locate(0,0); outbytes = 0; - return err; + return 0; } void ppm_expander::locate(unsigned int n) { locate(n/blocksize, n%blocksize); outbytes = n; } -int ppm_expander::locate(unsigned short block, unsigned int n) +void ppm_expander::locate(unsigned short block, unsigned int n) { if (needppmend) { ppm.PPM_End(); needppmend = false; } size_t fpos; fseek(my_file_in,STAT_MAGIC_SIZE+sizeof(maxnode)+sizeof(blocksize)+sizeof(numblocks)+block*sizeof(fpos),SEEK_SET); - if (fread(&fpos,sizeof(fpos),1,my_file_in) != 1) return 1; + fread(&fpos,sizeof(fpos),1,my_file_in); fseek(my_file_in,fpos,SEEK_SET); ppm.arith.Arith_DecodeInit(my_read_buf,buf_in,bufsize); int err=ppm.PPM_Init(maxnode); @@ -105,4 +106,11 @@ int ppm_expander::getch() { } outbytes++; return (c==SYM_EOF) ? EOF : c; } + +#ifndef __STATIC +extern "C" +{ + CExpander* newcodec() { return new ppm_expander; } +} +#endif |