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

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

Issue 2032613003: Get rid of NULLs in core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix a bad merge 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
« no previous file with comments | « core/fxcodec/codec/fx_codec_jbig.cpp ('k') | core/fxcodec/codec/fx_codec_jpx_opj.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 <setjmp.h> 7 #include <setjmp.h>
8 8
9 #include "core/fxcodec/codec/codec_int.h" 9 #include "core/fxcodec/codec/codec_int.h"
10 #include "core/fxcodec/include/fx_codec.h" 10 #include "core/fxcodec/include/fx_codec.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 extern "C" { 71 extern "C" {
72 static void _error_do_nothing1(j_common_ptr cinfo, int) {} 72 static void _error_do_nothing1(j_common_ptr cinfo, int) {}
73 }; 73 };
74 extern "C" { 74 extern "C" {
75 static void _error_do_nothing2(j_common_ptr cinfo, char*) {} 75 static void _error_do_nothing2(j_common_ptr cinfo, char*) {}
76 }; 76 };
77 77
78 #define JPEG_MARKER_ICC (JPEG_APP0 + 2) 78 #define JPEG_MARKER_ICC (JPEG_APP0 + 2)
79 #define JPEG_MARKER_MAXSIZE 0xFFFF 79 #define JPEG_MARKER_MAXSIZE 0xFFFF
80 80
81
82 #ifdef PDF_ENABLE_XFA 81 #ifdef PDF_ENABLE_XFA
83 static void JpegLoadAttribute(struct jpeg_decompress_struct* pInfo, 82 static void JpegLoadAttribute(struct jpeg_decompress_struct* pInfo,
84 CFX_DIBAttribute* pAttribute) { 83 CFX_DIBAttribute* pAttribute) {
85 if (!pInfo || !pAttribute) 84 if (!pAttribute)
86 return; 85 return;
87 86
88 pAttribute->m_nXDPI = pInfo->X_density; 87 pAttribute->m_nXDPI = pInfo->X_density;
89 pAttribute->m_nYDPI = pInfo->Y_density; 88 pAttribute->m_nYDPI = pInfo->Y_density;
90 pAttribute->m_wDPIUnit = pInfo->density_unit; 89 pAttribute->m_wDPIUnit = pInfo->density_unit;
91 } 90 }
92 #endif // PDF_ENABLE_XFA 91 #endif // PDF_ENABLE_XFA
93 92
94 static bool JpegLoadInfo(const uint8_t* src_buf, 93 static bool JpegLoadInfo(const uint8_t* src_buf,
95 uint32_t src_size, 94 uint32_t src_size,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 170
172 FX_BOOL m_bInited; 171 FX_BOOL m_bInited;
173 FX_BOOL m_bStarted; 172 FX_BOOL m_bStarted;
174 FX_BOOL m_bJpegTransform; 173 FX_BOOL m_bJpegTransform;
175 174
176 protected: 175 protected:
177 uint32_t m_nDefaultScaleDenom; 176 uint32_t m_nDefaultScaleDenom;
178 }; 177 };
179 178
180 CCodec_JpegDecoder::CCodec_JpegDecoder() { 179 CCodec_JpegDecoder::CCodec_JpegDecoder() {
181 m_pScanlineBuf = NULL; 180 m_pScanlineBuf = nullptr;
182 m_bStarted = FALSE; 181 m_bStarted = FALSE;
183 m_bInited = FALSE; 182 m_bInited = FALSE;
184 FXSYS_memset(&cinfo, 0, sizeof(cinfo)); 183 FXSYS_memset(&cinfo, 0, sizeof(cinfo));
185 FXSYS_memset(&jerr, 0, sizeof(jerr)); 184 FXSYS_memset(&jerr, 0, sizeof(jerr));
186 FXSYS_memset(&src, 0, sizeof(src)); 185 FXSYS_memset(&src, 0, sizeof(src));
187 m_nDefaultScaleDenom = 1; 186 m_nDefaultScaleDenom = 1;
188 } 187 }
189 188
190 CCodec_JpegDecoder::~CCodec_JpegDecoder() { 189 CCodec_JpegDecoder::~CCodec_JpegDecoder() {
191 FX_Free(m_pScanlineBuf); 190 FX_Free(m_pScanlineBuf);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 if (setjmp(ctx->m_JumpMark) == -1) 462 if (setjmp(ctx->m_JumpMark) == -1)
464 return FALSE; 463 return FALSE;
465 464
466 int nlines = jpeg_read_scanlines(&ctx->m_Info, &dest_buf, 1); 465 int nlines = jpeg_read_scanlines(&ctx->m_Info, &dest_buf, 1);
467 return nlines == 1; 466 return nlines == 1;
468 } 467 }
469 468
470 uint32_t CCodec_JpegModule::GetAvailInput(FXJPEG_Context* ctx, 469 uint32_t CCodec_JpegModule::GetAvailInput(FXJPEG_Context* ctx,
471 uint8_t** avail_buf_ptr) { 470 uint8_t** avail_buf_ptr) {
472 if (avail_buf_ptr) { 471 if (avail_buf_ptr) {
473 *avail_buf_ptr = NULL; 472 *avail_buf_ptr = nullptr;
474 if (ctx->m_SrcMgr.bytes_in_buffer > 0) { 473 if (ctx->m_SrcMgr.bytes_in_buffer > 0) {
475 *avail_buf_ptr = (uint8_t*)ctx->m_SrcMgr.next_input_byte; 474 *avail_buf_ptr = (uint8_t*)ctx->m_SrcMgr.next_input_byte;
476 } 475 }
477 } 476 }
478 return (uint32_t)ctx->m_SrcMgr.bytes_in_buffer; 477 return (uint32_t)ctx->m_SrcMgr.bytes_in_buffer;
479 } 478 }
OLDNEW
« no previous file with comments | « core/fxcodec/codec/fx_codec_jbig.cpp ('k') | core/fxcodec/codec/fx_codec_jpx_opj.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698