celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [01/10] celix git commit: CELIX-237: Added extra test
Date Fri, 31 Jul 2015 20:57:30 GMT
Repository: celix
Updated Branches:
  refs/heads/feature/CELIX-237_rsa-ffi f9ed9b33b -> 481e5c861


CELIX-237: Added extra test


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/a2b09e22
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/a2b09e22
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/a2b09e22

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: a2b09e223114b509a01209d418cd479bb09e4b7c
Parents: f9ed9b3
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Fri Jul 31 15:57:42 2015 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Fri Jul 31 15:57:42 2015 +0200

----------------------------------------------------------------------
 .../dynamic_function_interface/dyn_type.c            |  4 ++--
 .../dynamic_function_interface/dyn_type.h            |  2 ++
 .../tst/dyn_type_tests.cpp                           | 15 +++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/a2b09e22/remote_services/dynamic_function_interface/dyn_type.c
----------------------------------------------------------------------
diff --git a/remote_services/dynamic_function_interface/dyn_type.c b/remote_services/dynamic_function_interface/dyn_type.c
index af98fe9..2946607 100644
--- a/remote_services/dynamic_function_interface/dyn_type.c
+++ b/remote_services/dynamic_function_interface/dyn_type.c
@@ -595,7 +595,7 @@ void dynType_free(dyn_type *type, void *loc) {
 void dynType_deepFree(dyn_type *type, void *loc, bool alsoDeleteSelf) {
     if (loc != NULL) {
         dyn_type *subType = NULL;
-        const char *text = NULL;
+        char *text = NULL;
         switch (type->type) {
             case DYN_TYPE_COMPLEX :
                 dynType_freeComplexType(type, loc);
@@ -608,7 +608,7 @@ void dynType_deepFree(dyn_type *type, void *loc, bool alsoDeleteSelf)
{
                 dynType_deepFree(subType, *(void **)loc, true);
                 break;
             case DYN_TYPE_TEXT :
-                text = *(const char **)loc;
+                text = *(char **)loc;
                 free(text);
                 break;
         }

http://git-wip-us.apache.org/repos/asf/celix/blob/a2b09e22/remote_services/dynamic_function_interface/dyn_type.h
----------------------------------------------------------------------
diff --git a/remote_services/dynamic_function_interface/dyn_type.h b/remote_services/dynamic_function_interface/dyn_type.h
index c4f33a2..9fdbff2 100644
--- a/remote_services/dynamic_function_interface/dyn_type.h
+++ b/remote_services/dynamic_function_interface/dyn_type.h
@@ -128,8 +128,10 @@ int dynType_sequence_increaseLengthAndReturnLastLoc(dyn_type *type, void
*seqLoc
 dyn_type * dynType_sequence_itemType(dyn_type *type);
 uint32_t dynType_sequence_length(void *seqLoc);
 
+//typed pointer
 int dynType_typedPointer_getTypedType(dyn_type *type, dyn_type **typedType);
 
+//text
 int dynType_text_allocAndInit(dyn_type *type, void *textLoc, const char *value);
 
 //simple

http://git-wip-us.apache.org/repos/asf/celix/blob/a2b09e22/remote_services/dynamic_function_interface/tst/dyn_type_tests.cpp
----------------------------------------------------------------------
diff --git a/remote_services/dynamic_function_interface/tst/dyn_type_tests.cpp b/remote_services/dynamic_function_interface/tst/dyn_type_tests.cpp
index daee4cf..96f64fa 100644
--- a/remote_services/dynamic_function_interface/tst/dyn_type_tests.cpp
+++ b/remote_services/dynamic_function_interface/tst/dyn_type_tests.cpp
@@ -173,3 +173,18 @@ TEST(DynTypeTests, AssignTest2) {
 
     dynType_destroy(type);
 }
+
+TEST(DynTypeTests, AssignTest3) {
+    int simple = 1;
+    dyn_type *type = NULL;
+    int rc = dynType_parseWithStr("N", NULL, NULL, &type);
+    CHECK_EQUAL(0, rc);
+
+    int newValue = 42;
+    void *loc = &simple;
+    void *input = &newValue;
+    dynType_simple_setValue(type, loc, input);
+    CHECK_EQUAL(42, simple);
+    dynType_destroy(type);
+}
+


Mime
View raw message