From 669d8ad65db298dcd87207b1c6cf9e58018855ed Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Sat, 30 Jan 2021 13:20:14 -0300 Subject: [PATCH] Updating 'popup-an-errno' dialog. --- src/core/util.c | 22 ++++++++-------------- src/core/windows/util.c | 16 ---------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/core/util.c b/src/core/util.c index ef7f6ae..2a019a0 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -279,25 +279,19 @@ LIB3270_EXPORT char * lib3270_get_version_info(void) void lib3270_popup_an_errno(H3270 *hSession, int errn, const char *fmt, ...) { va_list args; - char * text; va_start(args, fmt); - text = lib3270_vsprintf(fmt, args); + lib3270_autoptr(char) summary = lib3270_vsprintf(fmt, args); + lib3270_autoptr(char) body = lib3270_strdup_printf( _( "The system error was '%s' (rc=%d)" ),strerror(errn),errn); va_end(args); - lib3270_write_log(hSession, "3270", "Error Popup:\n%s\nrc=%d (%s)",text,errn,strerror(errn)); - - lib3270_popup_dialog( - hSession, - LIB3270_NOTIFY_ERROR, - _( "Error" ), - text, - "%s (rc=%d)", - strerror(errn), - errn - ); + LIB3270_POPUP popup = { + .type = LIB3270_NOTIFY_ERROR, + .summary = summary, + .body = body + }; - lib3270_free(text); + lib3270_popup(hSession,&popup,0); } diff --git a/src/core/windows/util.c b/src/core/windows/util.c index c3df27b..51a327f 100644 --- a/src/core/windows/util.c +++ b/src/core/windows/util.c @@ -238,22 +238,6 @@ 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, struct timezone GNUC_UNUSED(*ignored)) -{ - FILETIME t; - ULARGE_INTEGER u; - - GetSystemTimeAsFileTime(&t); - memcpy(&u, &t, sizeof(ULARGE_INTEGER)); - - // 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() { char lpFilename[4096]; -- libgit2 0.21.2