summaryrefslogtreecommitdiff
path: root/libmateweather
diff options
context:
space:
mode:
Diffstat (limited to 'libmateweather')
-rw-r--r--libmateweather/mateweather-location.c9
-rw-r--r--libmateweather/mateweather-prefs.h2
-rw-r--r--libmateweather/mateweather-timezone.c15
-rw-r--r--libmateweather/test_metar.c2
-rw-r--r--libmateweather/test_sun_moon.c2
-rw-r--r--libmateweather/weather-met.c1
-rw-r--r--libmateweather/weather-metar.c2
-rw-r--r--libmateweather/weather-moon.c1
-rw-r--r--libmateweather/weather-priv.h1
-rw-r--r--libmateweather/weather-sun.c4
-rw-r--r--libmateweather/weather.c9
-rw-r--r--libmateweather/weather.h3
12 files changed, 17 insertions, 34 deletions
diff --git a/libmateweather/mateweather-location.c b/libmateweather/mateweather-location.c
index 30d33bd..9c13c13 100644
--- a/libmateweather/mateweather-location.c
+++ b/libmateweather/mateweather-location.c
@@ -397,16 +397,16 @@ mateweather_location_unref (MateWeatherLocation *loc)
GType
mateweather_location_get_type (void)
{
- static volatile gsize type_volatile = 0;
+ static gsize initialization_value = 0;
- if (g_once_init_enter (&type_volatile)) {
+ if (g_once_init_enter (&initialization_value)) {
GType type = g_boxed_type_register_static (
g_intern_static_string ("MateWeatherLocation"),
(GBoxedCopyFunc) mateweather_location_ref,
(GBoxedFreeFunc) mateweather_location_unref);
- g_once_init_leave (&type_volatile, type);
+ g_once_init_leave (&initialization_value, type);
}
- return type_volatile;
+ return initialization_value;
}
/**
@@ -502,7 +502,6 @@ mateweather_location_get_children (MateWeatherLocation *loc)
return &no_children;
}
-
/**
* mateweather_location_free_children:
* @loc: a #MateWeatherLocation
diff --git a/libmateweather/mateweather-prefs.h b/libmateweather/mateweather-prefs.h
index c7a3743..5bd55cb 100644
--- a/libmateweather/mateweather-prefs.h
+++ b/libmateweather/mateweather-prefs.h
@@ -19,12 +19,10 @@
#ifndef __MATEWEATHER_PREFS_H_
#define __MATEWEATHER_PREFS_H_
-
#ifndef MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
#error "libmateweather should only be used if you understand that it's subject to change, and is not supported as a fixed API/ABI or as part of the platform"
#endif
-
#include <libmateweather/weather.h>
#include <gio/gio.h>
diff --git a/libmateweather/mateweather-timezone.c b/libmateweather/mateweather-timezone.c
index a87c011..3b4c790 100644
--- a/libmateweather/mateweather-timezone.c
+++ b/libmateweather/mateweather-timezone.c
@@ -62,6 +62,7 @@ parse_tzdata (const char *tzname, time_t start, time_t end,
int *offset, gboolean *has_dst, int *dst_offset)
{
char *filename, *contents;
+ const char *tzdir;
gsize length;
int timecnt, transitions_size, ttinfo_map_size;
int initial_transition = -1, second_transition = -1;
@@ -71,7 +72,10 @@ parse_tzdata (const char *tzname, time_t start, time_t end,
char initial_isdst, second_isdst;
int i;
- filename = g_build_filename (ZONEINFO_DIR, tzname, NULL);
+ tzdir = g_getenv ("TZDIR");
+ if (tzdir == NULL)
+ tzdir = ZONEINFO_DIR;
+ filename = g_build_filename (tzdir, tzname, NULL);
if (!g_file_get_contents (filename, &contents, &length, NULL)) {
g_free (filename);
return FALSE;
@@ -285,16 +289,16 @@ mateweather_timezone_unref (MateWeatherTimezone *zone)
GType
mateweather_timezone_get_type (void)
{
- static volatile gsize type_volatile = 0;
+ static gsize initialization_value = 0;
- if (g_once_init_enter (&type_volatile)) {
+ if (g_once_init_enter (&initialization_value)) {
GType type = g_boxed_type_register_static (
g_intern_static_string ("MateWeatherTimezone"),
(GBoxedCopyFunc) mateweather_timezone_ref,
(GBoxedFreeFunc) mateweather_timezone_unref);
- g_once_init_leave (&type_volatile, type);
+ g_once_init_leave (&initialization_value, type);
}
- return type_volatile;
+ return initialization_value;
}
/**
@@ -403,4 +407,3 @@ mateweather_timezone_get_dst_offset (MateWeatherTimezone *zone)
g_return_val_if_fail (zone->has_dst, 0);
return zone->dst_offset;
}
-
diff --git a/libmateweather/test_metar.c b/libmateweather/test_metar.c
index b36e4d9..cbde991 100644
--- a/libmateweather/test_metar.c
+++ b/libmateweather/test_metar.c
@@ -21,7 +21,7 @@ main (int argc, char **argv)
GOptionEntry entries[] = {
{ "file", 'f', 0, G_OPTION_ARG_FILENAME, &filename,
"file constaining metar observations", NULL },
- { NULL }
+ { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
};
GOptionContext* context;
GError* error = NULL;
diff --git a/libmateweather/test_sun_moon.c b/libmateweather/test_sun_moon.c
index abcded7..9107b5f 100644
--- a/libmateweather/test_sun_moon.c
+++ b/libmateweather/test_sun_moon.c
@@ -27,7 +27,7 @@ main (int argc, char **argv)
"observer's longitude in degrees east", NULL },
{ "time", 0, 0, G_OPTION_ARG_STRING, &gtime,
"time in seconds from Unix epoch", NULL },
- { NULL }
+ { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
};
memset(&location, 0, sizeof(WeatherLocation));
diff --git a/libmateweather/weather-met.c b/libmateweather/weather-met.c
index 815a364..164e9f2 100644
--- a/libmateweather/weather-met.c
+++ b/libmateweather/weather-met.c
@@ -112,7 +112,6 @@ met_reprocess (char *x, int len)
return buf;
}
-
/*
* Parse the metoffice forecast info.
* For mate 3.0 we want to just embed an HTML matecomponent component and
diff --git a/libmateweather/weather-metar.c b/libmateweather/weather-metar.c
index a9f3c84..7bc24fc 100644
--- a/libmateweather/weather-metar.c
+++ b/libmateweather/weather-metar.c
@@ -550,7 +550,7 @@ metar_start_open (WeatherInfo *info)
}
msg = soup_form_request_new (
- "GET", "https://www.aviationweather.gov/adds/dataserver_current/httpparam",
+ "GET", "https://aviationweather.gov/cgi-bin/data/dataserver.php",
"dataSource", "metars",
"requestType", "retrieve",
"format", "xml",
diff --git a/libmateweather/weather-moon.c b/libmateweather/weather-moon.c
index 1541efc..feb98ba 100644
--- a/libmateweather/weather-moon.c
+++ b/libmateweather/weather-moon.c
@@ -137,7 +137,6 @@ calc_moon (WeatherInfo *info)
return TRUE;
}
-
/**
* calc_moon_phases:
* @info: WeatherInfo containing the time_t of interest
diff --git a/libmateweather/weather-priv.h b/libmateweather/weather-priv.h
index 08c828e..817f13c 100644
--- a/libmateweather/weather-priv.h
+++ b/libmateweather/weather-priv.h
@@ -35,7 +35,6 @@ const char *mateweather_dpgettext (const char *context, const char *str) G_GNUC_
#define C_(context, str) (mateweather_dpgettext (context, str))
#define N_(str) (str)
-
#define WEATHER_LOCATION_CODE_LEN 4
WeatherLocation *mateweather_location_to_weather_location (MateWeatherLocation *gloc,
diff --git a/libmateweather/weather-sun.c b/libmateweather/weather-sun.c
index 0c2f708..3db5526 100644
--- a/libmateweather/weather-sun.c
+++ b/libmateweather/weather-sun.c
@@ -146,7 +146,6 @@ gstObsv (gdouble ra, gdouble decl,
*rise = b;
}
-
static gdouble
t0 (time_t date)
{
@@ -157,7 +156,6 @@ t0 (time_t date)
return t0;
}
-
static gboolean
calc_sun2 (WeatherInfo *info, time_t t)
{
@@ -285,7 +283,6 @@ calc_sun2 (WeatherInfo *info, time_t t)
return (info->sunriseValid || info->sunsetValid);
}
-
/**
* calc_sun_time:
* @info: #WeatherInfo structure containing the observer's latitude
@@ -313,7 +310,6 @@ calc_sun (WeatherInfo *info)
return calc_sun_time(info, time(NULL));
}
-
/**
* weather_info_next_sun_event:
* @info: #WeatherInfo structure
diff --git a/libmateweather/weather.c b/libmateweather/weather.c
index 5b7bbe4..86453fc 100644
--- a/libmateweather/weather.c
+++ b/libmateweather/weather.c
@@ -50,7 +50,6 @@
static void _weather_internal_check (void);
-
static inline void
mateweather_gettext_init (void)
{
@@ -267,7 +266,6 @@ weather_sky_string (WeatherSky sky)
return _(sky_str[(int)sky]);
}
-
/*
* Even though tedious, I switched to a 2D array for weather condition
* strings, in order to facilitate internationalization, esp. for languages
@@ -341,7 +339,6 @@ weather_conditions_string (WeatherConditions cond)
/* Locals turned global to facilitate asynchronous HTTP requests */
-
gboolean
requests_init (WeatherInfo *info)
{
@@ -553,9 +550,7 @@ _weather_info_fill (WeatherInfo *info,
info->cb_data = data;
if (!info->session) {
- info->session = soup_session_async_new ();
- soup_session_add_feature_by_type (info->session, SOUP_TYPE_PROXY_RESOLVER_DEFAULT);
- g_object_set (G_OBJECT (info->session), "ssl-use-system-ca-file", TRUE, NULL);
+ info->session = soup_session_new ();
}
metar_start_open (info);
@@ -588,11 +583,9 @@ weather_info_clone (const WeatherInfo *info)
clone = g_new (WeatherInfo, 1);
-
/* move everything */
memmove (clone, info, sizeof (WeatherInfo));
-
/* special moves */
clone->location = weather_location_clone (info->location);
/* This handles null correctly */
diff --git a/libmateweather/weather.h b/libmateweather/weather.h
index 204e095..842975d 100644
--- a/libmateweather/weather.h
+++ b/libmateweather/weather.h
@@ -19,12 +19,10 @@
#ifndef __WEATHER_H_
#define __WEATHER_H_
-
#ifndef MATEWEATHER_I_KNOW_THIS_IS_UNSTABLE
#error "libmateweather should only be used if you understand that it's subject to change, and is not supported as a fixed API/ABI or as part of the platform"
#endif
-
#include <gdk-pixbuf/gdk-pixbuf.h>
#ifdef __cplusplus
@@ -280,7 +278,6 @@ gboolean weather_info_get_value_sunset (WeatherInfo *info, time_t *value);
gboolean weather_info_get_value_moonphase (WeatherInfo *info, WeatherMoonPhase *value, WeatherMoonLatitude *lat);
gboolean weather_info_get_upcoming_moonphases (WeatherInfo *info, time_t *phases);
-
#ifdef __cplusplus
}
#endif