Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: core/src/fxcodec/codec/fx_codec_flate.cpp

Issue 1253603002: Fix FX_BOOL type mismatches. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Public API Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxcodec/codec/codec_int.h ('k') | core/src/fxcodec/codec/fx_codec_jpeg.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "../../../../third_party/base/nonstd_unique_ptr.h" 7 #include "../../../../third_party/base/nonstd_unique_ptr.h"
8 #include "../../../../third_party/zlib_v128/zlib.h" 8 #include "../../../../third_party/zlib_v128/zlib.h"
9 #include "../../../include/fxcodec/fx_codec.h" 9 #include "../../../include/fxcodec/fx_codec.h"
10 #include "../../../include/fxcodec/fx_codec_flate.h" 10 #include "../../../include/fxcodec/fx_codec_flate.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void FPDFAPI_FlateEnd(void* context) 77 void FPDFAPI_FlateEnd(void* context)
78 { 78 {
79 inflateEnd((z_stream*)context); 79 inflateEnd((z_stream*)context);
80 ((z_stream*)context)->zfree(0, context); 80 ((z_stream*)context)->zfree(0, context);
81 } 81 }
82 } // extern "C" 82 } // extern "C"
83 83
84 class CLZWDecoder 84 class CLZWDecoder
85 { 85 {
86 public: 86 public:
87 FX_BOOL Decode(uint8_t* output, FX_DWORD& outlen, const uint8_t* input, FX_D WORD& size, FX_BOOL bEarlyChange); 87 int Decode(uint8_t* output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD & size, FX_BOOL bEarlyChange);
88
88 private: 89 private:
90 void AddCode(FX_DWORD prefix_code, uint8_t append_char);
91 void DecodeString(FX_DWORD code);
92
89 FX_DWORD m_InPos; 93 FX_DWORD m_InPos;
90 FX_DWORD m_OutPos; 94 FX_DWORD m_OutPos;
91 uint8_t* m_pOutput; 95 uint8_t* m_pOutput;
92 const uint8_t* m_pInput; 96 const uint8_t* m_pInput;
93 FX_BOOL m_Early; 97 FX_BOOL m_Early;
94 void AddCode(FX_DWORD prefix_code, uint8_t append_char);
95 FX_DWORD m_CodeArray[5021]; 98 FX_DWORD m_CodeArray[5021];
96 FX_DWORD m_nCodes; 99 FX_DWORD m_nCodes;
97 uint8_t m_DecodeStack[4000]; 100 uint8_t m_DecodeStack[4000];
98 FX_DWORD m_StackLen; 101 FX_DWORD m_StackLen;
99 void DecodeString(FX_DWORD code);
100 int m_CodeLen; 102 int m_CodeLen;
101 }; 103 };
102 void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) 104 void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char)
103 { 105 {
104 if (m_nCodes + m_Early == 4094) { 106 if (m_nCodes + m_Early == 4094) {
105 return; 107 return;
106 } 108 }
107 m_CodeArray[m_nCodes ++] = (prefix_code << 16) | append_char; 109 m_CodeArray[m_nCodes ++] = (prefix_code << 16) | append_char;
108 if (m_nCodes + m_Early == 512 - 258) { 110 if (m_nCodes + m_Early == 512 - 258) {
109 m_CodeLen = 10; 111 m_CodeLen = 10;
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 } 911 }
910 FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, ui nt8_t*& dest_buf, FX_DWORD& dest_size) 912 FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, ui nt8_t*& dest_buf, FX_DWORD& dest_size)
911 { 913 {
912 dest_size = src_size + src_size / 1000 + 12; 914 dest_size = src_size + src_size / 1000 + 12;
913 dest_buf = FX_Alloc( uint8_t, dest_size); 915 dest_buf = FX_Alloc( uint8_t, dest_size);
914 unsigned long temp_size = dest_size; 916 unsigned long temp_size = dest_size;
915 FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); 917 FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size);
916 dest_size = (FX_DWORD)temp_size; 918 dest_size = (FX_DWORD)temp_size;
917 return TRUE; 919 return TRUE;
918 } 920 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/codec_int.h ('k') | core/src/fxcodec/codec/fx_codec_jpeg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698