|
1 This is an epoc port of zlib (http://www.cdrom.com/pub/infozip/zlib/) |
|
2 |
|
3 Changes made in getting zlib lib to compile. |
|
4 |
|
5 General Changes: |
|
6 ------------------ |
|
7 |
|
8 All .c files renamed to .cpp |
|
9 |
|
10 K&R function defintions are rewritten to conform with ansi C. |
|
11 |
|
12 |
|
13 |
|
14 ZLib.h: |
|
15 --------- |
|
16 Since all our files are going to be .cpp files we don't need the extern c stuff so thats been commented out. |
|
17 At the start of zlib.h, the macros ZEXPORT, ZEXPORTVA are set to nothing. ZEXTERN is set to IMPORT_C. |
|
18 At the end of zlib.h ZEXTERN is set to nothing. This is nasty and hacky but it involes the least |
|
19 amount of changes to the zlib code. Anyway it can go if we decide not to export to c interface. |
|
20 Every exported function has had EXPORT_C appended to its definition. This affects many files. Again |
|
21 if we decide not to export the c interface these changes can be reversed. |
|
22 |
|
23 |
|
24 ZUtil.h: |
|
25 ----------- |
|
26 Includes <e32std.h> at the top. |
|
27 Commented out bit of code which checks moew msvc and messes redefines fdopen as _fdopen. Lines 139 |
|
28 |
|
29 |
|
30 |
|
31 deflate.h: |
|
32 ------------ |
|
33 |
|
34 Added a STATIC_CAST to first two lines of _tr_tally_dist |
|
35 |
|
36 delate.cpp: |
|
37 ---------- |
|
38 |
|
39 #included <e32def.h> |
|
40 |
|
41 Altered C style casts in INSERT_STRING macro to STATIC_CAST and added some more casts |
|
42 |
|
43 Lines 1041 & 1211 commented out. They contained trhe name of a macro in a piece of code which was |
|
44 #defed out of the compliation process. Unforntately makmake didn't like it. |
|
45 |
|
46 MSDOS & MACOS? specific stuff has been commented out. I guess this should be replace with an appropriate |
|
47 #ifdef but I'm not sure what this should be yet. |
|
48 |
|
49 Added line 284 |
|
50 s->status = INIT_STATE; |
|
51 to fix zlib bug where a memory leak can occur when zalloc fails |
|
52 |
|
53 |
|
54 infblock.cpp |
|
55 ------------- |
|
56 |
|
57 This file has been modified to fix a bug in zlib 1.1.3 which can cause a crash when ZALLOC fails. |
|
58 Essentially what happens is that in certain circumstances s->sub.trees.blens can be deleted twice. |
|
59 I have altered infblock.cpp with a patch sent to me by jloup@gzip.org which fixes this problem. I guess |
|
60 this fix will appear in zlib 1.1.4. |
|
61 |
|
62 trees.h: |
|
63 ---------- |
|
64 The array sizes specified for _dist_code & _length_code have been removed from the square brackets as |
|
65 it conflicts with another extern definition which appears elsewhere in the code. |
|
66 |
|
67 trees.cpp: |
|
68 ------------ |
|
69 |
|
70 #included <e32def.h> |
|
71 |
|
72 STATIC_CASTS added on lines 594, 607, 679, 730, 225 |
|
73 |
|
74 |
|
75 inftrees.cpp: |
|
76 -------------- |
|
77 commented out unused formal parameter z in inflate_trees_fixed at line 399. Seems to be some global |
|
78 data in here. Something is going to have to be done about it. |
|
79 |
|
80 |
|
81 gzio.cpp: |
|
82 ---------- |
|
83 Swapped around includes for zconf.h and stdio.h so we don't get warnings about multiple defintions of |
|
84 NULL. |
|
85 gzprintf uses to much stack for epoc. Compliation gives a failure to link with _chkstk. Rather than |
|
86 reducing the size of the buffer, I'm going to allocate the buffer on the heap. |
|
87 |
|
88 |
|
89 zconf.h |
|
90 ----------- |
|
91 Commented out lines that include unistd.h |
|
92 |
|
93 Global Variables: |
|
94 ------------------- |
|
95 Since EPOC cannot support writeable global data some modifications were required to the global variables |
|
96 in zlib. Conveniently, however, all of the global variables which were no const did not need to be so |
|
97 and I believe their non const status was dues to backward compatibility with older compilers. The |
|
98 following global variables were made read only to facilitate a marm build. |
|
99 |
|
100 inftrees.cpp: |
|
101 ------------- |
|
102 |
|
103 fixed_td |
|
104 fixed_tl |
|
105 inflate_mask |
|
106 |
|
107 trees.cpp: |
|
108 ---------- |
|
109 |
|
110 static_bl_desc |
|
111 static_d_desc |
|
112 static_l_desc |
|
113 table |
|
114 z_verbose |
|
115 |
|
116 |
|
117 deflate.cpp: |
|
118 ------------- |
|
119 delateInit2::my_version |
|
120 |
|
121 |
|
122 Changes made to remove dependency on the c standard library. |
|
123 ------------------------------------------------------------- |
|
124 |
|
125 zutil.h |
|
126 ---------- |
|
127 the following macros are redefined to make use of the Epoc32 Mem class, zmemcpy, zmemcmp, |
|
128 zmemzero. |
|
129 |
|
130 zutil.cpp |
|
131 ---------- |
|
132 zcalloc and zfree now call memory functions defined in User. |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |