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