OLD | NEW |
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 #include "PublicMethods.h" | 7 #include "PublicMethods.h" |
8 | 8 |
| 9 #include <algorithm> |
| 10 |
9 #include "Field.h" | 11 #include "Field.h" |
10 #include "JS_Context.h" | 12 #include "JS_Context.h" |
11 #include "JS_Define.h" | 13 #include "JS_Define.h" |
12 #include "JS_EventHandler.h" | 14 #include "JS_EventHandler.h" |
13 #include "JS_Object.h" | 15 #include "JS_Object.h" |
14 #include "JS_Runtime.h" | 16 #include "JS_Runtime.h" |
15 #include "JS_Value.h" | 17 #include "JS_Value.h" |
16 #include "color.h" | 18 #include "color.h" |
17 #include "core/include/fxcrt/fx_ext.h" | 19 #include "core/include/fxcrt/fx_ext.h" |
18 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. | 20 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 double dValue1, | 137 double dValue1, |
136 double dValue2) { | 138 double dValue2) { |
137 if (FXSYS_wcsicmp(sFuction, L"AVG") == 0 || | 139 if (FXSYS_wcsicmp(sFuction, L"AVG") == 0 || |
138 FXSYS_wcsicmp(sFuction, L"SUM") == 0) { | 140 FXSYS_wcsicmp(sFuction, L"SUM") == 0) { |
139 return dValue1 + dValue2; | 141 return dValue1 + dValue2; |
140 } | 142 } |
141 if (FXSYS_wcsicmp(sFuction, L"PRD") == 0) { | 143 if (FXSYS_wcsicmp(sFuction, L"PRD") == 0) { |
142 return dValue1 * dValue2; | 144 return dValue1 * dValue2; |
143 } | 145 } |
144 if (FXSYS_wcsicmp(sFuction, L"MIN") == 0) { | 146 if (FXSYS_wcsicmp(sFuction, L"MIN") == 0) { |
145 return FX_MIN(dValue1, dValue2); | 147 return std::min(dValue1, dValue2); |
146 } | 148 } |
147 if (FXSYS_wcsicmp(sFuction, L"MAX") == 0) { | 149 if (FXSYS_wcsicmp(sFuction, L"MAX") == 0) { |
148 return FX_MAX(dValue1, dValue2); | 150 return std::max(dValue1, dValue2); |
149 } | 151 } |
150 return dValue1; | 152 return dValue1; |
151 } | 153 } |
152 | 154 |
153 CFX_WideString CJS_PublicMethods::StrLTrim(const FX_WCHAR* pStr) { | 155 CFX_WideString CJS_PublicMethods::StrLTrim(const FX_WCHAR* pStr) { |
154 while (*pStr && *pStr == L' ') | 156 while (*pStr && *pStr == L' ') |
155 pStr++; | 157 pStr++; |
156 | 158 |
157 return pStr; | 159 return pStr; |
158 } | 160 } |
(...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); | 2058 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); |
2057 } | 2059 } |
2058 | 2060 |
2059 if (nums.GetLength() > 0) | 2061 if (nums.GetLength() > 0) |
2060 vRet = nums; | 2062 vRet = nums; |
2061 else | 2063 else |
2062 vRet.SetNull(); | 2064 vRet.SetNull(); |
2063 | 2065 |
2064 return TRUE; | 2066 return TRUE; |
2065 } | 2067 } |
OLD | NEW |