You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2015/09/23 16:22:33 UTC
[1/2] celix git commit: CELIX-237: Added support for boolean (Z)
Repository: celix
Updated Branches:
refs/heads/feature/CELIX-237_rsa-ffi d34089802 -> 3f71ac4a9
CELIX-237: Added support for boolean (Z)
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/8248c2c1
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/8248c2c1
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/8248c2c1
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 8248c2c1d8d812ae0ad645505bc55941d7ad86aa
Parents: d340898
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Wed Sep 23 14:51:27 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Wed Sep 23 14:51:27 2015 +0200
----------------------------------------------------------------------
.../dynamic_function_interface/dyn_type.c | 3 +++
.../dynamic_function_interface/json_serializer.c | 13 ++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/8248c2c1/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.c b/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.c
index de00784..88f8766 100644
--- a/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.c
+++ b/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.c
@@ -825,6 +825,9 @@ ffi_type *dynType_ffiType(dyn_type *type) {
static ffi_type * dynType_ffiTypeFor(int c) {
ffi_type *type = NULL;
switch (c) {
+ case 'Z' :
+ type = &ffi_type_uint8;
+ break;
case 'F' :
type = &ffi_type_float;
break;
http://git-wip-us.apache.org/repos/asf/celix/blob/8248c2c1/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c b/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
index eb38dbc..ae1b95b 100644
--- a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
+++ b/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
@@ -126,6 +126,7 @@ static int jsonSerializer_parseAny(dyn_type *type, void *loc, json_t *val) {
printf("\n");
*/
+ bool *z; //Z
float *f; //F
double *d; //D
char *b; //B
@@ -139,6 +140,10 @@ static int jsonSerializer_parseAny(dyn_type *type, void *loc, json_t *val) {
uint64_t *ul; //j
switch (c) {
+ case 'Z' :
+ z = loc;
+ *z = (bool) json_is_true(val);
+ break;
case 'F' :
f = loc;
*f = (float) json_real_value(val);
@@ -277,6 +282,7 @@ static int jsonSerializer_writeAny(dyn_type *type, void *input, json_t **out) {
json_t *val = NULL;
dyn_type *subType = NULL;
+ bool *z; //Z
float *f; //F
double *d; //D
char *b; //B
@@ -290,6 +296,10 @@ static int jsonSerializer_writeAny(dyn_type *type, void *input, json_t **out) {
uint64_t *ul; //j
switch (descriptor) {
+ case 'Z' :
+ z = input;
+ val = json_boolean((bool)*z);
+ break;
case 'B' :
b = input;
val = json_integer((json_int_t)*b);
@@ -438,4 +448,5 @@ static int jsonSerializer_writeComplex(dyn_type *type, void *input, json_t **out
}
return status;
-}
\ No newline at end of file
+}
+
[2/2] celix git commit: CELIX-237: Fixed small memory leak when
methods return not 0
Posted by pn...@apache.org.
CELIX-237: Fixed small memory leak when methods return not 0
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/3f71ac4a
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/3f71ac4a
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/3f71ac4a
Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: 3f71ac4a950bc8cca8542ecc770247089d7022bc
Parents: 8248c2c
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Wed Sep 23 16:21:55 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Wed Sep 23 16:21:55 2015 +0200
----------------------------------------------------------------------
.../dynamic_function_interface/json_rpc.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/3f71ac4a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_rpc.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_rpc.c b/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_rpc.c
index d4c8f30..01dc6b5 100644
--- a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_rpc.c
+++ b/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_rpc.c
@@ -124,13 +124,19 @@ int jsonRpc_call(dyn_interface_type *intf, void *service, const char *request, c
}
json_t *jsonResult = NULL;
+ for(i = 0; i < nrOfArgs; i += 1) {
+ dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
+ enum dyn_function_argument_meta meta = dynFunction_argumentMetaForIndex(func, i);
+ if (meta == DYN_FUNCTION_ARGUMENT_META__STD) {
+ //TODO SOMETIMES segfault dynType_free(argType, args[i]);
+ }
+ }
+
if (funcCallStatus == 0 && status == OK) {
for (i = 0; i < nrOfArgs; i += 1) {
dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
enum dyn_function_argument_meta meta = dynFunction_argumentMetaForIndex(func, i);
- if (meta == DYN_FUNCTION_ARGUMENT_META__STD) {
- dynType_free(argType, args[i]);
- } else if (meta == DYN_FUNCTION_ARGUMENT_META__PRE_ALLOCATED_OUTPUT) {
+ if (meta == DYN_FUNCTION_ARGUMENT_META__PRE_ALLOCATED_OUTPUT) {
if (status == OK) {
status = jsonSerializer_serializeJson(argType, args[i], &jsonResult);
}
@@ -162,8 +168,12 @@ int jsonRpc_call(dyn_interface_type *intf, void *service, const char *request, c
LOG_DEBUG("creating payload\n");
json_t *payload = json_object();
if (funcCallStatus == 0) {
- LOG_DEBUG("Setting result payload");
- json_object_set_new(payload, "r", jsonResult);
+ if (jsonResult == NULL) {
+ //ignore -> no result
+ } else {
+ LOG_DEBUG("Setting result payload");
+ json_object_set_new(payload, "r", jsonResult);
+ }
} else {
LOG_DEBUG("Setting error payload");
json_object_set_new(payload, "e", json_integer(funcCallStatus));