OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 #include "net/cert/x509_cert_types.h" | 5 #include "net/cert/x509_cert_types.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <cstring> | 8 #include <cstring> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 | 64 |
65 exploded.year = ParseIntAndAdvance(&field, year_length, &valid); | 65 exploded.year = ParseIntAndAdvance(&field, year_length, &valid); |
66 exploded.month = ParseIntAndAdvance(&field, 2, &valid); | 66 exploded.month = ParseIntAndAdvance(&field, 2, &valid); |
67 exploded.day_of_month = ParseIntAndAdvance(&field, 2, &valid); | 67 exploded.day_of_month = ParseIntAndAdvance(&field, 2, &valid); |
68 exploded.hour = ParseIntAndAdvance(&field, 2, &valid); | 68 exploded.hour = ParseIntAndAdvance(&field, 2, &valid); |
69 exploded.minute = ParseIntAndAdvance(&field, 2, &valid); | 69 exploded.minute = ParseIntAndAdvance(&field, 2, &valid); |
70 exploded.second = ParseIntAndAdvance(&field, 2, &valid); | 70 exploded.second = ParseIntAndAdvance(&field, 2, &valid); |
71 if (valid && year_length == 2) | 71 if (valid && year_length == 2) |
72 exploded.year += exploded.year < 50 ? 2000 : 1900; | 72 exploded.year += exploded.year < 50 ? 2000 : 1900; |
73 | 73 |
74 valid &= exploded.HasValidValues(); | 74 valid &= exploded.HasValidValues(); |
eroman
2016/10/27 21:44:34
This line is redundant with the call to FromUTCExp
maksims (do not use this acc)
2016/11/29 07:38:56
No. FromUTCExploded doesn't perform this kind of c
eroman
2016/11/30 00:21:05
FromUTCExploded() returns a boolean indicating suc
maksims (do not use this acc)
2016/12/05 13:15:49
Sorry, I was wrong. it's ok to remove this line.
| |
75 | 75 |
76 if (!valid) | 76 if (!valid) |
77 return false; | 77 return false; |
78 | 78 |
79 *time = base::Time::FromUTCExploded(exploded); | 79 // FromUTCExploded() can fail even though exploded.HasValidValues() |
80 return true; | 80 // returned true. |
81 return base::Time::FromUTCExploded(exploded, time); | |
81 } | 82 } |
82 | 83 |
83 } // namespace net | 84 } // namespace net |
OLD | NEW |