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

Side by Side Diff: fpdfsdk/include/javascript/JS_Define.h

Issue 818193004: XFA: merge patch from CL 729293003, use FX_ArraySize for safety (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | fpdfsdk/src/javascript/PublicMethods.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef _JS_DEFINE_H_ 7 #ifndef _JS_DEFINE_H_
8 #define _JS_DEFINE_H_ 8 #define _JS_DEFINE_H_
9 9
10 typedef v8::Value JSValue; 10 typedef v8::Value JSValue;
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 return 0;\ 592 return 0;\
593 } 593 }
594 594
595 /* ======================================== GLOBAL CONSTS ====================== ====================== */ 595 /* ======================================== GLOBAL CONSTS ====================== ====================== */
596 #define DEFINE_GLOBAL_CONST(pRuntime, const_name , const_value)\ 596 #define DEFINE_GLOBAL_CONST(pRuntime, const_name , const_value)\
597 if (JS_DefineGlobalConst(pRuntime,JS_WIDESTRING(const_name),JS_NewString(pRuntim e,JS_WIDESTRING(const_value)))) return -1 597 if (JS_DefineGlobalConst(pRuntime,JS_WIDESTRING(const_name),JS_NewString(pRuntim e,JS_WIDESTRING(const_value)))) return -1
598 598
599 /* ======================================== GLOBAL ARRAYS ====================== ====================== */ 599 /* ======================================== GLOBAL ARRAYS ====================== ====================== */
600 600
601 #define DEFINE_GLOBAL_ARRAY(pRuntime)\ 601 #define DEFINE_GLOBAL_ARRAY(pRuntime)\
602 int size = sizeof(ArrayContent) / sizeof(FX_LPCWSTR);\ 602 int size = FX_ArraySize(ArrayContent);\
603 \ 603 \
604 CJS_Array array(pRuntime);\ 604 CJS_Array array(pRuntime);\
605 for (int i=0; i<size; i++) array.SetElement(i,CJS_Value(pRuntime,ArrayContent[i] ));\ 605 for (int i=0; i<size; i++) array.SetElement(i,CJS_Value(pRuntime,ArrayContent[i] ));\
606 \ 606 \
607 CJS_PropValue prop(pRuntime);\ 607 CJS_PropValue prop(pRuntime);\
608 prop << array;\ 608 prop << array;\
609 if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, prop.ToJSValue()) < 0)\ 609 if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, prop.ToJSValue()) < 0)\
610 return -1 610 return -1
611 611
612 /* ============================================================ */ 612 /* ============================================================ */
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 else if (strcmp(sType,VALUE_NAME_NULL) == 0) 672 else if (strcmp(sType,VALUE_NAME_NULL) == 0)
673 return VT_null; 673 return VT_null;
674 else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0) 674 else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0)
675 return VT_undefined; 675 return VT_undefined;
676 */ 676 */
677 677
678 return VT_unknown; 678 return VT_unknown;
679 } 679 }
680 680
681 #endif //_JS_DEFINE_H_ 681 #endif //_JS_DEFINE_H_
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | fpdfsdk/src/javascript/PublicMethods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698