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

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

Issue 2032613003: Get rid of NULLs in core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: s/NULL/nullptr/ Created 4 years, 6 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/fxcodec/include/fx_codec.h" 7 #include "core/fxcodec/include/fx_codec.h"
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <memory> 10 #include <memory>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } else { \ 93 } else { \
94 exp_ret *= 10; \ 94 exp_ret *= 10; \
95 exp_ret += FXSYS_toDecimalDigit(*ptr); \ 95 exp_ret += FXSYS_toDecimalDigit(*ptr); \
96 continue; \ 96 continue; \
97 } \ 97 } \
98 } 98 }
99 99
100 extern "C" double FXstrtod(const char* nptr, char** endptr) { 100 extern "C" double FXstrtod(const char* nptr, char** endptr) {
101 double ret = 0.0; 101 double ret = 0.0;
102 const char* ptr = nptr; 102 const char* ptr = nptr;
103 const char* exp_ptr = NULL; 103 const char* exp_ptr = nullptr;
104 int e_number = 0, e_signal = 0, e_point = 0, is_negative = 0; 104 int e_number = 0, e_signal = 0, e_point = 0, is_negative = 0;
105 int exp_ret = 0, exp_sig = 1, fra_ret = 0, fra_count = 0, fra_base = 1; 105 int exp_ret = 0, exp_sig = 1, fra_ret = 0, fra_count = 0, fra_base = 1;
106 if (!nptr) { 106 if (!nptr) {
107 return 0.0; 107 return 0.0;
108 } 108 }
109 for (;; ptr++) { 109 for (;; ptr++) {
110 if (!e_number && !e_point && (*ptr == '\t' || *ptr == ' ')) 110 if (!e_number && !e_point && (*ptr == '\t' || *ptr == ' '))
111 continue; 111 continue;
112 112
113 if (std::isdigit(*ptr)) { 113 if (std::isdigit(*ptr)) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 uint8_t* m_pScanline; 237 uint8_t* m_pScanline;
238 const uint8_t* m_pSrcBuf; 238 const uint8_t* m_pSrcBuf;
239 uint32_t m_SrcSize; 239 uint32_t m_SrcSize;
240 uint32_t m_dwLineBytes; 240 uint32_t m_dwLineBytes;
241 uint32_t m_SrcOffset; 241 uint32_t m_SrcOffset;
242 FX_BOOL m_bEOD; 242 FX_BOOL m_bEOD;
243 uint8_t m_Operator; 243 uint8_t m_Operator;
244 }; 244 };
245 CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder() 245 CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder()
246 : m_pScanline(NULL), 246 : m_pScanline(nullptr),
247 m_pSrcBuf(NULL), 247 m_pSrcBuf(nullptr),
248 m_SrcSize(0), 248 m_SrcSize(0),
249 m_dwLineBytes(0), 249 m_dwLineBytes(0),
250 m_SrcOffset(0), 250 m_SrcOffset(0),
251 m_bEOD(FALSE), 251 m_bEOD(FALSE),
252 m_Operator(0) {} 252 m_Operator(0) {}
253 CCodec_RLScanlineDecoder::~CCodec_RLScanlineDecoder() { 253 CCodec_RLScanlineDecoder::~CCodec_RLScanlineDecoder() {
254 FX_Free(m_pScanline); 254 FX_Free(m_pScanline);
255 } 255 }
256 FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() { 256 FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() {
257 uint32_t i = 0; 257 uint32_t i = 0;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 m_SrcOffset = 0; 315 m_SrcOffset = 0;
316 m_bEOD = FALSE; 316 m_bEOD = FALSE;
317 m_Operator = 0; 317 m_Operator = 0;
318 return TRUE; 318 return TRUE;
319 } 319 }
320 uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { 320 uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() {
321 if (m_SrcOffset == 0) { 321 if (m_SrcOffset == 0) {
322 GetNextOperator(); 322 GetNextOperator();
323 } else { 323 } else {
324 if (m_bEOD) { 324 if (m_bEOD) {
325 return NULL; 325 return nullptr;
326 } 326 }
327 } 327 }
328 FXSYS_memset(m_pScanline, 0, m_Pitch); 328 FXSYS_memset(m_pScanline, 0, m_Pitch);
329 uint32_t col_pos = 0; 329 uint32_t col_pos = 0;
330 FX_BOOL eol = FALSE; 330 FX_BOOL eol = FALSE;
331 while (m_SrcOffset < m_SrcSize && !eol) { 331 while (m_SrcOffset < m_SrcSize && !eol) {
332 if (m_Operator < 128) { 332 if (m_Operator < 128) {
333 uint32_t copy_len = m_Operator + 1; 333 uint32_t copy_len = m_Operator + 1;
334 if (col_pos + copy_len >= m_dwLineBytes) { 334 if (col_pos + copy_len >= m_dwLineBytes) {
335 copy_len = m_dwLineBytes - col_pos; 335 copy_len = m_dwLineBytes - col_pos;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 int bpc) { 408 int bpc) {
409 std::unique_ptr<CCodec_RLScanlineDecoder> pRLScanlineDecoder( 409 std::unique_ptr<CCodec_RLScanlineDecoder> pRLScanlineDecoder(
410 new CCodec_RLScanlineDecoder); 410 new CCodec_RLScanlineDecoder);
411 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, 411 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps,
412 bpc)) { 412 bpc)) {
413 return nullptr; 413 return nullptr;
414 } 414 }
415 415
416 return pRLScanlineDecoder.release(); 416 return pRLScanlineDecoder.release();
417 } 417 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698