From 3cdf7c9dddae34ba07f38494c0634e815b01fd49 Mon Sep 17 00:00:00 2001
From: Utz-Uwe Haus <uhaus@hpe.com>
Date: Sun, 26 Apr 2020 13:25:05 +0000
Subject: [PATCH] transport cleanups

---
 transport/transport.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/transport/transport.c b/transport/transport.c
index a03e8c26..a2eb1d18 100644
--- a/transport/transport.c
+++ b/transport/transport.c
@@ -73,21 +73,21 @@ mstro_transport_get_dst_buffer(mstro_cdo dst, size_t len, void** data)
       return MSTRO_FAIL;
     }
   } else {
-    const void *available_size;
+    const int64_t *available_size;
     enum mstro_cdo_attr_value_type type;
     status = mstro_cdo_attribute_get(
-        dst, MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE, &type, &available_size);
+        dst, MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE, &type, (const void**)&available_size);
     if(status!=MSTRO_OK) {
       ERR("Failed to fetch size attribute\n");
       return MSTRO_FAIL;
     }
-    if(*(const int64_t*)available_size<len) {
-      ERR("local CDO handle has raw-ptr allocation, but it is too small for incoming CDO: have %zu, need %zu\n",
-          *(const int64_t*)available_size, len);
+    if(*available_size<len) {
+      ERR("local CDO handle has raw-ptr allocation, but it is too small for incoming CDO: have %" PRIi64 ", need %" PRIi64 "\n",
+          *available_size, len);
       return MSTRO_FAIL;
     } else {
-      DEBUG("Pre-allocated RAW-PTR (have %zu, need %zu), good\n",
-            *(const int64_t*)available_size, len);
+      DEBUG("Pre-allocated RAW-PTR (have %" PRIi64 ", need %" PRIi64 "), good\n",
+            *available_size, len);
       *data = dst->raw_ptr;
     }
   }
@@ -99,23 +99,23 @@ mstro_status
 mstro_transport_get_datalen(mstro_cdo src, struct mstro_transport_datalen* dl)
 {
 	enum mstro_cdo_attr_value_type type;
-	const void* val;
+	const int64_t* val;
 
 	if (src->raw_ptr != NULL ) {
 	INFO ("Found a raw ptr in CDO %s\n", src->name);
 		dl->data = src->raw_ptr;
 		if (!(MSTRO_OK == mstro_cdo_attribute_get(
-                        src, MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE, &type, &val))) {
+                        src, MSTRO_ATTR_CORE_CDO_SCOPE_LOCAL_SIZE, &type, (const void**)&val))) {
                   ERR("Failed to get size attribute of CDO %s for transport\n", src->name);
                   return MSTRO_FAIL;
 		}
-		dl->len = *(size_t*)val;
+		dl->len = *val;
                 INFO("CDO size is %zu\n", dl->len);
 	}
 	else if (src->mamba_array != NULL) {
 		mmbArray* ma = src->mamba_array;
 		dl->data = (char*)ma->allocation->ptr;
-		dl->len = (size_t)ma->allocation->n_bytes;
+		dl->len = ma->allocation->n_bytes;
 	}
 	else {
 		ERR("Failed to find a raw pointer or a Mamba array to transport from CDO %s\n", src->name);
-- 
GitLab