summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-30 15:10:55 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-30 15:10:55 -0800
commit345d489b70a8e057587512524e69bd5692e2e14b (patch)
tree01a34c53a991ef069b503bed1b8d1845510cfe04 /xfa
parent47718fbaf24000877aff58d9512b9b1dea0af818 (diff)
downloadpdfium-345d489b70a8e057587512524e69bd5692e2e14b.tar.xz
Convert loose FX_Create* functions into static methods
Also remove a bool that is always false. Review-Url: https://codereview.chromium.org/2539203002
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fgas/crt/fgas_stream.cpp6
-rw-r--r--xfa/fgas/crt/fgas_stream.h5
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.cpp2
-rw-r--r--xfa/fgas/font/cfgas_gefont.cpp2
-rw-r--r--xfa/fxfa/app/xfa_ffdoc.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp2
8 files changed, 13 insertions, 14 deletions
diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp
index c3850c00bb..73d3d0b661 100644
--- a/xfa/fgas/crt/fgas_stream.cpp
+++ b/xfa/fgas/crt/fgas_stream.cpp
@@ -1452,10 +1452,8 @@ IFX_Stream* CFX_Stream::CreateSharedStream(uint32_t dwAccess,
return pShared;
}
-IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream,
- bool bReleaseStream) {
- ASSERT(pBaseStream);
- return new CFGAS_FileRead(pBaseStream, bReleaseStream);
+IFX_SeekableReadStream* IFX_Stream::MakeSeekableReadStream() {
+ return new CFGAS_FileRead(this, false);
}
CFGAS_FileRead::CFGAS_FileRead(IFX_Stream* pStream, bool bReleaseStream)
diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/fgas_stream.h
index 674007e935..413927d22f 100644
--- a/xfa/fgas/crt/fgas_stream.h
+++ b/xfa/fgas/crt/fgas_stream.h
@@ -37,6 +37,7 @@ class IFX_Stream {
uint32_t dwAccess);
static IFX_Stream* CreateTextStream(IFX_Stream* pBaseStream,
bool bDeleteOnRelease);
+
virtual ~IFX_Stream() {}
virtual void Release() = 0;
virtual IFX_Stream* Retain() = 0;
@@ -61,9 +62,9 @@ class IFX_Stream {
virtual int32_t GetBOM(uint8_t bom[4]) const = 0;
virtual uint16_t GetCodePage() const = 0;
virtual uint16_t SetCodePage(uint16_t wCodePage) = 0;
+
+ IFX_SeekableReadStream* MakeSeekableReadStream();
};
-IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream,
- bool bReleaseStream);
#endif // XFA_FGAS_CRT_FGAS_STREAM_H_
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 9b95318bd0..219e67dbc6 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -909,7 +909,7 @@ IFX_SeekableReadStream* CFGAS_FontMgr::CreateFontStream(
uint8_t* pBuffer = FX_Alloc(uint8_t, dwFileSize + 1);
dwFileSize = pSystemFontInfo->GetFontData(hFont, 0, pBuffer, dwFileSize);
- return FX_CreateMemoryStream(pBuffer, dwFileSize, true);
+ return IFX_MemoryStream::Create(pBuffer, dwFileSize, true);
}
IFX_SeekableReadStream* CFGAS_FontMgr::CreateFontStream(
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index ffe791aab5..c1dfa2b5b9 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -209,7 +209,7 @@ bool CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream, bool bSaveStream) {
if (bSaveStream)
m_pStream.reset(pFontStream);
- m_pFileRead.reset(FX_CreateFileRead(pFontStream, false));
+ m_pFileRead.reset(pFontStream->MakeSeekableReadStream());
m_pFont = new CFX_Font;
if (m_pFont->LoadFile(m_pFileRead.get()))
return InitFont();
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index 1b5665bb08..cf5b289613 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -417,8 +417,8 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName,
CPDF_StreamAcc streamAcc;
streamAcc.LoadAllData(pStream);
- IFX_SeekableReadStream* pImageFileRead =
- FX_CreateMemoryStream((uint8_t*)streamAcc.GetData(), streamAcc.GetSize());
+ IFX_SeekableReadStream* pImageFileRead = IFX_MemoryStream::Create(
+ (uint8_t*)streamAcc.GetData(), streamAcc.GetSize());
CFX_DIBitmap* pDibSource = XFA_LoadImageFromBuffer(
pImageFileRead, FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi);
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index e6c0c595b2..bc1854eb42 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -1066,11 +1066,11 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
pImageBuffer = FX_Alloc(uint8_t, iLength);
int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer);
if (iRead > 0) {
- pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead);
+ pImageFileRead = IFX_MemoryStream::Create(pImageBuffer, iRead);
}
} else {
bsContent = CFX_ByteString::FromUnicode(wsImage);
- pImageFileRead = FX_CreateMemoryStream(
+ pImageFileRead = IFX_MemoryStream::Create(
const_cast<uint8_t*>(bsContent.raw_str()), bsContent.GetLength());
}
} else {
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index ad9693f98f..1ec9c44de6 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -197,7 +197,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
if (!pRichTextXML)
break;
- IFX_MemoryStream* pMemStream = FX_CreateMemoryStream(true);
+ IFX_MemoryStream* pMemStream = IFX_MemoryStream::Create(true);
IFX_Stream* pTempStream = IFX_Stream::CreateStream(
(IFX_SeekableWriteStream*)pMemStream, FX_STREAMACCESS_Text |
FX_STREAMACCESS_Write |
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 18ea41419a..05ddcfc71b 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1442,7 +1442,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) {
XFA_DataExporter_DealWithDataGroupNode(this);
}
std::unique_ptr<IFX_MemoryStream, ReleaseDeleter<IFX_MemoryStream>>
- pMemoryStream(FX_CreateMemoryStream(true));
+ pMemoryStream(IFX_MemoryStream::Create(true));
std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> pStream(
IFX_Stream::CreateStream(
static_cast<IFX_SeekableWriteStream*>(pMemoryStream.get()),