diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-14 15:12:09 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-15 01:13:16 +0000 |
commit | 4d67473d6ce55ad6361dae84b00283445f148f37 (patch) | |
tree | 872e1ff82d47d95e050c6d2666225c84901ae2d7 /xfa/fgas/font/cfgas_fontmgr.cpp | |
parent | 193e6ca5e48ee99e620f0e7546f1407ba1a20323 (diff) | |
download | pdfium-4d67473d6ce55ad6361dae84b00283445f148f37.tar.xz |
Replace FX_POSITION in GFGAS_FontMgr with bool
Change-Id: Iddd99312aee6447c05be5633eead023a004e65e1
Reviewed-on: https://pdfium-review.googlesource.com/3034
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fgas/font/cfgas_fontmgr.cpp')
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index 0173a6a24c..1746a2427d 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -542,19 +542,18 @@ CFX_ByteString CFX_FontSourceEnum_File::GetNextFile() { return bsName; } -FX_POSITION CFX_FontSourceEnum_File::GetStartPosition() { +bool CFX_FontSourceEnum_File::HasStartPosition() { m_wsNext = GetNextFile().UTF8Decode(); - if (m_wsNext.GetLength() == 0) - return (FX_POSITION)0; - return (FX_POSITION)-1; + return m_wsNext.GetLength() != 0; } -CFX_RetainPtr<IFX_FileAccess> CFX_FontSourceEnum_File::GetNext( - FX_POSITION& pos) { +CFX_RetainPtr<IFX_FileAccess> CFX_FontSourceEnum_File::GetNext() { + if (m_wsNext.GetLength() == 0) + return nullptr; + CFX_RetainPtr<IFX_FileAccess> pAccess = IFX_FileAccess::CreateDefault(m_wsNext.AsStringC()); m_wsNext = GetNextFile().UTF8Decode(); - pos = m_wsNext.GetLength() != 0 ? pAccess.Get() : nullptr; return pAccess; } @@ -600,9 +599,10 @@ bool CFGAS_FontMgr::EnumFontsFromFontMapper() { bool CFGAS_FontMgr::EnumFontsFromFiles() { CFX_GEModule::Get()->GetFontMgr()->InitFTLibrary(); - FX_POSITION pos = m_pFontSource->GetStartPosition(); - while (pos) { - CFX_RetainPtr<IFX_FileAccess> pFontSource = m_pFontSource->GetNext(pos); + if (!m_pFontSource->HasStartPosition()) + return !m_InstalledFonts.empty(); + + while (CFX_RetainPtr<IFX_FileAccess> pFontSource = m_pFontSource->GetNext()) { CFX_RetainPtr<IFX_SeekableReadStream> pFontStream = pFontSource->CreateFileStream(FX_FILEMODE_ReadOnly); if (pFontStream) |