| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 LOG(ERROR) << "Seek(): base_offset " << base_offset | 150 LOG(ERROR) << "Seek(): base_offset " << base_offset |
| 151 << " invalid for FileOffset"; | 151 << " invalid for FileOffset"; |
| 152 return -1; | 152 return -1; |
| 153 } | 153 } |
| 154 base::CheckedNumeric<FileOffset> new_offset(base_offset_fileoffset); | 154 base::CheckedNumeric<FileOffset> new_offset(base_offset_fileoffset); |
| 155 new_offset += offset; | 155 new_offset += offset; |
| 156 if (!new_offset.IsValid()) { | 156 if (!new_offset.IsValid()) { |
| 157 LOG(ERROR) << "Seek(): new_offset invalid"; | 157 LOG(ERROR) << "Seek(): new_offset invalid"; |
| 158 return -1; | 158 return -1; |
| 159 } | 159 } |
| 160 FileOffset new_offset_fileoffset = new_offset.ValueOrDie(); | |
| 161 size_t new_offset_sizet; | 160 size_t new_offset_sizet; |
| 162 if (!AssignIfInRange(&new_offset_sizet, new_offset_fileoffset)) { | 161 if (!new_offset.AssignIfValid(&new_offset_sizet)) { |
| 163 LOG(ERROR) << "Seek(): new_offset " << new_offset_fileoffset | 162 LOG(ERROR) << "Seek(): new_offset " << new_offset.ValueOrDie() |
| 164 << " invalid for size_t"; | 163 << " invalid for size_t"; |
| 165 return -1; | 164 return -1; |
| 166 } | 165 } |
| 167 | 166 |
| 168 offset_ = new_offset_sizet; | 167 offset_ = new_offset_sizet; |
| 169 | 168 |
| 170 return offset_.ValueOrDie(); | 169 return base::ValueOrDieForType<FileOffset>(offset_); |
| 171 } | 170 } |
| 172 | 171 |
| 173 } // namespace crashpad | 172 } // namespace crashpad |
| OLD | NEW |