Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2110)

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp

Issue 1417933002: Add type cast definitions for CPDF_String. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index 82bfbb56ebb8017be889fed8600409f4ed7d08ec..123ae8ba76da2b91291c14fae630401c9cf63431 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,8 +136,10 @@ 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));
+
Lei Zhang 2015/10/21 16:55:56 no trailing blank line
dsinclair 2015/10/21 17:08:05 Done.
} else if (CPDF_Dictionary* pFileDict = pFileSpec->AsDictionary()) {
pFileDict->SetAtString(FX_BSTRC("F"), CFX_ByteString::FromUnicode(result));
pFileDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(result));

Powered by Google App Engine
This is Rietveld 408576698