Implement replace_if condition lambda

Fix include typo and CS
This commit is contained in:
Tom Lankhorst
2019-03-02 14:50:15 +01:00
committed by Ted John
parent 744f2225ed
commit ed353faccf
3 changed files with 4 additions and 6 deletions
+1 -1
View File
@@ -208,7 +208,7 @@ std::string platform_sanitise_filename(const std::string& path)
std::replace_if(
sanitised.begin(), sanitised.end(),
[&prohibited](const std::string::value_type& ch) {
[&prohibited](const std::string::value_type& ch) -> bool {
return std::find(prohibited.begin(), prohibited.end(), ch) != prohibited.end();
},
'_');
+2 -2
View File
@@ -22,7 +22,7 @@
# include "../OpenRCT2.h"
# include "../Version.h"
# include "../config/Config.h"
# include "../core/String.h"
# include "../core/String.hpp"
# include "../localisation/Date.h"
# include "../localisation/Language.h"
# include "../rct2/RCT2.h"
@@ -264,7 +264,7 @@ std::string platform_sanitise_filename(const std::string& path)
std::replace_if(
sanitised.begin(), sanitised.end(),
[](const std::string::value_type& ch) {
[&prohibited](const std::string::value_type& ch) -> bool {
return std::find(prohibited.begin(), prohibited.end(), ch) != prohibited.end();
},
'_');
+1 -3
View File
@@ -7,9 +7,8 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <openrct2/platform/platform.h>
#include <gtest/gtest.h>
#include <openrct2/platform/platform.h>
TEST(platform, sanitise_filename)
{
@@ -27,4 +26,3 @@ TEST(platform, sanitise_filename)
ASSERT_EQ("non trimmed", platform_sanitise_filename(" non trimmed "));
#endif
}