From 4aec5185ef648944e3702e6d4c3f11396f27bd88 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 23 Oct 2019 12:25:59 -0300 Subject: [PATCH] Cleaning unused methods. --- src/core/ctlr.c | 29 +++++++++++++---------------- src/core/model.c | 4 ++-- src/core/screen.c | 2 +- src/core/telnet.c | 5 +++++ src/core/windows/util.c | 6 ++++-- src/include/ctlrc.h | 2 +- src/include/lib3270-internals.h | 24 ++++++++++++------------ 7 files changed, 38 insertions(+), 34 deletions(-) diff --git a/src/core/ctlr.c b/src/core/ctlr.c index 075e5d8..29e07db 100644 --- a/src/core/ctlr.c +++ b/src/core/ctlr.c @@ -126,28 +126,25 @@ void ctlr_init(H3270 *session, unsigned GNUC_UNUSED(cmask)) } /** - * @brief Reinitialize the emulated 3270 hardware. + * @brief Reinitialize the emulated 3270 hardware on model change */ -void ctlr_reinit(H3270 *session, unsigned cmask) +void ctlr_model_changed(H3270 *session) { - if (cmask & MODEL_CHANGE) - { - /* Allocate buffers */ - struct lib3270_ea *tmp; - size_t sz = (session->max.rows * session->max.cols); + // Allocate buffers + struct lib3270_ea *tmp; + size_t sz = (session->max.rows * session->max.cols); - session->buffer[0] = tmp = lib3270_calloc(sizeof(struct lib3270_ea), sz+1, session->buffer[0]); - session->ea_buf = tmp + 1; + session->buffer[0] = tmp = lib3270_calloc(sizeof(struct lib3270_ea), sz+1, session->buffer[0]); + session->ea_buf = tmp + 1; - session->buffer[1] = tmp = lib3270_calloc(sizeof(struct lib3270_ea),sz+1,session->buffer[1]); - session->aea_buf = tmp + 1; + session->buffer[1] = tmp = lib3270_calloc(sizeof(struct lib3270_ea),sz+1,session->buffer[1]); + session->aea_buf = tmp + 1; - session->text = lib3270_calloc(sizeof(struct lib3270_text),sz,session->text); - session->zero_buf = lib3270_calloc(sizeof(struct lib3270_ea),sz,session->zero_buf); + session->text = lib3270_calloc(sizeof(struct lib3270_text),sz,session->text); + session->zero_buf = lib3270_calloc(sizeof(struct lib3270_ea),sz,session->zero_buf); - session->cursor_addr = 0; - session->buffer_addr = 0; - } + session->cursor_addr = 0; + session->buffer_addr = 0; } void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) diff --git a/src/core/model.c b/src/core/model.c index ce5bdc2..dc83dcb 100644 --- a/src/core/model.c +++ b/src/core/model.c @@ -72,7 +72,7 @@ } ctlr_set_rows_cols(hSession, hSession->model_num, ovc, ovr); - ctlr_reinit(hSession,MODEL_CHANGE); + ctlr_model_changed(hSession); screen_update(hSession,0,hSession->view.rows*hSession->view.cols); return 0; @@ -232,7 +232,7 @@ int lib3270_set_model(H3270 *hSession, const char *model) } ctlr_set_rows_cols(hSession, model_number, ovc, ovr); - ctlr_reinit(hSession,MODEL_CHANGE); + ctlr_model_changed(hSession); screen_update(hSession,0,hSession->view.rows*hSession->view.cols); return 0; diff --git a/src/core/screen.c b/src/core/screen.c index f02857e..fb5c370 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -154,7 +154,7 @@ int screen_init(H3270 *session) /* Set up the controller. */ ctlr_init(session,-1); - ctlr_reinit(session,-1); + ctlr_model_changed(session); /* Finish screen initialization. */ session->cbk.suspend(session); diff --git a/src/core/telnet.c b/src/core/telnet.c index 60ded7f..aa83f2a 100644 --- a/src/core/telnet.c +++ b/src/core/telnet.c @@ -41,6 +41,10 @@ #include #endif +#ifdef __MINGW32__ + #include +#endif + #ifndef ANDROID #include #endif // !ANDROID @@ -2312,6 +2316,7 @@ void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, in double tdiff; (void) gettimeofday(&ts, (struct timezone *)NULL); + if (IN_3270) { tdiff = ((1.0e6 * (double)(ts.tv_sec - hSession->ds_ts.tv_sec)) + diff --git a/src/core/windows/util.c b/src/core/windows/util.c index 2956a6f..63b17fb 100644 --- a/src/core/windows/util.c +++ b/src/core/windows/util.c @@ -235,7 +235,8 @@ LIB3270_EXPORT const char * lib3270_win32_local_charset(void) #define SECS_BETWEEN_EPOCHS 11644473600ULL #define SECS_TO_100NS 10000000ULL /* 10^7 */ -int gettimeofday(struct timeval *tv, void GNUC_UNUSED(*ignored)) +/* +int gettimeofday(struct timeval *tv, struct timezone GNUC_UNUSED(*ignored)) { FILETIME t; ULARGE_INTEGER u; @@ -243,11 +244,12 @@ int gettimeofday(struct timeval *tv, void GNUC_UNUSED(*ignored)) GetSystemTimeAsFileTime(&t); memcpy(&u, &t, sizeof(ULARGE_INTEGER)); - /* Isolate seconds and move epochs. */ + // Isolate seconds and move epochs. tv->tv_sec = (DWORD)((u.QuadPart / SECS_TO_100NS) - SECS_BETWEEN_EPOCHS); tv->tv_usec = (u.QuadPart % SECS_TO_100NS) / 10ULL; return 0; } +*/ LIB3270_EXPORT char * lib3270_get_installation_path() { diff --git a/src/include/ctlrc.h b/src/include/ctlrc.h index c548552..cfed95a 100644 --- a/src/include/ctlrc.h +++ b/src/include/ctlrc.h @@ -54,7 +54,7 @@ LIB3270_INTERNAL void ctlr_erase_all_unprotected(H3270 *hSession); LIB3270_INTERNAL void ctlr_init(H3270 *session, unsigned cmask); LIB3270_INTERNAL void ctlr_read_buffer(H3270 *session, unsigned char aid_byte); LIB3270_INTERNAL void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all); -LIB3270_INTERNAL void ctlr_reinit(H3270 *session, unsigned cmask); +LIB3270_INTERNAL void ctlr_model_changed(H3270 *session); LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession); LIB3270_INTERNAL void ctlr_wrapping_memmove(H3270 *session, int baddr_to, int baddr_from, int count); LIB3270_INTERNAL enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean erase); diff --git a/src/include/lib3270-internals.h b/src/include/lib3270-internals.h index b98371d..752cedc 100644 --- a/src/include/lib3270-internals.h +++ b/src/include/lib3270-internals.h @@ -166,11 +166,11 @@ LIB3270_INTERNAL const char * build_rpq_revision; /** * @brief toggle names - */ + */ /* struct toggle_name { const char *name; int index; -}; +}; */ /// @brief State macros #define PCONNECTED lib3270_pconnected(hSession) @@ -205,13 +205,13 @@ struct toggle_name { #define Replace(var, value) { lib3270_free(var); var = (value); }; /// @brief Configuration change masks. -#define NO_CHANGE 0x0000 /// @brief no change -#define MODEL_CHANGE 0x0001 /// @brief screen dimensions changed -#define FONT_CHANGE 0x0002 /// @brief emulator font changed -#define COLOR_CHANGE 0x0004 /// @brief color scheme or 3278/9 mode changed -#define SCROLL_CHANGE 0x0008 /// @brief scrollbar snapped on or off -#define CHARSET_CHANGE 0x0010 /// @brief character set changed -#define ALL_CHANGE 0xffff /// @brief everything changed +//#define NO_CHANGE 0x0000 /// @brief no change +// #define MODEL_CHANGE 0x0001 /// @brief screen dimensions changed +//#define FONT_CHANGE 0x0002 /// @brief emulator font changed +//#define COLOR_CHANGE 0x0004 /// @brief color scheme or 3278/9 mode changed +//#define SCROLL_CHANGE 0x0008 /// @brief scrollbar snapped on or off +//#define CHARSET_CHANGE 0x0010 /// @brief character set changed +// #define ALL_CHANGE 0xffff /// @brief everything changed /* Portability macros */ @@ -234,13 +234,13 @@ struct toggle_name { #define DFT_BUF (4 * 1024) #endif /*]*/ -/* DBCS Preedit Types */ -#if defined(X3270_DBCS) /*[*/ +/* DBCS Preedit Types */ /* +#if defined(X3270_DBCS) #define PT_ROOT "Root" #define PT_OVER_THE_SPOT "OverTheSpot" #define PT_OFF_THE_SPOT "OffTheSpot" #define PT_ON_THE_SPOT "OnTheSpot" -#endif /*]*/ +#endif */ /** * @brief input key type -- libgit2 0.21.2