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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 return; | 383 return; |
384 } | 384 } |
385 if (header.magic != kMetadataFileHeaderMagic || | 385 if (header.magic != kMetadataFileHeaderMagic || |
386 header.version != kMetadataFileVersion) { | 386 header.version != kMetadataFileVersion) { |
387 LOG(ERROR) << "unexpected header"; | 387 LOG(ERROR) << "unexpected header"; |
388 return; | 388 return; |
389 } | 389 } |
390 | 390 |
391 base::CheckedNumeric<uint32_t> records_size = | 391 base::CheckedNumeric<uint32_t> records_size = |
392 base::CheckedNumeric<uint32_t>(header.num_records) * | 392 base::CheckedNumeric<uint32_t>(header.num_records) * |
393 sizeof(MetadataFileReportRecord); | 393 static_cast<uint32_t>(sizeof(MetadataFileReportRecord)); |
394 if (!records_size.IsValid()) { | 394 if (!records_size.IsValid()) { |
395 LOG(ERROR) << "record size out of range"; | 395 LOG(ERROR) << "record size out of range"; |
396 return; | 396 return; |
397 } | 397 } |
398 | 398 |
399 std::vector<MetadataFileReportRecord> records(header.num_records); | 399 std::vector<MetadataFileReportRecord> records(header.num_records); |
400 if (!LoggingReadFile(handle_.get(), &records[0], records_size.ValueOrDie())) { | 400 if (!LoggingReadFile(handle_.get(), &records[0], records_size.ValueOrDie())) { |
401 LOG(ERROR) << "failed to read records"; | 401 LOG(ERROR) << "failed to read records"; |
402 return; | 402 return; |
403 } | 403 } |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 // static | 728 // static |
729 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize( | 729 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize( |
730 const base::FilePath& path) { | 730 const base::FilePath& path) { |
731 scoped_ptr<CrashReportDatabaseWin> database_win( | 731 scoped_ptr<CrashReportDatabaseWin> database_win( |
732 new CrashReportDatabaseWin(path.Append(kDatabaseDirectoryName))); | 732 new CrashReportDatabaseWin(path.Append(kDatabaseDirectoryName))); |
733 return database_win->Initialize() ? database_win.Pass() | 733 return database_win->Initialize() ? database_win.Pass() |
734 : scoped_ptr<CrashReportDatabaseWin>(); | 734 : scoped_ptr<CrashReportDatabaseWin>(); |
735 } | 735 } |
736 | 736 |
737 } // namespace crashpad | 737 } // namespace crashpad |
OLD | NEW |