Commit 57622f882a3b0aa7a26eecaeb5268cfdb2a531ef

Authored by Perry Werneck
1 parent 84f04a6f
Exists in master and in 1 other branch develop

ICONV is now optional.

client/src/core/abstract.cc
... ... @@ -110,6 +110,8 @@
110 110 }
111 111  
112 112 /// @brief Converte charset.
  113 +#ifdef HAVE_ICONV
  114 +
113 115 std::string Abstract::Session::convertCharset(iconv_t &converter, const char * str, int length) {
114 116  
115 117 std::string rc;
... ... @@ -117,8 +119,6 @@
117 119 if(length < 0)
118 120 length = (int) strlen(str);
119 121  
120   -#ifdef HAVE_ICONV
121   -
122 122 if(length && converter != (iconv_t)(-1)) {
123 123  
124 124 size_t in = length;
... ... @@ -140,30 +140,37 @@
140 140 rc.assign(str);
141 141 }
142 142  
143   -#else
144   -
145   - rc.assign(str);
146   -
147   -#endif // HAVE_ICONV
148 143  
149 144 return rc;
150 145 }
  146 +#endif // HAVE_ICONV
151 147  
152 148 /// @brief Converte string recebida do host para o charset atual.
153 149 std::string Abstract::Session::convertFromHost(const std::string &str) const {
154 150 // debug(__FUNCTION__,"(",str.c_str(),")");
  151 +#ifdef HAVE_ICONV
155 152 return convertCharset(const_cast<Abstract::Session *>(this)->converter.local,str.c_str(),str.size());
  153 +#else
  154 + return str;
  155 +#endif // HAVE_ICONV
156 156 }
157 157  
158 158 // @brief Converte string do charset atual para o charset do host.
159 159 std::string Abstract::Session::convertToHost(const char *text, int length) const {
  160 +#ifdef HAVE_ICONV
160 161 return convertCharset(const_cast<Abstract::Session *>(this)->converter.host,text,length);
  162 +#else
  163 + return std::string(text,length);
  164 +#endif // HAVE_ICONV
161 165 }
162 166  
163 167 /// @brief Converte string do charset atual para o charset do host.
164 168 std::string Abstract::Session::convertToHost(const std::string &str) const {
165   - debug(__FUNCTION__,"(",str.c_str(),")");
  169 +#ifdef HAVE_ICONV
166 170 return convertCharset(const_cast<Abstract::Session *>(this)->converter.host,str.c_str(),str.size());
  171 +#else
  172 + return str;
  173 +#endif // HAVE_ICONV
167 174 }
168 175  
169 176  
... ...
client/src/core/constants.cc
... ... @@ -43,11 +43,19 @@
43 43 /*---[ Implement ]----------------------------------------------------------------------------------*/
44 44  
45 45 TN3270_PUBLIC const char * getVersion() {
  46 +#ifdef PACKAGE_VERSION
46 47 return PACKAGE_VERSION;
  48 +#else
  49 + return "";
  50 +#endif // PACKAGE_VERSION
47 51 }
48 52  
49 53 TN3270_PUBLIC const char * getRevision() {
  54 +#ifdef PACKAGE_RELEASE
50 55 return LIB3270_STRINGIZE_VALUE_OF(PACKAGE_RELEASE);
  56 +#else
  57 + return "";
  58 +#endif // PACKAGE_RELEASE
51 59 }
52 60  
53 61 TN3270_PUBLIC const char * toCharString(const TN3270::KeyboardAction action) {
... ...
client/src/include/ipc-client-internals.h
... ... @@ -139,10 +139,11 @@
139 139 iconv_t host;
140 140  
141 141 } converter;
142   -#endif
143 142  
144 143 /// @brief Converte charset.
145 144 static std::string convertCharset(iconv_t &converter, const char *str, int length);
  145 +#endif
  146 +
146 147  
147 148 protected:
148 149  
... ...