summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_context.cpp37
-rw-r--r--public/fpdf_formfill.h2
2 files changed, 22 insertions, 17 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
index d7b3bed849..f2bfff6fa6 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp
@@ -36,18 +36,24 @@ extern void SetLastError(int err);
extern int GetLastError();
#endif
-#define IS_VALID_ALERT_BUTTON(type) \
- ((type) == JSPLATFORM_ALERT_BUTTON_OK || \
- (type) == JSPLATFORM_ALERT_BUTTON_OKCANCEL || \
- (type) == JSPLATFORM_ALERT_BUTTON_YESNO || \
- (type) == JSPLATFORM_ALERT_BUTTON_YESNOCANCEL)
-
-#define IS_VALID_ALERT_ICON(type) \
- ((type) == JSPLATFORM_ALERT_ICON_ERROR || \
- (type) == JSPLATFORM_ALERT_ICON_WARNING || \
- (type) == JSPLATFORM_ALERT_ICON_QUESTION || \
- (type) == JSPLATFORM_ALERT_ICON_STATUS || \
- (type) == JSPLATFORM_ALERT_ICON_ASTERISK)
+namespace {
+
+bool IsValidAlertButton(int type) {
+ return type == JSPLATFORM_ALERT_BUTTON_OK ||
+ type == JSPLATFORM_ALERT_BUTTON_OKCANCEL ||
+ type == JSPLATFORM_ALERT_BUTTON_YESNO ||
+ type == JSPLATFORM_ALERT_BUTTON_YESNOCANCEL;
+}
+
+bool IsValidAlertIcon(int type) {
+ return type == JSPLATFORM_ALERT_ICON_ERROR ||
+ type == JSPLATFORM_ALERT_ICON_WARNING ||
+ type == JSPLATFORM_ALERT_ICON_QUESTION ||
+ type == JSPLATFORM_ALERT_ICON_STATUS ||
+ type == JSPLATFORM_ALERT_ICON_ASTERISK;
+}
+
+} // namespace
CPDFXFA_Context::CPDFXFA_Context(CPDF_Document* pPDFDoc)
: m_pPDFDoc(pPDFDoc),
@@ -260,10 +266,9 @@ int32_t CPDFXFA_Context::MsgBox(const WideString& wsMessage,
if (!m_pFormFillEnv || m_nLoadStatus != FXFA_LOADSTATUS_LOADED)
return -1;
- int iconType = IS_VALID_ALERT_ICON(dwIconType)
- ? dwIconType
- : JSPLATFORM_ALERT_ICON_DEFAULT;
- int iButtonType = IS_VALID_ALERT_BUTTON(dwButtonType)
+ int iconType =
+ IsValidAlertIcon(dwIconType) ? dwIconType : JSPLATFORM_ALERT_ICON_DEFAULT;
+ int iButtonType = IsValidAlertButton(dwButtonType)
? dwButtonType
: JSPLATFORM_ALERT_BUTTON_DEFAULT;
return m_pFormFillEnv->JS_appAlert(wsMessage, wsTitle, iButtonType, iconType);
diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h
index 915c07a134..0bc08ec54b 100644
--- a/public/fpdf_formfill.h
+++ b/public/fpdf_formfill.h
@@ -76,7 +76,7 @@ typedef struct _IPDF_JsPlatform {
* JSPLATFORM_ALERT_ICON_* above .
*
* Return Value:
- * Option selected by user in dialogue, see see
+ * Option selected by user in dialogue, see
* JSPLATFORM_ALERT_RETURN_* above.
*/
int (*app_alert)(struct _IPDF_JsPlatform* pThis,