summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/JS_Value.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-03-21 12:26:54 -0700
committerTom Sepez <tsepez@chromium.org>2016-03-21 12:26:54 -0700
commit4161c5ca6c5438476bf07b6dacfafb61ea611cc5 (patch)
tree76b021ad93546c362d6e6089c18e362aebe247aa /fpdfsdk/javascript/JS_Value.cpp
parenta98600aeb8d815c297834aa5006f5c3ea20dde6d (diff)
downloadpdfium-4161c5ca6c5438476bf07b6dacfafb61ea611cc5.tar.xz
Make a few more const tables smaller.chromium/2689chromium/2688
Remove some tables from .h file (risk of duplication). R=ochang@chromium.org Review URL: https://codereview.chromium.org/1814233005 .
Diffstat (limited to 'fpdfsdk/javascript/JS_Value.cpp')
-rw-r--r--fpdfsdk/javascript/JS_Value.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index 8e5e463e61..1da1525d09 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -653,14 +653,13 @@ double _TimeFromYear(int y) {
return 86400000.0 * _DayFromYear(y);
}
+static const uint16_t daysMonth[12] = {0, 31, 59, 90, 120, 151,
+ 181, 212, 243, 273, 304, 334};
+static const uint16_t leapDaysMonth[12] = {0, 31, 60, 91, 121, 152,
+ 182, 213, 244, 274, 305, 335};
+
double _TimeFromYearMonth(int y, int m) {
- static int daysMonth[12] = {0, 31, 59, 90, 120, 151,
- 181, 212, 243, 273, 304, 334};
- static int leapDaysMonth[12] = {0, 31, 60, 91, 121, 152,
- 182, 213, 244, 274, 305, 335};
- int* pMonth = daysMonth;
- if (_isLeapYear(y))
- pMonth = leapDaysMonth;
+ const uint16_t* pMonth = _isLeapYear(y) ? leapDaysMonth : daysMonth;
return _TimeFromYear(y) + ((double)pMonth[m]) * 86400000;
}