From ed5b36634199c8d1a994c2b360ab4da6302f106e Mon Sep 17 00:00:00 2001 From: Mario Fink Date: Tue, 8 Aug 2023 23:29:48 +0200 Subject: [PATCH] imc_channel.hpp: usage of iconv for unix only, bump version 2.0.15 --- .github/workflows/pypi-deploy.yml | 6 ------ lib/imc_channel.hpp | 21 ++++++++++++--------- python/VERSION | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pypi-deploy.yml b/.github/workflows/pypi-deploy.yml index ff956bc..e7a30c8 100644 --- a/.github/workflows/pypi-deploy.yml +++ b/.github/workflows/pypi-deploy.yml @@ -40,12 +40,6 @@ jobs: with: name: wheel-config path: python/ - - name: Install libiconv for windows - if: matrix.os == 'windows-2019' - run: | - git clone https://github.com/Microsoft/vcpkg.git - .\vcpkg\bootstrap-vcpkg.bat - vcpkg install libiconv - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse working-directory: python/ diff --git a/lib/imc_channel.hpp b/lib/imc_channel.hpp index 07e4e67..f1df8b4 100644 --- a/lib/imc_channel.hpp +++ b/lib/imc_channel.hpp @@ -146,21 +146,19 @@ namespace imc return sumstr; } + #if defined(__linux__) || defined(__APPLE__) // convert encoding of any descriptions, channel-names, units etc. class iconverter { - #if defined(__linux__) || defined(__APPLE__) - iconv_t cd_; - #endif - std::string in_enc_, out_enc_; - size_t out_buffer_size_; + std::string in_enc_, out_enc_; + iconv_t cd_; + size_t out_buffer_size_; public: iconverter(std::string in_enc, std::string out_enc, size_t out_buffer_size = 1024) : in_enc_(in_enc), out_enc_(out_enc), out_buffer_size_(out_buffer_size) { - #if defined(__linux__) || defined(__APPLE__) // allocate descriptor for character set conversion // (https://man7.org/linux/man-pages/man3/iconv_open.3.html) cd_ = iconv_open(out_enc.c_str(), in_enc.c_str()); @@ -174,12 +172,10 @@ namespace imc throw std::runtime_error(errmsg); } } - #endif } void convert(std::string &astring) { - #if defined(__linux__) || defined(__APPLE__) if ( astring.empty() ) return; std::vector in_buffer(astring.begin(),astring.end()); @@ -221,8 +217,15 @@ namespace imc std::string outstring(out_buffer.begin(),out_buffer.end()-outbytes); astring = outstring; } - #endif }; + #elif defined(__WIN32__) || defined(_WIN32) + class iconverter + { + public: + iconverter(std::string in_enc, std::string out_enc, size_t out_buffer_size = 1024) {} + void convert(std::string &astring) {} + }; + #endif // channel struct channel diff --git a/python/VERSION b/python/VERSION index 3d45b5c..b8061b5 100644 --- a/python/VERSION +++ b/python/VERSION @@ -1 +1 @@ -2.0.14 +2.0.15