From 9e651ee9c40f784de6d3805efc9def67b46402a0 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Fri, 25 May 2012 13:34:11 +0000 Subject: [PATCH] Reduzindo warnings, reativando programa de teste da biblioteca --- src/lib3270/charset.c | 8 ++++++-- src/lib3270/ft.c | 1 + src/lib3270/globals.h | 2 ++ src/lib3270/glue.c | 2 +- src/lib3270/html.c | 28 +++++++++++++++++++--------- src/lib3270/iocalls.c | 9 ++++++--- src/lib3270/kybd.c | 12 ++++++++++-- src/lib3270/lib3270.cbp | 36 +++++++++++++++--------------------- src/lib3270/macros.c | 36 +++++------------------------------- src/lib3270/resolver.c | 1 + src/lib3270/rpq.c | 1 + src/lib3270/selection.c | 9 ++++++--- src/lib3270/session.c | 14 +++++++++++--- src/lib3270/telnet.c | 2 +- src/lib3270/testprogram.c | 29 +++++++++++++++++++++++++---- src/lib3270/utf8.c | 36 +++++++++++++++++++++++------------- src/lib3270/util.c | 1 + 17 files changed, 134 insertions(+), 93 deletions(-) diff --git a/src/lib3270/charset.c b/src/lib3270/charset.c index 1fb353a..2d66706 100644 --- a/src/lib3270/charset.c +++ b/src/lib3270/charset.c @@ -45,6 +45,10 @@ #include "kybdc.h" #include "popupsc.h" +#ifndef ANDROID + #include +#endif // !ANDROID + /* #if defined(X3270_DISPLAY) || (defined(C3270) && !defined(_WIN32)) #include "screenc.h" @@ -199,8 +203,8 @@ wide_resource_init(char *csname) */ enum cs_result charset_init(H3270 *session, const char *csname) { - char *cs; - const char *ftcs; +// char *cs; +// const char *ftcs; enum cs_result rc; char *ccs, *cftcs; const char *ak; diff --git a/src/lib3270/ft.c b/src/lib3270/ft.c index 4733b0c..cde9616 100644 --- a/src/lib3270/ft.c +++ b/src/lib3270/ft.c @@ -56,6 +56,7 @@ #include "tablesc.h" #include "telnetc.h" #include "utilc.h" +#include "trace_dsc.h" static void ft_connected(H3270 *session, int ignored, void *unused); static void ft_in3270(H3270 *session, int ignored unused, void *unused); diff --git a/src/lib3270/globals.h b/src/lib3270/globals.h index f4b0253..511d414 100644 --- a/src/lib3270/globals.h +++ b/src/lib3270/globals.h @@ -352,3 +352,5 @@ LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr); LIB3270_INTERNAL void add_input_calls(H3270 *, void (*)(H3270 *), void (*)(H3270 *)); LIB3270_INTERNAL void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); + +LIB3270_INTERNAL void remove_input_calls(H3270 *session); diff --git a/src/lib3270/glue.c b/src/lib3270/glue.c index df16f99..d969f17 100644 --- a/src/lib3270/glue.c +++ b/src/lib3270/glue.c @@ -96,7 +96,7 @@ static int init_calls = 0; #endif - static void lib3270_session_init(H3270 *hSession, const char *model); +// static void lib3270_session_init(H3270 *hSession, const char *model); #define LAST_ARG "--" diff --git a/src/lib3270/html.c b/src/lib3270/html.c index b26084b..158c290 100644 --- a/src/lib3270/html.c +++ b/src/lib3270/html.c @@ -161,7 +161,7 @@ LIB3270_EXPORT char * lib3270_get_as_html(H3270 *session, LIB3270_HTML_OPTION option) { - int row, col, baddr; + int row, baddr; struct html_info info; memset(&info,0,sizeof(info)); @@ -180,16 +180,24 @@ baddr = 0; for(row=0;row < session->rows;row++) { - int cr = 0; + int cr = 0; + int len = 0; + int col; for(col = 0; col < session->cols;col++) { - if((option && LIB3270_HTML_OPTION_ALL) || (session->text[baddr].attr & LIB3270_ATTR_SELECTED)) + if( session->text[baddr+col].chr != ' ' || (session->text[baddr+col].attr & LIB3270_ATTR_CG)) + len = col; + } + + for(col = 0; col <= len;col++) + { + if((option && LIB3270_HTML_OPTION_ALL) || (session->text[baddr+col].attr & LIB3270_ATTR_SELECTED)) { cr++; - update_colors(&info,session->text[baddr].attr); + update_colors(&info,session->text[baddr+col].attr); - if(session->text[baddr].attr & LIB3270_ATTR_CG) + if(session->text[baddr+col].attr & LIB3270_ATTR_CG) { static const struct chr_xlat xlat[] = { @@ -213,7 +221,7 @@ { 0x00, NULL } }; - append_char(&info, xlat, session->text[baddr].chr); + append_char(&info, xlat, session->text[baddr+col].chr); } else @@ -224,19 +232,21 @@ { '&', "&" }, { '<', "<" }, { '>', ">" }, + { ' ', " " }, { 0x00, NULL } }; - append_char(&info, xlat, session->text[baddr].chr); + append_char(&info, xlat, session->text[baddr+col].chr); } } - baddr++; } - if(cr) + baddr += session->cols; + + if(cr || (option && LIB3270_HTML_OPTION_ALL)) append_element(&info,HTML_ELEMENT_LINE_BREAK); } diff --git a/src/lib3270/iocalls.c b/src/lib3270/iocalls.c index 76422a4..ad27c20 100644 --- a/src/lib3270/iocalls.c +++ b/src/lib3270/iocalls.c @@ -34,6 +34,7 @@ #include #include "xioc.h" #include "telnetc.h" +#include "utilc.h" #define MILLION 1000000L #define InputReadMask 0x1 @@ -54,7 +55,7 @@ static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 * static void internal_remove_input(void *id); -static int internal_process_events(int block); +// static int internal_process_events(int block); static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm); static int internal_wait(int seconds); @@ -505,6 +506,7 @@ static int internal_event_dispatcher(int block) static int internal_callthread(int(*callback)(H3270 *, void *), H3270 *session, void *parm) { callback(session,parm); + return 0; } static int internal_wait(int seconds) @@ -651,7 +653,7 @@ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 *h, void *parm) { - int rc; +// int rc; CHECK_SESSION_HANDLE(h); if(h->set_timer) @@ -664,7 +666,7 @@ LIB3270_EXPORT int lib3270_call_thread(int(*callback)(H3270 *h, void *), H3270 * if(h->set_timer) h->set_timer(h,0); - return rc; + return 0; } LIB3270_EXPORT void lib3270_main_iterate(H3270 *session, int block) @@ -676,6 +678,7 @@ LIB3270_EXPORT void lib3270_main_iterate(H3270 *session, int block) LIB3270_EXPORT int lib3270_wait(seconds) { wait(seconds); + return 0; } LIB3270_EXPORT void lib3270_ring_bell(H3270 *session) diff --git a/src/lib3270/kybd.c b/src/lib3270/kybd.c index ab61e2e..c6d4894 100644 --- a/src/lib3270/kybd.c +++ b/src/lib3270/kybd.c @@ -37,6 +37,10 @@ #include "globals.h" +#ifndef ANDROID + #include +#endif // !ANDROID + #if defined(X3270_DISPLAY) /*[*/ #include #endif @@ -2264,6 +2268,8 @@ LIB3270_ACTION( dup ) hSession->display(hSession); cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr)); } + + return 0; } /* @@ -2274,13 +2280,15 @@ LIB3270_ACTION( fieldmark ) if (kybdlock) { ENQUEUE_ACTION(lib3270_fieldmark); - return; + return 0; } #if defined(X3270_ANSI) if (IN_ANSI) - return; + return 0 ; #endif (void) key_Character(EBC_fm, False, False, NULL); + + return 0; } /** diff --git a/src/lib3270/lib3270.cbp b/src/lib3270/lib3270.cbp index cf9c572..c2334a4 100644 --- a/src/lib3270/lib3270.cbp +++ b/src/lib3270/lib3270.cbp @@ -9,9 +9,8 @@