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

Side by Side Diff: core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp

Issue 1801383002: Re-enable several MSVC warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase again Created 4 years, 9 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/fpdfapi/fpdf_parser/cpdf_parser.cpp ('k') | core/fpdfapi/fpdf_render/fpdf_render_text.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 "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" 7 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
8 8
9 #include <limits.h> 9 #include <limits.h>
10 #include <vector> 10 #include <vector>
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 uint8_t*& dest_buf, 170 uint8_t*& dest_buf,
171 FX_DWORD& dest_size) { 171 FX_DWORD& dest_size) {
172 FX_DWORD i = 0; 172 FX_DWORD i = 0;
173 FX_DWORD old; 173 FX_DWORD old;
174 dest_size = 0; 174 dest_size = 0;
175 while (i < src_size) { 175 while (i < src_size) {
176 if (src_buf[i] < 128) { 176 if (src_buf[i] < 128) {
177 old = dest_size; 177 old = dest_size;
178 dest_size += src_buf[i] + 1; 178 dest_size += src_buf[i] + 1;
179 if (dest_size < old) { 179 if (dest_size < old) {
180 return (FX_DWORD)-1; 180 return static_cast<FX_DWORD>(-1);
181 } 181 }
182 i += src_buf[i] + 2; 182 i += src_buf[i] + 2;
183 } else if (src_buf[i] > 128) { 183 } else if (src_buf[i] > 128) {
184 old = dest_size; 184 old = dest_size;
185 dest_size += 257 - src_buf[i]; 185 dest_size += 257 - src_buf[i];
186 if (dest_size < old) { 186 if (dest_size < old) {
187 return (FX_DWORD)-1; 187 return static_cast<FX_DWORD>(-1);
188 } 188 }
189 i += 2; 189 i += 2;
190 } else { 190 } else {
191 break; 191 break;
192 } 192 }
193 } 193 }
194 if (dest_size >= _STREAM_MAX_SIZE_) { 194 if (dest_size >= _STREAM_MAX_SIZE_) {
195 return -1; 195 return static_cast<FX_DWORD>(-1);
196 } 196 }
197 dest_buf = FX_Alloc(uint8_t, dest_size); 197 dest_buf = FX_Alloc(uint8_t, dest_size);
198 i = 0; 198 i = 0;
199 int dest_count = 0; 199 int dest_count = 0;
200 while (i < src_size) { 200 while (i < src_size) {
201 if (src_buf[i] < 128) { 201 if (src_buf[i] < 128) {
202 FX_DWORD copy_len = src_buf[i] + 1; 202 FX_DWORD copy_len = src_buf[i] + 1;
203 FX_DWORD buf_left = src_size - i - 1; 203 FX_DWORD buf_left = src_size - i - 1;
204 if (buf_left < copy_len) { 204 if (buf_left < copy_len) {
205 FX_DWORD delta = copy_len - buf_left; 205 FX_DWORD delta = copy_len - buf_left;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 FX_DWORD src_size, 583 FX_DWORD src_size,
584 uint8_t*& dest_buf, 584 uint8_t*& dest_buf,
585 FX_DWORD& dest_size) { 585 FX_DWORD& dest_size) {
586 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); 586 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
587 if (pEncoders) { 587 if (pEncoders) {
588 return pEncoders->GetFlateModule()->FlateOrLZWDecode( 588 return pEncoders->GetFlateModule()->FlateOrLZWDecode(
589 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); 589 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size);
590 } 590 }
591 return 0; 591 return 0;
592 } 592 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_parser.cpp ('k') | core/fpdfapi/fpdf_render/fpdf_render_text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698