diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-07 13:56:13 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-07 21:16:15 +0000 |
commit | c4a2b7518949df00651aa3513c93079f1968441e (patch) | |
tree | 6befb2de2d0b8222cbc68f3c1cee99a20bea1cd0 /core/fpdfapi/parser/fpdf_parser_decode.cpp | |
parent | 1835a6fb98286817cdf656f4d1e223bd85ee378f (diff) | |
download | pdfium-c4a2b7518949df00651aa3513c93079f1968441e.tar.xz |
Cleanup string passing in core/fpdf*
Return strings where possible.
Add missing consts to strings passed by ref.
Convert non-const cases to pointers.
Rename a few methods to be clearer.
Change-Id: I86569bc1744f539e6dd67fc73649b272c016328c
Reviewed-on: https://pdfium-review.googlesource.com/3951
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/fpdf_parser_decode.cpp')
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_decode.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index a1698aedde..cc8b507025 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -327,7 +327,7 @@ bool PDF_DataDecode(const uint8_t* src_buf, const CPDF_Dictionary* pDict, uint8_t*& dest_buf, uint32_t& dest_size, - CFX_ByteString& ImageEncoding, + CFX_ByteString* ImageEncoding, CPDF_Dictionary*& pImageParms, uint32_t last_estimated_size, bool bImageAcc) { @@ -362,8 +362,8 @@ bool PDF_DataDecode(const uint8_t* src_buf, int offset = -1; if (decoder == "FlateDecode" || decoder == "Fl") { if (bImageAcc && i == nSize - 1) { - ImageEncoding = "FlateDecode"; - dest_buf = (uint8_t*)last_buf; + *ImageEncoding = "FlateDecode"; + dest_buf = last_buf; dest_size = last_size; pImageParms = pParam; return true; @@ -379,8 +379,8 @@ bool PDF_DataDecode(const uint8_t* src_buf, offset = HexDecode(last_buf, last_size, new_buf, new_size); } else if (decoder == "RunLengthDecode" || decoder == "RL") { if (bImageAcc && i == nSize - 1) { - ImageEncoding = "RunLengthDecode"; - dest_buf = (uint8_t*)last_buf; + *ImageEncoding = "RunLengthDecode"; + dest_buf = last_buf; dest_size = last_size; pImageParms = pParam; return true; @@ -395,9 +395,9 @@ bool PDF_DataDecode(const uint8_t* src_buf, } else if (decoder == "CCF") { decoder = "CCITTFaxDecode"; } - ImageEncoding = decoder; + *ImageEncoding = decoder; pImageParms = pParam; - dest_buf = (uint8_t*)last_buf; + dest_buf = last_buf; dest_size = last_size; if (CPDF_Array* pDecoders = pDecoder->AsArray()) pDecoders->RemoveAt(i + 1, pDecoders->GetCount() - i - 1); @@ -413,7 +413,7 @@ bool PDF_DataDecode(const uint8_t* src_buf, last_buf = new_buf; last_size = new_size; } - ImageEncoding = ""; + *ImageEncoding = ""; pImageParms = nullptr; dest_buf = last_buf; dest_size = last_size; |