From 05892c630ee5ce95c045be49896dcd555c039253 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 14 Apr 2018 09:39:27 -0700 Subject: [PATCH] lazy: use glib to avoid gcc warnings --- xwords4/linux/Makefile | 2 +- xwords4/linux/linuxsms.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xwords4/linux/Makefile b/xwords4/linux/Makefile index 2a8b56b68..801a2e8e2 100644 --- a/xwords4/linux/Makefile +++ b/xwords4/linux/Makefile @@ -21,7 +21,7 @@ BUILD_DIR ?= . ifeq ($(MEMDEBUG),TRUE) DEFINES = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING -DNUMBER_KEY_AS_INDEX DEFINES += -DCOMMS_CHECKSUM -CFLAGS += -g $(GPROFFLAG) -Wall -Wunused-parameter -Wcast-align -Werror -O0 -Wno-format-truncation +CFLAGS += -g $(GPROFFLAG) -Wall -Wunused-parameter -Wcast-align -Werror -O0 # DEFINES += -DDEBUG_HASHING CFLAGS += -DDEBUG_TS -rdynamic PLATFORM = obj_linux_memdbg diff --git a/xwords4/linux/linuxsms.c b/xwords4/linux/linuxsms.c index 3c4946cf0..3958a36c9 100644 --- a/xwords4/linux/linuxsms.c +++ b/xwords4/linux/linuxsms.c @@ -85,12 +85,12 @@ static void writeHeader( XWStreamCtxt* stream, SMS_CMD cmd ); static void lock_queue( LinSMSData* storage ) { - char lock[256]; - snprintf( lock, sizeof(lock), "%s/%s", storage->myQueue, LOCK_FILE ); + gchar* lock = g_strdup_printf( "%s/%s", storage->myQueue, LOCK_FILE ); FILE* fp = fopen( lock, "w" ); XP_ASSERT( !!fp ); XP_ASSERT( NULL == storage->lock ); storage->lock = fp; + g_free( lock ); } static void @@ -162,8 +162,7 @@ decodeAndDelete( LinSMSData* storage, const gchar* name, { LOG_FUNC(); XP_S16 nRead = -1; - char path[256]; - snprintf( path, sizeof(path), "%s/%s", storage->myQueue, name ); + gchar* path = g_strdup_printf( "%s/%s", storage->myQueue, name ); gchar* contents; gsize length; @@ -173,6 +172,7 @@ decodeAndDelete( LinSMSData* storage, const gchar* name, g_file_get_contents( path, &contents, &length, NULL ); XP_ASSERT( success ); unlink( path ); + g_free( path ); char phone[32]; int port;