summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2021-10-19 17:32:05 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2021-11-10 17:06:46 +0000
commit3e19bdfb9fb2c2f05a45c99dabc8881de36a4a52 (patch)
tree5f9882c44534c8f65b10d0be239bd281d12ac869
parent5184cdf21d391d01d86d480d4fc2140f5db71d8b (diff)
downloadlibgweather-3e19bdfb9fb2c2f05a45c99dabc8881de36a4a52.tar.gz
Run the code base through the style formatter
Ensure that the changes are consistent.
-rw-r--r--libgweather/gweather-weather.c10
-rw-r--r--libgweather/tests/test_libgweather.c6
-rw-r--r--libgweather/weather-iwin.c6
-rw-r--r--libgweather/weather-metar.c42
-rw-r--r--libgweather/weather-metno.c5
-rw-r--r--libgweather/weather-owm.c9
6 files changed, 41 insertions, 37 deletions
diff --git a/libgweather/gweather-weather.c b/libgweather/gweather-weather.c
index 01343f7..6b2c882 100644
--- a/libgweather/gweather-weather.c
+++ b/libgweather/gweather-weather.c
@@ -376,17 +376,15 @@ _gweather_info_request_done (GWeatherInfo *info,
}
}
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
void
_gweather_info_queue_request (GWeatherInfo *info,
SoupMessage *msg,
GAsyncReadyCallback callback)
{
GCancellable *cancellable = g_cancellable_new ();
- g_object_set_data_full (G_OBJECT (msg), "request-cancellable",
- cancellable, g_object_unref);
- soup_session_send_and_read_async (info->session, msg, G_PRIORITY_DEFAULT,
- cancellable, callback, info);
+ g_object_set_data_full (G_OBJECT (msg), "request-cancellable", cancellable, g_object_unref);
+ soup_session_send_and_read_async (info->session, msg, G_PRIORITY_DEFAULT, cancellable, callback, info);
g_object_unref (msg);
}
#else
@@ -731,7 +729,7 @@ gweather_info_abort (GWeatherInfo *info)
info->requests_pending = &dummy;
for (iter = list; iter; iter = iter->next) {
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
g_cancellable_cancel (g_object_get_data (iter->data, "request-cancellable"));
#else
soup_session_cancel_message (info->session, iter->data, SOUP_STATUS_CANCELLED);
diff --git a/libgweather/tests/test_libgweather.c b/libgweather/tests/test_libgweather.c
index fe25812..ece4851 100644
--- a/libgweather/tests/test_libgweather.c
+++ b/libgweather/tests/test_libgweather.c
@@ -403,7 +403,7 @@ test_metar_weather_stations (void)
SoupSession *session;
GHashTable *stations_ht;
char *contents;
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
GBytes *body;
GError *error = NULL;
gsize bsize;
@@ -414,7 +414,7 @@ test_metar_weather_stations (void)
msg = soup_message_new ("GET", METAR_SOURCES);
session = soup_session_new ();
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
body = soup_session_send_and_read (session, msg, NULL, &error);
if (error && error->domain == G_TLS_ERROR) {
#else
@@ -425,7 +425,7 @@ test_metar_weather_stations (void)
g_test_failed ();
return;
}
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
g_assert_no_error (error);
g_assert_cmpint (soup_message_get_status (msg), >=, 200);
g_assert_cmpint (soup_message_get_status (msg), <, 300);
diff --git a/libgweather/weather-iwin.c b/libgweather/weather-iwin.c
index 1176553..b6a19cf 100644
--- a/libgweather/weather-iwin.c
+++ b/libgweather/weather-iwin.c
@@ -298,7 +298,7 @@ parseForecastXml (const char *buff, GWeatherInfo *original_info)
return res;
}
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
static void
iwin_finish (GObject *source, GAsyncResult *result, gpointer data)
{
@@ -325,8 +325,8 @@ iwin_finish (GObject *source, GAsyncResult *result, gpointer data)
} else if (!SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (msg))) {
g_bytes_unref (body);
g_warning ("Failed to get IWIN forecast data: %d %s\n",
- soup_message_get_status (msg),
- soup_message_get_reason_phrase (msg));
+ soup_message_get_status (msg),
+ soup_message_get_reason_phrase (msg));
_gweather_info_request_done (data, msg);
return;
}
diff --git a/libgweather/weather-metar.c b/libgweather/weather-metar.c
index 9460076..e82a917 100644
--- a/libgweather/weather-metar.c
+++ b/libgweather/weather-metar.c
@@ -546,7 +546,7 @@ metar_parse (gchar *metar, GWeatherInfo *info)
return TRUE;
}
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
static void
metar_finish (GObject *source, GAsyncResult *result, gpointer data)
#else
@@ -554,7 +554,7 @@ static void
metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
#endif
{
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
SoupSession *session = SOUP_SESSION (source);
SoupMessage *msg = soup_session_get_async_result_message (session, result);
GError *error = NULL;
@@ -568,7 +568,7 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
info = data;
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
body = soup_session_send_and_read_finish (session, result, &error);
if (!body) {
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
@@ -647,7 +647,7 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
if (!info->valid)
info->valid = success;
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
g_bytes_unref (body);
#endif
_gweather_info_request_done (info, msg);
@@ -659,7 +659,7 @@ metar_start_open (GWeatherInfo *info)
{
WeatherLocation *loc;
SoupMessage *msg;
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
GUri *uri;
#else
SoupURI *uri;
@@ -676,19 +676,27 @@ metar_start_open (GWeatherInfo *info)
g_debug ("metar_start_open, requesting: https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&hoursBeforeNow=3&mostRecent=true&fields=raw_text&stationString=%s", loc->code);
query = soup_form_encode (
- "dataSource", "metars",
- "requestType", "retrieve",
- "format", "xml",
- "hoursBeforeNow", "3",
- "mostRecent", "true",
- "fields", "raw_text",
- "stationString", loc->code,
- NULL
- );
-#if SOUP_CHECK_VERSION (2, 99, 2)
+ "dataSource",
+ "metars",
+ "requestType",
+ "retrieve",
+ "format",
+ "xml",
+ "hoursBeforeNow",
+ "3",
+ "mostRecent",
+ "true",
+ "fields",
+ "raw_text",
+ "stationString",
+ loc->code,
+ NULL);
+#if SOUP_CHECK_VERSION(2, 99, 2)
uri = g_uri_build (SOUP_HTTP_URI_FLAGS,
- "https", NULL,
- "www.aviationweather.gov", -1,
+ "https",
+ NULL,
+ "www.aviationweather.gov",
+ -1,
"/adds/dataserver_current/httpparam",
query,
NULL);
diff --git a/libgweather/weather-metno.c b/libgweather/weather-metno.c
index 242a8dd..94c568c 100644
--- a/libgweather/weather-metno.c
+++ b/libgweather/weather-metno.c
@@ -378,7 +378,7 @@ out:
xmlFreeDoc (doc);
}
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
static void
metno_finish_new (GObject *source,
GAsyncResult *result,
@@ -460,8 +460,7 @@ metno_finish_new (SoupSession *session,
g_debug ("metno data for %lf, %lf", loc->latitude, loc->longitude);
g_debug ("%s", msg->response_body->data);
- parse_forecast_xml_new (info, msg->response_body->data,
- msg->response_body->length);
+ parse_forecast_xml_new (info, msg->response_body->data, msg->response_body->length);
num_forecasts = g_slist_length (info->forecast_list);
g_debug ("metno parsed %d forecast infos", num_forecasts);
if (!info->valid)
diff --git a/libgweather/weather-owm.c b/libgweather/weather-owm.c
index 10b06cd..754fbb0 100644
--- a/libgweather/weather-owm.c
+++ b/libgweather/weather-owm.c
@@ -390,7 +390,7 @@ out:
xmlFreeDoc (doc);
}
-#if SOUP_CHECK_VERSION (2, 99, 2)
+#if SOUP_CHECK_VERSION(2, 99, 2)
static void
owm_finish (GObject *source,
GAsyncResult *result,
@@ -422,8 +422,8 @@ owm_finish (GObject *source,
} else if (!SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (msg))) {
g_bytes_unref (body);
g_warning ("Failed to get OpenWeatherMap forecast data: %d %s\n",
- soup_message_get_status (msg),
- soup_message_get_reason_phrase (msg));
+ soup_message_get_status (msg),
+ soup_message_get_reason_phrase (msg));
_gweather_info_request_done (data, msg);
return;
}
@@ -468,8 +468,7 @@ owm_finish (SoupSession *session,
g_debug ("owm data for %lf, %lf", loc->latitude, loc->longitude);
g_debug ("%s", msg->response_body->data);
- parse_forecast_xml (info, msg->response_body->data,
- msg->response_body->length);
+ parse_forecast_xml (info, msg->response_body->data, msg->response_body->length);
_gweather_info_request_done (info, msg);
}
#endif