Remove CPDF_StreamAcc::GetDict().
It is only used for tests, so provide a suitable alternative
method that doesn't expose the dictionary.
Change-Id: I8b7329daf85011c579ac706fbc015d48f72c9f2a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/98990
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index f0bd7ae..7ef79ff 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -71,8 +71,8 @@
return m_pStream;
}
-RetainPtr<const CPDF_Dictionary> CPDF_StreamAcc::GetDict() const {
- return m_pStream ? m_pStream->GetDict() : nullptr;
+int CPDF_StreamAcc::GetLength1ForTest() const {
+ return m_pStream->GetDict()->GetIntegerFor("Length1");
}
RetainPtr<const CPDF_Dictionary> CPDF_StreamAcc::GetImageParam() const {
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index 2ac7c45..7c1ca56 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -33,7 +33,6 @@
void LoadAllDataRaw();
RetainPtr<const CPDF_Stream> GetStream() const;
- RetainPtr<const CPDF_Dictionary> GetDict() const;
RetainPtr<const CPDF_Dictionary> GetImageParam() const;
uint32_t GetSize() const;
@@ -42,6 +41,8 @@
ByteString GetImageDecoder() const { return m_ImageDecoder; }
std::unique_ptr<uint8_t, FxFreeDeleter> DetachData();
+ int GetLength1ForTest() const;
+
private:
// TODO(crbug.com/pdfium/1872): Replace with fxcrt::DataVector.
struct OwnedData {
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index 82926b0..4eb648d 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -137,8 +137,7 @@
// Check that the font stream is the one that was provided
ASSERT_EQ(span.size(), streamAcc->GetSize());
if (font_type == FPDF_FONT_TRUETYPE) {
- ASSERT_EQ(static_cast<int>(span.size()),
- streamAcc->GetDict()->GetIntegerFor("Length1"));
+ ASSERT_EQ(static_cast<int>(span.size()), streamAcc->GetLength1ForTest());
}
pdfium::span<const uint8_t> stream_data = streamAcc->GetSpan();