1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-09-02 05:14:48 +00:00

Merge pull request #30 from moschlar/patch-1

Fix variable types and pointer sizes
This commit is contained in:
Jiaqiang Xu
2018-11-09 17:00:48 +08:00
committed by GitHub

View File

@@ -221,7 +221,7 @@ static void* named_pipe_client_handler(void *arg)
while (1) { while (1) {
len = 0; len = 0;
if (pipe_read_n(connfd, &len, sizeof(uint32_t)) < 0) { if (pipe_read_n(connfd, &len, sizeof(size_t)) < 0) {
g_warning("failed to read rpc request size: %s", strerror(errno)); g_warning("failed to read rpc request size: %s", strerror(errno));
break; break;
} }
@@ -252,7 +252,7 @@ static void* named_pipe_client_handler(void *arg)
g_free (service); g_free (service);
g_free (body); g_free (body);
if (pipe_write_n(connfd, &ret_len, sizeof(uint32_t)) < 0) { if (pipe_write_n(connfd, &ret_len, sizeof(size_t)) < 0) {
g_warning("failed to send rpc response(%s): %s", ret_str, strerror(errno)); g_warning("failed to send rpc response(%s): %s", ret_str, strerror(errno));
g_free (ret_str); g_free (ret_str);
break; break;
@@ -346,8 +346,8 @@ char *searpc_named_pipe_send(void *arg, const gchar *fcall_str,
char *json_str = request_to_json(data->service, fcall_str, fcall_len); char *json_str = request_to_json(data->service, fcall_str, fcall_len);
size_t json_len = strlen(json_str); size_t json_len = strlen(json_str);
uint32_t len = json_len; size_t len = json_len;
if (pipe_write_n(client->pipe_fd, &len, sizeof(uint32_t)) < 0) { if (pipe_write_n(client->pipe_fd, &len, sizeof(size_t)) < 0) {
g_warning("failed to send rpc call: %s", strerror(errno)); g_warning("failed to send rpc call: %s", strerror(errno));
free (json_str); free (json_str);
return NULL; return NULL;
@@ -361,7 +361,7 @@ char *searpc_named_pipe_send(void *arg, const gchar *fcall_str,
free (json_str); free (json_str);
if (pipe_read_n(client->pipe_fd, &len, sizeof(uint32_t)) < 0) { if (pipe_read_n(client->pipe_fd, &len, sizeof(size_t)) < 0) {
g_warning("failed to read rpc response: %s", strerror(errno)); g_warning("failed to read rpc response: %s", strerror(errno));
return NULL; return NULL;
} }