summaryrefslogtreecommitdiff
path: root/core/src/fxcodec/codec
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-14 16:43:54 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-14 16:43:54 -0700
commitb2552025f977873cc96bdfd7144329623159ad33 (patch)
tree34a5d912e4886e2141f2aecd23b6ec972ecaf85e /core/src/fxcodec/codec
parenta4755c6c899c6d29b01b1a0a58dac20b65d361dc (diff)
downloadpdfium-b2552025f977873cc96bdfd7144329623159ad33.tar.xz
Merge to XFA: Move FPDFAPI_FlateInit() prototype and friends to .h file
(cherry picked from commit dacc22cdfea727a04bce086d9bfec9a4d1a29bd4) Orignal Review URL: https://codereview.chromium.org/1240713004 . TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1230373003 .
Diffstat (limited to 'core/src/fxcodec/codec')
-rw-r--r--core/src/fxcodec/codec/fx_codec_flate.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp
index 99643e4470..6223b9c670 100644
--- a/core/src/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/src/fxcodec/codec/fx_codec_flate.cpp
@@ -7,18 +7,34 @@
#include "../../../../third_party/base/nonstd_unique_ptr.h"
#include "../../../../third_party/zlib_v128/zlib.h"
#include "../../../include/fxcodec/fx_codec.h"
+#include "../../../include/fxcodec/fx_codec_flate.h"
#include "codec_int.h"
extern "C"
{
- static void* my_alloc_func (void* opaque, unsigned int items, unsigned int size)
+ static void* my_alloc_func(void* opaque, unsigned int items, unsigned int size)
{
return FX_Alloc2D(uint8_t, items, size);
}
- static void my_free_func (void* opaque, void* address)
+ static void my_free_func(void* opaque, void* address)
{
FX_Free(address);
}
+ static int FPDFAPI_FlateGetTotalOut(void* context)
+ {
+ return ((z_stream*)context)->total_out;
+ }
+ static int FPDFAPI_FlateGetTotalIn(void* context)
+ {
+ return ((z_stream*)context)->total_in;
+ }
+ static void FPDFAPI_FlateCompress(unsigned char* dest_buf,
+ unsigned long* dest_size,
+ const unsigned char* src_buf,
+ unsigned long src_size)
+ {
+ compress(dest_buf, dest_size, src_buf, src_size);
+ }
void* FPDFAPI_FlateInit(void* (*alloc_func)(void*, unsigned int, unsigned int),
void (*free_func)(void*, void*))
{
@@ -37,10 +53,6 @@ extern "C"
((z_stream*)context)->next_in = (unsigned char*)src_buf;
((z_stream*)context)->avail_in = src_size;
}
- int FPDFAPI_FlateGetTotalOut(void* context)
- {
- return ((z_stream*)context)->total_out;
- }
int FPDFAPI_FlateOutput(void* context, unsigned char* dest_buf, unsigned int dest_size)
{
((z_stream*)context)->next_out = dest_buf;
@@ -54,28 +66,21 @@ extern "C"
}
return ret;
}
- int FPDFAPI_FlateGetTotalIn(void* context)
+ int FPDFAPI_FlateGetAvailIn(void* context)
{
- return ((z_stream*)context)->total_in;
+ return ((z_stream*)context)->avail_in;
}
int FPDFAPI_FlateGetAvailOut(void* context)
{
return ((z_stream*)context)->avail_out;
}
- int FPDFAPI_FlateGetAvailIn(void* context)
- {
- return ((z_stream*)context)->avail_in;
- }
void FPDFAPI_FlateEnd(void* context)
{
inflateEnd((z_stream*)context);
((z_stream*)context)->zfree(0, context);
}
- void FPDFAPI_FlateCompress(unsigned char* dest_buf, unsigned long* dest_size, const unsigned char* src_buf, unsigned long src_size)
- {
- compress(dest_buf, dest_size, src_buf, src_size);
- }
-}
+} // extern "C"
+
class CLZWDecoder
{
public: