mirror of
https://github.com/allankoechke/jwt-cpp.git
synced 2026-11-30 10:18:40 +00:00
⚙️ 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:
35
.github/workflows/targets.yml
vendored
Normal file
35
.github/workflows/targets.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Specific Targets CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
paths:
|
||||
- "CMakeLists.txt"
|
||||
- "cmake/**"
|
||||
- "include/jwt-cpp/**"
|
||||
- "tests/cmake/**"
|
||||
- ".github/actions/**"
|
||||
- ".github/workflows/targets.yml"
|
||||
|
||||
jobs:
|
||||
gcc-4-8:
|
||||
name: GCC 4.8
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- run: sudo apt-get install g++-4.8
|
||||
- uses: lukka/get-cmake@latest
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: setup
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
CC=gcc-4.8 CXX=g++-4.8 cmake ..
|
||||
sudo cmake --install .
|
||||
- name: test
|
||||
working-directory: tests/cmake
|
||||
run: |
|
||||
CC=gcc-4.8 CXX=g++-4.8 cmake . -DTEST:STRING="defaults-enabled"
|
||||
cmake --build .
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user