CFX_SeekableStreamProxy should not be an IFX_SeekableStream.

Although it implements methods with similar sounding names, the size
parameters in CFX_SeekableStreamProxy are in terms of wchar_t, not
bytes. Callers through the virtual interface might get confused (but
currently there isn't any such bad usage).

- Remove unused method.
- Make one other method private.
- Make enum From private.

Change-Id: Ifa798f33d4c40ea88d358f340c6f7f4b70655f40
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/52091
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp
index c0317ca..d01e1d1 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.cpp
+++ b/core/fxcrt/cfx_seekablestreamproxy.cpp
@@ -192,7 +192,7 @@
   return new_pos.IsValid() ? iBufferSize : 0;
 }
 
-size_t CFX_SeekableStreamProxy::ReadBlock(void* pStr, size_t size) {
+size_t CFX_SeekableStreamProxy::ReadBlock(wchar_t* pStr, size_t size) {
   if (!pStr || size == 0)
     return 0;
 
@@ -202,7 +202,7 @@
     size_t iLen = ReadData(reinterpret_cast<uint8_t*>(pStr), iBytes);
     size = iLen / 2;
     if (m_wCodePage == FX_CODEPAGE_UTF16BE)
-      SwapByteOrder(static_cast<uint16_t*>(pStr), size);
+      SwapByteOrder(reinterpret_cast<uint16_t*>(pStr), size);
 
     if (sizeof(wchar_t) > 2 && size > 0)
       UTF16ToWChar(pStr, size);
@@ -229,10 +229,3 @@
 
   return size;
 }
-
-bool CFX_SeekableStreamProxy::ReadBlockAtOffset(void* pStr,
-                                                FX_FILESIZE offset,
-                                                size_t size) {
-  NOTREACHED();
-  return false;
-}
diff --git a/core/fxcrt/cfx_seekablestreamproxy.h b/core/fxcrt/cfx_seekablestreamproxy.h
index 70aff0a..d6ea160 100644
--- a/core/fxcrt/cfx_seekablestreamproxy.h
+++ b/core/fxcrt/cfx_seekablestreamproxy.h
@@ -11,31 +11,31 @@
 #include "core/fxcrt/fx_system.h"
 #include "core/fxcrt/retain_ptr.h"
 
-class CFX_SeekableStreamProxy final : public IFX_SeekableReadStream {
+class CFX_SeekableStreamProxy final : public Retainable {
  public:
-  enum class From {
-    Begin = 0,
-    Current,
-  };
-
   template <typename T, typename... Args>
   friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
 
-  // IFX_SeekableReadStream:
-  FX_FILESIZE GetSize() override;
-  FX_FILESIZE GetPosition() override;
-  bool IsEOF() override;
-  size_t ReadBlock(void* pStr, size_t size) override;
-  bool ReadBlockAtOffset(void* pStr, FX_FILESIZE offset, size_t size) override;
+  // Unlike IFX_SeekableStreamProxy, buffers and sizes are always in terms
+  // of the number of wchar_t elementss, not bytes.
+  FX_FILESIZE GetSize();  // Estimate under worst possible expansion.
+  bool IsEOF();
+  size_t ReadBlock(wchar_t* pStr, size_t size);
 
   uint16_t GetCodePage() const { return m_wCodePage; }
   void SetCodePage(uint16_t wCodePage);
 
  private:
+  enum class From {
+    Begin = 0,
+    Current,
+  };
+
   explicit CFX_SeekableStreamProxy(
       const RetainPtr<IFX_SeekableReadStream>& stream);
   ~CFX_SeekableStreamProxy() override;
 
+  FX_FILESIZE GetPosition();
   void Seek(From eSeek, FX_FILESIZE iOffset);
   size_t ReadData(uint8_t* pBuffer, size_t iBufferSize);
 
diff --git a/core/fxcrt/xml/cfx_xmlparser.h b/core/fxcrt/xml/cfx_xmlparser.h
index 3d7cc78..38866c8 100644
--- a/core/fxcrt/xml/cfx_xmlparser.h
+++ b/core/fxcrt/xml/cfx_xmlparser.h
@@ -13,6 +13,7 @@
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/retain_ptr.h"
 
+class CFX_SeekableStreamProxy;
 class CFX_XMLDocument;
 class CFX_XMLElement;
 class CFX_XMLNode;
@@ -53,7 +54,7 @@
   void ProcessTargetData();
 
   CFX_XMLNode* current_node_ = nullptr;
-  RetainPtr<IFX_SeekableReadStream> stream_;
+  RetainPtr<CFX_SeekableStreamProxy> stream_;
   std::vector<wchar_t> current_text_;
   size_t xml_plane_size_ = 1024;
   int32_t entity_start_ = -1;