Avoid overloading in IFX_SeekableWriteStream.

Having overloaded virtual methods is confusing for the compiler. Rename
one variant of WriteBlock() to WriteBlockAtOffset().

Change-Id: If2bf291b02914fdcb06f1d441e6584237ec0a501
Reviewed-on: https://pdfium-review.googlesource.com/c/45553
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcrt/cfx_memorystream.cpp b/core/fxcrt/cfx_memorystream.cpp
index 442fdf3..05899ec 100644
--- a/core/fxcrt/cfx_memorystream.cpp
+++ b/core/fxcrt/cfx_memorystream.cpp
@@ -65,9 +65,9 @@
   return nRead;
 }
 
-bool CFX_MemoryStream::WriteBlock(const void* buffer,
-                                  FX_FILESIZE offset,
-                                  size_t size) {
+bool CFX_MemoryStream::WriteBlockAtOffset(const void* buffer,
+                                          FX_FILESIZE offset,
+                                          size_t size) {
   if (!buffer || offset < 0 || !size)
     return false;
 
diff --git a/core/fxcrt/cfx_memorystream.h b/core/fxcrt/cfx_memorystream.h
index a54b814..c5fa3c2 100644
--- a/core/fxcrt/cfx_memorystream.h
+++ b/core/fxcrt/cfx_memorystream.h
@@ -26,7 +26,9 @@
                          FX_FILESIZE offset,
                          size_t size) override;
   size_t ReadBlock(void* buffer, size_t size) override;
-  bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override;
+  bool WriteBlockAtOffset(const void* buffer,
+                          FX_FILESIZE offset,
+                          size_t size) override;
   bool Flush() override;
 
   const uint8_t* GetBuffer() const { return m_data.get(); }
diff --git a/core/fxcrt/cfx_seekablemultistream.cpp b/core/fxcrt/cfx_seekablemultistream.cpp
index 21bdd29..d817000 100644
--- a/core/fxcrt/cfx_seekablemultistream.cpp
+++ b/core/fxcrt/cfx_seekablemultistream.cpp
@@ -77,9 +77,9 @@
   return false;
 }
 
-bool CFX_SeekableMultiStream::WriteBlock(const void* pData,
-                                         FX_FILESIZE offset,
-                                         size_t size) {
+bool CFX_SeekableMultiStream::WriteBlockAtOffset(const void* pData,
+                                                 FX_FILESIZE offset,
+                                                 size_t size) {
   NOTREACHED();
   return false;
 }
diff --git a/core/fxcrt/cfx_seekablemultistream.h b/core/fxcrt/cfx_seekablemultistream.h
index 966877f..2f8b874 100644
--- a/core/fxcrt/cfx_seekablemultistream.h
+++ b/core/fxcrt/cfx_seekablemultistream.h
@@ -30,7 +30,9 @@
   size_t ReadBlock(void* buffer, size_t size) override;
   bool IsEOF() override;
   bool Flush() override;
-  bool WriteBlock(const void* pData, FX_FILESIZE offset, size_t size) override;
+  bool WriteBlockAtOffset(const void* pData,
+                          FX_FILESIZE offset,
+                          size_t size) override;
 
  private:
   std::vector<RetainPtr<CPDF_StreamAcc>> m_Data;
diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp
index 35be9d5..1d05cd3 100644
--- a/core/fxcrt/fx_stream.cpp
+++ b/core/fxcrt/fx_stream.cpp
@@ -44,9 +44,9 @@
   size_t ReadBlock(void* buffer, size_t size) override {
     return m_pFile->Read(buffer, size);
   }
-  bool WriteBlock(const void* buffer,
-                  FX_FILESIZE offset,
-                  size_t size) override {
+  bool WriteBlockAtOffset(const void* buffer,
+                          FX_FILESIZE offset,
+                          size_t size) override {
     return !!m_pFile->WritePos(buffer, size, offset);
   }
   bool Flush() override { return m_pFile->Flush(); }
@@ -88,7 +88,7 @@
 }
 
 bool IFX_SeekableWriteStream::WriteBlock(const void* pData, size_t size) {
-  return WriteBlock(pData, GetSize(), size);
+  return WriteBlockAtOffset(pData, GetSize(), size);
 }
 
 bool IFX_SeekableReadStream::IsEOF() {
@@ -104,7 +104,7 @@
 }
 
 bool IFX_SeekableStream::WriteBlock(const void* buffer, size_t size) {
-  return WriteBlock(buffer, GetSize(), size);
+  return WriteBlockAtOffset(buffer, GetSize(), size);
 }
 
 bool IFX_SeekableStream::WriteString(const ByteStringView& str) {
diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h
index aa77821..270cc9a 100644
--- a/core/fxcrt/fx_stream.h
+++ b/core/fxcrt/fx_stream.h
@@ -63,9 +63,9 @@
 
   virtual FX_FILESIZE GetSize() = 0;
   virtual bool Flush() = 0;
-  virtual bool WriteBlock(const void* pData,
-                          FX_FILESIZE offset,
-                          size_t size) = 0;
+  virtual bool WriteBlockAtOffset(const void* pData,
+                                  FX_FILESIZE offset,
+                                  size_t size) = 0;
 };
 
 class IFX_SeekableReadStream : public IFX_ReadStream {
@@ -101,9 +101,6 @@
   FX_FILESIZE GetSize() override = 0;
 
   // IFX_SeekableWriteStream:
-  bool WriteBlock(const void* buffer,
-                  FX_FILESIZE offset,
-                  size_t size) override = 0;
   bool WriteBlock(const void* buffer, size_t size) override;
   bool WriteString(const ByteStringView& str) override;
 };
diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp
index 22b46ce..f9657ae 100644
--- a/fpdfsdk/cpdfsdk_helpers.cpp
+++ b/fpdfsdk/cpdfsdk_helpers.cpp
@@ -52,7 +52,9 @@
                          FX_FILESIZE offset,
                          size_t size) override;
   size_t ReadBlock(void* buffer, size_t size) override;
