| 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 "../../core/include/fxcrt/fx_ext.h" | 
|     7 #include "../include/fsdk_define.h" |     8 #include "../include/fsdk_define.h" | 
|     8 #include "../include/fsdk_mgr.h" |     9 #include "../include/fsdk_mgr.h" | 
|     9 #include "../include/fsdk_baseannot.h" |    10 #include "../include/fsdk_baseannot.h" | 
|    10  |    11  | 
|    11 //--------------------------------------------------------------------------- |    12 //--------------------------------------------------------------------------- | 
|    12 //                              CPDFSDK_DateTime |    13 //                              CPDFSDK_DateTime | 
|    13 //--------------------------------------------------------------------------- |    14 //--------------------------------------------------------------------------- | 
|    14 int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute) { |    15 int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute) { | 
|    15   return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); |    16   return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); | 
|    16 } |    17 } | 
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   212   return mktime(&newtime); |   213   return mktime(&newtime); | 
|   213 } |   214 } | 
|   214  |   215  | 
|   215 CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |   216 CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( | 
|   216     const CFX_ByteString& dtStr) { |   217     const CFX_ByteString& dtStr) { | 
|   217   int strLength = dtStr.GetLength(); |   218   int strLength = dtStr.GetLength(); | 
|   218   if (strLength > 0) { |   219   if (strLength > 0) { | 
|   219     int i = 0; |   220     int i = 0; | 
|   220     int j, k; |   221     int j, k; | 
|   221     FX_CHAR ch; |   222     FX_CHAR ch; | 
|   222     while (i < strLength) { |   223     while (i < strLength && !std::isdigit(dtStr[i])) | 
|   223       ch = dtStr[i]; |   224       ++i; | 
|   224       if (ch >= '0' && ch <= '9') |   225  | 
|   225         break; |  | 
|   226       i++; |  | 
|   227     } |  | 
|   228     if (i >= strLength) |   226     if (i >= strLength) | 
|   229       return *this; |   227       return *this; | 
|   230  |   228  | 
|   231     j = 0; |   229     j = 0; | 
|   232     k = 0; |   230     k = 0; | 
|   233     while (i < strLength && j < 4) { |   231     while (i < strLength && j < 4) { | 
|   234       ch = dtStr[i]; |   232       ch = dtStr[i]; | 
|   235       k = k * 10 + ch - '0'; |   233       k = k * 10 + FXSYS_toDecimalDigit(ch); | 
|   236       j++; |   234       j++; | 
|   237       if (ch < '0' || ch > '9') |   235       if (!std::isdigit(ch)) | 
|   238         break; |   236         break; | 
|   239       i++; |   237       i++; | 
|   240     } |   238     } | 
|   241     dt.year = (int16_t)k; |   239     dt.year = (int16_t)k; | 
|   242     if (i >= strLength || j < 4) |   240     if (i >= strLength || j < 4) | 
|   243       return *this; |   241       return *this; | 
|   244  |   242  | 
|   245     j = 0; |   243     j = 0; | 
|   246     k = 0; |   244     k = 0; | 
|   247     while (i < strLength && j < 2) { |   245     while (i < strLength && j < 2) { | 
|   248       ch = dtStr[i]; |   246       ch = dtStr[i]; | 
|   249       k = k * 10 + ch - '0'; |   247       k = k * 10 + FXSYS_toDecimalDigit(ch); | 
|   250       j++; |   248       j++; | 
|   251       if (ch < '0' || ch > '9') |   249       if (!std::isdigit(ch)) | 
|   252         break; |   250         break; | 
|   253       i++; |   251       i++; | 
|   254     } |   252     } | 
|   255     dt.month = (uint8_t)k; |   253     dt.month = (uint8_t)k; | 
|   256     if (i >= strLength || j < 2) |   254     if (i >= strLength || j < 2) | 
|   257       return *this; |   255       return *this; | 
|   258  |   256  | 
|   259     j = 0; |   257     j = 0; | 
|   260     k = 0; |   258     k = 0; | 
|   261     while (i < strLength && j < 2) { |   259     while (i < strLength && j < 2) { | 
|   262       ch = dtStr[i]; |   260       ch = dtStr[i]; | 
|   263       k = k * 10 + ch - '0'; |   261       k = k * 10 + FXSYS_toDecimalDigit(ch); | 
|   264       j++; |   262       j++; | 
|   265       if (ch < '0' || ch > '9') |   263       if (!std::isdigit(ch)) | 
|   266         break; |   264         break; | 
|   267       i++; |   265       i++; | 
|   268     } |   266     } | 
|   269     dt.day = (uint8_t)k; |   267     dt.day = (uint8_t)k; | 
|   270     if (i >= strLength || j < 2) |   268     if (i >= strLength || j < 2) | 
|   271       return *this; |   269       return *this; | 
|   272  |   270  | 
|   273     j = 0; |   271     j = 0; | 
|   274     k = 0; |   272     k = 0; | 
|   275     while (i < strLength && j < 2) { |   273     while (i < strLength && j < 2) { | 
|   276       ch = dtStr[i]; |   274       ch = dtStr[i]; | 
|   277       k = k * 10 + ch - '0'; |   275       k = k * 10 + FXSYS_toDecimalDigit(ch); | 
|   278       j++; |   276       j++; | 
|   279       if (ch < '0' || ch > '9') |   277       if (!std::isdigit(ch)) | 
|   280         break; |   278         break; | 
|   281       i++; |   279       i++; | 
|   282     } |   280     } | 
|   283     dt.hour = (uint8_t)k; |   281     dt.hour = (uint8_t)k; | 
|   284     if (i >= strLength || j < 2) |   282     if (i >= strLength || j < 2) | 
|   285       return *this; |   283       return *this; | 
|   286  |   284  | 
|   287     j = 0; |   285     j = 0; | 
|   288     k = 0; |   286     k = 0; | 
|   289     while (i < strLength && j < 2) { |   287     while (i < strLength && j < 2) { | 
|   290       ch = dtStr[i]; |   288       ch = dtStr[i]; | 
|   291       k = k * 10 + ch - '0'; |   289       k = k * 10 + FXSYS_toDecimalDigit(ch); | 
|   292       j++; |   290       j++; | 
|   293       if (ch < '0' || ch > '9') |   291       if (!std::isdigit(ch)) | 
|   294         break; |   292         break; | 
|   295       i++; |   293       i++; | 
|   296     } |   294     } | 
|   297     dt.minute = (uint8_t)k; |   295     dt.minute = (uint8_t)k; | 
|   298     if (i >= strLength || j < 2) |   296     if (i >= strLength || j < 2) | 
|   299       return *this; |   297       return *this; | 
|   300  |   298  | 
|   301     j = 0; |   299     j = 0; | 
|   302     k = 0; |   300     k = 0; | 
|   303     while (i < strLength && j < 2) { |   301     while (i < strLength && j < 2) { | 
|   304       ch = dtStr[i]; |   302       ch = dtStr[i]; | 
|   305       k = k * 10 + ch - '0'; |   303       k = k * 10 + FXSYS_toDecimalDigit(ch); | 
|   306       j++; |   304       j++; | 
|   307       if (ch < '0' || ch > '9') |   305       if (!std::isdigit(ch)) | 
|   308         break; |   306         break; | 
|   309       i++; |   307       i++; | 
|   310     } |   308     } | 
|   311     dt.second = (uint8_t)k; |   309     dt.second = (uint8_t)k; | 
|   312     if (i >= strLength || j < 2) |   310     if (i >= strLength || j < 2) | 
|   313       return *this; |   311       return *this; | 
|   314  |   312  | 
|   315     ch = dtStr[i++]; |   313     ch = dtStr[i++]; | 
|   316     if (ch != '-' && ch != '+') |   314     if (ch != '-' && ch != '+') | 
|   317       return *this; |   315       return *this; | 
|   318     if (ch == '-') |   316     if (ch == '-') | 
|   319       dt.tzHour = -1; |   317       dt.tzHour = -1; | 
|   320     else |   318     else | 
|   321       dt.tzHour = 1; |   319       dt.tzHour = 1; | 
|   322     j = 0; |   320     j = 0; | 
|   323     k = 0; |   321     k = 0; | 
|   324     while (i < strLength && j < 2) { |   322     while (i < strLength && j < 2) { | 
|   325       ch = dtStr[i]; |   323       ch = dtStr[i]; | 
|   326       k = k * 10 + ch - '0'; |   324       k = k * 10 + FXSYS_toDecimalDigit(ch); | 
|   327       j++; |   325       j++; | 
|   328       if (ch < '0' || ch > '9') |   326       if (!std::isdigit(ch)) | 
|   329         break; |   327         break; | 
|   330       i++; |   328       i++; | 
|   331     } |   329     } | 
|   332     dt.tzHour *= (FX_CHAR)k; |   330     dt.tzHour *= (FX_CHAR)k; | 
|   333     if (i >= strLength || j < 2) |   331     if (i >= strLength || j < 2) | 
|   334       return *this; |   332       return *this; | 
|   335  |   333  | 
|   336     ch = dtStr[i++]; |   334     ch = dtStr[i++]; | 
|   337     if (ch != '\'') |   335     if (ch != '\'') | 
|   338       return *this; |   336       return *this; | 
|   339     j = 0; |   337     j = 0; | 
|   340     k = 0; |   338     k = 0; | 
|   341     while (i < strLength && j < 2) { |   339     while (i < strLength && j < 2) { | 
|   342       ch = dtStr[i]; |   340       ch = dtStr[i]; | 
|   343       k = k * 10 + ch - '0'; |   341       k = k * 10 + FXSYS_toDecimalDigit(ch); | 
|   344       j++; |   342       j++; | 
|   345       if (ch < '0' || ch > '9') |   343       if (!std::isdigit(ch)) | 
|   346         break; |   344         break; | 
|   347       i++; |   345       i++; | 
|   348     } |   346     } | 
|   349     dt.tzMinute = (uint8_t)k; |   347     dt.tzMinute = (uint8_t)k; | 
|   350     if (i >= strLength || j < 2) |   348     if (i >= strLength || j < 2) | 
|   351       return *this; |   349       return *this; | 
|   352   } |   350   } | 
|   353  |   351  | 
|   354   return *this; |   352   return *this; | 
|   355 } |   353 } | 
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   997                            CPDF_Annot::Normal, NULL); |   995                            CPDF_Annot::Normal, NULL); | 
|   998  |   996  | 
|   999   return; |   997   return; | 
|  1000 } |   998 } | 
|  1001  |   999  | 
|  1002 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |  1000 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 
|  1003   if (m_pPageView) |  1001   if (m_pPageView) | 
|  1004     return m_pPageView->GetPDFPage(); |  1002     return m_pPageView->GetPDFPage(); | 
|  1005   return NULL; |  1003   return NULL; | 
|  1006 } |  1004 } | 
| OLD | NEW |