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

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

Issue 1253603002: Fix FX_BOOL type mismatches. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Public API Created 5 years, 5 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/src/fxcodec/codec/fx_codec_flate.cpp ('k') | core/src/fxcodec/jbig2/JBig2_Context.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 "../../../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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 return 2; 634 return 2;
635 } 635 }
636 if (ret != JPEG_HEADER_OK) { 636 if (ret != JPEG_HEADER_OK) {
637 return 1; 637 return 1;
638 } 638 }
639 *width = p->m_Info.image_width; 639 *width = p->m_Info.image_width;
640 *height = p->m_Info.image_height; 640 *height = p->m_Info.image_height;
641 *nComps = p->m_Info.num_components; 641 *nComps = p->m_Info.num_components;
642 return 0; 642 return 0;
643 } 643 }
644 FX_BOOL CCodec_JpegModule::StartScanline(void* pContext, int down_scale) 644 int CCodec_JpegModule::StartScanline(void* pContext, int down_scale)
645 { 645 {
646 if (m_pExtProvider) { 646 if (m_pExtProvider) {
647 return m_pExtProvider->StartScanline(pContext, down_scale); 647 return m_pExtProvider->StartScanline(pContext, down_scale);
648 } 648 }
649 FXJPEG_Context* p = (FXJPEG_Context*)pContext; 649 FXJPEG_Context* p = (FXJPEG_Context*)pContext;
650 if (setjmp(p->m_JumpMark) == -1) { 650 if (setjmp(p->m_JumpMark) == -1) {
651 return FALSE; 651 return 0;
652 } 652 }
653 p->m_Info.scale_denom = down_scale; 653 p->m_Info.scale_denom = down_scale;
654 return jpeg_start_decompress(&p->m_Info); 654 return jpeg_start_decompress(&p->m_Info);
655 } 655 }
656 FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext, unsigned char* dest_buf) 656 FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext, unsigned char* dest_buf)
657 { 657 {
658 if (m_pExtProvider) { 658 if (m_pExtProvider) {
659 return m_pExtProvider->ReadScanline(pContext, dest_buf); 659 return m_pExtProvider->ReadScanline(pContext, dest_buf);
660 } 660 }
661 FXJPEG_Context* p = (FXJPEG_Context*)pContext; 661 FXJPEG_Context* p = (FXJPEG_Context*)pContext;
662 if (setjmp(p->m_JumpMark) == -1) { 662 if (setjmp(p->m_JumpMark) == -1) {
663 return FALSE; 663 return FALSE;
664 } 664 }
665 int nlines = jpeg_read_scanlines(&p->m_Info, &dest_buf, 1); 665 int nlines = jpeg_read_scanlines(&p->m_Info, &dest_buf, 1);
666 return nlines == 1; 666 return nlines == 1;
667 } 667 }
668 FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, uint8_t** avail_buf_pt r) 668 FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, uint8_t** avail_buf_pt r)
669 { 669 {
670 if (m_pExtProvider) { 670 if (m_pExtProvider) {
671 return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr); 671 return m_pExtProvider->GetAvailInput(pContext, avail_buf_ptr);
672 } 672 }
673 if(avail_buf_ptr != NULL) { 673 if(avail_buf_ptr != NULL) {
674 *avail_buf_ptr = NULL; 674 *avail_buf_ptr = NULL;
675 if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) { 675 if(((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer > 0) {
676 *avail_buf_ptr = (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.nex t_input_byte; 676 *avail_buf_ptr = (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.nex t_input_byte;
677 } 677 }
678 } 678 }
679 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; 679 return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer;
680 } 680 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_flate.cpp ('k') | core/src/fxcodec/jbig2/JBig2_Context.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698