diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-21 13:08:24 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-21 13:08:24 -0400 |
commit | 53d3ab125ef583be8cfac907b308a6551b93067a (patch) | |
tree | 7680ace0f99bb5aa2532def62411d7e59360793f /core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp | |
parent | 83bf02dfb860a66d756434d194118dae572d04d3 (diff) | |
download | pdfium-53d3ab125ef583be8cfac907b308a6551b93067a.tar.xz |
Add type cast definitions for CPDF_String.
This Cl adds ToString, CPDF_Object::AsString and CPDF_Object::IsString and
updates the src to use them as needed.
BUG=pdfium:201
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1417933002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp')
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp index 82bfbb56eb..c766dd397f 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp @@ -100,12 +100,10 @@ CFX_WideString CFDF_Document::GetWin32Path() const { CPDF_Dictionary* pDict = m_pRootDict ? m_pRootDict->GetDict(FX_BSTRC("FDF")) : NULL; CPDF_Object* pFileSpec = pDict ? pDict->GetElementValue(FX_BSTRC("F")) : NULL; - if (pFileSpec == NULL) { + if (!pFileSpec) return CFX_WideString(); - } - if (pFileSpec->GetType() == PDFOBJ_STRING) { + if (pFileSpec->IsString()) return FPDF_FileSpec_GetWin32Path(m_pRootDict->GetDict(FX_BSTRC("FDF"))); - } return FPDF_FileSpec_GetWin32Path(pFileSpec); } static CFX_WideString ChangeSlash(const FX_WCHAR* str) { @@ -138,7 +136,8 @@ void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec, } else { result = ChangeSlash(filepath.c_str()); } - if (pFileSpec->GetType() == PDFOBJ_STRING) { + + if (pFileSpec->IsString()) { pFileSpec->SetString(CFX_ByteString::FromUnicode(result)); } else if (CPDF_Dictionary* pFileDict = pFileSpec->AsDictionary()) { pFileDict->SetAtString(FX_BSTRC("F"), CFX_ByteString::FromUnicode(result)); |