Commit 1985106c2eefbbc3d40398f759de6be1d690315e

Authored by Perry Werneck
1 parent 195ab601

Fixing iconv wrapper.

src/core/charset/iconv.c
... ... @@ -35,6 +35,7 @@
35 35  
36 36 #include <config.h>
37 37 #include <lib3270.h>
  38 +#include <lib3270/log.h>
38 39 #include <lib3270/charset.h>
39 40 #include <iconv.h>
40 41 #include <string.h>
... ... @@ -112,10 +113,10 @@ struct _lib3270_iconv
112 113  
113 114 char * lib3270_iconv_from_host(LIB3270_ICONV *conv, const char *str, int len)
114 115 {
115   - return convert(&conv->local,str,len);
  116 + return convert(conv->local,str,len);
116 117 }
117 118  
118 119 char * lib3270_iconv_to_host(LIB3270_ICONV *conv, const char *str, int len)
119 120 {
120   - return convert(&conv->host,str,len);
  121 + return convert(conv->host,str,len);
121 122 }
... ...
src/testprogram/testprogram.c
... ... @@ -11,6 +11,7 @@
11 11 #include <lib3270/toggle.h>
12 12 #include <lib3270/log.h>
13 13 #include <lib3270/properties.h>
  14 +#include <lib3270/charset.h>
14 15  
15 16 #define MAX_ARGS 10
16 17  
... ... @@ -34,6 +35,16 @@ static void online_group_state_changed(H3270 GNUC_UNUSED(*hSession), void GNUC_U
34 35  
35 36 int main(int argc, char *argv[])
36 37 {
  38 +
  39 + {
  40 + LIB3270_ICONV *converter = lib3270_iconv_new("iso-8859-1","utf-8");
  41 +
  42 + lib3270_autoptr(char) text = lib3270_iconv_to_host(converter,"teste",-1);
  43 +
  44 + lib3270_iconv_free(converter);
  45 + return 0;
  46 + }
  47 +
37 48 // #pragma GCC diagnostic push
38 49 // #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
39 50 static struct option options[] = {
... ...