diff --git a/lib3270.cbp b/lib3270.cbp
index 4ecfb3e..44db021 100644
--- a/lib3270.cbp
+++ b/lib3270.cbp
@@ -64,6 +64,7 @@
+
@@ -82,7 +83,6 @@
-
@@ -170,6 +170,7 @@
+
@@ -216,6 +217,9 @@
+
+
+
diff --git a/src/include/kybdc.h b/src/include/kybdc.h
index 2426945..3cfc010 100644
--- a/src/include/kybdc.h
+++ b/src/include/kybdc.h
@@ -73,7 +73,7 @@
LIB3270_INTERNAL int run_ta(H3270 *hSession);
// LIB3270_INTERNAL int state_from_keymap(char keymap[32]);
LIB3270_INTERNAL void kybd_connect(H3270 *session, int connected, void *dunno);
- LIB3270_INTERNAL void kybd_in3270(H3270 *session, int in3270 unused, void *dunno);
+ LIB3270_INTERNAL void kybd_in3270(H3270 *session, int in3270, void *dunno);
#endif /* KYBDC_H_INCLUDED */
diff --git a/src/include/lib3270.h b/src/include/lib3270.h
index 93335fd..1ca3659 100644
--- a/src/include/lib3270.h
+++ b/src/include/lib3270.h
@@ -41,10 +41,23 @@
#if defined(__GNUC__)
#define LIB3270_GNUC_FORMAT(s,f) __attribute__ ((__format__ (__printf__, s, f)))
+ #define LIB3270_DEPRECATED(func) func __attribute__ ((deprecated))
+
+ #elif defined(_WIN32)
+
+ #define LIB3270_DEPRECATED(func) __declspec(deprecated) func
+
+ #elif defined(__LCLINT__)
+
+ #define LIB3270_DEPRECATED(func) func
+
#else
- #define LIB3270_GNUC_FORMAT(s, f)
+
+ #define LIB3270_DEPRECATED(func) func
+
#endif
+
/**
* BIND definitions.
*/
@@ -745,7 +758,7 @@
* @return 0 if ok, error code if not.
*
*/
- int LIB3270_EXPORT lib3270_register_handlers(const struct lib3270_callbacks *cbk);
+ LIB3270_EXPORT int lib3270_register_handlers(const struct lib3270_callbacks *cbk);
/**
* Register time handlers.
@@ -754,9 +767,9 @@
* @param rm Callback for removing a timeout
*
*/
- void LIB3270_EXPORT lib3270_register_time_handlers(void * (*add)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)), void (*rm)(H3270 *session, void *timer));
+ LIB3270_EXPORT void lib3270_register_time_handlers(void * (*add)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)), void (*rm)(H3270 *session, void *timer));
- void LIB3270_EXPORT lib3270_register_fd_handlers(void * (*add)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata), void (*rm)(H3270 *, void *id));
+ LIB3270_EXPORT void lib3270_register_fd_handlers(void * (*add)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata), void (*rm)(H3270 *, void *id));
/**
* Get program message.
diff --git a/src/include/lib3270/session.h b/src/include/lib3270/session.h
index 0fe758e..83f50d7 100644
--- a/src/include/lib3270/session.h
+++ b/src/include/lib3270/session.h
@@ -39,6 +39,10 @@
#include
#endif // WIN32
+#ifdef HAVE_LIBSSL
+ #include
+#endif // HAVE_LIBSSL
+
#include
struct lib3270_session_callbacks
@@ -74,6 +78,12 @@
void (*message)(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *text);
+#ifdef HAVE_LIBSSL
+ void (*set_peer_certificate)(const X509 *cert);
+#else
+ void (*set_peer_certificate)(const void *cert);
+#endif // HAVE_LIBSSL
+
};
/**
@@ -84,7 +94,7 @@
* @return 0 if ok, error code if not.
*
*/
- int LIB3270_EXPORT lib3270_set_session_callbacks(const struct lib3270_callbacks *cbk);
+ LIB3270_EXPORT int lib3270_set_session_callbacks(const struct lib3270_callbacks *cbk);
LIB3270_EXPORT int lib3270_getpeername(H3270 *hSession, struct sockaddr *addr, socklen_t *addrlen);
LIB3270_EXPORT int lib3270_getsockname(H3270 *hSession, struct sockaddr *addr, socklen_t *addrlen);
diff --git a/src/include/popupsc.h b/src/include/popupsc.h
index f4886d2..6efa3ea 100644
--- a/src/include/popupsc.h
+++ b/src/include/popupsc.h
@@ -33,9 +33,9 @@
#define popup_an_errno(hSession, errn, fmt, ...) lib3270_popup_an_errno(hSession, errn, fmt, __VA_ARGS__)
- LOCAL_EXTERN void popup_an_error(H3270 *session, const char *fmt, ...) printflike(2,3);
- LOCAL_EXTERN void popup_system_error(H3270 *session, const char *title, const char *message, const char *fmt, ...) printflike(4,5);
- LOCAL_EXTERN void popup_a_sockerr(H3270 *session, char *fmt, ...) printflike(2,3);
+ LOCAL_EXTERN void popup_an_error(H3270 *session, const char *fmt, ...) LIB3270_GNUC_FORMAT(2,3);
+ LOCAL_EXTERN void popup_system_error(H3270 *session, const char *title, const char *message, const char *fmt, ...) LIB3270_GNUC_FORMAT(4,5);
+ LOCAL_EXTERN void popup_a_sockerr(H3270 *session, char *fmt, ...) LIB3270_GNUC_FORMAT(2,3);
LOCAL_EXTERN void Error(H3270 *session, const char *fmt, ...);
LOCAL_EXTERN void Warning(H3270 *session, const char *fmt, ...);
diff --git a/src/include/trace_dsc.h b/src/include/trace_dsc.h
index de85429..713c68f 100644
--- a/src/include/trace_dsc.h
+++ b/src/include/trace_dsc.h
@@ -40,9 +40,9 @@
void trace_ansi_disc(H3270 *hSession);
void trace_char(H3270 *hSession, char c);
- void trace_ds(H3270 *hSession, const char *fmt, ...) printflike(2, 3);
- void trace_ds_nb(H3270 *hSession, const char *fmt, ...) printflike(2, 3);
- void trace_dsn(H3270 *hSession, const char *fmt, ...) printflike(2, 3);
+ void trace_ds(H3270 *hSession, const char *fmt, ...) LIB3270_GNUC_FORMAT(2, 3);
+ void trace_ds_nb(H3270 *hSession, const char *fmt, ...) LIB3270_GNUC_FORMAT(2, 3);
+ void trace_dsn(H3270 *hSession, const char *fmt, ...) LIB3270_GNUC_FORMAT(2, 3);
void trace_screen(H3270 *session);
// #define trace_event(...) lib3270_trace_event(&h3270,__VA_ARGS__)
diff --git a/src/include/utilc.h b/src/include/utilc.h
index b4808a4..9099c7c 100644
--- a/src/include/utilc.h
+++ b/src/include/utilc.h
@@ -23,7 +23,7 @@ LIB3270_INTERNAL char *ctl_see(int c);
// LIB3270_INTERNAL char *do_subst(const char *s, Boolean do_vars, Boolean do_tilde);
// LIB3270_INTERNAL void fcatv(FILE *f, char *s);
LIB3270_INTERNAL const char *get_message(const char *key);
-LIB3270_INTERNAL const char *get_fresource(H3270 *hSession, const char *fmt, ...) printflike(2, 3);
+LIB3270_INTERNAL const char *get_fresource(H3270 *hSession, const char *fmt, ...) LIB3270_GNUC_FORMAT(2, 3);
LIB3270_INTERNAL const char *get_resource(H3270 *hSession, const char *name);
// LIB3270_INTERNAL char *scatv(const char *s, char *buf, size_t len);
LIB3270_INTERNAL int split_dbcs_resource(const char *value, char sep, char **part1,
@@ -32,9 +32,9 @@ LIB3270_INTERNAL int split_dresource(char **st, char **left, char **right);
LIB3270_INTERNAL int split_lresource(char **st, char **value);
LIB3270_INTERNAL char *strip_whitespace(const char *s);
-LIB3270_INTERNAL char *xs_buffer(const char *fmt, ...) printflike(1, 2);
-LIB3270_INTERNAL void xs_error(const char *fmt, ...) printflike(1, 2);
-LIB3270_INTERNAL void xs_warning(const char *fmt, ...) printflike(1, 2);
+LIB3270_INTERNAL char *xs_buffer(const char *fmt, ...) LIB3270_GNUC_FORMAT(1, 2);
+LIB3270_INTERNAL void xs_error(const char *fmt, ...) LIB3270_GNUC_FORMAT(1, 2);
+LIB3270_INTERNAL void xs_warning(const char *fmt, ...) LIB3270_GNUC_FORMAT(1, 2);
LIB3270_INTERNAL void * AddInput(int, H3270 *session, void (*fn)(H3270 *session));
LIB3270_INTERNAL void * AddOutput(int, H3270 *session, void (*fn)(H3270 *session));
@@ -57,5 +57,5 @@ typedef struct {
LIB3270_INTERNAL void rpf_init(rpf_t *r);
LIB3270_INTERNAL void rpf_reset(rpf_t *r);
-LIB3270_INTERNAL void rpf(rpf_t *r, char *fmt, ...) printflike(2, 3);
+LIB3270_INTERNAL void rpf(rpf_t *r, char *fmt, ...) LIB3270_GNUC_FORMAT(2, 3);
LIB3270_INTERNAL void rpf_free(rpf_t *r);
diff --git a/src/lib3270/ansi.c b/src/lib3270/ansi.c
index fe8d552..479e8b1 100644
--- a/src/lib3270/ansi.c
+++ b/src/lib3270/ansi.c
@@ -492,7 +492,7 @@ static int dbcs_process(H3270 *hSession, int ch, unsigned char ebc[]);
static void ansi_scroll(H3270 *hSession);
static enum lib3270_ansi_state
-ansi_data_mode(H3270 *hSession, int ig1 unused, int ig2 unused)
+ansi_data_mode(H3270 *hSession unused, int ig1 unused, int ig2 unused)
{
return DATA;
}
@@ -560,7 +560,7 @@ ansi_cursor_up(H3270 *hSession, int nn, int ig2 unused)
}
static enum lib3270_ansi_state
-ansi_esc2(H3270 *hSession, int ig1 unused, int ig2 unused)
+ansi_esc2(H3270 *hSession unused, int ig1 unused, int ig2 unused)
{
register int i;
@@ -1009,13 +1009,13 @@ ansi_htab(H3270 *hSession, int ig1 unused, int ig2 unused)
}
static enum lib3270_ansi_state
-ansi_escape(H3270 *hSession, int ig1 unused, int ig2 unused)
+ansi_escape(H3270 *hSession unused, int ig1 unused, int ig2 unused)
{
return ESC;
}
static enum lib3270_ansi_state
-ansi_nop(H3270 *hSession, int ig1 unused, int ig2 unused)
+ansi_nop(H3270 *hSession unused, int ig1 unused, int ig2 unused)
{
return DATA;
}
@@ -1363,7 +1363,7 @@ ansi_reset_mode(H3270 *hSession, int nn, int ig2 unused)
static enum lib3270_ansi_state
ansi_status_report(H3270 *hSession, int nn, int ig2 unused)
{
- static char cpr[11];
+ static char cpr[22];
switch (nn)
{
@@ -1372,7 +1372,7 @@ ansi_status_report(H3270 *hSession, int nn, int ig2 unused)
break;
case 6:
- (void) sprintf(cpr, "\033[%d;%dR",(hSession->cursor_addr/hSession->cols) + 1, (hSession->cursor_addr%hSession->cols) + 1);
+ (void) snprintf(cpr, 22, "\033[%d;%dR",(hSession->cursor_addr/hSession->cols) + 1, (hSession->cursor_addr%hSession->cols) + 1);
net_sends(hSession,cpr);
break;
}
@@ -1436,7 +1436,7 @@ ansi_one_g3(H3270 *hSession, int ig1 unused, int ig2 unused)
}
static enum lib3270_ansi_state
-ansi_esc3(H3270 *hSession, int ig1 unused, int ig2 unused)
+ansi_esc3(H3270 *hSession unused, int ig1 unused, int ig2 unused)
{
return DECP;
}
@@ -1598,7 +1598,7 @@ dec_scrolling_region(H3270 *hSession, int top, int bottom)
}
static enum lib3270_ansi_state
-xterm_text_mode(H3270 *hSession, int ig1 unused, int ig2 unused)
+xterm_text_mode(H3270 *hSession unused, int ig1 unused, int ig2 unused)
{
nx = 0;
n[0] = 0;
@@ -1606,7 +1606,7 @@ xterm_text_mode(H3270 *hSession, int ig1 unused, int ig2 unused)
}
static enum lib3270_ansi_state
-xterm_text_semicolon(H3270 *hSession, int ig1 unused, int ig2 unused)
+xterm_text_semicolon(H3270 *hSession unused, int ig1 unused, int ig2 unused)
{
tx = 0;
return LIB3270_ANSI_STATE_TEXT2;
@@ -1621,7 +1621,7 @@ xterm_text(H3270 *hSession, int ig1 unused, int ig2 unused)
}
static enum lib3270_ansi_state
-xterm_text_do(H3270 *hSession, int ig1 unused, int ig2 unused)
+xterm_text_do(H3270 *hSession unused, int ig1 unused, int ig2 unused)
{
/*
#if defined(X3270_DISPLAY) || defined(WC3270)
@@ -1720,7 +1720,7 @@ static void ansi_scroll(H3270 *hSession)
}
/* Callback for when we enter ANSI mode. */
-void ansi_in3270(H3270 *session, int in3270, void *dunno)
+void ansi_in3270(H3270 *session, int in3270, void *dunno unused)
{
if (!in3270)
(void) ansi_reset(session, 0, 0);
@@ -1840,7 +1840,7 @@ ansi_send_pf(H3270 *hSession, int nn)
35, 36, 37, 38
};
- if (nn < 1 || nn > sizeof(code)/sizeof(code[0]))
+ if (nn < 1 || ((size_t) nn) > sizeof(code)/sizeof(code[0]))
return;
(void) sprintf(fn_buf, "\033[%d~", code[nn-1]);
net_sends(hSession,fn_buf);
diff --git a/src/lib3270/ctlr.c b/src/lib3270/ctlr.c
index 3f84178..7cd3bf2 100644
--- a/src/lib3270/ctlr.c
+++ b/src/lib3270/ctlr.c
@@ -394,7 +394,7 @@ static void update_formatted(H3270 *hSession)
/*
* Called when a host is half connected.
*/
-static void ctlr_half_connect(H3270 *hSession, int ignored unused, void *dunno)
+static void ctlr_half_connect(H3270 *hSession, int ignored unused, void *dunno unused)
{
ticking_start(hSession,True);
}
@@ -402,7 +402,7 @@ static void ctlr_half_connect(H3270 *hSession, int ignored unused, void *dunno)
/*
* Called when a host connects, disconnects, or changes ANSI/3270 modes.
*/
-static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno)
+static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno unused)
{
ticking_stop(hSession);
status_untiming(hSession);
diff --git a/src/lib3270/ft.c b/src/lib3270/ft.c
index 3b106a8..f4e9896 100644
--- a/src/lib3270/ft.c
+++ b/src/lib3270/ft.c
@@ -59,7 +59,7 @@
#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);
+static void ft_in3270(H3270 *session, int ignored, void *unused);
/* Macros. */
#define eos(s) strchr((s), '\0')
diff --git a/src/lib3270/ft_cut.c b/src/lib3270/ft_cut.c
index 92b375e..6a643c7 100644
--- a/src/lib3270/ft_cut.c
+++ b/src/lib3270/ft_cut.c
@@ -117,7 +117,7 @@ static void cut_retransmit(H3270 *hSession);
static void cut_data(H3270 *hSession);
static void cut_ack(H3270 *hSession);
-static void cut_abort(H3270 *hSession, unsigned short code, const char *fmt, ...) printflike(3,4);
+static void cut_abort(H3270 *hSession, unsigned short code, const char *fmt, ...) LIB3270_GNUC_FORMAT(3,4);
static unsigned from6(unsigned char c);
static int xlate_getc(H3270FT *ft);
diff --git a/src/lib3270/private.h b/src/lib3270/private.h
index 2b55a47..2561dbb 100644
--- a/src/lib3270/private.h
+++ b/src/lib3270/private.h
@@ -6,7 +6,7 @@
* Copyright (C) <2008>
*
* Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
- * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * os termos da GPL v.2 - Licença Pública Geral ', conforme publicado pela
* Free Software Foundation.
*
* Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
@@ -87,14 +87,12 @@
*/
/* 'unused' explicitly flags an unused parameter */
-#if defined(__GNUC__) /*[*/
+#if defined(__GNUC__)
#define unused __attribute__((__unused__))
- #define printflike(s,f) __attribute__ ((__format__ (__printf__, s, f)))
-#else /*][*/
- #define unused /* nothing */
- #define printflike(s, f) /* nothing */
-#endif /*]*/
-
+#else
+ #define unused
+ #define printflike(s, f)
+#endif
/*
diff --git a/src/lib3270/rpq.c b/src/lib3270/rpq.c
index bda90d3..b936836 100644
--- a/src/lib3270/rpq.c
+++ b/src/lib3270/rpq.c
@@ -72,7 +72,7 @@ static int get_rpq_user(H3270 *hSession, unsigned char buf[], const int buflen);
#if !defined(_WIN32) /*[*/
static int get_rpq_address(H3270 *hSession, unsigned char buf[], const int buflen);
#endif /*]*/
-static void rpq_warning(H3270 *hSession, const char *fmt, ...) printflike(2,3);
+static void rpq_warning(H3270 *hSession, const char *fmt, ...) LIB3270_GNUC_FORMAT(2,3);
static void rpq_dump_warnings(H3270 *hSession);
diff --git a/src/lib3270/ssl.c b/src/lib3270/ssl.c
index e3898b3..e8e39a2 100644
--- a/src/lib3270/ssl.c
+++ b/src/lib3270/ssl.c
@@ -132,11 +132,13 @@ int ssl_negotiate(H3270 *hSession)
{
case X509_V_OK:
peer = SSL_get_peer_certificate(hSession->ssl_con);
+/*
#if defined(SSL_ENABLE_CRL_CHECK)
trace_dsn(hSession,"TLS/SSL negotiated connection complete with CRL validation. Peer certificate %s presented.\n", peer ? "was" : "was not");
#else
trace_dsn(hSession,"TLS/SSL negotiated connection complete without CRL validation. Peer certificate %s presented.\n", peer ? "was" : "was not");
#endif // SSL_ENABLE_CRL_CHECK
+*/
break;
case X509_V_ERR_UNABLE_TO_GET_CRL:
@@ -207,10 +209,11 @@ int ssl_negotiate(H3270 *hSession)
free(text);
BIO_free(out);
- X509_free(peer);
}
+ hSession->cbk.set_peer_certificate(peer);
+
set_ssl_state(hSession,LIB3270_SSL_SECURE);
X509_free(peer);
}
diff --git a/src/lib3270/toggles.c b/src/lib3270/toggles.c
index f43923b..ef49d40 100644
--- a/src/lib3270/toggles.c
+++ b/src/lib3270/toggles.c
@@ -301,11 +301,11 @@ static void toggle_redraw(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG
/*
* No-op toggle.
*/
-static void toggle_nop(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt unused)
+static void toggle_nop(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE LIB3270_UNUSED(tt) )
{
}
-static void toggle_keepalive(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE tt unused)
+static void toggle_keepalive(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE tt unused )
{
if(session->sock > 0)
{
diff --git a/src/lib3270/utf8.c b/src/lib3270/utf8.c
index 5c6d0ad..99b329e 100644
--- a/src/lib3270/utf8.c
+++ b/src/lib3270/utf8.c
@@ -351,7 +351,7 @@ static char *utf8_tab[U_MAX][96] = {
* character set.
* Returns 0 if the lookup fails.
*/
-unsigned char utf8_lookup(char *mbs, enum ulfail *fail, int *consumed)
+unsigned char utf8_lookup(char *mbs unused, enum ulfail *fail, int *consumed unused)
{
if (fail != NULL)
*fail = ULFAIL_NOUTF8;
diff --git a/src/lib3270/util.c b/src/lib3270/util.c
index 5ec2bdd..2e6c9d4 100644
--- a/src/lib3270/util.c
+++ b/src/lib3270/util.c
@@ -1034,7 +1034,7 @@ int gettimeofday(struct timeval *tv, void *ignored)
{ 0x83, LIB3270_POINTER_SELECTION_TOP_LEFT }
};
- int f;
+ size_t f;
unsigned short id = lib3270_get_selection_flags(hSession,baddr) & 0x8f;
if(!lib3270_connected(hSession) || baddr < 0)
diff --git a/src/testprogram/testprogram.c b/src/testprogram/testprogram.c
index 247f68c..0b32361 100644
--- a/src/testprogram/testprogram.c
+++ b/src/testprogram/testprogram.c
@@ -4,7 +4,7 @@
#include
// #include
-#include "private.h"
+#include "../lib3270/private.h"
#include
#define MAX_ARGS 10
--
libgit2 0.21.2