Commit fea686b0af249c32dccf76f2b93e1e32e733fdf0

Authored by Perry Werneck
1 parent df0d7fe9
Exists in master and in 1 other branch develop

Fixing bugs.

server/src/core/methods/methods.c
... ... @@ -88,16 +88,11 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req
88 88  
89 89 if(!g_ascii_strcasecmp(actions[ix].name,method_name)) {
90 90  
91   - int rc = actions[ix].call(hSession);
92   - if(rc)
93   - {
94   - // Failed
  91 + if(actions[ix].call(hSession))
95 92 ipc3270_set_error(object,errno,error);
96   - return;
97   - }
  93 + else
  94 + ipc3270_response_append_int32(response, 0);
98 95  
99   - // Suceeded
100   - ipc3270_response_append_int32(response, 0);
101 96 return 0;
102 97  
103 98 }
... ... @@ -113,16 +108,11 @@ int ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *req
113 108 gint value;
114 109 g_variant_get(request, "(i)", &value);
115 110  
116   - int rc = int_methods[ix].call(hSession, value);
117   - if(rc)
118   - {
119   - // Failed
  111 + if(int_methods[ix].call(hSession, value))
120 112 ipc3270_set_error(object,errno,error);
121   - return;
122   - }
  113 + else
  114 + ipc3270_response_append_int32(response, 0);
123 115  
124   - // Suceeded
125   - ipc3270_response_append_int32(response, 0);
126 116 return 0;
127 117  
128 118 }
... ...
server/src/core/methods/set.c
... ... @@ -28,6 +28,8 @@
28 28 */
29 29  
30 30 #include "private.h"
  31 +#include <errno.h>
  32 +#include <string.h>
31 33  
32 34 int ipc3270_method_set_string(GObject *session, GVariant *request, GObject *response, GError **error) {
33 35  
... ... @@ -50,8 +52,12 @@ int ipc3270_method_set_string(GObject *session, GVariant *request, GObject *resp
50 52  
51 53 g_autofree gchar * converted = ipc3270_convert_to_3270(session,text,error);
52 54  
53   - if(!lib3270_input_string(hSession,(const unsigned char *) converted, -1))
  55 + debug("Converted: \"%s\"",converted);
  56 +
  57 + if(lib3270_input_string(hSession,(const unsigned char *) converted, -1)) {
  58 + debug("lib3270_input_string has failed: %s", strerror(errno));
54 59 return errno;
  60 + }
55 61 }
56 62  
57 63 }
... ... @@ -86,7 +92,7 @@ int ipc3270_method_set_string(GObject *session, GVariant *request, GObject *resp
86 92  
87 93 g_autofree gchar * converted = ipc3270_convert_to_3270(session,text,error);
88 94  
89   - if(lib3270_set_string_at(hSession, row, col, (unsigned char *) converted) < 0)
  95 + if(lib3270_set_string_at(hSession, row, col, (unsigned char *) converted, -1) < 0)
90 96 return errno;
91 97  
92 98 }
... ... @@ -98,7 +104,7 @@ int ipc3270_method_set_string(GObject *session, GVariant *request, GObject *resp
98 104 return EINVAL;
99 105 }
100 106  
101   - ipc3270_response_append_uint32(response, 0);
  107 + ipc3270_response_append_int32(response, 0);
102 108  
103 109 return 0;
104 110 }
... ...