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

Side by Side Diff: client/crash_report_database_win.cc

Issue 1117393002: win: Don't log wide strings via path.value().c_str() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@settings-access
Patch Set: just convert at callsite instead of global std::operator<< Created 5 years, 7 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 | snapshot/crashpad_info_client_options_test.cc » ('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 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 439 }
440 440
441 // Build the records and string table we're going to write. 441 // Build the records and string table we're going to write.
442 std::string string_table; 442 std::string string_table;
443 std::vector<MetadataFileReportRecord> records; 443 std::vector<MetadataFileReportRecord> records;
444 records.reserve(num_records); 444 records.reserve(num_records);
445 for (const auto& report : reports_) { 445 for (const auto& report : reports_) {
446 const base::FilePath& path = report.file_path; 446 const base::FilePath& path = report.file_path;
447 if (path.DirName() != report_dir_) { 447 if (path.DirName() != report_dir_) {
448 LOG(ERROR) << path.value().c_str() << " expected to start with " 448 LOG(ERROR) << path.value().c_str() << " expected to start with "
449 << report_dir_.value().c_str(); 449 << base::UTF16ToUTF8(report_dir_.value());
450 return; 450 return;
451 } 451 }
452 records.push_back(MetadataFileReportRecord(report, &string_table)); 452 records.push_back(MetadataFileReportRecord(report, &string_table));
453 } 453 }
454 454
455 if (!LoggingWriteFile(handle_.get(), 455 if (!LoggingWriteFile(handle_.get(),
456 &records[0], 456 &records[0],
457 records.size() * sizeof(MetadataFileReportRecord))) { 457 records.size() * sizeof(MetadataFileReportRecord))) {
458 LOG(ERROR) << "failed to write records"; 458 LOG(ERROR) << "failed to write records";
459 return; 459 return;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 619
620 // Take ownership of the report. 620 // Take ownership of the report.
621 scoped_ptr<NewReport> scoped_report(report); 621 scoped_ptr<NewReport> scoped_report(report);
622 622
623 // Close the outstanding handle. 623 // Close the outstanding handle.
624 LoggingCloseFile(report->handle); 624 LoggingCloseFile(report->handle);
625 625
626 // We failed to write, so remove the dump file. There's no entry in the 626 // We failed to write, so remove the dump file. There's no entry in the
627 // metadata table yet. 627 // metadata table yet.
628 if (!DeleteFile(scoped_report->path.value().c_str())) { 628 if (!DeleteFile(scoped_report->path.value().c_str())) {
629 PLOG(ERROR) << "DeleteFile " << scoped_report->path.value().c_str(); 629 PLOG(ERROR) << "DeleteFile "
630 << base::UTF16ToUTF8(scoped_report->path.value());
630 return CrashReportDatabase::kFileSystemError; 631 return CrashReportDatabase::kFileSystemError;
631 } 632 }
632 633
633 return kNoError; 634 return kNoError;
634 } 635 }
635 636
636 OperationStatus CrashReportDatabaseWin::LookUpCrashReport(const UUID& uuid, 637 OperationStatus CrashReportDatabaseWin::LookUpCrashReport(const UUID& uuid,
637 Report* report) { 638 Report* report) {
638 INITIALIZATION_STATE_DCHECK_VALID(initialized_); 639 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
639 640
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 // static 750 // static
750 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize( 751 scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize(
751 const base::FilePath& path) { 752 const base::FilePath& path) {
752 scoped_ptr<CrashReportDatabaseWin> database_win( 753 scoped_ptr<CrashReportDatabaseWin> database_win(
753 new CrashReportDatabaseWin(path)); 754 new CrashReportDatabaseWin(path));
754 return database_win->Initialize() ? database_win.Pass() 755 return database_win->Initialize() ? database_win.Pass()
755 : scoped_ptr<CrashReportDatabaseWin>(); 756 : scoped_ptr<CrashReportDatabaseWin>();
756 } 757 }
757 758
758 } // namespace crashpad 759 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | snapshot/crashpad_info_client_options_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698