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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "core/include/fxcrt/fx_ext.h" | 9 #include "core/include/fxcrt/fx_ext.h" |
10 #include "fpdfsdk/include/fsdk_baseannot.h" | 10 #include "fpdfsdk/include/fsdk_baseannot.h" |
11 #include "fpdfsdk/include/fsdk_define.h" | 11 #include "fpdfsdk/include/fsdk_define.h" |
12 #include "fpdfsdk/include/fsdk_mgr.h" | 12 #include "fpdfsdk/include/fsdk_mgr.h" |
13 | 13 |
14 #ifdef PDF_ENABLE_XFA | 14 #ifdef PDF_ENABLE_XFA |
15 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" | 15 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" |
16 #endif // PDF_ENABLE_XFA | 16 #endif // PDF_ENABLE_XFA |
17 | 17 |
18 int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute) { | 18 int gAfxGetTimeZoneInSeconds(int8_t tzhour, uint8_t tzminute) { |
19 return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); | 19 return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); |
20 } | 20 } |
21 | 21 |
22 FX_BOOL _gAfxIsLeapYear(int16_t year) { | 22 FX_BOOL _gAfxIsLeapYear(int16_t year) { |
23 return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))); | 23 return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))); |
24 } | 24 } |
25 | 25 |
26 FX_WORD _gAfxGetYearDays(int16_t year) { | 26 FX_WORD _gAfxGetYearDays(int16_t year) { |
27 return (_gAfxIsLeapYear(year) == TRUE ? 366 : 365); | 27 return (_gAfxIsLeapYear(year) == TRUE ? 366 : 365); |
28 } | 28 } |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 st.wDayOfWeek = (FX_WORD)pTime->tm_wday; | 397 st.wDayOfWeek = (FX_WORD)pTime->tm_wday; |
398 st.wHour = (FX_WORD)pTime->tm_hour; | 398 st.wHour = (FX_WORD)pTime->tm_hour; |
399 st.wMinute = (FX_WORD)pTime->tm_min; | 399 st.wMinute = (FX_WORD)pTime->tm_min; |
400 st.wSecond = (FX_WORD)pTime->tm_sec; | 400 st.wSecond = (FX_WORD)pTime->tm_sec; |
401 st.wMilliseconds = 0; | 401 st.wMilliseconds = 0; |
402 } | 402 } |
403 } | 403 } |
404 | 404 |
405 CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() { | 405 CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() { |
406 CPDFSDK_DateTime dt = *this; | 406 CPDFSDK_DateTime dt = *this; |
407 dt.AddSeconds(-_gAfxGetTimeZoneInSeconds(dt.dt.tzHour, dt.dt.tzMinute)); | 407 dt.AddSeconds(-gAfxGetTimeZoneInSeconds(dt.dt.tzHour, dt.dt.tzMinute)); |
408 dt.dt.tzHour = 0; | 408 dt.dt.tzHour = 0; |
409 dt.dt.tzMinute = 0; | 409 dt.dt.tzMinute = 0; |
410 return dt; | 410 return dt; |
411 } | 411 } |
412 | 412 |
413 CPDFSDK_DateTime& CPDFSDK_DateTime::AddDays(short days) { | 413 CPDFSDK_DateTime& CPDFSDK_DateTime::AddDays(short days) { |
414 if (days == 0) | 414 if (days == 0) |
415 return *this; | 415 return *this; |
416 | 416 |
417 int16_t y = dt.year, yy; | 417 int16_t y = dt.year, yy; |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 | 979 |
980 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 980 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
981 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 981 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
982 } | 982 } |
983 | 983 |
984 #ifdef PDF_ENABLE_XFA | 984 #ifdef PDF_ENABLE_XFA |
985 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 985 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
986 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; | 986 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
987 } | 987 } |
988 #endif // PDF_ENABLE_XFA | 988 #endif // PDF_ENABLE_XFA |
OLD | NEW |