Commit 1985106c2eefbbc3d40398f759de6be1d690315e

Authored by Perry Werneck
1 parent 195ab601

Fixing iconv wrapper.

src/core/charset/iconv.c
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 35
36 #include <config.h> 36 #include <config.h>
37 #include <lib3270.h> 37 #include <lib3270.h>
  38 +#include <lib3270/log.h>
38 #include <lib3270/charset.h> 39 #include <lib3270/charset.h>
39 #include <iconv.h> 40 #include <iconv.h>
40 #include <string.h> 41 #include <string.h>
@@ -112,10 +113,10 @@ struct _lib3270_iconv @@ -112,10 +113,10 @@ struct _lib3270_iconv
112 113
113 char * lib3270_iconv_from_host(LIB3270_ICONV *conv, const char *str, int len) 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 char * lib3270_iconv_to_host(LIB3270_ICONV *conv, const char *str, int len) 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,6 +11,7 @@
11 #include <lib3270/toggle.h> 11 #include <lib3270/toggle.h>
12 #include <lib3270/log.h> 12 #include <lib3270/log.h>
13 #include <lib3270/properties.h> 13 #include <lib3270/properties.h>
  14 +#include <lib3270/charset.h>
14 15
15 #define MAX_ARGS 10 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,6 +35,16 @@ static void online_group_state_changed(H3270 GNUC_UNUSED(*hSession), void GNUC_U
34 35
35 int main(int argc, char *argv[]) 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 // #pragma GCC diagnostic push 48 // #pragma GCC diagnostic push
38 // #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" 49 // #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
39 static struct option options[] = { 50 static struct option options[] = {