aboutsummaryrefslogtreecommitdiffstats
path: root/nbrpc_call.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-10-01 14:41:43 +0100
committerFreeArtMan <dos21h@gmail.com>2017-10-01 14:41:43 +0100
commitcd09b06adb30135f55909c02840c339422217d95 (patch)
treecdb3764ce7fe59df55c4fec68b4ab8dd667fec61 /nbrpc_call.c
parent512f057166af84c11fc7ed5e4768b9dd2fe9f590 (diff)
downloadagni-cd09b06adb30135f55909c02840c339422217d95.tar.gz
agni-cd09b06adb30135f55909c02840c339422217d95.zip
Fixed warnings all over the places
Diffstat (limited to 'nbrpc_call.c')
-rw-r--r--nbrpc_call.c188
1 files changed, 121 insertions, 67 deletions
diff --git a/nbrpc_call.c b/nbrpc_call.c
index 1fc60ba..67242a9 100644
--- a/nbrpc_call.c
+++ b/nbrpc_call.c
@@ -28,7 +28,7 @@ rpc_call_request* rpc_call_req_new(char *method, char *params, int id)
ret->params = alloc_new_str(params);
ret->user = NULL;
ret->mask = NULL;
- ret->server == NULL;
+ ret->server = NULL;
return ret;
}
@@ -64,7 +64,9 @@ int rpc_call_req_free(rpc_call_request *req)
FREE(req->method);
FREE(req->params);
FREE(req);
+ return 0;
}
+ return -1;
}
@@ -78,7 +80,9 @@ int rpc_call_resp_free(rpc_call_response *resp)
FREE(resp->mask);
FREE(resp->server);
FREE(resp);
+ return 0;
}
+ return -1;
}
@@ -91,24 +95,22 @@ int rpc_call_req_marsh( rpc_call_request *req, netbyte_store **nb_req)
nb = calloc(1,sizeof(netbyte_store));
nb_init(nb);
- nb_u8arr_create(&nb_method, strlen(req->method), req->method);
+ nb_u8arr_create(&nb_method, strlen(req->method), (uint8_t *)req->method);
nb_add_u8arr(nb, &nb_method);
- nb_u8arr_create(&nb_params, strlen(req->params), req->params);
+ nb_u8arr_create(&nb_params, strlen(req->params), (uint8_t *)req->params);
nb_add_u8arr(nb, &nb_params);
nb_u32_create(&nb_id, req->id);
- //PRINT("%d\n", req->id);
- //PRINT("%d\n", nb_id.val);
nb_add_u32(nb, &nb_id);
- nb_u8arr_create(&nb_user, strlen(req->user), req->user);
+ nb_u8arr_create(&nb_user, strlen(req->user), (uint8_t *)req->user);
nb_add_u8arr(nb, &nb_user);
- nb_u8arr_create(&nb_mask, strlen(req->mask), req->mask);
+ nb_u8arr_create(&nb_mask, strlen(req->mask), (uint8_t *)req->mask);
nb_add_u8arr(nb, &nb_params);
- nb_u8arr_create(&nb_server, strlen(req->server), req->server);
+ nb_u8arr_create(&nb_server, strlen(req->server), (uint8_t *)req->server);
nb_add_u8arr(nb, &nb_server);
//nb_print(nb);
@@ -129,24 +131,22 @@ int rpc_call_resp_marsh( rpc_call_response *resp, netbyte_store **nb_resp)
nb = calloc(1,sizeof(netbyte_store));
nb_init(nb);
- eret = nb_u8arr_create(&nb_result, strlen(resp->result), resp->result);
+ eret = nb_u8arr_create(&nb_result, strlen(resp->result), (uint8_t *)resp->result);
eret |= nb_add_u8arr(nb, &nb_result);
- eret = nb_u8arr_create(&nb_error, strlen(resp->error), resp->error);
+ eret = nb_u8arr_create(&nb_error, strlen(resp->error), (uint8_t *)resp->error);
eret |= nb_add_u8arr(nb, &nb_error);
eret = nb_u32_create(&nb_id, resp->id);
- //PRINT("%d\n", resp->id);
- //PRINT("%d\n", nb_id.val);
eret |= nb_add_u32(nb, &nb_id);
- eret = nb_u8arr_create(&nb_user, strlen(resp->user), resp->user);
+ eret = nb_u8arr_create(&nb_user, strlen(resp->user), (uint8_t *)resp->user);
eret |= nb_add_u8arr(nb, &nb_user);
- eret = nb_u8arr_create(&nb_mask, strlen(resp->mask), resp->mask);
+ eret = nb_u8arr_create(&nb_mask, strlen(resp->mask), (uint8_t *)resp->mask);
eret |= nb_add_u8arr(nb, &nb_mask);
- eret = nb_u8arr_create(&nb_server, strlen(resp->server), resp->server);
+ eret = nb_u8arr_create(&nb_server, strlen(resp->server), (uint8_t *)resp->server);
eret |= nb_add_u8arr(nb, &nb_server);
if (!eret)
@@ -180,10 +180,15 @@ int rpc_call_req_unmarsh( netbyte_store *nb_req, rpc_call_request **req)
//method
if (0 == nb_val(nb_req, 0, &type))
- if (type->type == NBT_U8ARRAY)
{
- nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
- __req->method = alloc_new_str_s(u8arr->val, u8arr->len);
+ if (type->type == NBT_U8ARRAY)
+ {
+ nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
+ __req->method = alloc_new_str_s((char *)u8arr->val, u8arr->len);
+ } else
+ {
+ ENL();
+ }
} else
{
ENL();
@@ -191,10 +196,15 @@ int rpc_call_req_unmarsh( netbyte_store *nb_req, rpc_call_request **req)
//params
if (0 == nb_val(nb_req, 1, &type))
- if (type->type == NBT_U8ARRAY)
{
- nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
- __req->params = alloc_new_str_s(u8arr->val, u8arr->len);
+ if (type->type == NBT_U8ARRAY)
+ {
+ nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
+ __req->params = alloc_new_str_s((char *)u8arr->val, u8arr->len);
+ } else
+ {
+ ENL();
+ }
} else
{
ENL();
@@ -202,11 +212,16 @@ int rpc_call_req_unmarsh( netbyte_store *nb_req, rpc_call_request **req)
//id
if (0 == nb_val(nb_req, 2, &type))
- if (type->type == NBT_U32)
{
- //PNL();
- nb_u32 *u32 = (nb_u32 *)type->nb_val;
- __req->id = u32->val;
+ if (type->type == NBT_U32)
+ {
+ //PNL();
+ nb_u32 *u32 = (nb_u32 *)type->nb_val;
+ __req->id = u32->val;
+ } else
+ {
+ ENL();
+ }
} else
{
ENL();
@@ -214,11 +229,16 @@ int rpc_call_req_unmarsh( netbyte_store *nb_req, rpc_call_request **req)
//user
if (0 == nb_val(nb_req, 3, &type))
- if (type->type == NBT_U8ARRAY)
{
- //PNL();
- nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
- __req->user = alloc_new_str_s(u8arr->val, u8arr->len);
+ if (type->type == NBT_U8ARRAY)
+ {
+ //PNL();
+ nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
+ __req->user = alloc_new_str_s((char *)u8arr->val, u8arr->len);
+ } else
+ {
+ ENL();
+ }
} else
{
ENL();
@@ -226,11 +246,16 @@ int rpc_call_req_unmarsh( netbyte_store *nb_req, rpc_call_request **req)
//mask
if (0 == nb_val(nb_req, 4, &type))
- if (type->type == NBT_U8ARRAY)
{
- //PNL();
- nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
- __req->mask = alloc_new_str_s(u8arr->val, u8arr->len);
+ if (type->type == NBT_U8ARRAY)
+ {
+ //PNL();
+ nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
+ __req->mask = alloc_new_str_s((char *)u8arr->val, u8arr->len);
+ } else
+ {
+ ENL();
+ }
} else
{
ENL();
@@ -238,11 +263,16 @@ int rpc_call_req_unmarsh( netbyte_store *nb_req, rpc_call_request **req)
//server
if (0 == nb_val(nb_req, 5, &type))
- if (type->type == NBT_U8ARRAY)
{
- //PNL();
- nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
- __req->server = alloc_new_str_s(u8arr->val, u8arr->len);
+ if (type->type == NBT_U8ARRAY)
+ {
+ //PNL();
+ nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
+ __req->server = alloc_new_str_s((char *)u8arr->val, u8arr->len);
+ } else
+ {
+ ENL();
+ }
} else
{
ENL();
@@ -273,10 +303,15 @@ int rpc_call_resp_unmarsh(netbyte_store *nb_resp, rpc_call_response **resp)
//result
if (0 == nb_val(nb_resp, 0, &type))
- if (type->type == NBT_U8ARRAY)
{
- nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
- __resp->result = alloc_new_str_s(u8arr->val, u8arr->len);
+ if (type->type == NBT_U8ARRAY)
+ {
+ nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
+ __resp->result = alloc_new_str_s((char *)u8arr->val, u8arr->len);
+ } else
+ {
+ ENL();
+ }
} else
{
ENL();
@@ -284,10 +319,15 @@ int rpc_call_resp_unmarsh(netbyte_store *nb_resp, rpc_call_response **resp)
//error
if (0 == nb_val(nb_resp, 1, &type))
- if (type->type == NBT_U8ARRAY)
{
- nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
- __resp->error = alloc_new_str_s(u8arr->val, u8arr->len);
+ if (type->type == NBT_U8ARRAY)
+ {
+ nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
+ __resp->error = alloc_new_str_s((char *)u8arr->val, u8arr->len);
+ } else
+ {
+ ENL();
+ }
} else
{
ENL();
@@ -295,12 +335,17 @@ int rpc_call_resp_unmarsh(netbyte_store *nb_resp, rpc_call_response **resp)
//id
if (0 == nb_val(nb_resp, 2, &type))
- if (type->type == NBT_U32)
{
- PNL();
- nb_u32 *u32 = (nb_u32 *)type->nb_val;
- __resp->id = u32->val;
- //PRINT("%d\n",u32->val)
+ if (type->type == NBT_U32)
+ {
+ PNL();
+ nb_u32 *u32 = (nb_u32 *)type->nb_val;
+ __resp->id = u32->val;
+ //PRINT("%d\n",u32->val)
+ } else
+ {
+ ENL();
+ }
} else
{
ENL();
@@ -308,35 +353,44 @@ int rpc_call_resp_unmarsh(netbyte_store *nb_resp, rpc_call_response **resp)
//user
if (0 == nb_val(nb_resp, 3, &type))
- if (type->type == NBT_U8ARRAY)
{
- nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
- __resp->user = alloc_new_str_s(u8arr->val, u8arr->len);
+ if (type->type == NBT_U8ARRAY)
+ {
+ nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
+ __resp->user = alloc_new_str_s((char *)u8arr->val, u8arr->len);
+ } else
+ {
+ ENL();
+ }
} else
{
ENL();
}
//mask
- if (0 == nb_val(nb_resp, 1, &type))
- if (type->type == NBT_U8ARRAY)
- {
- nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
- __resp->mask = alloc_new_str_s(u8arr->val, u8arr->len);
- } else
- {
- ENL();
+ if (0 == nb_val(nb_resp, 4, &type))
+ {
+ if (type->type == NBT_U8ARRAY)
+ {
+ nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
+ __resp->mask = alloc_new_str_s((char *)u8arr->val, u8arr->len);
+ } else
+ {
+ ENL();
+ }
}
//server
- if (0 == nb_val(nb_resp, 1, &type))
- if (type->type == NBT_U8ARRAY)
- {
- nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
- __resp->server = alloc_new_str_s(u8arr->val, u8arr->len);
- } else
- {
- ENL();
+ if (0 == nb_val(nb_resp, 5, &type))
+ {
+ if (type->type == NBT_U8ARRAY)
+ {
+ nb_u8arr *u8arr = (nb_u8arr *)type->nb_val;
+ __resp->server = alloc_new_str_s((char *)u8arr->val, u8arr->len);
+ } else
+ {
+ ENL();
+ }
}
*resp = __resp;