OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../fx_zlib.h" | 7 #include "../../fx_zlib.h" |
8 #include "../../../include/fxcodec/fx_codec.h" | 8 #include "../../../include/fxcodec/fx_codec.h" |
9 #include "codec_int.h" | 9 #include "codec_int.h" |
10 extern "C" | 10 extern "C" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void FPDFAPI_FlateEnd(void* context) | 67 void FPDFAPI_FlateEnd(void* context) |
68 { | 68 { |
69 inflateEnd((z_stream*)context); | 69 inflateEnd((z_stream*)context); |
70 ((z_stream*)context)->zfree(0, context); | 70 ((z_stream*)context)->zfree(0, context); |
71 } | 71 } |
72 void FPDFAPI_FlateCompress(unsigned char* dest_buf, unsigned long* dest_size
, const unsigned char* src_buf, unsigned long src_size) | 72 void FPDFAPI_FlateCompress(unsigned char* dest_buf, unsigned long* dest_size
, const unsigned char* src_buf, unsigned long src_size) |
73 { | 73 { |
74 compress(dest_buf, dest_size, src_buf, src_size); | 74 compress(dest_buf, dest_size, src_buf, src_size); |
75 } | 75 } |
76 } | 76 } |
77 class CLZWDecoder : public CFX_Object | 77 class CLZWDecoder |
78 { | 78 { |
79 public: | 79 public: |
80 FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const FX_BYTE* input, FX_
DWORD& size, FX_BOOL bEarlyChange); | 80 FX_BOOL Decode(FX_LPBYTE output, FX_DWORD& outlen, const FX_BYTE* input, FX_
DWORD& size, FX_BOOL bEarlyChange); |
81 private: | 81 private: |
82 FX_DWORD m_InPos; | 82 FX_DWORD m_InPos; |
83 FX_DWORD m_OutPos; | 83 FX_DWORD m_OutPos; |
84 FX_LPBYTE m_pOutput; | 84 FX_LPBYTE m_pOutput; |
85 const FX_BYTE* m_pInput; | 85 const FX_BYTE* m_pInput; |
86 FX_BOOL m_Early; | 86 FX_BOOL m_Early; |
87 void AddCode(FX_DWORD prefix_code, FX_BYTE append_char); | 87 void AddCode(FX_DWORD prefix_code, FX_BYTE append_char); |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 dest_size = src_size + src_size / 1000 + 12; | 937 dest_size = src_size + src_size / 1000 + 12; |
938 dest_buf = FX_Alloc( FX_BYTE, dest_size); | 938 dest_buf = FX_Alloc( FX_BYTE, dest_size); |
939 if (dest_buf == NULL) { | 939 if (dest_buf == NULL) { |
940 return FALSE; | 940 return FALSE; |
941 } | 941 } |
942 unsigned long temp_size = dest_size; | 942 unsigned long temp_size = dest_size; |
943 FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); | 943 FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); |
944 dest_size = (FX_DWORD)temp_size; | 944 dest_size = (FX_DWORD)temp_size; |
945 return TRUE; | 945 return TRUE; |
946 } | 946 } |
OLD | NEW |