⚙️ Restore support for GCC-4.8 (#246)

* Create workflow for targeting specific platforms/compilers

starts with a GCC-4.8 CentOS base

* make sure to install dev tools

* Update targets.yml

* Update targets.yml

* Update targets.yml

* Update targets.yml

* install CMake by hand

* try ubuntu with gcc 4.8

* fix action

* actions/checkout@v3

* latest cmake + set compiler for CMake

* install g++

* fix compiler passed to cmake

* try to run in docker container

* in container we are root

* try an update

* assume yes

* revert to using gh runner image

* permissions

* replace `codecvt` when required

* pass locale

* fix linter

* linter

* revert changes to actions (min for pr)
This commit is contained in:
Chris Mc
2022-09-17 21:04:40 -07:00
committed by GitHub
parent 25377cb041
commit 484bdb086a
2 changed files with 46 additions and 1 deletions

View File

@@ -24,7 +24,6 @@
#include <algorithm>
#include <chrono>
#include <cmath>
#include <codecvt>
#include <functional>
#include <iterator>
#include <locale>
@@ -36,6 +35,10 @@
#include <utility>
#include <vector>
#if __cplusplus > 201103L
#include <codecvt>
#endif
#if __cplusplus >= 201402L
#ifdef __has_include
#if __has_include(<experimental/type_traits>)
@@ -3125,11 +3128,18 @@ namespace jwt {
}
static std::string to_lower_unicode(const std::string& str, const std::locale& loc) {
#if __cplusplus > 201103L
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> conv;
auto wide = conv.from_bytes(str);
auto& f = std::use_facet<std::ctype<wchar_t>>(loc);
f.tolower(&wide[0], &wide[0] + wide.size());
return conv.to_bytes(wide);
#else
std::string result;
std::transform(str.begin(), str.end(), std::back_inserter(result),
[&loc](unsigned char c) { return std::tolower(c, loc); });
return result;
#endif
}
};
} // namespace verify_ops