From 6f550292f4b9efd9dfe866627eb6bf2489b5f0d9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 10 Mar 2016 16:06:04 -0800 Subject: [PATCH] pass delete paths by reference for trimming --- assignment-client/src/assets/AssetServer.cpp | 4 ++-- assignment-client/src/assets/AssetServer.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index 8598a33715..ff7d869a0b 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -551,12 +551,12 @@ bool pathIsFolder(const AssetPath& path) { return path.endsWith('/'); } -bool AssetServer::deleteMappings(const AssetPathList& paths) { +bool AssetServer::deleteMappings(AssetPathList& paths) { // take a copy of the current mappings in case persistence of these deletes fails auto oldMappings = _fileMappings; // enumerate the paths to delete and remove them all - for (auto path : paths) { + for (auto& path : paths) { path = path.trimmed(); diff --git a/assignment-client/src/assets/AssetServer.h b/assignment-client/src/assets/AssetServer.h index 2e4321e4cd..1a8ebed50b 100644 --- a/assignment-client/src/assets/AssetServer.h +++ b/assignment-client/src/assets/AssetServer.h @@ -55,7 +55,7 @@ private: bool setMapping(AssetPath path, AssetHash hash); /// Delete mapping `path`. Returns `true` if deletion of mappings succeeds, else `false`. - bool deleteMappings(const AssetPathList& paths); + bool deleteMappings(AssetPathList& paths); /// Rename mapping from `oldPath` to `newPath`. Returns true if successful bool renameMapping(AssetPath oldPath, AssetPath newPath);