lazy: use glib to avoid gcc warnings

This commit is contained in:
Eric House 2018-04-14 09:39:27 -07:00
parent 3bb6f842b2
commit 05892c630e
2 changed files with 5 additions and 5 deletions

View file

@ -21,7 +21,7 @@ BUILD_DIR ?= .
ifeq ($(MEMDEBUG),TRUE) ifeq ($(MEMDEBUG),TRUE)
DEFINES = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING -DNUMBER_KEY_AS_INDEX DEFINES = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING -DNUMBER_KEY_AS_INDEX
DEFINES += -DCOMMS_CHECKSUM 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 # DEFINES += -DDEBUG_HASHING
CFLAGS += -DDEBUG_TS -rdynamic CFLAGS += -DDEBUG_TS -rdynamic
PLATFORM = obj_linux_memdbg PLATFORM = obj_linux_memdbg

View file

@ -85,12 +85,12 @@ static void writeHeader( XWStreamCtxt* stream, SMS_CMD cmd );
static void static void
lock_queue( LinSMSData* storage ) lock_queue( LinSMSData* storage )
{ {
char lock[256]; gchar* lock = g_strdup_printf( "%s/%s", storage->myQueue, LOCK_FILE );
snprintf( lock, sizeof(lock), "%s/%s", storage->myQueue, LOCK_FILE );
FILE* fp = fopen( lock, "w" ); FILE* fp = fopen( lock, "w" );
XP_ASSERT( !!fp ); XP_ASSERT( !!fp );
XP_ASSERT( NULL == storage->lock ); XP_ASSERT( NULL == storage->lock );
storage->lock = fp; storage->lock = fp;
g_free( lock );
} }
static void static void
@ -162,8 +162,7 @@ decodeAndDelete( LinSMSData* storage, const gchar* name,
{ {
LOG_FUNC(); LOG_FUNC();
XP_S16 nRead = -1; XP_S16 nRead = -1;
char path[256]; gchar* path = g_strdup_printf( "%s/%s", storage->myQueue, name );
snprintf( path, sizeof(path), "%s/%s", storage->myQueue, name );
gchar* contents; gchar* contents;
gsize length; gsize length;
@ -173,6 +172,7 @@ decodeAndDelete( LinSMSData* storage, const gchar* name,
g_file_get_contents( path, &contents, &length, NULL ); g_file_get_contents( path, &contents, &length, NULL );
XP_ASSERT( success ); XP_ASSERT( success );
unlink( path ); unlink( path );
g_free( path );
char phone[32]; char phone[32];
int port; int port;