hpdf 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/History +57 -0
  2. data/License +25 -0
  3. data/README +165 -0
  4. data/examples/arc_demo.rb +82 -0
  5. data/examples/demo.rb +92 -0
  6. data/examples/encryption.rb +41 -0
  7. data/examples/ext_gstater_demo.rb +171 -0
  8. data/examples/font_demo.rb +67 -0
  9. data/examples/jpfont_demo.rb +122 -0
  10. data/examples/line_demo.rb +301 -0
  11. data/examples/slide_show_demo.rb +139 -0
  12. data/examples/text_demo2.rb +189 -0
  13. data/examples/ttfont_demo.rb +106 -0
  14. data/ext/extconf.rb +6 -0
  15. data/ext/hpdf.c +3779 -0
  16. data/ext/hpdf_annotation.c +415 -0
  17. data/ext/hpdf_array.c +344 -0
  18. data/ext/hpdf_binary.c +117 -0
  19. data/ext/hpdf_boolean.c +47 -0
  20. data/ext/hpdf_catalog.c +354 -0
  21. data/ext/hpdf_destination.c +339 -0
  22. data/ext/hpdf_dict.c +488 -0
  23. data/ext/hpdf_doc.c +2020 -0
  24. data/ext/hpdf_doc_png.c +137 -0
  25. data/ext/hpdf_encoder.c +2991 -0
  26. data/ext/hpdf_encoder_cns.c +36359 -0
  27. data/ext/hpdf_encoder_cnt.c +15307 -0
  28. data/ext/hpdf_encoder_jp.c +16125 -0
  29. data/ext/hpdf_encoder_kr.c +27978 -0
  30. data/ext/hpdf_encrypt.c +632 -0
  31. data/ext/hpdf_encryptdict.c +240 -0
  32. data/ext/hpdf_error.c +114 -0
  33. data/ext/hpdf_ext_gstate.c +150 -0
  34. data/ext/hpdf_font.c +229 -0
  35. data/ext/hpdf_font_cid.c +1030 -0
  36. data/ext/hpdf_font_tt.c +406 -0
  37. data/ext/hpdf_font_type1.c +391 -0
  38. data/ext/hpdf_fontdef.c +56 -0
  39. data/ext/hpdf_fontdef_base14.c +4506 -0
  40. data/ext/hpdf_fontdef_cid.c +194 -0
  41. data/ext/hpdf_fontdef_cns.c +471 -0
  42. data/ext/hpdf_fontdef_cnt.c +250 -0
  43. data/ext/hpdf_fontdef_jp.c +1904 -0
  44. data/ext/hpdf_fontdef_kr.c +1572 -0
  45. data/ext/hpdf_fontdef_tt.c +2230 -0
  46. data/ext/hpdf_fontdef_type1.c +524 -0
  47. data/ext/hpdf_gstate.c +119 -0
  48. data/ext/hpdf_image.c +568 -0
  49. data/ext/hpdf_image_png.c +424 -0
  50. data/ext/hpdf_info.c +164 -0
  51. data/ext/hpdf_list.c +333 -0
  52. data/ext/hpdf_mmgr.c +243 -0
  53. data/ext/hpdf_name.c +71 -0
  54. data/ext/hpdf_null.c +31 -0
  55. data/ext/hpdf_number.c +49 -0
  56. data/ext/hpdf_objects.c +172 -0
  57. data/ext/hpdf_outline.c +329 -0
  58. data/ext/hpdf_page_label.c +74 -0
  59. data/ext/hpdf_page_operator.c +2764 -0
  60. data/ext/hpdf_pages.c +1508 -0
  61. data/ext/hpdf_real.c +61 -0
  62. data/ext/hpdf_streams.c +1435 -0
  63. data/ext/hpdf_string.c +189 -0
  64. data/ext/hpdf_utils.c +438 -0
  65. data/ext/hpdf_xref.c +348 -0
  66. data/ext/include/hpdf.h +1227 -0
  67. data/ext/include/hpdf_annotation.h +74 -0
  68. data/ext/include/hpdf_catalog.h +81 -0
  69. data/ext/include/hpdf_conf.h +76 -0
  70. data/ext/include/hpdf_consts.h +549 -0
  71. data/ext/include/hpdf_destination.h +41 -0
  72. data/ext/include/hpdf_doc.h +159 -0
  73. data/ext/include/hpdf_encoder.h +311 -0
  74. data/ext/include/hpdf_encrypt.h +156 -0
  75. data/ext/include/hpdf_encryptdict.h +66 -0
  76. data/ext/include/hpdf_error.h +201 -0
  77. data/ext/include/hpdf_ext_gstate.h +38 -0
  78. data/ext/include/hpdf_font.h +112 -0
  79. data/ext/include/hpdf_fontdef.h +403 -0
  80. data/ext/include/hpdf_gstate.h +80 -0
  81. data/ext/include/hpdf_image.h +72 -0
  82. data/ext/include/hpdf_info.h +48 -0
  83. data/ext/include/hpdf_list.h +85 -0
  84. data/ext/include/hpdf_mmgr.h +82 -0
  85. data/ext/include/hpdf_objects.h +587 -0
  86. data/ext/include/hpdf_outline.h +74 -0
  87. data/ext/include/hpdf_page_label.h +35 -0
  88. data/ext/include/hpdf_pages.h +128 -0
  89. data/ext/include/hpdf_streams.h +276 -0
  90. data/ext/include/hpdf_types.h +488 -0
  91. data/ext/include/hpdf_utils.h +161 -0
  92. data/tests/arc_demo.rb +82 -0
  93. data/tests/demo.rb +91 -0
  94. data/tests/encryption.rb +41 -0
  95. data/tests/ext_gstater_demo.rb +171 -0
  96. data/tests/font_demo.rb +67 -0
  97. data/tests/line_demo.rb +301 -0
  98. data/tests/slide_show_demo.rb +139 -0
  99. data/tests/test_all_examples.rb +31 -0
  100. data/tests/text_demo2.rb +189 -0
  101. metadata +147 -0
