summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/ppm_expander.cpp
Unidiff
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.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/ppm_expander.cpp b/noncore/apps/opie-reader/ppm_expander.cpp
index 4f0a277..fe2745c 100644
--- a/noncore/apps/opie-reader/ppm_expander.cpp
+++ b/noncore/apps/opie-reader/ppm_expander.cpp
@@ -14,49 +14,49 @@
14 */ 14 */
15 15
16#define METHOD_NB 2 /* nombre total de méthodes de compression */ 16#define METHOD_NB 2 /* nombre total de méthodes de compression */
17 17
18#define METHOD_STORE 0 18#define METHOD_STORE 0
19#define METHOD_PPM 1 19#define METHOD_PPM 1
20 20
21 21
22#define DEFAULT_SUFFIX ".st" /* extension par défault */ 22#define DEFAULT_SUFFIX ".st" /* extension par défault */
23/* signature en début de fichier */ 23/* signature en début de fichier */
24#define STAT_MAGIC_SIZE 4 24#define STAT_MAGIC_SIZE 4
25char stat_magic[STAT_MAGIC_SIZE]={'P','P','M','S'}; 25char stat_magic[STAT_MAGIC_SIZE]={'P','P','M','S'};
26 26
27#include "ppm_expander.h" 27#include "ppm_expander.h"
28 28
29ppm_expander::~ppm_expander() { 29ppm_expander::~ppm_expander() {
30 if (needppmend) ppm.PPM_End(); 30 if (needppmend) ppm.PPM_End();
31 ppm.arith.Arith_DecodeEnd(); 31 ppm.arith.Arith_DecodeEnd();
32 if (buf_in!=NULL) delete [] buf_in; 32 if (buf_in!=NULL) delete [] buf_in;
33 if (buf_out!=NULL) delete [] buf_out; 33 if (buf_out!=NULL) delete [] buf_out;
34 if (my_read_buf != NULL) delete my_read_buf; 34 if (my_read_buf != NULL) delete my_read_buf;
35 if (my_file_in != NULL) fclose(my_file_in); 35 if (my_file_in != NULL) fclose(my_file_in);
36} 36}
37 37
38int ppm_expander::openfile(const char* infile) 38int ppm_expander::OpenFile(const char* infile)
39{ 39{
40 my_file_in=fopen(infile,"rb"); 40 my_file_in=fopen(infile,"rb");
41 my_read_buf = new PPM_ReadBuf(my_file_in); 41 my_read_buf = new PPM_ReadBuf(my_file_in);
42 return home(); 42 return home();
43} 43}
44 44
45void ppm_expander::sizes(unsigned long& file, unsigned long& text) 45void ppm_expander::sizes(unsigned long& file, unsigned long& text)
46{ 46{
47 struct stat _stat; 47 struct stat _stat;
48 fstat(fileno(my_file_in),&_stat); 48 fstat(fileno(my_file_in),&_stat);
49 file = _stat.st_size; 49 file = _stat.st_size;
50 text = numblocks*blocksize; 50 text = numblocks*blocksize;
51} 51}
52 52
53int ppm_expander::home() 53int ppm_expander::home()
54{ 54{
55 fseek(my_file_in,0, SEEK_SET); 55 fseek(my_file_in,0, SEEK_SET);
56 unsigned char header[STAT_MAGIC_SIZE]; 56 unsigned char header[STAT_MAGIC_SIZE];
57 size_t len=fread(header,1,STAT_MAGIC_SIZE,my_file_in); 57 size_t len=fread(header,1,STAT_MAGIC_SIZE,my_file_in);
58 if (strncmp((char*)header,stat_magic,STAT_MAGIC_SIZE)!=0) { 58 if (strncmp((char*)header,stat_magic,STAT_MAGIC_SIZE)!=0) {
59 return 1; 59 return 1;
60 } 60 }
61 if (len!=(STAT_MAGIC_SIZE)) { 61 if (len!=(STAT_MAGIC_SIZE)) {
62 return 1; 62 return 1;