]> rtime.felk.cvut.cz Git - orte.git/commitdiff
JORTE: fix the '2^32' problem and formatting in debug printf()
authorMartin Vajnar <martin.vajnar@gmail.com>
Sat, 20 Jul 2013 22:06:34 +0000 (00:06 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Mon, 23 Sep 2013 09:06:26 +0000 (11:06 +0200)
This fixes problems with wrong calculation of (2^32) on many occasions
both on the Java and the C side.

Many format strings for printf() are fixed. Display Host ID
and App ID in hexadecimal (as the ortemanager does).

12 files changed:
orte/java/src/org/ocera/orte/tools/CheckType.java
orte/java/src/org/ocera/orte/types/AppInfo.java
orte/java/src/org/ocera/orte/types/NtpTime.java
orte/java/src/org/ocera/orte/types/SequenceNumber.java
orte/libjorte/JORTEDomainAppCreate.c
orte/libjorte/JORTEPublicationPropertiesSet.c
orte/libjorte/JORTEPublicationWaitForSubscriptions.c
orte/libjorte/JORTESubscriptionCreate.c
orte/libjorte/JORTESubscriptionPropertiesSet.c
orte/libjorte/JORTESubscriptionWaitForPublications.c
orte/libjorte/createAppInfo.c
orte/libjorte/setRecvInfo.c

index a9a7d1f010d08597742ba8513279782a7057a62f..c1bf6fa64d314e320516b3f6b8093f94a5124ca1 100644 (file)
@@ -33,7 +33,7 @@ package org.ocera.orte.tools;
 public class CheckType {
 
  /** constants - max and min boundry values of the unsigned integer32 */ 
-   final static long UINT32MAX = (2^32 - 1);   
+   final static long UINT32MAX = ((long)1 << 32) - 1;
    final static long UINT32MIN = 0;
 
 
index 02a315bbc035f80c8322eb11be340e7d7379c154..f06349b6ac940acf8348d712b3980321a6708a69 100644 (file)
@@ -147,15 +147,15 @@ ProtocolVersion protocolVersion;
   // only for testing purposes
   public void printWithLegend()
   {
-       System.out.println(":j: * AppInfo.hostId = " + getHostId());
-       System.out.println(":j: * AppInfo.appId  = " + getAppId());
+       System.out.format(":j: * AppInfo.hostId = %#x\n", getHostId());
+       System.out.format(":j: * AppInfo.appId  = %#x\n", getAppId());
        // ipAdressList
-       System.out.println(":j: * AppInfo.pAddressTemp  = " + getIpAddressTemp());
+       System.out.println(":j: * AppInfo.ipAddressTemp  = " + getIpAddressTemp());
        System.out.println(":j: * AppInfo.unicastIPcount = " + getUnicastIPcount());
        // ipAdressList
-       System.out.println(":j: * AppInfo.pAddressTemp  = " + getIpAddressTemp());
-        System.out.println(":j: * AppInfo.unicastIPcount = " + getMulticastIPcount());
-       System.out.println(":j: * AppInfo.mettatrafficUniPort = " + getMetatrafficUniPort());
+       System.out.println(":j: * AppInfo.mettaTrafficMulticastIPAddressTemp  = " + getMettaTrafficMulticastIPAddressTemp());
+        System.out.println(":j: * AppInfo.multicastIPcount = " + getMulticastIPcount());
+       System.out.println(":j: * AppInfo.metatrafficUniPort = " + getMetatrafficUniPort());
        System.out.println(":j: * AppInfo.userdataUniPort     = " + getUserdataUniPort());
        System.out.println(":j: * AppInfo.vendorId = " + getVendorId());
        System.out.println(":j: * AppInfo.protocolVersion = " + getProtocolVersion());  
index 0f8ea5443e07e14344df1965c3cc6c5202fc92ff..d5e34708338bd6b4259ab1ef561869586b8dcef6 100644 (file)
@@ -87,7 +87,7 @@ public class NtpTime {
    **/
   public long getDecimal()
   {
-    return this.seconds + (this.fraction/2^32);
+    return this.seconds + (this.fraction << 32);
   }
     
   /* ****************************************************************** *
index a26aa4568037c5b72607cfaa0e60369fd859ddc4..76dd4ca85dfb443da8ae28fe4b8455dc203fd82f 100644 (file)
@@ -53,7 +53,7 @@ public class SequenceNumber
 
   public long getDecimal()
   {
-    long sn = high*2^32 + low; 
+    long sn = ((long)high << 32) + low;
        return sn;      
   }
   
index da82c61128fa44bceb4352180533145763d79698..54e8ae6ec33cc64a7bb0435f0ebdf59b52e77a84 100644 (file)
@@ -1142,7 +1142,7 @@ Java_org_ocera_orte_DomainApp_jORTEDomainDefaultAppCreate
     return 0;
   }
   #ifdef TEST_STAGE
-    printf(":c: ORTEDomainDefautlAppCreate() ok.. + %"PRIiPTR"\n", d);
+    printf(":c: ORTEDomainDefautlAppCreate() ok.. + %#"PRIxPTR"\n", (intptr_t)d);
   #endif
   return (d);
 }
@@ -1231,7 +1231,7 @@ Java_org_ocera_orte_DomainApp_jORTEDomainAppCreate
     return 0;
   }
   #ifdef TEST_STAGE
-    printf(":c: ORTEDomainAppCreate() ok.. + %"PRIiPTR"\n", d);
+    printf(":c: ORTEDomainAppCreate() ok.. + %#"PRIxPTR"\n", (intptr_t)d);
   #endif
   return (d);
 }
index 2a0d4a77157b4000ccb8e88c2224cad81ac014d5..f0f319dbdf11f4f41f3c3125eae4d2c2890ea7f2 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <inttypes.h>
 // library header file's path
 #include "orte.h"
 // getNtpTime function
@@ -145,7 +146,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     }
     publ_prop->typeChecksum = (TypeChecksum) (*env)->GetIntField(env, obj_pp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->typeChecksum = %d\n",
+      printf(":c: check: publ_prop->typeChecksum = %"PRId32"\n",
              publ_prop->typeChecksum);
     #endif
     /////////////////////////////////////////////////
@@ -162,7 +163,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     if (jbool == 0) publ_prop->expectsAck = ORTE_FALSE;
       else publ_prop->expectsAck = ORTE_TRUE;
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->expectsAck = %d\n", publ_prop->expectsAck);
+      printf(":c: check: publ_prop->expectsAck = %"PRId8"\n", publ_prop->expectsAck);
     #endif
     /////////////////////////////////////////////////
     // set persistence
@@ -187,7 +188,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     }
     publ_prop->persistence = getNtpTime(env, obj_ntpT);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->persistence: sec = %d, fract = %d  \n",
+      printf(":c: check: publ_prop->persistence: sec = %"PRId32", fract = %"PRIu32"  \n",
              publ_prop->persistence.seconds, publ_prop->persistence.fraction);
     #endif
     /////////////////////////////////////////////////
@@ -205,7 +206,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     }
     publ_prop->reliabilityOffered = (uint32_t) (*env)->GetLongField(env, obj_pp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->reliabilityOffered = %d \n",
+      printf(":c: check: publ_prop->reliabilityOffered = %"PRIu32" \n",
              publ_prop->reliabilityOffered);
     #endif
     /////////////////////////////////////////////////
@@ -223,7 +224,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     }
     publ_prop->sendQueueSize = (uint32_t) (*env)->GetLongField(env,obj_pp,fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->sendQueueSize = %d \n",
+      printf(":c: check: publ_prop->sendQueueSize = %"PRIu32" \n",
              publ_prop->sendQueueSize);
     #endif
     /////////////////////////////////////////////////
@@ -241,7 +242,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     }
     publ_prop->strength = (int32_t) (*env)->GetIntField(env,obj_pp,fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->strength = %d \n",
+      printf(":c: check: publ_prop->strength = %"PRId32" \n",
              publ_prop->strength);
     #endif
     /////////////////////////////////////////////////
@@ -259,7 +260,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     }
     publ_prop->criticalQueueLevel = (uint32_t) (*env)->GetLongField(env, obj_pp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->criticalQueueLevel = %d \n",
+      printf(":c: check: publ_prop->criticalQueueLevel = %"PRIu32" \n",
              publ_prop->criticalQueueLevel);
     #endif
     /////////////////////////////////////////////////
@@ -278,7 +279,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     obj_ntpT = (*env)->GetObjectField(env, obj_pp, fid);
     publ_prop->HBNornalRate = getNtpTime(env, obj_ntpT);
     #ifdef TEST_STAGE
-    printf(":c: check: publ_prop->HBNornalRate: sec = %d, fract = %d  \n",
+    printf(":c: check: publ_prop->HBNornalRate: sec = %"PRId32", fract = %"PRIu32"  \n",
            publ_prop->HBNornalRate.seconds, publ_prop->HBNornalRate.fraction);
     #endif
     /////////////////////////////////////////////////
@@ -304,7 +305,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     }
     publ_prop->HBCQLRate = getNtpTime(env, obj_ntpT);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->HBCQLRate: sec = %d, fract = %d  \n",
+      printf(":c: check: publ_prop->HBCQLRate: sec = %"PRId32", fract = %"PRIu32"  \n",
              publ_prop->HBCQLRate.seconds, publ_prop->HBCQLRate.fraction);
     #endif
     /////////////////////////////////////////////////
@@ -322,7 +323,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     }
     publ_prop->HBMaxRetries = (unsigned int) (*env)->GetLongField(env, obj_pp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->HBMaxRetries = %d \n",
+      printf(":c: check: publ_prop->HBMaxRetries = %u \n",
              publ_prop->HBMaxRetries);
     #endif
     /////////////////////////////////////////////////
@@ -348,7 +349,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationPropertiesSet
     }
     publ_prop->maxBlockTime = getNtpTime(env, obj_ntpT);
     #ifdef TEST_STAGE
-      printf(":c: check: publ_prop->maxBlockTime: sec = %d, fract = %d  \n",
+      printf(":c: check: publ_prop->maxBlockTime: sec = %"PRId32", fract = %"PRIu32"  \n",
              publ_prop->maxBlockTime.seconds, publ_prop->maxBlockTime.fraction);
     #endif
     /////////////////////////////////////////////////
index 0e9365433c6902425d753609a3d9fabf95eee24a..4b9b377f09f1e2ab74182a67ff94c46901d7419f 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <inttypes.h>
 // library header file's path
 #include "orte.h"
 // getNtpTime function
@@ -51,7 +52,7 @@ Java_org_ocera_orte_Publication_jORTEPublicationWaitForSubscriptions
 
   wait = getNtpTime(env, obj_ntpT);
   #ifdef TEST_STAGE
-    printf(":c: check: wait: sec = %d, fract = %d  \n",
+    printf(":c: check: wait: sec = %"PRId32", fract = %"PRIu32"  \n",
            wait.seconds, wait.fraction);
   #endif
 
index 6475a2c2819ecee0b1a61034b9e76a25bc29e06a..998840d3ccfd908af1c28db0b1255bb112fa80be 100644 (file)
@@ -27,6 +27,7 @@
 
 
 #include <stdlib.h>
+#include <inttypes.h>
 
 // library header file's path
 #include "orte.h"
@@ -98,7 +99,7 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 
       #ifdef TEST_STAGE
          printf(":c: #0 \n");
-         printf(":c: env = %p, obj_msg = %p \n", env, obj_msg);
+         printf(":c: env = %#"PRIxPTR", obj_msg = %#"PRIxPTR" \n", (intptr_t)env, (intptr_t)obj_msg);
       #endif
 
 
@@ -156,16 +157,16 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
     #ifdef TEST_STAGE
       printf(":c: rinfo created :] \n");
       printf(":c:----- ORTERecvInfo members  ------ \n");
-      printf(":c:    recvStatus: %d \n", info->status);
-      printf(":c:    senderGuid: hid = %d, aid = %d, oid = %d \n",
+      printf(":c:    recvStatus: %#x \n", info->status);
+      printf(":c:    senderGuid: hid = %#"PRIx32", aid = %#"PRIx32", oid = %#"PRIx32" \n",
              info->senderGUID.hid,info->senderGUID.aid,info->senderGUID.oid);
       printf(":c:         topic: %s \n",info->topic);
       printf(":c:          type: %s \n",info->type);
-      printf(":c: localTimeRecv: sec = %d, fract = %d \n",
+      printf(":c: localTimeRecv: sec = %"PRId32", fract = %"PRIu32" \n",
              info->localTimeReceived.seconds,info->localTimeReceived.fraction);
-      printf(":c: remoteTimePub: sec = %d, fract = %d \n",
+      printf(":c: remoteTimePub: sec = %"PRId32", fract = %"PRIu32" \n",
              info->remoteTimePublished.seconds,info->remoteTimePublished.fraction);
-      printf(":c:         seqNr: high = %d, low = %d \n",info->sn.high,info->sn.low);
+      printf(":c:         seqNr: high = %"PRId32", low = %"PRIu32" \n",info->sn.high,info->sn.low);
       printf(":c:---------------------------------- \n");
     #endif
     ////////////////////////////////////////////////////
index 5af99809cb1e9dddd142b5e501ed0a5cb742d908..2ba47e5579c3f22668ca5efae75d4cb944f78329 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <inttypes.h>
 // library header file's path
 #include "orte.h"
 // getNtpTime function
@@ -143,7 +144,7 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
     }
     subs_prop->typeChecksum = (TypeChecksum) (*env)->GetIntField(env, obj_sp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->typeChecksum = %d\n",
+      printf(":c: check: subs_prop->typeChecksum = %"PRId32"\n",
              subs_prop->typeChecksum);
     #endif
     /////////////////////////////////////////////////
@@ -162,7 +163,7 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
     j_minSeparation = (*env)->GetObjectField(env, obj_sp, fid);
     subs_prop->minimumSeparation = getNtpTime(env, j_minSeparation);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->minimumSeparation: sec = %d, fract = %d \n",
+      printf(":c: check: subs_prop->minimumSeparation: sec = %"PRId32", fract = %"PRIu32" \n",
              subs_prop->minimumSeparation.seconds,
              subs_prop->minimumSeparation.fraction);
     #endif
@@ -178,7 +179,7 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
     }
     subs_prop->recvQueueSize = (uint32_t) (*env)->GetLongField(env, obj_sp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->recvQueueSize = %d \n",
+      printf(":c: check: subs_prop->recvQueueSize = %"PRIu32" \n",
              subs_prop->recvQueueSize);
     #endif
     /////////////////////////////////////////////////
@@ -193,7 +194,7 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
     }
     subs_prop->reliabilityRequested = (uint32_t) (*env)->GetLongField(env, obj_sp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->reliabilityRequested = %d \n",
+      printf(":c: check: subs_prop->reliabilityRequested = %"PRIu32" \n",
              subs_prop->reliabilityRequested);
     #endif
     /////////////////////////////////////////////////
@@ -212,7 +213,7 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
     j_deadline = (*env)->GetObjectField(env, obj_sp, fid);
     subs_prop->deadline = getNtpTime(env, j_deadline);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->deadline: sec = %d, fract = %d  \n",
+      printf(":c: check: subs_prop->deadline: sec = %"PRId32", fract = %"PRIu32"  \n",
              subs_prop->deadline.seconds, subs_prop->deadline.fraction);
     #endif
     /////////////////////////////////////////////////
@@ -227,7 +228,7 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionPropertiesSet
     }
     subs_prop->mode = (uint32_t) (*env)->GetIntField(env, obj_sp, fid);
     #ifdef TEST_STAGE
-      printf(":c: check: subs_prop->mode = %d \n",
+      printf(":c: check: subs_prop->mode = %"PRIu32" \n",
              subs_prop->mode);
     #endif
 /*
index 9169219a8dd2dd06a8a2bc1aa60f7f74c3ead66e..7852648e8d5cb0f56d785297ea025f34ba708852 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <inttypes.h>
 // library header file's path
 #include "orte.h"
 // getNtpTime function
@@ -51,7 +52,7 @@ Java_org_ocera_orte_Subscription_jORTESubscriptionWaitForPublications
   //
   wait = getNtpTime(env, obj_ntpT);
   #ifdef TEST_STAGE
-    printf(":c: check: wait: sec = %d, fract = %d  \n",
+    printf(":c: check: wait: sec = %"PRId32", fract = %"PRIu32"  \n",
            wait.seconds, wait.fraction);
   #endif
   // calling ORTE function
index 87a3652f84a5846387e281e590cb0547585ec2e9..1d06bbe1338da62cc951f0867095581cc0d042c3 100644 (file)
@@ -56,7 +56,7 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.hostId = %d \n",ainfo->hostId);
+       printf(":c: ainfo.hostId = %#"PRIx32" \n",ainfo->hostId);
     #endif
     (*env)->SetLongField(env,
                          obj,
@@ -73,7 +73,7 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.appId = %d \n",ainfo->appId);
+       printf(":c: ainfo.appId = %#"PRIx32" \n",ainfo->appId);
     #endif
     (*env)->SetLongField(env,
                          obj,
@@ -89,7 +89,7 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.unicastIPAddressList = %"PRIoPTR"\n",(intptr_t)ainfo->unicastIPAddressList);
+       printf(":c: ainfo.unicastIPAddressList = %#"PRIxPTR"\n",(intptr_t)ainfo->unicastIPAddressList);
     #endif
     (*env)->SetLongField(env,
                          obj,
@@ -105,7 +105,7 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.unicastIPcount = %d \n",
+       printf(":c: ainfo.unicastIPcount = %hhu \n",
               ainfo->unicastIPAddressCount);
     #endif
     (*env)->SetByteField(env,
@@ -122,7 +122,7 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.multicastIPAddressList = %"PRIoPTR"\n",
+       printf(":c: ainfo.multicastIPAddressList = %#"PRIxPTR"\n",
               (intptr_t)ainfo->metatrafficMulticastIPAddressList);
     #endif
     (*env)->SetLongField(env,
@@ -139,7 +139,7 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.metatrafficMulticastIPAddressCount = %d \n",
+       printf(":c: ainfo.metatrafficMulticastIPAddressCount = %hhu \n",
               ainfo->metatrafficMulticastIPAddressCount);
     #endif
     (*env)->SetByteField(env,
@@ -157,7 +157,7 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.metatrafficUnicastPort = %d \n",
+       printf(":c: ainfo.metatrafficUnicastPort = %"PRIu32" \n",
               ainfo->metatrafficUnicastPort);
     #endif
     (*env)->SetLongField(env,
@@ -175,7 +175,7 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.userdataUnicastPort = %d \n",
+       printf(":c: ainfo.userdataUnicastPort = %"PRIu32" \n",
               ainfo->userdataUnicastPort);
     #endif
     (*env)->SetLongField(env,
@@ -230,7 +230,7 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.vendorId: major = %d, minor = %d \n",
+       printf(":c: ainfo.vendorId: major = %"PRId8", minor = %"PRId8" \n",
               ainfo->vendorId.major, ainfo->vendorId.minor);
     #endif
     (*env)->SetObjectField(env,
@@ -285,7 +285,7 @@ jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: ainfo.protocolVersion: major = %d, minor = %d \n",
+       printf(":c: ainfo.protocolVersion: major = %"PRId8", minor = %"PRId8" \n",
               ainfo->protocolVersion.major, ainfo->protocolVersion.minor);
     #endif
     (*env)->SetObjectField(env,
index 521393911f2e842d308ccdbb6a2d289e85792f1f..c73455dde18f1299d93697d99e47227fa696085e 100644 (file)
@@ -1,6 +1,7 @@
 /* setRecvInfo.c  */
 
 #include <jni.h>
+#include <inttypes.h>
 #include "orte.h"
 #include "jorte/4all.h"
 #include "jorte/jorte_protos_api.h"
@@ -15,6 +16,8 @@ int setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo, jobject obj)
   jmethodID mid;
   //
   int flag_ok = 0;
+  int32_t sec;
+  uint32_t us;
 
   do
   {
@@ -110,7 +113,7 @@ int setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo, jobject obj)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: rinfo.senderGUID: hid = %d, aid = %d, oid = %d \n",
+       printf(":c: rinfo.senderGUID: hid = %#"PRIx32", aid = %#"PRIx32", oid = %#"PRIx32" \n",
               rinfo->senderGUID.hid,rinfo->senderGUID.aid,rinfo->senderGUID.oid);
     #endif
     (*env)->SetObjectField(env,
@@ -165,8 +168,9 @@ int setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo, jobject obj)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: rinfo.NtpTime: %d (sec = %d fract = %d) \n",
-              (rinfo->localTimeReceived.seconds + rinfo->localTimeReceived.fraction/(2^32)),
+       NtpTimeDisAssembToUs(sec, us, rinfo->localTimeReceived);
+       printf(":c: rinfo.NtpTime: %"PRId32".%"PRIu32" (sec = %"PRId32" fract = %"PRIu32") \n",
+              sec, us,
               rinfo->localTimeReceived.seconds,rinfo->localTimeReceived.fraction);
     #endif
     (*env)->SetObjectField(env,
@@ -223,8 +227,9 @@ int setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo, jobject obj)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: rinfo.remoteTimePub: %d (sec = %d fract = %d) \n",
-              (rinfo->remoteTimePublished.seconds + rinfo->remoteTimePublished.fraction/(2^32)),
+       NtpTimeDisAssembToUs(sec, us, rinfo->remoteTimePublished);
+       printf(":c: rinfo.remoteTimePub: %"PRId32".%"PRIu32" (sec = %"PRId32" fract = %"PRIu32") \n",
+              sec, us,
               rinfo->remoteTimePublished.seconds,rinfo->remoteTimePublished.fraction);
     #endif
     (*env)->SetObjectField(env,
@@ -279,8 +284,8 @@ int setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo, jobject obj)
       break;
     }
     #ifdef TEST_STAGE
-       printf(":c: rinfo.sn: %d (high = %d low = %d) \n",
-              (rinfo->sn.high*(2^32) + rinfo->sn.low),rinfo->sn.high,rinfo->sn.low);
+       printf(":c: rinfo.sn: %"PRId64" (high = %"PRId32" low = %"PRId32") \n",
+              (((int64_t)rinfo->sn.high << 32) + rinfo->sn.low),rinfo->sn.high,rinfo->sn.low);
     #endif
     (*env)->SetObjectField(env,
                            obj,