Chromium Code Reviews| Index: chrome/browser/media_gallery/media_storage_util.cc |
| diff --git a/chrome/browser/media_gallery/media_storage_util.cc b/chrome/browser/media_gallery/media_storage_util.cc |
| index d41f13c508e3f5561c93e06c4a4c8962447cf971..f8e5d7461eda8bfd99a65b074f236dba9d18434b 100644 |
| --- a/chrome/browser/media_gallery/media_storage_util.cc |
| +++ b/chrome/browser/media_gallery/media_storage_util.cc |
| @@ -101,8 +101,11 @@ std::string MediaStorageUtil::MakeDeviceId(Type type, |
| // static |
| bool MediaStorageUtil::CrackDeviceId(const std::string& device_id, |
| Type* type, std::string* unique_id) { |
| + // The device ID is always generated by MakeDeviceId, so we should always |
|
James Hawkins
2012/08/29 22:46:51
nit: Don't use pronouns (we) in comments; pronouns
thorogood
2012/08/30 01:36:28
Thanks, although this has been fixed by another pa
|
| + // be able to find a valid prefix delimited by ':'. |
| size_t prefix_length = device_id.find_first_of(':'); |
| - std::string prefix = device_id.substr(0, prefix_length); |
| + DCHECK(prefix_length != std::string::npos); |
| + std::string prefix = device_id.substr(0, prefix_length + 1); |
|
James Hawkins
2012/08/29 22:46:51
What this a bug previously?
thorogood
2012/08/30 01:36:28
Yes. It's been fixed by another patch, so you can
|
| Type found_type; |
| if (prefix == kUsbMassStorageWithDCIMPrefix) { |