summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-17 17:33:07 -0800
committerLei Zhang <thestig@chromium.org>2015-11-17 17:33:07 -0800
commit447946588d6bbd4d5bc34477a09dd983285c507e (patch)
tree84576b65795889ed0a19f9a4670bd89d69cf99fa
parent9c62cadff466f26307bd06ed1e9df2c1b5f25a32 (diff)
downloadpdfium-447946588d6bbd4d5bc34477a09dd983285c507e.tar.xz
Fix Windows build after commit 9c62cadff466.
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1456823002 .
-rw-r--r--core/include/fpdfdoc/fpdf_doc.h5
-rw-r--r--core/src/fpdfdoc/doc_form.cpp32
2 files changed, 15 insertions, 22 deletions
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h
index fd85fda4b9..9b86e0ecb1 100644
--- a/core/include/fpdfdoc/fpdf_doc.h
+++ b/core/include/fpdfdoc/fpdf_doc.h
@@ -553,10 +553,9 @@ class CPDF_InterForm : public CFX_PrivateData {
static uint8_t GetNativeCharSet();
- static CPDF_Font* AddNativeFont(uint8_t iCharSet,
- const CPDF_Document* pDocument);
+ static CPDF_Font* AddNativeFont(uint8_t iCharSet, CPDF_Document* pDocument);
- static CPDF_Font* AddNativeFont(const CPDF_Document* pDocument);
+ static CPDF_Font* AddNativeFont(CPDF_Document* pDocument);
FX_BOOL ValidateFieldName(CFX_WideString& csNewFieldName, int iType);
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 421f02fa3f..93d4fcb9f4 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -506,34 +506,28 @@ uint8_t CPDF_InterForm::GetNativeCharSet() {
return 0;
#endif
}
+
CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet,
- const CPDF_Document* pDocument) {
- if (pDocument == NULL) {
- return NULL;
- }
- CPDF_Font* pFont = NULL;
+ CPDF_Document* pDocument) {
+ if (!pDocument)
+ return nullptr;
+
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
LOGFONTA lf;
CFX_ByteString csFontName = GetNativeFont(charSet, &lf);
if (!csFontName.IsEmpty()) {
- if (csFontName == "Helvetica") {
- pFont = AddStandardFont(pDocument, csFontName);
- } else {
- pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE);
- }
+ if (csFontName == "Helvetica")
+ return pFont = AddStandardFont(pDocument, csFontName);
+ return pDocument->AddWindowsFont(&lf, FALSE, TRUE);
}
#endif
- return pFont;
+ return nullptr;
}
-CPDF_Font* CPDF_InterForm::AddNativeFont(const CPDF_Document* pDocument) {
- if (pDocument == NULL) {
- return NULL;
- }
- CPDF_Font* pFont = NULL;
- uint8_t charSet = GetNativeCharSet();
- pFont = AddNativeFont(charSet, pDocument);
- return pFont;
+
+CPDF_Font* CPDF_InterForm::AddNativeFont(CPDF_Document* pDocument) {
+ return pDocument ? AddNativeFont(GetNativeCharSet(), pDocument) : nullptr;
}
+
FX_BOOL CPDF_InterForm::ValidateFieldName(
CFX_WideString& csNewFieldName,
int iType,