| 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/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 dt.tzMinute = (uint8_t)k; | 339 dt.tzMinute = (uint8_t)k; |
| 340 if (i >= strLength || j < 2) | 340 if (i >= strLength || j < 2) |
| 341 return *this; | 341 return *this; |
| 342 } | 342 } |
| 343 | 343 |
| 344 return *this; | 344 return *this; |
| 345 } | 345 } |
| 346 | 346 |
| 347 CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() { | 347 CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() { |
| 348 CFX_ByteString str1; | 348 CFX_ByteString str1; |
| 349 str1.Format("%04d-%02d-%02d %02d:%02d:%02d ", dt.year, dt.month, dt.day, | 349 str1.Format("%04d-%02u-%02u %02u:%02u:%02u ", dt.year, dt.month, dt.day, |
| 350 dt.hour, dt.minute, dt.second); | 350 dt.hour, dt.minute, dt.second); |
| 351 if (dt.tzHour < 0) | 351 if (dt.tzHour < 0) |
| 352 str1 += "-"; | 352 str1 += "-"; |
| 353 else | 353 else |
| 354 str1 += "+"; | 354 str1 += "+"; |
| 355 CFX_ByteString str2; | 355 CFX_ByteString str2; |
| 356 str2.Format("%02d:%02d", abs(dt.tzHour), dt.tzMinute); | 356 str2.Format("%02d:%02u", abs(dt.tzHour), dt.tzMinute); |
| 357 return str1 + str2; | 357 return str1 + str2; |
| 358 } | 358 } |
| 359 | 359 |
| 360 CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() { | 360 CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() { |
| 361 CFX_ByteString dtStr; | 361 CFX_ByteString dtStr; |
| 362 char tempStr[32]; | 362 char tempStr[32]; |
| 363 memset(tempStr, 0, sizeof(tempStr)); | 363 memset(tempStr, 0, sizeof(tempStr)); |
| 364 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02d%02d%02d%02d%02d", | 364 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02u%02u%02u%02u%02u", |
| 365 dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second); | 365 dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second); |
| 366 dtStr = CFX_ByteString(tempStr); | 366 dtStr = CFX_ByteString(tempStr); |
| 367 if (dt.tzHour < 0) | 367 if (dt.tzHour < 0) |
| 368 dtStr += CFX_ByteString("-"); | 368 dtStr += CFX_ByteString("-"); |
| 369 else | 369 else |
| 370 dtStr += CFX_ByteString("+"); | 370 dtStr += CFX_ByteString("+"); |
| 371 memset(tempStr, 0, sizeof(tempStr)); | 371 memset(tempStr, 0, sizeof(tempStr)); |
| 372 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02d'", abs(dt.tzHour), | 372 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", abs(dt.tzHour), |
| 373 dt.tzMinute); | 373 dt.tzMinute); |
| 374 dtStr += CFX_ByteString(tempStr); | 374 dtStr += CFX_ByteString(tempStr); |
| 375 return dtStr; | 375 return dtStr; |
| 376 } | 376 } |
| 377 | 377 |
| 378 void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) { | 378 void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) { |
| 379 CPDFSDK_DateTime dt = *this; | 379 CPDFSDK_DateTime dt = *this; |
| 380 time_t t = (time_t)dt; | 380 time_t t = (time_t)dt; |
| 381 struct tm* pTime = localtime(&t); | 381 struct tm* pTime = localtime(&t); |
| 382 if (pTime) { | 382 if (pTime) { |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 927 |
| 928 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 928 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
| 929 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 929 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
| 930 } | 930 } |
| 931 | 931 |
| 932 #ifdef PDF_ENABLE_XFA | 932 #ifdef PDF_ENABLE_XFA |
| 933 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 933 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
| 934 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; | 934 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
| 935 } | 935 } |
| 936 #endif // PDF_ENABLE_XFA | 936 #endif // PDF_ENABLE_XFA |
| OLD | NEW |