This is an automated email from the ASF dual-hosted git repository.

abroekhuis pushed a commit to branch Pubsub_wireprotocol_endianness
in repository https://gitbox.apache.org/repos/asf/celix.git

commit ede4581f3e2f82e589f3c0764a42710ffd9831d6
Author: Alexander Broekhuis <alexander.broekh...@luminis.eu>
AuthorDate: Wed Mar 25 22:07:33 2020 +0100

    Fixed endianness of metadata size.
---
 .../pubsub/pubsub_protocol_wire_v1/src/pubsub_wire_protocol_impl.c  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/bundles/pubsub/pubsub_protocol_wire_v1/src/pubsub_wire_protocol_impl.c 
b/bundles/pubsub/pubsub_protocol_wire_v1/src/pubsub_wire_protocol_impl.c
index d0af3d0..00fbc46 100644
--- a/bundles/pubsub/pubsub_protocol_wire_v1/src/pubsub_wire_protocol_impl.c
+++ b/bundles/pubsub/pubsub_protocol_wire_v1/src/pubsub_wire_protocol_impl.c
@@ -106,7 +106,7 @@ celix_status_t pubsubProtocol_encodePayload(void *handle, 
pubsub_protocol_messag
 celix_status_t pubsubProtocol_encodeMetadata(void *handle, 
pubsub_protocol_message_t *message, void **outBuffer, size_t *outLength) {
     celix_status_t status = CELIX_SUCCESS;
 
-    char *line = calloc(1, 4);
+    unsigned char *line = calloc(1, 4);
     size_t idx = 4;
     size_t len = 0;
 
@@ -128,7 +128,7 @@ celix_status_t pubsubProtocol_encodeMetadata(void *handle, 
pubsub_protocol_messa
 
             len += strlen(keyNetString);
             len += strlen(valueNetString);
-            char *tmp = realloc(line, len + sizeof(uint32_t));
+            unsigned char *tmp = realloc(line, len + sizeof(uint32_t));
             if (!tmp) {
                 free(line);
                 status = CELIX_ENOMEM;
@@ -146,7 +146,7 @@ celix_status_t pubsubProtocol_encodeMetadata(void *handle, 
pubsub_protocol_messa
         }
     }
     int size = celix_properties_size(message->metadata.metadata);
-    memcpy(line, &size, sizeof(int32_t));
+    writeInt(line, 0, size);
 
     *outBuffer = line;
     *outLength = idx;

Reply via email to