OLD | NEW |
---|---|
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 bool Settings::ReadSettings(FileHandle handle, | 246 bool Settings::ReadSettings(FileHandle handle, |
247 Data* out_data, | 247 Data* out_data, |
248 bool log_read_error) { | 248 bool log_read_error) { |
249 if (LoggingSeekFile(handle, 0, SEEK_SET) != 0) | 249 if (LoggingSeekFile(handle, 0, SEEK_SET) != 0) |
250 return false; | 250 return false; |
251 | 251 |
252 bool read_result; | 252 bool read_result; |
253 if (log_read_error) | 253 if (log_read_error) |
254 read_result = LoggingReadFile(handle, out_data, sizeof(*out_data)); | 254 read_result = LoggingReadFile(handle, out_data, sizeof(*out_data)); |
255 else | 255 else |
256 read_result = ReadFile(handle, out_data, sizeof(*out_data)); | 256 read_result = ReadFile(handle, out_data, sizeof(*out_data)) >= 0; |
Mark Mentovai
2015/10/22 21:22:40
Oops, this was my mistake.
== sizeof(*out_data) w
scottmg
2015/10/22 21:28:27
Done.
scottmg
2015/10/22 21:29:54
Let's hope sizeof(Data) != 0xffffffff bytes!
| |
257 | 257 |
258 if (!read_result) | 258 if (!read_result) |
259 return false; | 259 return false; |
260 | 260 |
261 if (out_data->magic != Data::kSettingsMagic) { | 261 if (out_data->magic != Data::kSettingsMagic) { |
262 LOG(ERROR) << "Settings magic is not " << Data::kSettingsMagic; | 262 LOG(ERROR) << "Settings magic is not " << Data::kSettingsMagic; |
263 return false; | 263 return false; |
264 } | 264 } |
265 | 265 |
266 if (out_data->version != Data::kSettingsVersion) { | 266 if (out_data->version != Data::kSettingsVersion) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 | 307 |
308 bool Settings::InitializeSettings(FileHandle handle) { | 308 bool Settings::InitializeSettings(FileHandle handle) { |
309 Data settings; | 309 Data settings; |
310 if (!settings.client_id.InitializeWithNew()) | 310 if (!settings.client_id.InitializeWithNew()) |
311 return false; | 311 return false; |
312 | 312 |
313 return WriteSettings(handle, settings); | 313 return WriteSettings(handle, settings); |
314 } | 314 } |
315 | 315 |
316 } // namespace crashpad | 316 } // namespace crashpad |
OLD | NEW |