summaryrefslogtreecommitdiffstats
path: root/chromeos/disks
diff options
context:
space:
mode:
authorpkasting <pkasting@chromium.org>2016-02-04 16:08:56 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-05 00:09:57 +0000
commit9022cb435a91083c86633d6672f92ca6643cb229 (patch)
treebe1758ca65722b328468c626996f9822e0afe5b5 /chromeos/disks
parent44a33be0211fae0485f4e77b8c7d6c5190069066 (diff)
downloadchromium_src-9022cb435a91083c86633d6672f92ca6643cb229.zip
chromium_src-9022cb435a91083c86633d6672f92ca6643cb229.tar.gz
chromium_src-9022cb435a91083c86633d6672f92ca6643cb229.tar.bz2
Allow string::front() and back() and update the codebase to use back().
I searched for "length() - 1]", which won't find all potential sites to use back(), but should hit a reasonable number. These were all converted. I don't consider str.front() to be vastly more readable than str[0], so I made no effort to seek these out and change them. I did change code to use front() when it would make for better parallel structure with a place I was making use back(), e.g.: if (str[0] == 'x' && str[str.length() - 1] == 'y') { ...was transformed to: if (str.front() == 'x' && str.back() == 'y') { ...and not: if (str[0] == 'x' && str.back() == 'y') { I also added front() and back() methods to StringPiece so people wouldn't need to distinguish between string and StringPiece for these purposes. BUG=none TEST=none Review URL: https://codereview.chromium.org/1663253004 Cr-Commit-Position: refs/heads/master@{#373672}
Diffstat (limited to 'chromeos/disks')
-rw-r--r--chromeos/disks/disk_mount_manager.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/chromeos/disks/disk_mount_manager.cc b/chromeos/disks/disk_mount_manager.cc
index 3c89ac6..d4edfea 100644
--- a/chromeos/disks/disk_mount_manager.cc
+++ b/chromeos/disks/disk_mount_manager.cc
@@ -275,7 +275,7 @@ class DiskMountManagerImpl : public DiskMountManager {
void UnmountChildMounts(const std::string& mount_path_in) {
std::string mount_path = mount_path_in;
// Let's make sure mount path has trailing slash.
- if (mount_path[mount_path.length() - 1] != '/')
+ if (mount_path.back() != '/')
mount_path += '/';
for (MountPointMap::iterator it = mount_points_.begin();