From 6c26c6bba9a620e6fef782b948224d50055da9c3 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 24 Dec 2011 13:00:02 +0100 Subject: [PATCH] =?utf8?q?Rimosso=20il=20parametro=20format=20a=20SolipaUt?= =?utf8?q?ils::gdate=5Fto=5Fsql=20perch=C3=A9=20inutile.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/utils.c | 21 ++++++++++++--------- src/utils.h | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/utils.c b/src/utils.c index 656cdb9..5b62d86 100644 --- a/src/utils.c +++ b/src/utils.c @@ -886,7 +886,7 @@ GDateTime GDateTime *ret; ret = NULL; - if (g_date_valid (gdate)) + if (gdate != NULL && g_date_valid (gdate)) { ret = g_date_time_new_local (g_date_get_year (gdate), g_date_get_month (gdate), @@ -902,10 +902,14 @@ GDate { GDate *ret; - ret = g_new0 (GDate, 1); - g_date_set_year (ret, g_date_time_get_year (gdatetime)); - g_date_set_month (ret, g_date_time_get_month (gdatetime)); - g_date_set_day (ret, g_date_time_get_day_of_month (gdatetime)); + ret = NULL; + if (gdatetime != NULL) + { + ret = g_new0 (GDate, 1); + g_date_set_year (ret, g_date_time_get_year (gdatetime)); + g_date_set_month (ret, g_date_time_get_month (gdatetime)); + g_date_set_day (ret, g_date_time_get_day_of_month (gdatetime)); + } return ret; } @@ -925,17 +929,16 @@ const gchar return ret; } - const gchar -*solipa_gdate_to_sql (GDate *gdate, const gchar *format) +*solipa_gdate_to_sql (GDate *gdate) { const gchar *ret; ret = g_strdup ("NULL"); - if (g_date_valid (gdate)) + if (gdate != NULL && g_date_valid (gdate)) { - ret = solipa_gdatetime_to_sql (solipa_gdate_to_gdatetime (gdate), format); + ret = solipa_gdatetime_to_sql (solipa_gdate_to_gdatetime (gdate), "date"); } return ret; diff --git a/src/utils.h b/src/utils.h index 7312840..22737ea 100644 --- a/src/utils.h +++ b/src/utils.h @@ -68,7 +68,7 @@ GDateTime *solipa_gdate_to_gdatetime (GDate *gdate); GDate *solipa_gdatetime_to_gdate (GDateTime *gdatetime); const gchar *solipa_tm_to_sql (struct tm *tm_data, const gchar *format); -const gchar *solipa_gdate_to_sql (GDate *gdate, const gchar *format); +const gchar *solipa_gdate_to_sql (GDate *gdate); const gchar *solipa_gdatetime_to_sql (GDateTime *gdatetime, const gchar *format); GDate *solipa_get_gdate_from_string (const gchar *string, const gchar *format); -- 2.49.0