From fea686b0af249c32dccf76f2b93e1e32e733fdf0 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 14 Aug 2019 16:24:51 -0300 Subject: [PATCH] Fixing bugs. --- server/src/core/methods/methods.c | 22 ++++++---------------- server/src/core/methods/set.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/server/src/core/methods/methods.c b/server/src/core/methods/methods.c index 2a41626..cf671fa 100644 --- a/server/src/core/methods/methods.c +++ b/server/src/core/methods/methods.c @@ -88,16 +88,11 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req if(!g_ascii_strcasecmp(actions[ix].name,method_name)) { - int rc = actions[ix].call(hSession); - if(rc) - { - // Failed + if(actions[ix].call(hSession)) ipc3270_set_error(object,errno,error); - return; - } + else + ipc3270_response_append_int32(response, 0); - // Suceeded - ipc3270_response_append_int32(response, 0); return 0; } @@ -113,16 +108,11 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req gint value; g_variant_get(request, "(i)", &value); - int rc = int_methods[ix].call(hSession, value); - if(rc) - { - // Failed + if(int_methods[ix].call(hSession, value)) ipc3270_set_error(object,errno,error); - return; - } + else + ipc3270_response_append_int32(response, 0); - // Suceeded - ipc3270_response_append_int32(response, 0); return 0; } diff --git a/server/src/core/methods/set.c b/server/src/core/methods/set.c index dbf737a..00ccd88 100644 --- a/server/src/core/methods/set.c +++ b/server/src/core/methods/set.c @@ -28,6 +28,8 @@ */ #include "private.h" +#include +#include int ipc3270_method_set_string(GObject *session, GVariant *request, GObject *response, GError **error) { @@ -50,8 +52,12 @@ int ipc3270_method_set_string(GObject *session, GVariant *request, GObject *resp g_autofree gchar * converted = ipc3270_convert_to_3270(session,text,error); - if(!lib3270_input_string(hSession,(const unsigned char *) converted, -1)) + debug("Converted: \"%s\"",converted); + + if(lib3270_input_string(hSession,(const unsigned char *) converted, -1)) { + debug("lib3270_input_string has failed: %s", strerror(errno)); return errno; + } } } @@ -86,7 +92,7 @@ int ipc3270_method_set_string(GObject *session, GVariant *request, GObject *resp g_autofree gchar * converted = ipc3270_convert_to_3270(session,text,error); - if(lib3270_set_string_at(hSession, row, col, (unsigned char *) converted) < 0) + if(lib3270_set_string_at(hSession, row, col, (unsigned char *) converted, -1) < 0) return errno; } @@ -98,7 +104,7 @@ int ipc3270_method_set_string(GObject *session, GVariant *request, GObject *resp return EINVAL; } - ipc3270_response_append_uint32(response, 0); + ipc3270_response_append_int32(response, 0); return 0; } -- libgit2 0.21.2