You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2020/03/25 21:07:47 UTC

[celix] branch Pubsub_wireprotocol_endianness created (now ede4581)

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

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


      at ede4581  Fixed endianness of metadata size.

This branch includes the following new commits:

     new ede4581  Fixed endianness of metadata size.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[celix] 01/01: Fixed endianness of metadata size.

Posted by ab...@apache.org.
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 <al...@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;