diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-05-27 23:13:25 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-05-29 00:13:23 +0800 |
commit | fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056 (patch) | |
tree | ae78be371695c3dc18847b87d3f014f985aa3a40 /plugins/save-calendar | |
parent | 6f5464f34ceec9e5701e3e3e651a40f9e6b3a072 (diff) | |
download | gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.gz gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.bz2 gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.lz gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.xz gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.zst gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.zip |
Prefer GLib basic types over C types.
Diffstat (limited to 'plugins/save-calendar')
-rw-r--r-- | plugins/save-calendar/csv-format.c | 20 | ||||
-rw-r--r-- | plugins/save-calendar/format-handler.h | 4 | ||||
-rw-r--r-- | plugins/save-calendar/ical-format.c | 10 | ||||
-rw-r--r-- | plugins/save-calendar/rdf-format.c | 58 | ||||
-rw-r--r-- | plugins/save-calendar/save-calendar.c | 8 |
5 files changed, 50 insertions, 50 deletions
diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c index 2f9c92d6f7..4e59b80edd 100644 --- a/plugins/save-calendar/csv-format.c +++ b/plugins/save-calendar/csv-format.c @@ -47,7 +47,7 @@ struct _CsvConfig { gboolean header; }; -static gboolean string_needsquotes (const char *value, CsvConfig *config); +static gboolean string_needsquotes (const gchar *value, CsvConfig *config); typedef struct _CsvPluginData CsvPluginData; struct _CsvPluginData @@ -93,7 +93,7 @@ add_list_to_csv (GString *line, GSList *list_in, CsvConfig *config, gint type) GString *tmp = NULL; gint cnt=0; while (list) { - const char *str = NULL; + const gchar *str = NULL; if (cnt == 0) tmp = g_string_new (""); if (cnt > 0) @@ -113,7 +113,7 @@ add_list_to_csv (GString *line, GSList *list_in, CsvConfig *config, gint type) if (!needquotes) needquotes = string_needsquotes (str, config); if (str) - tmp = g_string_append (tmp, (const gchar*)str); + tmp = g_string_append (tmp, (const gchar *)str); list = g_slist_next (list); cnt++; if (list) tmp = g_string_append (tmp, config->delimiter); @@ -154,7 +154,7 @@ add_time_to_csv (GString *line, icaltimetype *time, CsvConfig *config) if (time) { gboolean needquotes = FALSE; struct tm mytm = icaltimetype_to_tm (time); - gchar *str = (gchar*) g_malloc (sizeof (gchar) * 200); + gchar *str = (gchar *) g_malloc (sizeof (gchar) * 200); /* * Translator: the %F %T is the thirth argument for a strftime function. @@ -182,7 +182,7 @@ add_time_to_csv (GString *line, icaltimetype *time, CsvConfig *config) } static gboolean -string_needsquotes (const char *value, CsvConfig *config) +string_needsquotes (const gchar *value, CsvConfig *config) { /* This is the actual need for quotes-checker */ @@ -243,7 +243,7 @@ string_needsquotes (const char *value, CsvConfig *config) } static GString * -add_string_to_csv (GString *line, const char *value, CsvConfig *config) +add_string_to_csv (GString *line, const gchar *value, CsvConfig *config) { /* Will add a string to the record and will check for the need for quotes */ @@ -252,7 +252,7 @@ add_string_to_csv (GString *line, const char *value, CsvConfig *config) if (needquotes) line = g_string_append (line, config->quote); - line = g_string_append (line, (const gchar*)value); + line = g_string_append (line, (const gchar *)value); if (needquotes) line = g_string_append (line, config->quote); } @@ -303,7 +303,7 @@ userstring_to_systemstring (const gchar *userstring) } static void -do_save_calendar_csv (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, char *dest_uri) +do_save_calendar_csv (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, gchar *dest_uri) { /* @@ -393,11 +393,11 @@ do_save_calendar_csv (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource while (objects != NULL) { ECalComponent *comp = objects->data; gchar *delimiter_temp = NULL; - const char *temp_constchar; + const gchar *temp_constchar; GSList *temp_list; ECalComponentDateTime temp_dt; struct icaltimetype *temp_time; - int *temp_int; + gint *temp_int; ECalComponentText temp_comptext; line = g_string_new (""); diff --git a/plugins/save-calendar/format-handler.h b/plugins/save-calendar/format-handler.h index a7bc2e8d85..f9e15dc771 100644 --- a/plugins/save-calendar/format-handler.h +++ b/plugins/save-calendar/format-handler.h @@ -43,11 +43,11 @@ struct _FormatHandler gpointer data; - void (*save) (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, char *dest_uri); + void (*save) (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, gchar *dest_uri); }; FormatHandler *csv_format_handler_new (void); FormatHandler *ical_format_handler_new (void); FormatHandler *rdf_format_handler_new (void); -GOutputStream *open_for_writing (GtkWindow *parent, const char *uri, GError **error); +GOutputStream *open_for_writing (GtkWindow *parent, const gchar *uri, GError **error); diff --git a/plugins/save-calendar/ical-format.c b/plugins/save-calendar/ical-format.c index f538a9e0a1..3b54176284 100644 --- a/plugins/save-calendar/ical-format.c +++ b/plugins/save-calendar/ical-format.c @@ -39,7 +39,7 @@ #include "e-util/e-error.h" static void -display_error_message (GtkWidget *parent, const char *message) +display_error_message (GtkWidget *parent, const gchar *message) { GtkWidget *dialog; @@ -54,9 +54,9 @@ typedef struct { } CompTzData; static void -insert_tz_comps (icalparameter *param, void *cb_data) +insert_tz_comps (icalparameter *param, gpointer cb_data) { - const char *tzid; + const gchar *tzid; CompTzData *tdata = cb_data; icaltimezone *zone = NULL; icalcomponent *tzcomp; @@ -84,7 +84,7 @@ append_tz_to_comp (gpointer key, gpointer value, icalcomponent *toplevel) } static void -do_save_calendar_ical (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, char *dest_uri) +do_save_calendar_ical (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, gchar *dest_uri) { ESource *primary_source; ECal *source_client; @@ -136,7 +136,7 @@ do_save_calendar_ical (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSourc stream = open_for_writing (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (target->selector))), dest_uri, &error); if (stream) { - char *ical_str = icalcomponent_as_ical_string_r (top_level); + gchar *ical_str = icalcomponent_as_ical_string_r (top_level); g_output_stream_write_all (stream, ical_str, strlen (ical_str), NULL, NULL, &error); g_output_stream_close (stream, NULL, NULL); diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c index 9c9f864a2a..685fbdd6e5 100644 --- a/plugins/save-calendar/rdf-format.c +++ b/plugins/save-calendar/rdf-format.c @@ -45,7 +45,7 @@ #include "format-handler.h" static void -add_string_to_rdf (xmlNodePtr node, const gchar *tag, const char *value); +add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value); /* Use { */ @@ -100,7 +100,7 @@ add_list_to_rdf (xmlNodePtr node, const gchar *tag, GSList *list_in, gint type) GSList *list = list_in; while (list) { - const char *str = NULL; + const gchar *str = NULL; switch (type) { case ECALCOMPONENTATTENDEE: @@ -127,8 +127,8 @@ add_nummeric_to_rdf (xmlNodePtr node, const gchar *tag, gint *nummeric) { if (nummeric) { gchar *value = g_strdup_printf ("%d", *nummeric); - xmlNodePtr cur_node = xmlNewChild (node, NULL, (unsigned char *)tag, (unsigned char *)value); - xmlSetProp (cur_node, (const unsigned char *)"rdf:datatype", (const unsigned char *)"http://www.w3.org/2001/XMLSchema#integer"); + xmlNodePtr cur_node = xmlNewChild (node, NULL, (guchar *)tag, (guchar *)value); + xmlSetProp (cur_node, (const guchar *)"rdf:datatype", (const guchar *)"http://www.w3.org/2001/XMLSchema#integer"); g_free (value); } } @@ -139,7 +139,7 @@ add_time_to_rdf (xmlNodePtr node, const gchar *tag, icaltimetype *time) if (time) { xmlNodePtr cur_node = NULL; struct tm mytm = icaltimetype_to_tm (time); - gchar *str = (gchar*) g_malloc (sizeof (gchar) * 200); + gchar *str = (gchar *) g_malloc (sizeof (gchar) * 200); gchar *tmp = NULL; gchar *timezone; /* @@ -149,12 +149,12 @@ add_time_to_rdf (xmlNodePtr node, const gchar *tag, icaltimetype *time) * */ e_utf8_strftime (str, 200, _("%FT%T"), &mytm); - cur_node = xmlNewChild (node, NULL, (unsigned char *)tag, (unsigned char *)str); + cur_node = xmlNewChild (node, NULL, (guchar *)tag, (guchar *)str); /* Not sure about this property */ timezone = calendar_config_get_timezone (); tmp = g_strdup_printf ("http://www.w3.org/2002/12/cal/tzd/%s#tz", timezone); - xmlSetProp (cur_node, (const unsigned char *)"rdf:datatype", (unsigned char *)tmp); + xmlSetProp (cur_node, (const guchar *)"rdf:datatype", (guchar *)tmp); g_free (tmp); g_free (timezone); g_free (str); @@ -163,12 +163,12 @@ add_time_to_rdf (xmlNodePtr node, const gchar *tag, icaltimetype *time) static void -add_string_to_rdf (xmlNodePtr node, const gchar *tag, const char *value) +add_string_to_rdf (xmlNodePtr node, const gchar *tag, const gchar *value) { if (value) { xmlNodePtr cur_node = NULL; - cur_node = xmlNewChild (node, NULL, (unsigned char *)tag, (unsigned char *)value); - xmlSetProp (cur_node, (const unsigned char *)"rdf:datatype", (const unsigned char *)"http://www.w3.org/2001/XMLSchema#string"); + cur_node = xmlNewChild (node, NULL, (guchar *)tag, (guchar *)value); + xmlSetProp (cur_node, (const guchar *)"rdf:datatype", (const guchar *)"http://www.w3.org/2001/XMLSchema#string"); } } @@ -176,7 +176,7 @@ add_string_to_rdf (xmlNodePtr node, const gchar *tag, const char *value) static void -do_save_calendar_rdf (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, char *dest_uri) +do_save_calendar_rdf (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, gchar *dest_uri) { /* @@ -216,51 +216,51 @@ do_save_calendar_rdf (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource xmlDocPtr doc = xmlNewDoc((xmlChar *) "1.0"); xmlNodePtr fnode = doc->children; - doc->children = xmlNewDocNode (doc, NULL, (const unsigned char *)"rdf:RDF", NULL); - xmlSetProp (doc->children, (const unsigned char *)"xmlns:rdf", (const unsigned char *)"http://www.w3.org/1999/02/22-rdf-syntax-ns#"); - xmlSetProp (doc->children, (const unsigned char *)"xmlns", (const unsigned char *)"http://www.w3.org/2002/12/cal/ical#"); + doc->children = xmlNewDocNode (doc, NULL, (const guchar *)"rdf:RDF", NULL); + xmlSetProp (doc->children, (const guchar *)"xmlns:rdf", (const guchar *)"http://www.w3.org/1999/02/22-rdf-syntax-ns#"); + xmlSetProp (doc->children, (const guchar *)"xmlns", (const guchar *)"http://www.w3.org/2002/12/cal/ical#"); - fnode = xmlNewChild (doc->children, NULL, (const unsigned char *)"Vcalendar", NULL); + fnode = xmlNewChild (doc->children, NULL, (const guchar *)"Vcalendar", NULL); /* Should Evolution publicise these? */ - xmlSetProp (fnode, (const unsigned char *)"xmlns:x-wr", (const unsigned char *)"http://www.w3.org/2002/12/cal/prod/Apple_Comp_628d9d8459c556fa#"); - xmlSetProp (fnode, (const unsigned char *)"xmlns:x-lic", (const unsigned char *)"http://www.w3.org/2002/12/cal/prod/Apple_Comp_628d9d8459c556fa#"); + xmlSetProp (fnode, (const guchar *)"xmlns:x-wr", (const guchar *)"http://www.w3.org/2002/12/cal/prod/Apple_Comp_628d9d8459c556fa#"); + xmlSetProp (fnode, (const guchar *)"xmlns:x-lic", (const guchar *)"http://www.w3.org/2002/12/cal/prod/Apple_Comp_628d9d8459c556fa#"); /* Not sure if it's correct like this */ - xmlNewChild (fnode, NULL, (const unsigned char *)"prodid", (const unsigned char *)"-//" PACKAGE_STRING "//iCal 1.0//EN"); + xmlNewChild (fnode, NULL, (const guchar *)"prodid", (const guchar *)"-//" PACKAGE_STRING "//iCal 1.0//EN"); /* Assuming GREGORIAN is the only supported calendar scale */ - xmlNewChild (fnode, NULL, (const unsigned char *)"calscale", (const unsigned char *)"GREGORIAN"); + xmlNewChild (fnode, NULL, (const guchar *)"calscale", (const guchar *)"GREGORIAN"); temp = calendar_config_get_timezone (); - xmlNewChild (fnode, NULL, (const unsigned char *)"x-wr:timezone", (unsigned char *)temp); + xmlNewChild (fnode, NULL, (const guchar *)"x-wr:timezone", (guchar *)temp); g_free (temp); - xmlNewChild (fnode, NULL, (const unsigned char *)"method", (const unsigned char *)"PUBLISH"); + xmlNewChild (fnode, NULL, (const guchar *)"method", (const guchar *)"PUBLISH"); - xmlNewChild (fnode, NULL, (const unsigned char *)"x-wr:relcalid", (unsigned char *)e_source_peek_uid (primary_source)); + xmlNewChild (fnode, NULL, (const guchar *)"x-wr:relcalid", (guchar *)e_source_peek_uid (primary_source)); - xmlNewChild (fnode, NULL, (const unsigned char *)"x-wr:calname", (unsigned char *)e_source_peek_name (primary_source)); + xmlNewChild (fnode, NULL, (const guchar *)"x-wr:calname", (guchar *)e_source_peek_name (primary_source)); /* Version of this RDF-format */ - xmlNewChild (fnode, NULL, (const unsigned char *)"version", (const unsigned char *)"2.0"); + xmlNewChild (fnode, NULL, (const guchar *)"version", (const guchar *)"2.0"); while (objects != NULL) { ECalComponent *comp = objects->data; - const char *temp_constchar; + const gchar *temp_constchar; gchar *tmp_str = NULL; GSList *temp_list; ECalComponentDateTime temp_dt; struct icaltimetype *temp_time; - int *temp_int; + gint *temp_int; ECalComponentText temp_comptext; - xmlNodePtr c_node = xmlNewChild (fnode, NULL, (const unsigned char *)"component", NULL); - xmlNodePtr node = xmlNewChild (c_node, NULL, (const unsigned char *)"Vevent", NULL); + xmlNodePtr c_node = xmlNewChild (fnode, NULL, (const guchar *)"component", NULL); + xmlNodePtr node = xmlNewChild (c_node, NULL, (const guchar *)"Vevent", NULL); /* Getting the stuff */ e_cal_component_get_uid (comp, &temp_constchar); tmp_str = g_strdup_printf ("#%s", temp_constchar); - xmlSetProp (node, (const unsigned char *)"about", (unsigned char *)tmp_str); + xmlSetProp (node, (const guchar *)"about", (guchar *)tmp_str); g_free (tmp_str); add_string_to_rdf (node, "uid",temp_constchar); diff --git a/plugins/save-calendar/save-calendar.c b/plugins/save-calendar/save-calendar.c index e461821242..c63c1dab2b 100644 --- a/plugins/save-calendar/save-calendar.c +++ b/plugins/save-calendar/save-calendar.c @@ -109,7 +109,7 @@ ask_destination_and_save (EPlugin *ep, ECalPopupTargetSource *target, ECalSource GtkListStore *store = GTK_LIST_STORE (model); GtkTreeIter iter; GtkWidget *dialog = NULL; - char *dest_uri = NULL; + gchar *dest_uri = NULL; GList *format_handlers = NULL; @@ -173,7 +173,7 @@ ask_destination_and_save (EPlugin *ep, ECalPopupTargetSource *target, ECalSource if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { - char *tmp = NULL; + gchar *tmp = NULL; gtk_combo_box_get_active_iter (combo, &iter); gtk_tree_model_get (model, &iter, @@ -186,7 +186,7 @@ ask_destination_and_save (EPlugin *ep, ECalPopupTargetSource *target, ECalSource if (!(tmp && *(tmp + strlen (handler->filename_ext)) == '\0')) { - char *temp; + gchar *temp; temp = g_strconcat (dest_uri, handler->filename_ext, NULL); g_free (dest_uri); dest_uri = temp; @@ -210,7 +210,7 @@ ask_destination_and_save (EPlugin *ep, ECalPopupTargetSource *target, ECalSource It will ask for overwrite if file already exists. */ GOutputStream * -open_for_writing (GtkWindow *parent, const char *uri, GError **error) +open_for_writing (GtkWindow *parent, const gchar *uri, GError **error) { GFile *file; GFileOutputStream *fostream; |