| OLD | NEW |
| 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 "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
| 10 #include "../../../include/fxcrt/fx_safe_types.h" | 10 #include "../../../include/fxcrt/fx_safe_types.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 FXSYS_assert(FALSE); | 495 FXSYS_assert(FALSE); |
| 496 return FALSE; | 496 return FALSE; |
| 497 } | 497 } |
| 498 m_bStarted = TRUE; | 498 m_bStarted = TRUE; |
| 499 return TRUE; | 499 return TRUE; |
| 500 } | 500 } |
| 501 uint8_t* CCodec_JpegDecoder::v_GetNextLine() { | 501 uint8_t* CCodec_JpegDecoder::v_GetNextLine() { |
| 502 if (m_pExtProvider) { | 502 if (m_pExtProvider) { |
| 503 return m_pExtProvider->GetNextLine(m_pExtContext); | 503 return m_pExtProvider->GetNextLine(m_pExtContext); |
| 504 } | 504 } |
| 505 |
| 506 if (setjmp(m_JmpBuf) == -1) |
| 507 return nullptr; |
| 508 |
| 505 int nlines = jpeg_read_scanlines(&cinfo, &m_pScanlineBuf, 1); | 509 int nlines = jpeg_read_scanlines(&cinfo, &m_pScanlineBuf, 1); |
| 506 if (nlines < 1) { | 510 if (nlines < 1) { |
| 507 return NULL; | 511 return nullptr; |
| 508 } | 512 } |
| 509 return m_pScanlineBuf; | 513 return m_pScanlineBuf; |
| 510 } | 514 } |
| 511 FX_DWORD CCodec_JpegDecoder::GetSrcOffset() { | 515 FX_DWORD CCodec_JpegDecoder::GetSrcOffset() { |
| 512 if (m_pExtProvider) { | 516 if (m_pExtProvider) { |
| 513 return m_pExtProvider->GetSrcOffset(m_pExtContext); | 517 return m_pExtProvider->GetSrcOffset(m_pExtContext); |
| 514 } | 518 } |
| 515 return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); | 519 return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); |
| 516 } | 520 } |
| 517 ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder( | 521 ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder( |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 } | 713 } |
| 710 if (avail_buf_ptr != NULL) { | 714 if (avail_buf_ptr != NULL) { |
| 711 *avail_buf_ptr = NULL; | 715 *avail_buf_ptr = NULL; |
| 712 if (((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { | 716 if (((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { |
| 713 *avail_buf_ptr = | 717 *avail_buf_ptr = |
| 714 (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; | 718 (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; |
| 715 } | 719 } |
| 716 } | 720 } |
| 717 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; | 721 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; |
| 718 } | 722 } |
| OLD | NEW |