summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fxcrt/cfx_seekablestreamproxy.cpp37
-rw-r--r--core/fxcrt/cfx_seekablestreamproxy.h6
2 files changed, 4 insertions, 39 deletions
diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp
index 989c440db1..44a212d867 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.cpp
+++ b/core/fxcrt/cfx_seekablestreamproxy.cpp
@@ -134,20 +134,13 @@ void SwapByteOrder(wchar_t* pStr, size_t iLength) {
#define BOM_UTF16_LE 0x0000FEFF
CFX_SeekableStreamProxy::CFX_SeekableStreamProxy(
- const RetainPtr<IFX_SeekableStream>& stream,
- bool isWriteStream)
- : m_IsWriteStream(isWriteStream),
- m_wCodePage(FX_CODEPAGE_DefANSI),
+ const RetainPtr<IFX_SeekableStream>& stream)
+ : m_wCodePage(FX_CODEPAGE_DefANSI),
m_wBOMLength(0),
m_iPosition(0),
m_pStream(stream) {
ASSERT(m_pStream);
- if (isWriteStream) {
- m_iPosition = m_pStream->GetSize();
- return;
- }
-
Seek(From::Begin, 0);
uint32_t bom = 0;
@@ -176,8 +169,7 @@ CFX_SeekableStreamProxy::CFX_SeekableStreamProxy(
CFX_SeekableStreamProxy::CFX_SeekableStreamProxy(uint8_t* data, size_t size)
: CFX_SeekableStreamProxy(
- pdfium::MakeRetain<CFX_MemoryStream>(data, size, false),
- false) {}
+ pdfium::MakeRetain<CFX_MemoryStream>(data, size, false)) {}
CFX_SeekableStreamProxy::~CFX_SeekableStreamProxy() {}
@@ -206,9 +198,6 @@ void CFX_SeekableStreamProxy::SetCodePage(uint16_t wCodePage) {
size_t CFX_SeekableStreamProxy::ReadData(uint8_t* pBuffer, size_t iBufferSize) {
ASSERT(pBuffer && iBufferSize > 0);
- if (m_IsWriteStream)
- return 0;
-
iBufferSize =
std::min(iBufferSize, static_cast<size_t>(GetLength() - m_iPosition));
if (iBufferSize <= 0)
@@ -229,9 +218,6 @@ size_t CFX_SeekableStreamProxy::ReadString(wchar_t* pStr,
if (!pStr || iMaxLength == 0)
return 0;
- if (m_IsWriteStream)
- return 0;
-
if (m_wCodePage == FX_CODEPAGE_UTF16LE ||
m_wCodePage == FX_CODEPAGE_UTF16BE) {
size_t iBytes = iMaxLength * 2;
@@ -267,20 +253,3 @@ size_t CFX_SeekableStreamProxy::ReadString(wchar_t* pStr,
*bEOS = IsEOF();
return iMaxLength;
}
-
-void CFX_SeekableStreamProxy::WriteString(const WideStringView& str) {
- if (!m_IsWriteStream || str.GetLength() == 0 ||
- m_wCodePage != FX_CODEPAGE_UTF8) {
- return;
- }
- if (!m_pStream->WriteBlock(str.unterminated_c_str(), m_iPosition,
- str.GetLength() * sizeof(wchar_t))) {
- return;
- }
-
- pdfium::base::CheckedNumeric<FX_FILESIZE> new_pos = m_iPosition;
- new_pos += str.GetLength() * sizeof(wchar_t);
- m_iPosition = new_pos.ValueOrDefault(std::numeric_limits<FX_FILESIZE>::max());
- m_iPosition =
- pdfium::clamp(m_iPosition, static_cast<FX_FILESIZE>(0), GetLength());
-}
diff --git a/core/fxcrt/cfx_seekablestreamproxy.h b/core/fxcrt/cfx_seekablestreamproxy.h
index c25ab3c9b6..451f7769c2 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.h
+++ b/core/fxcrt/cfx_seekablestreamproxy.h
@@ -31,20 +31,16 @@ class CFX_SeekableStreamProxy : public Retainable {
void Seek(From eSeek, FX_FILESIZE iOffset);
size_t ReadString(wchar_t* pStr, size_t iMaxLength, bool* bEOS);
- void WriteString(const WideStringView& str);
-
uint16_t GetCodePage() const { return m_wCodePage; }
void SetCodePage(uint16_t wCodePage);
private:
- CFX_SeekableStreamProxy(const RetainPtr<IFX_SeekableStream>& stream,
- bool isWriteSteam);
+ explicit CFX_SeekableStreamProxy(const RetainPtr<IFX_SeekableStream>& stream);
CFX_SeekableStreamProxy(uint8_t* data, size_t size);
~CFX_SeekableStreamProxy() override;
size_t ReadData(uint8_t* pBuffer, size_t iBufferSize);
- bool m_IsWriteStream;
uint16_t m_wCodePage;
size_t m_wBOMLength;
FX_FILESIZE m_iPosition;