-  bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override;
+  bool WriteBlockAtOffset(const void* buffer,
+                          FX_FILESIZE offset,
+                          size_t size) override;
   bool Flush() override;
 
   void SetPosition(FX_FILESIZE pos) { m_nCurPos = pos; }
@@ -122,9 +124,9 @@
   return 0;
 }
 
-bool FPDF_FileHandlerContext::WriteBlock(const void* buffer,
-                                         FX_FILESIZE offset,
-                                         size_t size) {
+bool FPDF_FileHandlerContext::WriteBlockAtOffset(const void* buffer,
+                                                 FX_FILESIZE offset,
+                                                 size_t size) {
   if (!m_pFS || !m_pFS->WriteBlock)
     return false;
 
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index e9cd2f6..cbb8764 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -446,8 +446,8 @@
   RetainPtr<IFX_SeekableStream> fileWrite = MakeSeekableStream(pFileHandler);
   if (fileType == FXFA_SAVEAS_XML) {
     ByteString content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
-    fileWrite->WriteBlock(content.c_str(), fileWrite->GetSize(),
-                          content.GetLength());
+    fileWrite->WriteBlockAtOffset(content.c_str(), fileWrite->GetSize(),
+                                  content.GetLength());
     CXFA_FFDoc* ffdoc = m_pContext->GetXFADocView()->GetDoc();
     ffdoc->SavePackage(
         ToNode(ffdoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Data)), fileWrite);
@@ -500,13 +500,13 @@
         static const char kFormat[] =
             "\n<pdf href=\"%s\" xmlns=\"http://ns.adobe.com/xdp/pdf/\"/>";
         ByteString content = ByteString::Format(kFormat, bPath.c_str());
-        fileWrite->WriteBlock(content.c_str(), fileWrite->GetSize(),
-                              content.GetLength());
+        fileWrite->WriteBlockAtOffset(content.c_str(), fileWrite->GetSize(),
+                                      content.GetLength());
       }
       auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
       pAcc->LoadAllDataFiltered();
-      fileWrite->WriteBlock(pAcc->GetData(), fileWrite->GetSize(),
-                            pAcc->GetSize());
+      fileWrite->WriteBlockAtOffset(pAcc->GetData(), fileWrite->GetSize(),
+                                    pAcc->GetSize());
     }
   }
   fileWrite->Flush();
@@ -725,7 +725,7 @@
   if (fileType == FXFA_SAVEAS_XML) {
     static constexpr char kContent[] =
         "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
-    fileStream->WriteBlock(kContent, 0, strlen(kContent));
+    fileStream->WriteBlockAtOffset(kContent, 0, strlen(kContent));
 
     ffdoc->SavePackage(
         ToNode(ffdoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Data)),
diff --git a/testing/string_write_stream.cpp b/testing/string_write_stream.cpp
index 4747438..77e6825 100644
--- a/testing/string_write_stream.cpp
+++ b/testing/string_write_stream.cpp
@@ -18,9 +18,9 @@
   return true;
 }
 
-bool StringWriteStream::WriteBlock(const void* pData,
-                                   FX_FILESIZE offset,
-                                   size_t size) {
+bool StringWriteStream::WriteBlockAtOffset(const void* pData,
+                                           FX_FILESIZE offset,
+                                           size_t size) {
   ASSERT(offset == 0);
   stream_.write(static_cast<const char*>(pData), size);
   return true;
diff --git a/testing/string_write_stream.h b/testing/string_write_stream.h
index a77e4f0..b266f33 100644
--- a/testing/string_write_stream.h
+++ b/testing/string_write_stream.h
@@ -18,7 +18,9 @@
   // IFX_SeekableWriteStream
   FX_FILESIZE GetSize() override;
   bool Flush() override;
-  bool WriteBlock(const void* pData, FX_FILESIZE offset, size_t size) override;
+  bool WriteBlockAtOffset(const void* pData,
+                          FX_FILESIZE offset,
+                          size_t size) override;
   bool WriteString(const ByteStringView& str) override;
 
   std::string ToString() const { return stream_.str(); }