@@ -0,0 +1,333 @@
1
+ /*
2
+ * << Haru Free PDF Library 2.0.0 >> -- hpdf_list.c
3
+ *
4
+ * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
5
+ *
6
+ * Permission to use, copy, modify, distribute and sell this software
7
+ * and its documentation for any purpose is hereby granted without fee,
8
+ * provided that the above copyright notice appear in all copies and
9
+ * that both that copyright notice and this permission notice appear
10
+ * in supporting documentation.
11
+ * It is provided "as is" without express or implied warranty.
12
+ *
13
+ */
14
+
15
+ #include "hpdf_conf.h"
16
+ #include "hpdf_utils.h"
17
+ #include "hpdf_consts.h"
18
+ #include "hpdf_list.h"
19
+
20
+ static HPDF_STATUS
21
+ Resize (HPDF_List list,
22
+ HPDF_UINT count);
23
+
24
+
25
+ /*
26
+ * HPDF_List_new
27
+ *
28
+ * mmgr : handle to a HPDF_MMgr object.
29
+ * items_per_block : number of increases of pointers.
30
+ *
31
+ * return: If HPDF_List_New success, it returns a handle to new HPDF_List
32
+ * object, otherwise it returns NULL.
33
+ *
34
+ */
35
+
36
+ HPDF_List
37
+ HPDF_List_New (HPDF_MMgr mmgr,
38
+ HPDF_UINT items_per_block)
39
+ {
40
+ HPDF_List list;
41
+
42
+ HPDF_PTRACE((" HPDF_List_New\n"));
43
+
44
+ if (mmgr == NULL)
45
+ return NULL;
46
+
47
+ list = (HPDF_List)HPDF_GetMem (mmgr, sizeof(HPDF_List_Rec));
48
+ if (list) {
49
+ list->mmgr = mmgr;
50
+ list->error = mmgr->error;
51
+ list->block_siz = 0;
52
+ list->items_per_block =
53
+ (items_per_block <= 0 ? HPDF_DEF_ITEMS_PER_BLOCK : items_per_block);
54
+ list->count = 0;
55
+ list->obj = NULL;
56
+ }
57
+
58
+ return list;
59
+ }
60
+
61
+ /*
62
+ * HPDF_List_add
63
+ *
64
+ * list : Pointer to a HPDF_List object.
65
+ * item : Pointer to a object to be added.
66
+ *
67
+ * return: If HPDF_List_Add success, it returns HPDF_OK.
68
+ * HPDF_FAILD_TO_ALLOC_MEM is returned when the expansion of the
69
+ * object list is failed.
70
+ *
71
+ */
72
+
73
+ HPDF_STATUS
74
+ HPDF_List_Add (HPDF_List list,
75
+ void *item)
76
+ {
77
+ HPDF_PTRACE((" HPDF_List_Add\n"));
78
+
79
+ if (list->count >= list->block_siz) {
80
+ HPDF_STATUS ret = Resize (list,
81
+ list->block_siz + list->items_per_block);
82
+
83
+ if (ret != HPDF_OK) {
84
+ return ret;
85
+ }
86
+ }
87
+
88
+ list->obj[list->count++] = item;
89
+ return HPDF_OK;
90
+ }
91
+
92
+
93
+ /*
94
+ * HPDF_List_Insert
95
+ *
96
+ * list : Pointer to a HPDF_List object.
97
+ * target : Pointer to the target object.
98
+ * item : Pointer to a object to be inserted.
99
+ *
100
+ * insert the item before the target.
101
+ *
102
+ * return: If HPDF_List_Add success, it returns HPDF_OK.
103
+ * HPDF_FAILD_TO_ALLOC_MEM is returned when the expansion of the
104
+ * object list is failed.
105
+ * HPDF_ITEM_NOT_FOUND is returned where the target object is not
106
+ * found.
107
+ *
108
+ */
109
+
110
+ HPDF_STATUS
111
+ HPDF_List_Insert (HPDF_List list,
112
+ void *target,
113
+ void *item)
114
+ {
115
+ HPDF_INT target_idx = HPDF_List_Find (list, target);
116
+ void *last_item = list->obj[list->count - 1];
117
+ HPDF_INT i;
118
+
119
+ HPDF_PTRACE((" HPDF_List_Insert\n"));
120
+
121
+ if (target_idx < 0)
122
+ return HPDF_ITEM_NOT_FOUND;
123
+
124
+ /* move the item of the list to behind one by one. */
125
+ for (i = list->count - 2; i >= target_idx; i--)
126
+ list->obj[i + 1] = list->obj[i];
127
+
128
+ list->obj[target_idx] = item;
129
+
130
+ return HPDF_List_Add (list, last_item);
131
+ }
132
+
133
+ /*
134
+ * HPDF_List_Remove
135
+ *
136
+ * Remove the object specified by item parameter from the list object. The
137
+ * memory area that the object uses is not released.
138
+ *
139
+ * list : Pointer to a HPDF_List object.
140
+ * item : Pointer to a object to be remove.
141
+ *
142
+ * return: If HPDF_List_Remove success, it returns HPDF_OK.
143
+ * HPDF_ITEM_NOT_FOUND is returned when the object specified by item
144
+ * parameter is not found.
145
+ *
146
+ */
147
+
148
+ HPDF_STATUS
149
+ HPDF_List_Remove (HPDF_List list,
150
+ void *item)
151
+ {
152
+ HPDF_UINT i;
153
+ void **obj = list->obj;
154
+
155
+ HPDF_PTRACE((" HPDF_List_Remove\n"));
156
+
157
+ for (i = 0; i < list->count; i++) {
158
+ if (*obj == item) {
159
+ HPDF_List_RemoveByIndex(list, i);
160
+ return HPDF_OK;
161
+ } else
162
+ obj++;
163
+ }
164
+
165
+ return HPDF_ITEM_NOT_FOUND;
166
+ }
167
+
168
+ /*
169
+ * HPDF_List_RemoveByIndex
170
+ *
171
+ * Remove the object by index number.
172
+ *
173
+ * list : Pointer to a HPDF_List object.
174
+ * index : Index of a object to be remove.
175
+ *
176
+ * return: If HPDF_List_RemoveByIndex success, it returns HPDF_OK.
177
+ * HPDF_ITEM_NOT_FOUND is returned when the value which is specified
178
+ * by index parameter is invalid.
179
+ *
180
+ */
181
+
182
+ void*
183
+ HPDF_List_RemoveByIndex (HPDF_List list,
184
+ HPDF_UINT index)
185
+ {
186
+ void *tmp;
187
+
188
+ HPDF_PTRACE((" HPDF_List_RemoveByIndex\n"));
189
+
190
+ if (list->count <= index)
191
+ return NULL;
192
+
193
+ tmp = list->obj[index];
194
+
195
+ while (index < list->count - 1) {
196
+ list->obj[index] = list->obj[index + 1];
197
+ index++;
198
+ }
199
+
200
+ list->count--;
201
+
202
+ return tmp;
203
+ }
204
+
205
+ /*
206
+ * HPDF_List_ItemAt
207
+ *
208
+ * list : Pointer to a HPDF_List object.
209
+ * index : Index of a object.
210
+ *
211
+ * return: If HPDF_List_at success, it returns a pointer to the object.
212
+ * otherwise it returns NULL.
213
+ *
214
+ */
215
+
216
+ void*
217
+ HPDF_List_ItemAt (HPDF_List list,
218
+ HPDF_UINT index)
219
+ {
220
+ HPDF_PTRACE((" HPDF_List_ItemAt\n"));
221
+
222
+ return (list->count <= index) ? NULL : list->obj[index];
223
+ }
224
+
225
+ /*
226
+ * HPDF_List_free
227
+ *
228
+ * list : Pointer to a HPDF_List object.
229
+ *
230
+ */
231
+
232
+ void
233
+ HPDF_List_Free (HPDF_List list)
234
+ {
235
+ HPDF_PTRACE((" HPDF_List_Free\n"));
236
+
237
+ if (!list)
238
+ return ;
239
+
240
+ HPDF_List_Clear (list);
241
+ HPDF_FreeMem (list->mmgr, list);
242
+ }
243
+
244
+ /*
245
+ * HPDF_List_Clear
246
+ *
247
+ * list : Pointer to a HPDF_List object.
248
+ *
249
+ */
250
+
251
+ void
252
+ HPDF_List_Clear (HPDF_List list)
253
+ {
254
+ HPDF_PTRACE((" HPDF_List_Clear\n"));
255
+
256
+ if (list->obj)
257
+ HPDF_FreeMem (list->mmgr, list->obj);
258
+
259
+ list->block_siz = 0;
260
+ list->count = 0;
261
+ list->obj = NULL;
262
+ }
263
+
264
+ /*
265
+ * Resize
266
+ *
267
+ * list : Pointer to a HPDF_List object.
268
+ * count : The size of array of pointers.
269
+ *
270
+ * return: If Resize success, it returns HPDF_OK.
271
+ * otherwise it returns error-code which is set by HPDF_MMgr object.
272
+ *
273
+ */
274
+
275
+ HPDF_STATUS
276
+ Resize (HPDF_List list,
277
+ HPDF_UINT count)
278
+ {
279
+ void **new_obj;
280
+
281
+ HPDF_PTRACE((" HPDF_List_Resize\n"));
282
+
283
+ if (list->count >= count) {
284
+ if (list->count == count)
285
+ return HPDF_OK;
286
+ else
287
+ return HPDF_INVALID_PARAMETER;
288
+ }
289
+
290
+ new_obj = (void **)HPDF_GetMem (list->mmgr, count * sizeof(void *));
291
+
292
+ if (!new_obj)
293
+ return HPDF_Error_GetCode (list->error);
294
+
295
+ if (list->obj)
296
+ HPDF_MemCpy ((HPDF_BYTE *)new_obj, (HPDF_BYTE *)list->obj,
297
+ list->block_siz * sizeof(void *));
298
+
299
+ list->block_siz = count;
300
+ if (list->obj)
301
+ HPDF_FreeMem (list->mmgr, list->obj);
302
+ list->obj = new_obj;
303
+
304
+ return HPDF_OK;
305
+ }
306
+
307
+ /*
308
+ * HPDF_List_Find
309
+ *
310
+ * list : Pointer to a HPDF_List object.
311
+ * count : the size of array of pointers.
312
+ *
313
+ * return: If HPDF_List_Find success, it returns index of the object.
314
+ * otherwise it returns negative value.
315
+ *
316
+ */
317
+
318
+ HPDF_INT32
319
+ HPDF_List_Find (HPDF_List list,
320
+ void *item)
321
+ {
322
+ HPDF_UINT i;
323
+
324
+ HPDF_PTRACE((" HPDF_List_Find\n"));
325
+
326
+ for (i = 0; i < list->count; i++) {
327
+ if (list->obj[i] == item)
328
+ return i;
329
+ }
330
+
331
+ return -1;
332
+ }
333
+
@@ -0,0 +1,243 @@
1
+ /*
2
+ * << Haru Free PDF Library 2.0.0 >> -- hpdf_mmgr.c
3
+ *
4
+ * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
5
+ *
6
+ * Permission to use, copy, modify, distribute and sell this software
7
+ * and its documentation for any purpose is hereby granted without fee,
8
+ * provided that the above copyright notice appear in all copies and
9
+ * that both that copyright notice and this permission notice appear
10
+ * in supporting documentation.
11
+ * It is provided "as is" without express or implied warranty.
12
+ *
13
+ */
14
+
15
+ #include "hpdf_conf.h"
16
+ #include "hpdf_consts.h"
17
+ #include "hpdf_mmgr.h"
18
+ #include "hpdf_utils.h"
19
+
20
+ #ifndef HPDF_STDCALL
21
+ #ifdef HPDF_DLL_MAKE
22
+ #define HPDF_STDCALL __stdcall
23
+ #else
24
+ #ifdef HPDF_DLL
25
+ #define HPDF_STDCALL __stdcall
26
+ #else
27
+ #define HPDF_STDCALL
28
+ #endif
29
+ #endif
30
+ #endif
31
+
32
+ static void * HPDF_STDCALL
33
+ InternalGetMem (HPDF_UINT size);
34
+
35
+ static void HPDF_STDCALL
36
+ InternalFreeMem (void* aptr);
37
+
38
+
39
+ HPDF_MMgr
40
+ HPDF_MMgr_New (HPDF_Error error,
41
+ HPDF_UINT buf_size,
42
+ HPDF_Alloc_Func alloc_fn,
43
+ HPDF_Free_Func free_fn)
44
+ {
45
+ HPDF_MMgr mmgr;
46
+
47
+ HPDF_PTRACE((" HPDF_MMgr_New\n"));
48
+
49
+ if (alloc_fn)
50
+ mmgr = (HPDF_MMgr)alloc_fn (sizeof(HPDF_MMgr_Rec));
51
+ else
52
+ mmgr = (HPDF_MMgr)InternalGetMem (sizeof(HPDF_MMgr_Rec));
53
+
54
+ HPDF_PTRACE(("+%p mmgr-new\n", mmgr));
55
+
56
+ if (mmgr != NULL) {
57
+ /* initialize mmgr object */
58
+ mmgr->error = error;
59
+
60
+
61
+ #ifdef HPDF_MEM_DEBUG
62
+ mmgr->alloc_cnt = 0;
63
+ mmgr->free_cnt = 0;
64
+ #endif
65
+ /*
66
+ * if alloc_fn and free_fn are specified, these function is
67
+ * used. if not, default function (maybe these will be "malloc" and
68
+ * "free") is used.
69
+ */
70
+ if (alloc_fn && free_fn) {
71
+ mmgr->alloc_fn = alloc_fn;
72
+ mmgr->free_fn = free_fn;
73
+ } else {
74
+ mmgr->alloc_fn = InternalGetMem;
75
+ mmgr->free_fn = InternalFreeMem;
76
+ }
77
+
78
+ /*
79
+ * if buf_size parameter is specified, this object is configured
80
+ * to be using memory-pool.
81
+ *
82
+ */
83
+ if (!buf_size)
84
+ mmgr->mpool = NULL;
85
+ else {
86
+ HPDF_MPool_Node node;
87
+
88
+ node = (HPDF_MPool_Node)mmgr->alloc_fn (sizeof(HPDF_MPool_Node_Rec) +
89
+ buf_size);
90
+
91
+ HPDF_PTRACE(("+%p mmgr-node-new\n", node));
92
+
93
+ if (node == NULL) {
94
+ HPDF_SetError (error, HPDF_FAILD_TO_ALLOC_MEM, HPDF_NOERROR);
95
+
96
+ mmgr->free_fn(mmgr);
97
+ mmgr = NULL;
98
+ } else {
99
+ mmgr->mpool = node;
100
+ node->buf = (HPDF_BYTE *)node + sizeof(HPDF_MPool_Node_Rec);
101
+ node->size = buf_size;
102
+ node->used_size = 0;
103
+ node->next_node = NULL;
104
+ }
105
+
106
+ #ifdef HPDF_MEM_DEBUG
107
+ mmgr->alloc_cnt += 1;
108
+ #endif
109
+ }
110
+
111
+ mmgr->buf_size = buf_size;
112
+ } else
113
+ HPDF_SetError(error, HPDF_FAILD_TO_ALLOC_MEM, HPDF_NOERROR);
114
+
115
+ return mmgr;
116
+ }
117
+
118
+ void
119
+ HPDF_MMgr_Free (HPDF_MMgr mmgr)
120
+ {
121
+ HPDF_MPool_Node node;
122
+
123
+ HPDF_PTRACE((" HPDF_MMgr_Free\n"));
124
+
125
+ if (mmgr == NULL)
126
+ return;
127
+
128
+ node = mmgr->mpool;
129
+
130
+ /* delete all nodes recursively */
131
+ while (node != NULL) {
132
+ HPDF_MPool_Node tmp = node;
133
+ node = tmp->next_node;
134
+
135
+ HPDF_PTRACE(("-%p mmgr-node-free\n", tmp));
136
+ mmgr->free_fn (tmp);
137
+
138
+ #ifdef HPDF_MEM_DEBUG
139
+ mmgr->free_cnt++;
140
+ #endif
141
+
142
+ }
143
+
144
+ #ifdef HPDF_MEM_DEBUG
145
+ HPDF_PRINTF ("# HPDF_MMgr alloc-cnt=%u, free-cnt=%u\n",
146
+ mmgr->alloc_cnt, mmgr->free_cnt);
147
+
148
+ if (mmgr->alloc_cnt != mmgr->free_cnt)
149
+ HPDF_PRINTF ("# ERROR #\n");
150
+ #endif
151
+
152
+ HPDF_PTRACE(("-%p mmgr-free\n", mmgr));
153
+ mmgr->free_fn (mmgr);
154
+ }
155
+
156
+ void*
157
+ HPDF_GetMem (HPDF_MMgr mmgr,
158
+ HPDF_UINT size)
159
+ {
160
+ void * ptr;
161
+
162
+ if (mmgr->mpool) {
163
+ HPDF_MPool_Node node = mmgr->mpool;
164
+
165
+ #ifdef HPDF_ALINMENT_SIZ
166
+ size = (size + (HPDF_ALINMENT_SIZ - 1)) / HPDF_ALINMENT_SIZ;
167
+ size *= HPDF_ALINMENT_SIZ;
168
+ #endif
169
+
170
+ if (node->size - node->used_size >= size) {
171
+ ptr = (HPDF_BYTE*)node->buf + node->used_size;
172
+ node->used_size += size;
173
+ return ptr;
174
+ } else {
175
+ HPDF_UINT tmp_buf_siz = (mmgr->buf_size < size) ? size :
176
+ mmgr->buf_size;
177
+
178
+ node = (HPDF_MPool_Node)mmgr->alloc_fn (sizeof(HPDF_MPool_Node_Rec)
179
+ + tmp_buf_siz);
180
+ HPDF_PTRACE(("+%p mmgr-new-node\n", node));
181
+
182
+ if (!node) {
183
+ HPDF_SetError (mmgr->error, HPDF_FAILD_TO_ALLOC_MEM,
184
+ HPDF_NOERROR);
185
+ return NULL;
186
+ }
187
+
188
+ node->size = tmp_buf_siz;
189
+ }
190
+
191
+ node->next_node = mmgr->mpool;
192
+ mmgr->mpool = node;
193
+ node->used_size = size;
194
+ node->buf = (HPDF_BYTE*)node + sizeof(HPDF_MPool_Node_Rec);
195
+ ptr = node->buf;
196
+ } else {
197
+ ptr = mmgr->alloc_fn (size);
198
+ HPDF_PTRACE(("+%p mmgr-alloc_fn size=%u\n", ptr, size));
199
+
200
+ if (ptr == NULL)
201
+ HPDF_SetError (mmgr->error, HPDF_FAILD_TO_ALLOC_MEM, HPDF_NOERROR);
202
+ }
203
+
204
+ #ifdef HPDF_MEM_DEBUG
205
+ if (ptr)
206
+ mmgr->alloc_cnt++;
207
+ #endif
208
+
209
+ return ptr;
210
+ }
211
+
212
+ void
213
+ HPDF_FreeMem (HPDF_MMgr mmgr,
214
+ void *aptr)
215
+ {
216
+ if (!aptr)
217
+ return;
218
+
219
+ if (!mmgr->mpool) {
220
+ HPDF_PTRACE(("-%p mmgr-free-mem\n", aptr));
221
+ mmgr->free_fn(aptr);
222
+
223
+ #ifdef HPDF_MEM_DEBUG
224
+ mmgr->free_cnt++;
225
+ #endif
226
+ }
227
+
228
+ return;
229
+ }
230
+
231
+ static void * HPDF_STDCALL
232
+ InternalGetMem (HPDF_UINT size)
233
+ {
234
+ return HPDF_MALLOC (size);
235
+ }
236
+
237
+ static void HPDF_STDCALL
238
+ InternalFreeMem (void* aptr)
239
+ {
240
+ HPDF_FREE (aptr);
241
+ }
242
+
243
+