diff options
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r-- | core/fpdfapi/parser/cfdf_document.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.cpp | 9 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser_unittest.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp | 26 |
5 files changed, 24 insertions, 22 deletions
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp index 41e285245d..a6045e7795 100644 --- a/core/fpdfapi/parser/cfdf_document.cpp +++ b/core/fpdfapi/parser/cfdf_document.cpp @@ -45,8 +45,8 @@ std::unique_ptr<CFDF_Document> CFDF_Document::ParseFile( std::unique_ptr<CFDF_Document> CFDF_Document::ParseMemory(const uint8_t* pData, uint32_t size) { - return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size), - true); + return CFDF_Document::ParseFile( + IFX_MemoryStream::Create((uint8_t*)pData, size), true); } void CFDF_Document::ParseStream(IFX_SeekableReadStream* pFile, bool bOwnFile) { diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index 1ac6e06a97..248748470c 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -718,7 +718,7 @@ bool CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) { if (m_pLinearized) return true; - ScopedFileStream file(FX_CreateMemoryStream(pData, (size_t)dwLen, false)); + ScopedFileStream file(IFX_MemoryStream::Create(pData, (size_t)dwLen, false)); int32_t offset = GetHeaderOffset(file.get()); if (offset == -1) { m_docStatus = PDF_DATAAVAIL_ERROR; @@ -753,7 +753,8 @@ bool CPDF_DataAvail::CheckEnd(DownloadHints* pHints) { uint8_t buffer[1024]; m_pFileRead->ReadBlock(buffer, req_pos, dwSize); - ScopedFileStream file(FX_CreateMemoryStream(buffer, (size_t)dwSize, false)); + ScopedFileStream file( + IFX_MemoryStream::Create(buffer, (size_t)dwSize, false)); m_syntaxParser.InitParser(file.get(), 0); m_syntaxParser.RestorePos(dwSize - 1); @@ -800,7 +801,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(DownloadHints* pHints, m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize); - ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, false)); + ScopedFileStream file(IFX_MemoryStream::Create(pBuf, (size_t)iSize, false)); m_parser.m_pSyntax->InitParser(file.get(), 0); bool bNumber; @@ -1046,7 +1047,7 @@ bool CPDF_DataAvail::CheckTrailer(DownloadHints* pHints) { if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize)) return false; - ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, false)); + ScopedFileStream file(IFX_MemoryStream::Create(pBuf, (size_t)iSize, false)); m_syntaxParser.InitParser(file.get(), 0); std::unique_ptr<CPDF_Object> pTrailer( diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 2f432ed9f9..1fae0d641c 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -1124,7 +1124,7 @@ std::unique_ptr<CPDF_Object> CPDF_Parser::ParseIndirectObject( if (!pObjStream) return nullptr; - ScopedFileStream file(FX_CreateMemoryStream( + ScopedFileStream file(IFX_MemoryStream::Create( (uint8_t*)pObjStream->GetData(), (size_t)pObjStream->GetSize(), false)); CPDF_SyntaxParser syntax; syntax.InitParser(file.get(), 0); @@ -1204,7 +1204,7 @@ void CPDF_Parser::GetIndirectBinary(uint32_t objnum, const uint8_t* pData = pObjStream->GetData(); uint32_t totalsize = pObjStream->GetSize(); ScopedFileStream file( - FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, false)); + IFX_MemoryStream::Create((uint8_t*)pData, (size_t)totalsize, false)); CPDF_SyntaxParser syntax; syntax.InitParser(file.get(), 0); diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp index 7148c54f30..0a70103d3a 100644 --- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp @@ -45,7 +45,8 @@ class CPDF_TestParser : public CPDF_Parser { // Setup reading from a file and initial states. bool InitTestFromFile(const FX_CHAR* path) { - IFX_SeekableReadStream* pFileAccess = FX_CreateFileRead(path); + IFX_SeekableReadStream* pFileAccess = + IFX_SeekableReadStream::CreateFromFilename(path); if (!pFileAccess) return false; diff --git a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp index a23c0ed64e..f94b431c82 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp @@ -16,7 +16,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Empty string. uint8_t data[] = ""; - ScopedFileStream stream(FX_CreateMemoryStream(data, 0, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 0, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -27,7 +27,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Blank string. uint8_t data[] = " "; - ScopedFileStream stream(FX_CreateMemoryStream(data, 2, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 2, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -38,7 +38,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Skips unknown characters. uint8_t data[] = "z12b"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -49,7 +49,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Skips unknown characters. uint8_t data[] = "*<&*#$^&@1"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 10, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 10, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -60,7 +60,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Skips unknown characters. uint8_t data[] = "\x80zab"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -71,7 +71,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Skips unknown characters. uint8_t data[] = "\xffzab"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -82,7 +82,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Regular conversion. uint8_t data[] = "1A2b>abcd"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 9, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 9, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -93,7 +93,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Position out of bounds. uint8_t data[] = "12ab>"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 5, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 5, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -117,7 +117,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Missing ending >. uint8_t data[] = "1A2b"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -128,7 +128,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Missing ending >. uint8_t data[] = "12abz"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 5, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 5, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -139,7 +139,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Uneven number of bytes. uint8_t data[] = "1A2>asdf"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 8, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 8, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -150,7 +150,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Uneven number of bytes. uint8_t data[] = "1A2zasdf"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 8, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 8, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); @@ -161,7 +161,7 @@ TEST(cpdf_syntax_parser, ReadHexString) { { // Just ending character. uint8_t data[] = ">"; - ScopedFileStream stream(FX_CreateMemoryStream(data, 1, false)); + ScopedFileStream stream(IFX_MemoryStream::Create(data, 1, false)); CPDF_SyntaxParser parser; parser.InitParser(stream.get(), 0); |