Remove out-parameters from more codec decoding functions
Convert to using DataAndBytesConsumed.
Change-Id: Ic93ccdf9fcad7016449a0d5d1fbd4f5f1ecd8f55
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/119172
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/BUILD.gn b/fpdfsdk/BUILD.gn
index c8aa54f..b18ca03 100644
--- a/fpdfsdk/BUILD.gn
+++ b/fpdfsdk/BUILD.gn
@@ -76,6 +76,7 @@
"../core/fpdfapi/render",
"../core/fpdfdoc",
"../core/fpdftext",
+ "../core/fxcodec",
"../core/fxcrt",
"../core/fxge",
"../fxjs",
diff --git a/fpdfsdk/fpdf_attachment.cpp b/fpdfsdk/fpdf_attachment.cpp
index 85ba9fb..4136ad5 100644
--- a/fpdfsdk/fpdf_attachment.cpp
+++ b/fpdfsdk/fpdf_attachment.cpp
@@ -22,6 +22,7 @@
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fpdfdoc/cpdf_filespec.h"
#include "core/fpdfdoc/cpdf_nametree.h"
+#include "core/fxcodec/data_and_bytes_consumed.h"
#include "core/fxcrt/cfx_datetime.h"
#include "core/fxcrt/data_vector.h"
#include "core/fxcrt/fx_extension.h"
@@ -34,10 +35,8 @@
constexpr char kChecksumKey[] = "CheckSum";
ByteString CFXByteStringHexDecode(const ByteString& bsHex) {
- std::unique_ptr<uint8_t, FxFreeDeleter> result;
- uint32_t size = 0;
- HexDecode(bsHex.unsigned_span(), &result, &size);
- return ByteString(result.get(), size);
+ DataAndBytesConsumed result = HexDecode(bsHex.unsigned_span());
+ return ByteString(result.data.get(), result.size);
}
// TODO(tsepez): should be UNSAFE_BUFFER_USAGE.