author | pohly <pohly> | 2004-08-24 20:52:45 (UTC) |
---|---|---|
committer | pohly <pohly> | 2004-08-24 20:52:45 (UTC) |
commit | 73253e93327cf4ef0932de1b4afb56af22a0f37e (patch) (side-by-side diff) | |
tree | 1c9a7a6dd3341e036a894d348a3372525d29acec /noncore/apps/opie-reader/ppm_expander.cpp | |
parent | e90847c784c48bd21bf8768cb38edb853b832697 (diff) | |
download | opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.zip opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.tar.gz opie-73253e93327cf4ef0932de1b4afb56af22a0f37e.tar.bz2 |
updated source to opie-reader 0.7g
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 @@ -5,12 +5,13 @@ #include <stdlib.h> //#include <unistd.h> #include <stdio.h> #include <string.h> #include <time.h> +#include "static.h" /*************************************************************************** * Interface avec les routines de compression */ #define METHOD_NB 2 /* nombre total de méthodes de compression */ @@ -62,32 +63,32 @@ int ppm_expander::home() return 1; } 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); needppmend = true; curblock = block; @@ -103,6 +104,13 @@ int ppm_expander::getch() { locate(curblock,0); c = ppm.PPM_Decode(); } outbytes++; return (c==SYM_EOF) ? EOF : c; } + +#ifndef __STATIC +extern "C" +{ + CExpander* newcodec() { return new ppm_expander; } +} +#endif |