Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/conflicts/module_info_win.h" | 5 #include "chrome/browser/conflicts/module_info_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <fileapi.h> | 9 #include <fileapi.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <tuple> | |
| 12 | 13 |
| 13 #include "base/file_version_info.h" | 14 #include "base/file_version_info.h" |
| 14 #include "base/i18n/case_conversion.h" | 15 #include "base/i18n/case_conversion.h" |
| 15 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 16 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 // Using the module path, populates |inspection_result| with information | 22 // Using the module path, populates |inspection_result| with information |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 uint32_t module_id) | 63 uint32_t module_id) |
| 63 : module_path(module_path), | 64 : module_path(module_path), |
| 64 module_size(module_size), | 65 module_size(module_size), |
| 65 module_time_date_stamp(module_time_date_stamp), | 66 module_time_date_stamp(module_time_date_stamp), |
| 66 module_id(module_id) {} | 67 module_id(module_id) {} |
| 67 | 68 |
| 68 bool ModuleInfoKey::operator<(const ModuleInfoKey& mik) const { | 69 bool ModuleInfoKey::operator<(const ModuleInfoKey& mik) const { |
| 69 // The key consists of the triplet of | 70 // The key consists of the triplet of |
| 70 // (module_path, module_size, module_time_date_stamp). | 71 // (module_path, module_size, module_time_date_stamp). |
| 71 // Use the std::tuple lexicographic comparison operator. | 72 // Use the std::tuple lexicographic comparison operator. |
| 72 return std::make_tuple(module_path, module_size, module_time_date_stamp) < | 73 return std::tie(module_path, module_size, module_time_date_stamp) < |
| 73 std::make_tuple(mik.module_path, mik.module_size, | 74 std::tie(mik.module_path, mik.module_size, mik.module_time_date_stamp); |
|
chrisha
2017/03/04 16:09:07
TIL!
| |
| 74 mik.module_time_date_stamp); | |
| 75 } | 75 } |
| 76 | 76 |
| 77 // ModuleInspectionResult ------------------------------------------------------ | 77 // ModuleInspectionResult ------------------------------------------------------ |
| 78 ModuleInspectionResult::ModuleInspectionResult() = default; | 78 ModuleInspectionResult::ModuleInspectionResult() = default; |
| 79 | 79 |
| 80 ModuleInspectionResult::~ModuleInspectionResult() = default; | 80 ModuleInspectionResult::~ModuleInspectionResult() = default; |
| 81 | 81 |
| 82 // ModuleInfoData -------------------------------------------------------------- | 82 // ModuleInfoData -------------------------------------------------------------- |
| 83 | 83 |
| 84 ModuleInfoData::ModuleInfoData() : process_types(0) {} | 84 ModuleInfoData::ModuleInfoData() : process_types(0) {} |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 inspection_result->version = | 134 inspection_result->version = |
| 135 inspection_result->version.substr(0, first_space); | 135 inspection_result->version.substr(0, first_space); |
| 136 | 136 |
| 137 // The signer may be returned with trailing nulls. | 137 // The signer may be returned with trailing nulls. |
| 138 size_t first_null = inspection_result->certificate_info.subject.find(L'\0'); | 138 size_t first_null = inspection_result->certificate_info.subject.find(L'\0'); |
| 139 if (first_null != base::string16::npos) | 139 if (first_null != base::string16::npos) |
| 140 inspection_result->certificate_info.subject.resize(first_null); | 140 inspection_result->certificate_info.subject.resize(first_null); |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace internal | 143 } // namespace internal |
| OLD | NEW |