From 43ce9f390a7dd64e1da4d8dd92921bddd6fcbd32 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 31 May 2020 23:42:44 -0700 Subject: [PATCH] force 16-letter devids --- xwords4/common/comtypes.h | 4 ++-- xwords4/linux/mqttcon.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xwords4/common/comtypes.h b/xwords4/common/comtypes.h index bb6170ab6..1c7a4ca90 100644 --- a/xwords4/common/comtypes.h +++ b/xwords4/common/comtypes.h @@ -249,9 +249,9 @@ typedef struct _PlayerDicts { typedef uint64_t MQTTDevID; #if __WORDSIZE == 64 -# define MQTTDevID_FMT "%lX" +# define MQTTDevID_FMT "%016lX" #elif __WORDSIZE == 32 -# define MQTTDevID_FMT "%llX" +# define MQTTDevID_FMT "%016llX" #endif # define MQTTTopic_FMT "xw4/device/" MQTTDevID_FMT diff --git a/xwords4/linux/mqttcon.c b/xwords4/linux/mqttcon.c index 9a078987f..43551e690 100644 --- a/xwords4/linux/mqttcon.c +++ b/xwords4/linux/mqttcon.c @@ -52,6 +52,7 @@ loadClientID( LaunchParams* params, MQTTConStorage* storage ) dvc_getMQTTDevID( params->dutil, NULL_XWE, &storage->clientID ); formatMQTTDevID( &storage->clientID, storage->clientIDStr, VSIZE(storage->clientIDStr) ); + XP_ASSERT( 16 == strlen(storage->clientIDStr) ); formatMQTTTopic( &storage->clientID, storage->topic, VSIZE(storage->topic) ); } @@ -238,6 +239,7 @@ mqttc_invite( LaunchParams* params, NetLaunchInfo* nli, const MQTTDevID* invitee MQTTConStorage* storage = getStorage( params ); gchar buf[32]; XP_LOGFF( "need to send to %s", formatMQTTDevID(invitee, buf, sizeof(buf) ) ); + XP_ASSERT( 16 == strlen(buf) ); XWStreamCtxt* stream = mem_stream_make_raw( MPPARM(params->mpool) params->vtMgr );