From 66e99ac5ccf2d8313ec4a7f33460c64f521b27e2 Mon Sep 17 00:00:00 2001 From: "U-CFATI-5510-0\\cfati" Date: Thu, 15 Feb 2018 11:34:43 +0200 Subject: [PATCH] Added support for Win (by stripping out code that deals with 4 byte char STL containers) --- export.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/export.cpp b/export.cpp index 3dcda26..ee720a9 100644 --- a/export.cpp +++ b/export.cpp @@ -19,9 +19,18 @@ #endif/*USE_LIBICONV_GNU*/ #ifndef ICONV_CONST +#if defined (WIN32) +#define ICONV_CONST const +#else #define ICONV_CONST +#endif #endif/*ICONV_CONST*/ +#if defined (WIN32) +#define __SIZEOF_WCHAR_T__ 2 +#endif + + template bool iconv_convert(iconv_t cd, const source_type& src, destination_type& dst) { @@ -269,7 +278,7 @@ void retrieve_iconv( iconv_close(bwd); } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(WIN32) #include #endif @@ -283,7 +292,7 @@ std::vector reader::retrieve(const char *query) retrieve_thru(dbr, query, this->measure, this->threshold, std::back_inserter(ret)); break; case 2: -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(WIN32) #if __SIZEOF_WCHAR_T__ == 2 retrieve_iconv(dbr, query, UTF16, this->measure, this->threshold, std::back_inserter(ret)); #else @@ -294,7 +303,7 @@ assert(0); #endif break; case 4: -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(WIN32) #if __SIZEOF_WCHAR_T__ == 4 retrieve_iconv(dbr, query, UTF32, this->measure, this->threshold, std::back_inserter(ret)); #else @@ -317,7 +326,7 @@ bool reader::check(const char *query) std::string qstr = query; return dbr.check(qstr, translate_measure(this->measure), this->threshold); } else if (dbr.char_size() == 2) { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(WIN32) #if __SIZEOF_WCHAR_T__ == 2 std::basic_string qstr; #else @@ -333,7 +342,7 @@ assert(0); iconv_close(fwd); return dbr.check(qstr, translate_measure(this->measure), this->threshold); } else if (dbr.char_size() == 4) { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(WIN32) #if __SIZEOF_WCHAR_T__ == 4 std::basic_string qstr; #else