Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Migrated upcase, downcase to platform code
Browse files Browse the repository at this point in the history
Replaced manual, per-character upper- and lowercasing code with calls to platform-specific code that affects a wider range of characters.
  • Loading branch information
1ec5 committed Dec 14, 2017
1 parent d2cc855 commit 40f20a1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/mbgl/style/expression/compound_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <mbgl/math/log2.hpp>
#include <mbgl/util/ignore.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/util/platform.hpp>

namespace mbgl {
namespace style {
Expand Down Expand Up @@ -397,16 +398,10 @@ std::unordered_map<std::string, CompoundExpressionRegistry::Definition> initiali
define("!", [](bool e) -> Result<bool> { return !e; });

define("upcase", [](const std::string& input) -> Result<std::string> {
std::string s = input;
std::transform(s.begin(), s.end(), s.begin(),
[](unsigned char c){ return std::toupper(c); });
return s;
return platform::uppercase(input);
});
define("downcase", [](const std::string& input) -> Result<std::string> {
std::string s = input;
std::transform(s.begin(), s.end(), s.begin(),
[](unsigned char c){ return std::tolower(c); });
return s;
return platform::lowercase(input);
});
define("concat", [](const Varargs<std::string>& args) -> Result<std::string> {
std::string s;
Expand Down

0 comments on commit 40f20a1

Please sign in to comment.