1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

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

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();
},
'_');

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();
},
'_');

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
}