summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-12-13 12:48:13 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-13 12:48:13 -0800
commit974b4a6c4bceb50bbe5bf316e9e273b62eaeceac (patch)
treee243d34a04905b88a11e9146e698daaa0cee2416 /core/fpdfapi/parser
parent988599c5d81bbb568f949454580ec6001258f806 (diff)
downloadpdfium-974b4a6c4bceb50bbe5bf316e9e273b62eaeceac.tar.xz
Return unique_ptr<>s from fxcodec/chromium/2951
Review-Url: https://codereview.chromium.org/2572843002
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.cpp7
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.h19
2 files changed, 22 insertions, 4 deletions
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 6398c71835..884b5c50d1 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -245,7 +245,7 @@ uint32_t RunLengthDecode(const uint8_t* src_buf,
return std::min(i + 1, src_size);
}
-CCodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
+std::unique_ptr<CCodec_ScanlineDecoder> FPDFAPI_CreateFaxDecoder(
const uint8_t* src_buf,
uint32_t src_size,
int width,
@@ -273,7 +273,7 @@ CCodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
Columns, Rows);
}
-CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
+std::unique_ptr<CCodec_ScanlineDecoder> FPDFAPI_CreateFlateDecoder(
const uint8_t* src_buf,
uint32_t src_size,
int width,
@@ -288,9 +288,8 @@ CCodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
Colors = pParams->GetIntegerFor("Colors", 1);
BitsPerComponent = pParams->GetIntegerFor("BitsPerComponent", 8);
Columns = pParams->GetIntegerFor("Columns", 1);
- if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
+ if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns))
return nullptr;
- }
}
return CPDF_ModuleMgr::Get()->GetFlateModule()->CreateDecoder(
src_buf, src_size, width, height, nComps, bpc, predictor, Colors,
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h
index 4d99f1559d..dc8ecf0c9b 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.h
+++ b/core/fpdfapi/parser/fpdf_parser_decode.h
@@ -7,8 +7,11 @@
#ifndef CORE_FPDFAPI_PARSER_FPDF_PARSER_DECODE_H_
#define CORE_FPDFAPI_PARSER_FPDF_PARSER_DECODE_H_
+#include <memory>
+
#include "core/fxcrt/fx_basic.h"
+class CCodec_ScanlineDecoder;
class CPDF_Dictionary;
// Indexed by 8-bit char code, contains unicode code points.
@@ -45,6 +48,22 @@ uint32_t RunLengthDecode(const uint8_t* src_buf,
uint8_t*& dest_buf,
uint32_t& dest_size);
+std::unique_ptr<CCodec_ScanlineDecoder> FPDFAPI_CreateFaxDecoder(
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ int width,
+ int height,
+ const CPDF_Dictionary* pParams);
+
+std::unique_ptr<CCodec_ScanlineDecoder> FPDFAPI_CreateFlateDecoder(
+ const uint8_t* src_buf,
+ uint32_t src_size,
+ int width,
+ int height,
+ int nComps,
+ int bpc,
+ const CPDF_Dictionary* pParams);
+
// Public for testing.
uint32_t A85Decode(const uint8_t* src_buf,
uint32_t src_size,