From 2a708810861d498580df4d13a33ed34070c3b173 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Sat, 23 Jan 2016 12:16:38 +0000 Subject: [PATCH] [QA] Consistent usage of g_stat() GStatBuf parameter type Thus removes some compiler warnings under Windows. --- src/download.c | 2 +- src/vik_compat.h | 4 ++++ src/vikdemlayer.c | 2 +- src/vikmapniklayer.c | 6 +----- src/vikmapslayer.c | 6 +++++- src/vikwindow.c | 4 ---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/download.c b/src/download.c index f839396e..d438f7d7 100644 --- a/src/download.c +++ b/src/download.c @@ -379,7 +379,7 @@ static DownloadResult_t download( const char *hostname, const char *uri, const c time_t tile_age = a_preferences_get(VIKING_PREFERENCES_NAMESPACE "download_tile_age")->u; /* Get the modified time of this file */ - struct stat buf; + GStatBuf buf; (void)g_stat ( fn, &buf ); time_t file_time = buf.st_mtime; if ( (time(NULL) - file_time) < tile_age ) { diff --git a/src/vik_compat.h b/src/vik_compat.h index 0a1b8996..46ed7ba3 100644 --- a/src/vik_compat.h +++ b/src/vik_compat.h @@ -27,6 +27,10 @@ G_BEGIN_DECLS +#if !GLIB_CHECK_VERSION(2,26,0) +typedef struct stat GStatBuf; +#endif + // Hide ifdef complexities of function variants here GMutex * vik_mutex_new (); diff --git a/src/vikdemlayer.c b/src/vikdemlayer.c index 392fd1fe..5e9f7919 100644 --- a/src/vikdemlayer.c +++ b/src/vikdemlayer.c @@ -1233,7 +1233,7 @@ static void dem_layer_file_info ( GtkWidget *widget, struct LatLon *ll ) if ( g_file_test ( filename, G_FILE_TEST_EXISTS ) ) { // Get some timestamp information of the file - struct stat stat_buf; + GStatBuf stat_buf; if ( g_stat ( filename, &stat_buf ) == 0 ) { gchar time_buf[64]; strftime ( time_buf, sizeof(time_buf), "%c", gmtime((const time_t *)&stat_buf.st_mtime) ); diff --git a/src/vikmapniklayer.c b/src/vikmapniklayer.c index 6e33e451..541f0ecb 100644 --- a/src/vikmapniklayer.c +++ b/src/vikmapniklayer.c @@ -47,10 +47,6 @@ #include "vikmapslayer.h" -#if !GLIB_CHECK_VERSION(2,26,0) -typedef struct stat GStatBuf; -#endif - struct _VikMapnikLayerClass { VikLayerClass object_class; @@ -1096,7 +1092,7 @@ static void mapnik_layer_tile_info ( VikMapnikLayer *vml ) if ( g_file_test ( filename, G_FILE_TEST_EXISTS ) ) { filemsg = g_strconcat ( "Tile File: ", filename, NULL ); // Get some timestamp information of the tile - struct stat stat_buf; + GStatBuf stat_buf; if ( g_stat ( filename, &stat_buf ) == 0 ) { gchar time_buf[64]; strftime ( time_buf, sizeof(time_buf), "%c", gmtime((const time_t *)&stat_buf.st_mtime) ); diff --git a/src/vikmapslayer.c b/src/vikmapslayer.c index c0e23752..6b1f9f90 100644 --- a/src/vikmapslayer.c +++ b/src/vikmapslayer.c @@ -1914,6 +1914,10 @@ static void maps_layer_redownload_new ( VikMapsLayer *vml ) start_download_thread ( vml, vml->redownload_vvp, &(vml->redownload_ul), &(vml->redownload_br), REDOWNLOAD_NEW ); } +#if !GLIB_CHECK_VERSION(2,26,0) +typedef struct stat GStatBuf; +#endif + /** * Display a simple dialog with information about this particular map tile */ @@ -1997,7 +2001,7 @@ static void maps_layer_tile_info ( VikMapsLayer *vml ) if ( g_file_test ( filename, G_FILE_TEST_EXISTS ) ) { filemsg = g_strconcat ( "Tile File: ", filename, NULL ); // Get some timestamp information of the tile - struct stat stat_buf; + GStatBuf stat_buf; if ( g_stat ( filename, &stat_buf ) == 0 ) { gchar time_buf[64]; strftime ( time_buf, sizeof(time_buf), "%c", gmtime((const time_t *)&stat_buf.st_mtime) ); diff --git a/src/vikwindow.c b/src/vikwindow.c index 891a2f39..a3bc06b4 100644 --- a/src/vikwindow.c +++ b/src/vikwindow.c @@ -3490,10 +3490,6 @@ static void export_to_kml ( GtkAction *a, VikWindow *vw ) export_to_common ( vw, FILE_TYPE_KML, ".kml" ); } -#if !GLIB_CHECK_VERSION(2,26,0) -typedef struct stat GStatBuf; -#endif - static void file_properties_cb ( GtkAction *a, VikWindow *vw ) { gchar *message = NULL; -- 2.39.5