summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-06-01 09:17:18 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-06-01 16:29:30 +0000
commitf6ca07b3fda40f0c5d5690caad8ac931cb46ccf6 (patch)
treed2bd0044d8d5851990c46b51efb2706ec3e65385 /fpdfsdk
parenta64cd6c86438636b031e1204057b27a8b9673296 (diff)
downloadpdfium-f6ca07b3fda40f0c5d5690caad8ac931cb46ccf6.tar.xz
Replace some repeated code with existing CFXJS_Engine::NewString() helper.
In turn, fix type information for New*() return values. In turn, resolve some ambiguity in a ? operator expression. Change-Id: I45c31d81f815b11590b46dacc8060d8e489dde5c Reviewed-on: https://pdfium-review.googlesource.com/6131 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/javascript/JS_Define.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h
index fb901dc714..f360e8f6b9 100644
--- a/fpdfsdk/javascript/JS_Define.h
+++ b/fpdfsdk/javascript/JS_Define.h
@@ -173,14 +173,15 @@ void JSMethod(const char* method_name_string,
static JSConstSpec ConstSpecs[]; \
static void DefineConsts(CFXJS_Engine* pEngine);
-#define IMPLEMENT_JS_CLASS_CONST_PART(js_class_name, class_name) \
- void js_class_name::DefineConsts(CFXJS_Engine* pEngine) { \
- for (size_t i = 0; i < FX_ArraySize(ConstSpecs) - 1; ++i) { \
- pEngine->DefineObjConst(g_nObjDefnID, ConstSpecs[i].pName, \
- ConstSpecs[i].eType == JSConstSpec::Number \
- ? pEngine->NewNumber(ConstSpecs[i].number) \
- : pEngine->NewString(ConstSpecs[i].pStr)); \
- } \
+#define IMPLEMENT_JS_CLASS_CONST_PART(js_class_name, class_name) \
+ void js_class_name::DefineConsts(CFXJS_Engine* pEngine) { \
+ for (size_t i = 0; i < FX_ArraySize(ConstSpecs) - 1; ++i) { \
+ pEngine->DefineObjConst( \
+ g_nObjDefnID, ConstSpecs[i].pName, \
+ ConstSpecs[i].eType == JSConstSpec::Number \
+ ? pEngine->NewNumber(ConstSpecs[i].number).As<v8::Value>() \
+ : pEngine->NewString(ConstSpecs[i].pStr).As<v8::Value>()); \
+ } \
}
// Convenience macros for declaring classes without an alternate.