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

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


The following commit(s) were added to refs/heads/feature/pubsub_inteceptors by 
this push:
     new 0fa89dd  Fixed overflow in protocol handling. Added macro for right 
printf type.
0fa89dd is described below

commit 0fa89dd46d9b15222c3d23b1d594c3d9a88973cf
Author: Alexander Broekhuis <[email protected]>
AuthorDate: Wed Mar 25 10:03:32 2020 +0100

    Fixed overflow in protocol handling. Added macro for right printf type.
---
 .../pubsub/examples/pubsub/interceptors/src/first_interceptor.c   | 8 +++++---
 .../pubsub_protocol_wire_v1/src/pubsub_wire_protocol_impl.c       | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/bundles/pubsub/examples/pubsub/interceptors/src/first_interceptor.c 
b/bundles/pubsub/examples/pubsub/interceptors/src/first_interceptor.c
index 64c63fe..7f64835 100644
--- a/bundles/pubsub/examples/pubsub/interceptors/src/first_interceptor.c
+++ b/bundles/pubsub/examples/pubsub/interceptors/src/first_interceptor.c
@@ -18,6 +18,8 @@
  */
 #include "first_interceptor_private.h"
 
+#include <inttypes.h>
+
 celix_status_t firstInterceptor_create(first_interceptor_t **interceptor) {
     celix_status_t status = CELIX_SUCCESS;
 
@@ -54,18 +56,18 @@ bool firstInterceptor_preSend(void *handle, 
pubsub_interceptor_properties_t prop
 
 void firstInterceptor_postSend(void *handle, pubsub_interceptor_properties_t 
properties, const char *messageType, const uint32_t msgTypeId, const void 
*message, celix_properties_t *metadata) {
     uint64_t sequence = celix_properties_getAsLong(metadata, SEQUENCE_NUMBER, 
0);
-    printf("Invoked postSend on first interceptor, for message with 
sequenceNumber [%llu]\n", sequence);
+    printf("Invoked postSend on first interceptor, for message with 
sequenceNumber [%"PRIu64"]\n", sequence);
 }
 
 bool firstInterceptor_preReceive(void *handle, pubsub_interceptor_properties_t 
properties, const char *messageType, const uint32_t msgTypeId, const void 
*message, celix_properties_t *metadata) {
     uint64_t sequence = celix_properties_getAsLong(metadata, SEQUENCE_NUMBER, 
0);
-    printf("Invoked preReceive on first interceptor, for message with 
sequenceNumber [%llu]\n", sequence);
+    printf("Invoked preReceive on first interceptor, for message with 
sequenceNumber [%"PRIu64"]\n", sequence);
 
     return true;
 }
 
 void firstInterceptor_postReceive(void *handle, 
pubsub_interceptor_properties_t properties, const char *messageType, const 
uint32_t msgTypeId, const void *message, celix_properties_t *metadata) {
     uint64_t sequence = celix_properties_getAsLong(metadata, SEQUENCE_NUMBER, 
0);
-    printf("Invoked postReceive on first interceptor, for message with 
sequenceNumber [%llu]\n", sequence);
+    printf("Invoked postReceive on first interceptor, for message with 
sequenceNumber [%"PRIu64"]\n", sequence);
 }
 
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..a7949d6 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
@@ -138,7 +138,7 @@ celix_status_t pubsubProtocol_encodeMetadata(void *handle, 
pubsub_protocol_messa
 
             memcpy(line + idx, keyNetString, strlen(keyNetString));
             idx += strlen(keyNetString);
-            memcpy(line + idx, valueNetString, strlen(keyNetString));
+            memcpy(line + idx, valueNetString, strlen(valueNetString));
             idx += strlen(valueNetString);
 
             free(keyNetString);

Reply via email to