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

Unified Diff: core/src/fpdfdoc/doc_form.cpp

Issue 1456823002: Fix Windows build after commit 9c62cadff466. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: less casting Created 5 years, 1 month 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
« no previous file with comments | « core/include/fpdfdoc/fpdf_doc.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_form.cpp
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 421f02fa3fe10cb154437a9f8d41aefe05ed8270..93d4fcb9f437ed179088ac3c938518e73c38f662 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,
« no previous file with comments | « core/include/fpdfdoc/fpdf_doc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698