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

Side by Side Diff: core/fxcodec/codec/fx_codec.cpp

Issue 1861403002: Rename FX_SAFE_DWORD to FX_SAFE_UINT32 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
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/include/fxcodec/fx_codec.h" 7 #include "core/include/fxcodec/fx_codec.h"
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 int height, 287 int height,
288 int nComps, 288 int nComps,
289 int bpc) { 289 int bpc) {
290 m_pSrcBuf = src_buf; 290 m_pSrcBuf = src_buf;
291 m_SrcSize = src_size; 291 m_SrcSize = src_size;
292 m_OutputWidth = m_OrigWidth = width; 292 m_OutputWidth = m_OrigWidth = width;
293 m_OutputHeight = m_OrigHeight = height; 293 m_OutputHeight = m_OrigHeight = height;
294 m_nComps = nComps; 294 m_nComps = nComps;
295 m_bpc = bpc; 295 m_bpc = bpc;
296 // Aligning the pitch to 4 bytes requires an integer overflow check. 296 // Aligning the pitch to 4 bytes requires an integer overflow check.
297 FX_SAFE_DWORD pitch = width; 297 FX_SAFE_UINT32 pitch = width;
298 pitch *= nComps; 298 pitch *= nComps;
299 pitch *= bpc; 299 pitch *= bpc;
300 pitch += 31; 300 pitch += 31;
301 pitch /= 32; 301 pitch /= 32;
302 pitch *= 4; 302 pitch *= 4;
303 if (!pitch.IsValid()) { 303 if (!pitch.IsValid()) {
304 return FALSE; 304 return FALSE;
305 } 305 }
306 m_Pitch = pitch.ValueOrDie(); 306 m_Pitch = pitch.ValueOrDie();
307 // Overflow should already have been checked before this is called. 307 // Overflow should already have been checked before this is called.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 int nComps, 405 int nComps,
406 int bpc) { 406 int bpc) {
407 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; 407 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder;
408 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, 408 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps,
409 bpc)) { 409 bpc)) {
410 delete pRLScanlineDecoder; 410 delete pRLScanlineDecoder;
411 return NULL; 411 return NULL;
412 } 412 }
413 return pRLScanlineDecoder; 413 return pRLScanlineDecoder;
414 } 414 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp ('k') | core/fxcodec/codec/fx_codec_jpeg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698