Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: fpdfsdk/fsdk_baseannot.cpp

Issue 2043873006: Change time_t conversion operator to ToTime_t() function (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comment Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | fpdfsdk/include/fsdk_baseannot.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 CPDFSDK_DateTime& CPDFSDK_DateTime::operator=( 109 CPDFSDK_DateTime& CPDFSDK_DateTime::operator=(
110 const CPDFSDK_DateTime& datetime) { 110 const CPDFSDK_DateTime& datetime) {
111 FXSYS_memcpy(&dt, &datetime.dt, sizeof(FX_DATETIME)); 111 FXSYS_memcpy(&dt, &datetime.dt, sizeof(FX_DATETIME));
112 return *this; 112 return *this;
113 } 113 }
114 114
115 CPDFSDK_DateTime& CPDFSDK_DateTime::operator=(const FX_SYSTEMTIME& st) { 115 CPDFSDK_DateTime& CPDFSDK_DateTime::operator=(const FX_SYSTEMTIME& st) {
116 tzset(); 116 tzset();
117 117
118 dt.year = (int16_t)st.wYear; 118 dt.year = static_cast<int16_t>(st.wYear);
119 dt.month = (uint8_t)st.wMonth; 119 dt.month = static_cast<uint8_t>(st.wMonth);
120 dt.day = (uint8_t)st.wDay; 120 dt.day = static_cast<uint8_t>(st.wDay);
121 dt.hour = (uint8_t)st.wHour; 121 dt.hour = static_cast<uint8_t>(st.wHour);
122 dt.minute = (uint8_t)st.wMinute; 122 dt.minute = static_cast<uint8_t>(st.wMinute);
123 dt.second = (uint8_t)st.wSecond; 123 dt.second = static_cast<uint8_t>(st.wSecond);
124 return *this; 124 return *this;
125 } 125 }
126 126
127 bool CPDFSDK_DateTime::operator==(const CPDFSDK_DateTime& datetime) const { 127 bool CPDFSDK_DateTime::operator==(const CPDFSDK_DateTime& datetime) const {
128 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) == 0); 128 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) == 0);
129 } 129 }
130 130
131 bool CPDFSDK_DateTime::operator!=(const CPDFSDK_DateTime& datetime) const { 131 bool CPDFSDK_DateTime::operator!=(const CPDFSDK_DateTime& datetime) const {
132 return !(*this == datetime); 132 return !(*this == datetime);
133 } 133 }
134 134
135 bool CPDFSDK_DateTime::operator>(const CPDFSDK_DateTime& datetime) const { 135 time_t CPDFSDK_DateTime::ToTime_t() const {
136 CPDFSDK_DateTime dt1 = ToGMT();
137 CPDFSDK_DateTime dt2 = datetime.ToGMT();
138 int d1 =
139 (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1.dt.day;
140 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) |
141 (int)dt1.dt.second;
142 int d3 =
143 (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day;
144 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) |
145 (int)dt2.dt.second;
146
147 return d1 > d3 || d2 > d4;
148 }
149
150 bool CPDFSDK_DateTime::operator>=(const CPDFSDK_DateTime& datetime) const {
151 CPDFSDK_DateTime dt1 = ToGMT();
152 CPDFSDK_DateTime dt2 = datetime.ToGMT();
153 int d1 =
154 (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1.dt.day;
155 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) |
156 (int)dt1.dt.second;
157 int d3 =
158 (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day;
159 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) |
160 (int)dt2.dt.second;
161
162 return d1 >= d3 || d2 >= d4;
163 }
164
165 bool CPDFSDK_DateTime::operator<(const CPDFSDK_DateTime& datetime) const {
166 CPDFSDK_DateTime dt1 = ToGMT();
167 CPDFSDK_DateTime dt2 = datetime.ToGMT();
168 int d1 =
169 (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1.dt.day;
170 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) |
171 (int)dt1.dt.second;
172 int d3 =
173 (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day;
174 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) |
175 (int)dt2.dt.second;
176
177 return d1 < d3 || d2 < d4;
178 }
179
180 bool CPDFSDK_DateTime::operator<=(const CPDFSDK_DateTime& datetime) const {
181 CPDFSDK_DateTime dt1 = ToGMT();
182 CPDFSDK_DateTime dt2 = datetime.ToGMT();
183 int d1 =
184 (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1.dt.day;
185 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) |
186 (int)dt1.dt.second;
187 int d3 =
188 (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day;
189 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) |
190 (int)dt2.dt.second;
191
192 return d1 <= d3 || d2 <= d4;
193 }
194
195 CPDFSDK_DateTime::operator time_t() {
196 struct tm newtime; 136 struct tm newtime;
197 137
198 newtime.tm_year = dt.year - 1900; 138 newtime.tm_year = dt.year - 1900;
199 newtime.tm_mon = dt.month - 1; 139 newtime.tm_mon = dt.month - 1;
200 newtime.tm_mday = dt.day; 140 newtime.tm_mday = dt.day;
201 newtime.tm_hour = dt.hour; 141 newtime.tm_hour = dt.hour;
202 newtime.tm_min = dt.minute; 142 newtime.tm_min = dt.minute;
203 newtime.tm_sec = dt.second; 143 newtime.tm_sec = dt.second;
204 144
205 return mktime(&newtime); 145 return mktime(&newtime);
206 } 146 }
207 147
208 CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( 148 CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString(
209 const CFX_ByteString& dtStr) { 149 const CFX_ByteString& dtStr) {
210 int strLength = dtStr.GetLength(); 150 int strLength = dtStr.GetLength();
211 if (strLength > 0) { 151 if (strLength <= 0)
212 int i = 0; 152 return *this;
213 int j, k;
214 FX_CHAR ch;
215 while (i < strLength && !std::isdigit(dtStr[i]))
216 ++i;
217 153
218 if (i >= strLength) 154 int i = 0;
219 return *this; 155 while (i < strLength && !std::isdigit(dtStr[i]))
156 ++i;
220 157
221 j = 0; 158 if (i >= strLength)
222 k = 0; 159 return *this;
223 while (i < strLength && j < 4) {
224 ch = dtStr[i];
225 k = k * 10 + FXSYS_toDecimalDigit(ch);
226 j++;
227 if (!std::isdigit(ch))
228 break;
229 i++;
230 }
231 dt.year = (int16_t)k;
232 if (i >= strLength || j < 4)
233 return *this;
234 160
235 j = 0; 161 int j = 0;
236 k = 0; 162 int k = 0;
237 while (i < strLength && j < 2) { 163 FX_CHAR ch;
238 ch = dtStr[i]; 164 while (i < strLength && j < 4) {
239 k = k * 10 + FXSYS_toDecimalDigit(ch); 165 ch = dtStr[i];
240 j++; 166 k = k * 10 + FXSYS_toDecimalDigit(ch);
241 if (!std::isdigit(ch)) 167 j++;
242 break; 168 if (!std::isdigit(ch))
243 i++; 169 break;
244 } 170 i++;
245 dt.month = (uint8_t)k; 171 }
246 if (i >= strLength || j < 2) 172 dt.year = static_cast<int16_t>(k);
247 return *this; 173 if (i >= strLength || j < 4)
174 return *this;
248 175
249 j = 0; 176 j = 0;
250 k = 0; 177 k = 0;
251 while (i < strLength && j < 2) { 178 while (i < strLength && j < 2) {
252 ch = dtStr[i]; 179 ch = dtStr[i];
253 k = k * 10 + FXSYS_toDecimalDigit(ch); 180 k = k * 10 + FXSYS_toDecimalDigit(ch);
254 j++; 181 j++;
255 if (!std::isdigit(ch)) 182 if (!std::isdigit(ch))
256 break; 183 break;
257 i++; 184 i++;
258 } 185 }
259 dt.day = (uint8_t)k; 186 dt.month = static_cast<uint8_t>(k);
260 if (i >= strLength || j < 2) 187 if (i >= strLength || j < 2)
261 return *this; 188 return *this;
262 189
263 j = 0; 190 j = 0;
264 k = 0; 191 k = 0;
265 while (i < strLength && j < 2) { 192 while (i < strLength && j < 2) {
266 ch = dtStr[i]; 193 ch = dtStr[i];
267 k = k * 10 + FXSYS_toDecimalDigit(ch); 194 k = k * 10 + FXSYS_toDecimalDigit(ch);
268 j++; 195 j++;
269 if (!std::isdigit(ch)) 196 if (!std::isdigit(ch))
270 break; 197 break;
271 i++; 198 i++;
272 } 199 }
273 dt.hour = (uint8_t)k; 200 dt.day = static_cast<uint8_t>(k);
274 if (i >= strLength || j < 2) 201 if (i >= strLength || j < 2)
275 return *this; 202 return *this;
276 203
277 j = 0; 204 j = 0;
278 k = 0; 205 k = 0;
279 while (i < strLength && j < 2) { 206 while (i < strLength && j < 2) {
280 ch = dtStr[i]; 207 ch = dtStr[i];
281 k = k * 10 + FXSYS_toDecimalDigit(ch); 208 k = k * 10 + FXSYS_toDecimalDigit(ch);
282 j++; 209 j++;
283 if (!std::isdigit(ch)) 210 if (!std::isdigit(ch))
284 break; 211 break;
285 i++; 212 i++;
286 } 213 }
287 dt.minute = (uint8_t)k; 214 dt.hour = static_cast<uint8_t>(k);
288 if (i >= strLength || j < 2) 215 if (i >= strLength || j < 2)
289 return *this; 216 return *this;
290 217
291 j = 0; 218 j = 0;
292 k = 0; 219 k = 0;
293 while (i < strLength && j < 2) { 220 while (i < strLength && j < 2) {
294 ch = dtStr[i]; 221 ch = dtStr[i];
295 k = k * 10 + FXSYS_toDecimalDigit(ch); 222 k = k * 10 + FXSYS_toDecimalDigit(ch);
296 j++; 223 j++;
297 if (!std::isdigit(ch)) 224 if (!std::isdigit(ch))
298 break; 225 break;
299 i++; 226 i++;
300 } 227 }
301 dt.second = (uint8_t)k; 228 dt.minute = static_cast<uint8_t>(k);
302 if (i >= strLength || j < 2) 229 if (i >= strLength || j < 2)
303 return *this; 230 return *this;
304 231
305 ch = dtStr[i++]; 232 j = 0;
306 if (ch != '-' && ch != '+') 233 k = 0;
307 return *this; 234 while (i < strLength && j < 2) {
308 if (ch == '-') 235 ch = dtStr[i];
309 dt.tzHour = -1; 236 k = k * 10 + FXSYS_toDecimalDigit(ch);
310 else 237 j++;
311 dt.tzHour = 1; 238 if (!std::isdigit(ch))
312 j = 0; 239 break;
313 k = 0; 240 i++;
314 while (i < strLength && j < 2) { 241 }
315 ch = dtStr[i]; 242 dt.second = static_cast<uint8_t>(k);
316 k = k * 10 + FXSYS_toDecimalDigit(ch); 243 if (i >= strLength || j < 2)
317 j++; 244 return *this;
318 if (!std::isdigit(ch))
319 break;
320 i++;
321 }
322 dt.tzHour *= (FX_CHAR)k;
323 if (i >= strLength || j < 2)
324 return *this;
325 245
326 ch = dtStr[i++]; 246 ch = dtStr[i++];
327 if (ch != '\'') 247 if (ch != '-' && ch != '+')
328 return *this; 248 return *this;
329 j = 0; 249 if (ch == '-')
330 k = 0; 250 dt.tzHour = -1;
331 while (i < strLength && j < 2) { 251 else
332 ch = dtStr[i]; 252 dt.tzHour = 1;
333 k = k * 10 + FXSYS_toDecimalDigit(ch); 253 j = 0;
334 j++; 254 k = 0;
335 if (!std::isdigit(ch)) 255 while (i < strLength && j < 2) {
336 break; 256 ch = dtStr[i];
337 i++; 257 k = k * 10 + FXSYS_toDecimalDigit(ch);
338 } 258 j++;
339 dt.tzMinute = (uint8_t)k; 259 if (!std::isdigit(ch))
340 if (i >= strLength || j < 2) 260 break;
341 return *this; 261 i++;
342 } 262 }
263 dt.tzHour *= static_cast<int8_t>(k);
264 if (i >= strLength || j < 2)
265 return *this;
343 266
267 if (dtStr[i++] != '\'')
268 return *this;
269 j = 0;
270 k = 0;
271 while (i < strLength && j < 2) {
272 ch = dtStr[i];
273 k = k * 10 + FXSYS_toDecimalDigit(ch);
274 j++;
275 if (!std::isdigit(ch))
276 break;
277 i++;
278 }
279 dt.tzMinute = static_cast<uint8_t>(k);
344 return *this; 280 return *this;
345 } 281 }
346 282
347 CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() { 283 CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() {
348 CFX_ByteString str1; 284 CFX_ByteString str1;
349 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,
350 dt.hour, dt.minute, dt.second); 286 dt.hour, dt.minute, dt.second);
351 if (dt.tzHour < 0) 287 if (dt.tzHour < 0)
352 str1 += "-"; 288 str1 += "-";
353 else 289 else
(...skipping 15 matching lines...) Expand all
369 else 305 else
370 dtStr += CFX_ByteString("+"); 306 dtStr += CFX_ByteString("+");
371 memset(tempStr, 0, sizeof(tempStr)); 307 memset(tempStr, 0, sizeof(tempStr));
372 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", abs(dt.tzHour), 308 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", abs(dt.tzHour),
373 dt.tzMinute); 309 dt.tzMinute);
374 dtStr += CFX_ByteString(tempStr); 310 dtStr += CFX_ByteString(tempStr);
375 return dtStr; 311 return dtStr;
376 } 312 }
377 313
378 void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) { 314 void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) {
379 time_t t = (time_t)(*this); 315 time_t t = this->ToTime_t();
380 struct tm* pTime = localtime(&t); 316 struct tm* pTime = localtime(&t);
381 if (pTime) { 317 if (pTime) {
382 st.wYear = (uint16_t)pTime->tm_year + 1900; 318 st.wYear = static_cast<uint16_t>(pTime->tm_year) + 1900;
383 st.wMonth = (uint16_t)pTime->tm_mon + 1; 319 st.wMonth = static_cast<uint16_t>(pTime->tm_mon) + 1;
384 st.wDay = (uint16_t)pTime->tm_mday; 320 st.wDay = static_cast<uint16_t>(pTime->tm_mday);
385 st.wDayOfWeek = (uint16_t)pTime->tm_wday; 321 st.wDayOfWeek = static_cast<uint16_t>(pTime->tm_wday);
386 st.wHour = (uint16_t)pTime->tm_hour; 322 st.wHour = static_cast<uint16_t>(pTime->tm_hour);
387 st.wMinute = (uint16_t)pTime->tm_min; 323 st.wMinute = static_cast<uint16_t>(pTime->tm_min);
388 st.wSecond = (uint16_t)pTime->tm_sec; 324 st.wSecond = static_cast<uint16_t>(pTime->tm_sec);
389 st.wMilliseconds = 0; 325 st.wMilliseconds = 0;
390 } 326 }
391 } 327 }
392 328
393 CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() const { 329 CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() const {
394 CPDFSDK_DateTime new_dt = *this; 330 CPDFSDK_DateTime new_dt = *this;
395 new_dt.AddSeconds( 331 new_dt.AddSeconds(
396 -gAfxGetTimeZoneInSeconds(new_dt.dt.tzHour, new_dt.dt.tzMinute)); 332 -gAfxGetTimeZoneInSeconds(new_dt.dt.tzHour, new_dt.dt.tzMinute));
397 new_dt.dt.tzHour = 0; 333 new_dt.dt.tzHour = 0;
398 new_dt.dt.tzMinute = 0; 334 new_dt.dt.tzMinute = 0;
399 return new_dt; 335 return new_dt;
400 } 336 }
401 337
402 CPDFSDK_DateTime& CPDFSDK_DateTime::AddDays(short days) { 338 CPDFSDK_DateTime& CPDFSDK_DateTime::AddDays(short days) {
403 if (days == 0) 339 if (days == 0)
404 return *this; 340 return *this;
405 341
406 int16_t y = dt.year, yy; 342 int16_t y = dt.year;
407 uint8_t m = dt.month; 343 uint8_t m = dt.month;
408 uint8_t d = dt.day; 344 uint8_t d = dt.day;
409 int mdays, ydays, ldays;
410 345
411 ldays = days; 346 int ldays = days;
412 if (ldays > 0) { 347 if (ldays > 0) {
413 yy = y; 348 int16_t yy = y;
414 if (((uint16_t)m * 100 + d) > 300) 349 if ((static_cast<uint16_t>(m) * 100 + d) > 300)
415 yy++; 350 yy++;
416 ydays = gAfxGetYearDays(yy); 351 int ydays = gAfxGetYearDays(yy);
352 int mdays;
417 while (ldays >= ydays) { 353 while (ldays >= ydays) {
418 y++; 354 y++;
419 ldays -= ydays; 355 ldays -= ydays;
420 yy++; 356 yy++;
421 mdays = gAfxGetMonthDays(y, m); 357 mdays = gAfxGetMonthDays(y, m);
422 if (d > mdays) { 358 if (d > mdays) {
423 m++; 359 m++;
424 d -= mdays; 360 d -= mdays;
425 } 361 }
426 ydays = gAfxGetYearDays(yy); 362 ydays = gAfxGetYearDays(yy);
427 } 363 }
428 mdays = gAfxGetMonthDays(y, m) - d + 1; 364 mdays = gAfxGetMonthDays(y, m) - d + 1;
429 while (ldays >= mdays) { 365 while (ldays >= mdays) {
430 ldays -= mdays; 366 ldays -= mdays;
431 m++; 367 m++;
432 d = 1; 368 d = 1;
433 mdays = gAfxGetMonthDays(y, m); 369 mdays = gAfxGetMonthDays(y, m);
434 } 370 }
435 d += ldays; 371 d += ldays;
436 } else { 372 } else {
437 ldays *= -1; 373 ldays *= -1;
438 yy = y; 374 int16_t yy = y;
439 if (((uint16_t)m * 100 + d) < 300) 375 if ((static_cast<uint16_t>(m) * 100 + d) < 300)
440 yy--; 376 yy--;
441 ydays = gAfxGetYearDays(yy); 377 int ydays = gAfxGetYearDays(yy);
442 while (ldays >= ydays) { 378 while (ldays >= ydays) {
443 y--; 379 y--;
444 ldays -= ydays; 380 ldays -= ydays;
445 yy--; 381 yy--;
446 mdays = gAfxGetMonthDays(y, m); 382 int mdays = gAfxGetMonthDays(y, m);
447 if (d > mdays) { 383 if (d > mdays) {
448 m++; 384 m++;
449 d -= mdays; 385 d -= mdays;
450 } 386 }
451 ydays = gAfxGetYearDays(yy); 387 ydays = gAfxGetYearDays(yy);
452 } 388 }
453 while (ldays >= d) { 389 while (ldays >= d) {
454 ldays -= d; 390 ldays -= d;
455 m--; 391 m--;
456 mdays = gAfxGetMonthDays(y, m); 392 d = gAfxGetMonthDays(y, m);
457 d = mdays;
458 } 393 }
459 d -= ldays; 394 d -= ldays;
460 } 395 }
461 396
462 dt.year = y; 397 dt.year = y;
463 dt.month = m; 398 dt.month = m;
464 dt.day = d; 399 dt.day = d;
465 400
466 return *this; 401 return *this;
467 } 402 }
468 403
469 CPDFSDK_DateTime& CPDFSDK_DateTime::AddSeconds(int seconds) { 404 CPDFSDK_DateTime& CPDFSDK_DateTime::AddSeconds(int seconds) {
470 if (seconds == 0) 405 if (seconds == 0)
471 return *this; 406 return *this;
472 407
473 int n; 408 int n;
474 int days; 409 int days;
475 410
476 n = dt.hour * 3600 + dt.minute * 60 + dt.second + seconds; 411 n = dt.hour * 3600 + dt.minute * 60 + dt.second + seconds;
477 if (n < 0) { 412 if (n < 0) {
478 days = (n - 86399) / 86400; 413 days = (n - 86399) / 86400;
479 n -= days * 86400; 414 n -= days * 86400;
480 } else { 415 } else {
481 days = n / 86400; 416 days = n / 86400;
482 n %= 86400; 417 n %= 86400;
483 } 418 }
484 dt.hour = (uint8_t)(n / 3600); 419 dt.hour = static_cast<uint8_t>(n / 3600);
485 dt.hour %= 24; 420 dt.hour %= 24;
486 n %= 3600; 421 n %= 3600;
487 dt.minute = (uint8_t)(n / 60); 422 dt.minute = static_cast<uint8_t>(n / 60);
488 dt.second = (uint8_t)(n % 60); 423 dt.second = static_cast<uint8_t>(n % 60);
489 if (days != 0) 424 if (days != 0)
490 AddDays(days); 425 AddDays(days);
491 426
492 return *this; 427 return *this;
493 } 428 }
494 429
495 CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) 430 CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView)
496 : m_pPageView(pPageView), m_bSelected(FALSE), m_nTabOrder(-1) {} 431 : m_pPageView(pPageView), m_bSelected(FALSE), m_nTabOrder(-1) {}
497 432
498 CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, 433 CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot,
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 862
928 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { 863 CPDF_Page* CPDFSDK_Annot::GetPDFPage() {
929 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; 864 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr;
930 } 865 }
931 866
932 #ifdef PDF_ENABLE_XFA 867 #ifdef PDF_ENABLE_XFA
933 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { 868 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() {
934 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; 869 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr;
935 } 870 }
936 #endif // PDF_ENABLE_XFA 871 #endif // PDF_ENABLE_XFA
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/include/fsdk_baseannot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698