From ae35c27d1a6da7a8182423f86cfb3a2f76c256c0 Mon Sep 17 00:00:00 2001 From: Martin Vajnar Date: Sun, 21 Jul 2013 00:06:34 +0200 Subject: [PATCH] JORTE: fix the '2^32' problem and formatting in debug printf() 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). --- .../src/org/ocera/orte/tools/CheckType.java | 2 +- .../src/org/ocera/orte/types/AppInfo.java | 12 +++++----- .../src/org/ocera/orte/types/NtpTime.java | 2 +- .../org/ocera/orte/types/SequenceNumber.java | 2 +- orte/libjorte/JORTEDomainAppCreate.c | 4 ++-- orte/libjorte/JORTEPublicationPropertiesSet.c | 23 ++++++++++--------- .../JORTEPublicationWaitForSubscriptions.c | 3 ++- orte/libjorte/JORTESubscriptionCreate.c | 13 ++++++----- .../libjorte/JORTESubscriptionPropertiesSet.c | 13 ++++++----- .../JORTESubscriptionWaitForPublications.c | 3 ++- orte/libjorte/createAppInfo.c | 20 ++++++++-------- orte/libjorte/setRecvInfo.c | 19 +++++++++------ 12 files changed, 63 insertions(+), 53 deletions(-) diff --git a/orte/java/src/org/ocera/orte/tools/CheckType.java b/orte/java/src/org/ocera/orte/tools/CheckType.java index a9a7d1f..c1bf6fa 100644 --- a/orte/java/src/org/ocera/orte/tools/CheckType.java +++ b/orte/java/src/org/ocera/orte/tools/CheckType.java @@ -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; diff --git a/orte/java/src/org/ocera/orte/types/AppInfo.java b/orte/java/src/org/ocera/orte/types/AppInfo.java index 02a315b..f06349b 100644 --- a/orte/java/src/org/ocera/orte/types/AppInfo.java +++ b/orte/java/src/org/ocera/orte/types/AppInfo.java @@ -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()); diff --git a/orte/java/src/org/ocera/orte/types/NtpTime.java b/orte/java/src/org/ocera/orte/types/NtpTime.java index 0f8ea54..d5e3470 100644 --- a/orte/java/src/org/ocera/orte/types/NtpTime.java +++ b/orte/java/src/org/ocera/orte/types/NtpTime.java @@ -87,7 +87,7 @@ public class NtpTime { **/ public long getDecimal() { - return this.seconds + (this.fraction/2^32); + return this.seconds + (this.fraction << 32); } /* ****************************************************************** * diff --git a/orte/java/src/org/ocera/orte/types/SequenceNumber.java b/orte/java/src/org/ocera/orte/types/SequenceNumber.java index a26aa45..76dd4ca 100644 --- a/orte/java/src/org/ocera/orte/types/SequenceNumber.java +++ b/orte/java/src/org/ocera/orte/types/SequenceNumber.java @@ -53,7 +53,7 @@ public class SequenceNumber public long getDecimal() { - long sn = high*2^32 + low; + long sn = ((long)high << 32) + low; return sn; } diff --git a/orte/libjorte/JORTEDomainAppCreate.c b/orte/libjorte/JORTEDomainAppCreate.c index da82c61..54e8ae6 100644 --- a/orte/libjorte/JORTEDomainAppCreate.c +++ b/orte/libjorte/JORTEDomainAppCreate.c @@ -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); } diff --git a/orte/libjorte/JORTEPublicationPropertiesSet.c b/orte/libjorte/JORTEPublicationPropertiesSet.c index 2a0d4a7..f0f319d 100644 --- a/orte/libjorte/JORTEPublicationPropertiesSet.c +++ b/orte/libjorte/JORTEPublicationPropertiesSet.c @@ -27,6 +27,7 @@ #include #include +#include // 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 ///////////////////////////////////////////////// diff --git a/orte/libjorte/JORTEPublicationWaitForSubscriptions.c b/orte/libjorte/JORTEPublicationWaitForSubscriptions.c index 0e93654..4b9b377 100644 --- a/orte/libjorte/JORTEPublicationWaitForSubscriptions.c +++ b/orte/libjorte/JORTEPublicationWaitForSubscriptions.c @@ -27,6 +27,7 @@ #include #include +#include // 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 diff --git a/orte/libjorte/JORTESubscriptionCreate.c b/orte/libjorte/JORTESubscriptionCreate.c index 6475a2c..998840d 100644 --- a/orte/libjorte/JORTESubscriptionCreate.c +++ b/orte/libjorte/JORTESubscriptionCreate.c @@ -27,6 +27,7 @@ #include +#include // 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 //////////////////////////////////////////////////// diff --git a/orte/libjorte/JORTESubscriptionPropertiesSet.c b/orte/libjorte/JORTESubscriptionPropertiesSet.c index 5af9980..2ba47e5 100644 --- a/orte/libjorte/JORTESubscriptionPropertiesSet.c +++ b/orte/libjorte/JORTESubscriptionPropertiesSet.c @@ -27,6 +27,7 @@ #include #include +#include // 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 /* diff --git a/orte/libjorte/JORTESubscriptionWaitForPublications.c b/orte/libjorte/JORTESubscriptionWaitForPublications.c index 9169219..7852648 100644 --- a/orte/libjorte/JORTESubscriptionWaitForPublications.c +++ b/orte/libjorte/JORTESubscriptionWaitForPublications.c @@ -27,6 +27,7 @@ #include #include +#include // 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 diff --git a/orte/libjorte/createAppInfo.c b/orte/libjorte/createAppInfo.c index 87a3652..1d06bbe 100644 --- a/orte/libjorte/createAppInfo.c +++ b/orte/libjorte/createAppInfo.c @@ -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, diff --git a/orte/libjorte/setRecvInfo.c b/orte/libjorte/setRecvInfo.c index 5213939..c73455d 100644 --- a/orte/libjorte/setRecvInfo.c +++ b/orte/libjorte/setRecvInfo.c @@ -1,6 +1,7 @@ /* setRecvInfo.c */ #include +#include #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, -- 2.39.2