Chromium Code Reviews| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 | 282 |
| 283 CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() { | 283 CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() { |
| 284 CFX_ByteString str1; | 284 CFX_ByteString str1; |
| 285 str1.Format("%04d-%02u-%02u %02u:%02u:%02u ", dt.year, dt.month, dt.day, | 285 str1.Format("%04d-%02u-%02u %02u:%02u:%02u ", dt.year, dt.month, dt.day, |
| 286 dt.hour, dt.minute, dt.second); | 286 dt.hour, dt.minute, dt.second); |
| 287 if (dt.tzHour < 0) | 287 if (dt.tzHour < 0) |
| 288 str1 += "-"; | 288 str1 += "-"; |
| 289 else | 289 else |
| 290 str1 += "+"; | 290 str1 += "+"; |
| 291 CFX_ByteString str2; | 291 CFX_ByteString str2; |
| 292 str2.Format("%02d:%02u", abs(dt.tzHour), dt.tzMinute); | 292 str2.Format("%02d:%02u", abs(dt.tzHour), dt.tzMinute); |
|
Lei Zhang
2016/07/07 00:06:25
Also, not complaining here?
| |
| 293 return str1 + str2; | 293 return str1 + str2; |
| 294 } | 294 } |
| 295 | 295 |
| 296 CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() { | 296 CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() { |
| 297 CFX_ByteString dtStr; | 297 CFX_ByteString dtStr; |
| 298 char tempStr[32]; | 298 char tempStr[32]; |
| 299 memset(tempStr, 0, sizeof(tempStr)); | 299 memset(tempStr, 0, sizeof(tempStr)); |
| 300 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02u%02u%02u%02u%02u", | 300 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02u%02u%02u%02u%02u", |
| 301 dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second); | 301 dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second); |
| 302 dtStr = CFX_ByteString(tempStr); | 302 dtStr = CFX_ByteString(tempStr); |
| 303 if (dt.tzHour < 0) | 303 if (dt.tzHour < 0) |
| 304 dtStr += CFX_ByteString("-"); | 304 dtStr += CFX_ByteString("-"); |
| 305 else | 305 else |
| 306 dtStr += CFX_ByteString("+"); | 306 dtStr += CFX_ByteString("+"); |
| 307 memset(tempStr, 0, sizeof(tempStr)); | 307 memset(tempStr, 0, sizeof(tempStr)); |
| 308 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", abs(dt.tzHour), | 308 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", |
| 309 dt.tzMinute); | 309 static_cast<int>(abs(dt.tzHour)), dt.tzMinute); |
| 310 dtStr += CFX_ByteString(tempStr); | 310 dtStr += CFX_ByteString(tempStr); |
| 311 return dtStr; | 311 return dtStr; |
| 312 } | 312 } |
| 313 | 313 |
| 314 void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) { | 314 void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) { |
| 315 time_t t = this->ToTime_t(); | 315 time_t t = this->ToTime_t(); |
| 316 struct tm* pTime = localtime(&t); | 316 struct tm* pTime = localtime(&t); |
| 317 if (pTime) { | 317 if (pTime) { |
| 318 st.wYear = static_cast<uint16_t>(pTime->tm_year) + 1900; | 318 st.wYear = static_cast<uint16_t>(pTime->tm_year) + 1900; |
| 319 st.wMonth = static_cast<uint16_t>(pTime->tm_mon) + 1; | 319 st.wMonth = static_cast<uint16_t>(pTime->tm_mon) + 1; |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 899 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 899 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
| 900 } | 900 } |
| 901 | 901 |
| 902 #ifdef PDF_ENABLE_XFA | 902 #ifdef PDF_ENABLE_XFA |
| 903 | 903 |
| 904 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 904 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
| 905 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; | 905 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
| 906 } | 906 } |
| 907 | 907 |
| 908 #endif // PDF_ENABLE_XFA | 908 #endif // PDF_ENABLE_XFA |
| OLD | NEW |