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

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

Issue 1719493002: Revert "Use safe arithmentic in CFX_BinaryBuf::ExpandBuf." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 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/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | core/src/fxcrt/fx_basic_buffer.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 "core/include/fxcodec/fx_codec.h" 7 #include "core/include/fxcodec/fx_codec.h"
8 #include "core/src/fxcodec/codec/codec_int.h" 8 #include "core/src/fxcodec/codec/codec_int.h"
9 9
10 namespace { 10 namespace {
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 m_pLineBuf[0] = last_byte; 792 m_pLineBuf[0] = last_byte;
793 FaxEncode2DLine(m_pLineBuf, dest_bitpos, scan_line, m_pRefLine, m_Cols); 793 FaxEncode2DLine(m_pLineBuf, dest_bitpos, scan_line, m_pRefLine, m_Cols);
794 m_DestBuf.AppendBlock(m_pLineBuf, dest_bitpos / 8); 794 m_DestBuf.AppendBlock(m_pLineBuf, dest_bitpos / 8);
795 last_byte = m_pLineBuf[dest_bitpos / 8]; 795 last_byte = m_pLineBuf[dest_bitpos / 8];
796 dest_bitpos %= 8; 796 dest_bitpos %= 8;
797 FXSYS_memcpy(m_pRefLine, scan_line, m_Pitch); 797 FXSYS_memcpy(m_pRefLine, scan_line, m_Pitch);
798 } 798 }
799 if (dest_bitpos) { 799 if (dest_bitpos) {
800 m_DestBuf.AppendByte(last_byte); 800 m_DestBuf.AppendByte(last_byte);
801 } 801 }
802 dest_buf = m_DestBuf.GetBuffer();
802 dest_size = m_DestBuf.GetSize(); 803 dest_size = m_DestBuf.GetSize();
803 dest_buf = m_DestBuf.DetachBuffer(); 804 m_DestBuf.DetachBuffer();
804 } 805 }
805 FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf, 806 FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf,
806 int width, 807 int width,
807 int height, 808 int height,
808 int pitch, 809 int pitch,
809 uint8_t*& dest_buf, 810 uint8_t*& dest_buf,
810 FX_DWORD& dest_size) { 811 FX_DWORD& dest_size) {
811 CCodec_FaxEncoder encoder(src_buf, width, height, pitch); 812 CCodec_FaxEncoder encoder(src_buf, width, height, pitch);
812 encoder.Encode(dest_buf, dest_size); 813 encoder.Encode(dest_buf, dest_size);
813 return TRUE; 814 return TRUE;
814 } 815 }
815 ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder( 816 ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(
816 const uint8_t* src_buf, 817 const uint8_t* src_buf,
817 FX_DWORD src_size, 818 FX_DWORD src_size,
818 int width, 819 int width,
819 int height, 820 int height,
820 int K, 821 int K,
821 FX_BOOL EndOfLine, 822 FX_BOOL EndOfLine,
822 FX_BOOL EncodedByteAlign, 823 FX_BOOL EncodedByteAlign,
823 FX_BOOL BlackIs1, 824 FX_BOOL BlackIs1,
824 int Columns, 825 int Columns,
825 int Rows) { 826 int Rows) {
826 CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; 827 CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder;
827 pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, 828 pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine,
828 EncodedByteAlign, BlackIs1, Columns, Rows); 829 EncodedByteAlign, BlackIs1, Columns, Rows);
829 return pDecoder; 830 return pDecoder;
830 } 831 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | core/src/fxcrt/fx_basic_buffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698