aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/importers
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-27 23:13:25 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-05-29 00:13:23 +0800
commitfad4af8a3d4c6f50f7bcceca8d545eb17d6fd056 (patch)
treeae78be371695c3dc18847b87d3f014f985aa3a40 /addressbook/importers
parent6f5464f34ceec9e5701e3e3e651a40f9e6b3a072 (diff)
downloadgsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.gz
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.tar.zst
gsoc2013-evolution-fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056.zip
Prefer GLib basic types over C types.
Diffstat (limited to 'addressbook/importers')
-rw-r--r--addressbook/importers/evolution-csv-importer.c34
-rw-r--r--addressbook/importers/evolution-ldif-importer.c44
-rw-r--r--addressbook/importers/evolution-vcard-importer.c32
3 files changed, 55 insertions, 55 deletions
diff --git a/addressbook/importers/evolution-csv-importer.c b/addressbook/importers/evolution-csv-importer.c
index 164f9f5fe2..0456f81b19 100644
--- a/addressbook/importers/evolution-csv-importer.c
+++ b/addressbook/importers/evolution-csv-importer.c
@@ -53,7 +53,7 @@ typedef struct {
guint idle_id;
- int state;
+ gint state;
FILE *file;
gulong size;
gint count;
@@ -63,7 +63,7 @@ typedef struct {
} CSVImporter;
static gint importer;
-static char delimiter;
+static gchar delimiter;
static void csv_import_done(CSVImporter *gci);
@@ -85,7 +85,7 @@ typedef struct {
#define FLAG_BIRTH_MONTH 0x50
#define FLAG_DATE_ANNIVERSARY 0x30
#define FLAG_INVALID 0xff
- int flags;
+ gint flags;
}import_fields;
static import_fields csv_fields_outlook[] = {
@@ -263,7 +263,7 @@ static import_fields csv_fields_evolution[] = {
};
static void
-add_to_notes(EContact *contact, gint i, char *val) {
+add_to_notes(EContact *contact, gint i, gchar *val) {
const gchar *old_text;
const gchar *field_text = NULL;
GString *new_text;
@@ -296,12 +296,12 @@ add_to_notes(EContact *contact, gint i, char *val) {
/* @str: a date string in the format MM-DD-YYYY or MMDDYYYY */
static EContactDate*
-date_from_string (const char *str)
+date_from_string (const gchar *str)
{
EContactDate* date;
- int length;
- char *t;
- int i = 0;
+ gint length;
+ gchar *t;
+ gint i = 0;
g_return_val_if_fail (str != NULL, NULL);
@@ -335,13 +335,13 @@ date_from_string (const char *str)
}
static gboolean
-parseLine (CSVImporter *gci, EContact *contact, char *buf) {
+parseLine (CSVImporter *gci, EContact *contact, gchar *buf) {
- char *ptr = buf, *do_free = NULL;
+ gchar *ptr = buf, *do_free = NULL;
GString *value;
gint i = 0;
- int flags = 0;
- int contact_field;
+ gint flags = 0;
+ gint contact_field;
EContactAddress *home_address = NULL, *work_address = NULL, *other_address = NULL;
EContactDate *bday = NULL;
GString *home_street, *work_street, *other_street;
@@ -554,8 +554,8 @@ getNextCSVEntry(CSVImporter *gci, FILE *f) {
EContact *contact = NULL;
GString *line;
GString *str;
- char *buf;
- char c;
+ gchar *buf;
+ gchar c;
/*
if(!fgets(line, sizeof(line),f))
@@ -642,7 +642,7 @@ getNextCSVEntry(CSVImporter *gci, FILE *f) {
}
static gboolean
-csv_import_contacts(void *d) {
+csv_import_contacts(gpointer d) {
CSVImporter *gci = d;
EContact *contact = NULL;
@@ -711,8 +711,8 @@ static const gchar *supported_extensions[4] = {
static gboolean
csv_supported(EImport *ei, EImportTarget *target, EImportImporter *im)
{
- char *ext;
- int i;
+ gchar *ext;
+ gint i;
EImportTargetURI *s;
if (target->type != E_IMPORT_TARGET_URI)
diff --git a/addressbook/importers/evolution-ldif-importer.c b/addressbook/importers/evolution-ldif-importer.c
index 75f30a2359..544bb485fb 100644
--- a/addressbook/importers/evolution-ldif-importer.c
+++ b/addressbook/importers/evolution-ldif-importer.c
@@ -58,7 +58,7 @@ typedef struct {
GHashTable *dn_contact_hash;
- int state; /* 0 - initial scan, 1 - list cards, 2 - cancelled/complete */
+ gint state; /* 0 - initial scan, 1 - list cards, 2 - cancelled/complete */
FILE *file;
gulong size;
@@ -79,7 +79,7 @@ static struct {
#define FLAG_WORK_ADDRESS 0x02
#define FLAG_LIST 0x04
#define FLAG_BOOLEAN 0x08
- int flags;
+ gint flags;
}
ldif_fields[] = {
{ "cn", E_CONTACT_FULL_NAME },
@@ -128,13 +128,13 @@ ldif_fields[] = {
{ "nsAIMid", E_CONTACT_IM_AIM, FLAG_LIST },
{ "mozilla_AimScreenName", E_CONTACT_IM_AIM, FLAG_LIST }
};
-static int num_ldif_fields = sizeof(ldif_fields) / sizeof (ldif_fields[0]);
+static gint num_ldif_fields = sizeof(ldif_fields) / sizeof (ldif_fields[0]);
static GString *
-getValue( char **src )
+getValue( gchar **src )
{
GString *dest = g_string_new("");
- char *s = *src;
+ gchar *s = *src;
gboolean need_base64 = (*s == ':');
copy_line:
@@ -167,7 +167,7 @@ getValue( char **src )
}
static void
-populate_contact_address (EContactAddress *address, char *attr, char *value)
+populate_contact_address (EContactAddress *address, gchar *attr, gchar *value)
{
if (!g_ascii_strcasecmp (attr, "locality") ||
!g_ascii_strcasecmp (attr, "l") ||
@@ -188,7 +188,7 @@ populate_contact_address (EContactAddress *address, char *attr, char *value)
else if (!g_ascii_strcasecmp (attr, "mozillaPostalAddress2") ||
!g_ascii_strcasecmp (attr, "mozillaHomePostalAddress2")) {
if (address->ext && *address->ext) {
- char *temp = g_strdup (address->ext);
+ gchar *temp = g_strdup (address->ext);
g_free (address->ext);
address->ext = g_strconcat (temp, ",\n", value, NULL);
g_free (temp);
@@ -199,7 +199,7 @@ populate_contact_address (EContactAddress *address, char *attr, char *value)
}
else if (!g_ascii_strcasecmp (attr, "postalAddress") ||
!g_ascii_strcasecmp (attr, "homepostalAddress")) {
- char *c, *i, *addr_field;
+ gchar *c, *i, *addr_field;
addr_field = g_strdup (value);
i = addr_field;
@@ -210,7 +210,7 @@ populate_contact_address (EContactAddress *address, char *attr, char *value)
}
}
if (address->ext && *address->ext) {
- char *temp = g_strdup (address->ext);
+ gchar *temp = g_strdup (address->ext);
g_free (address->ext);
address->ext = g_strconcat (addr_field, ",\n", temp, NULL);
g_free (temp);
@@ -225,10 +225,10 @@ populate_contact_address (EContactAddress *address, char *attr, char *value)
static gboolean
parseLine (LDIFImporter *gci, EContact *contact,
EContactAddress *work_address, EContactAddress *home_address,
- char **buf)
+ gchar **buf)
{
- char *ptr;
- char *colon, *value;
+ gchar *ptr;
+ gchar *colon, *value;
gboolean field_handled;
GString *ldif_value;
@@ -256,9 +256,9 @@ parseLine (LDIFImporter *gci, EContact *contact,
return FALSE;
}
- colon = (char *)strchr( ptr, ':' );
+ colon = (gchar *)strchr( ptr, ':' );
if (colon) {
- int i;
+ gint i;
*colon = 0;
value = colon + 1;
@@ -345,8 +345,8 @@ getNextLDIFEntry(LDIFImporter *gci, FILE *f )
EContact *contact;
EContactAddress *work_address, *home_address;
GString *str;
- char line[1024];
- char *buf;
+ gchar line[1024];
+ gchar *buf;
str = g_string_new ("");
/* read from the file until we get to a blank line (or eof) */
@@ -402,7 +402,7 @@ resolve_list_card (LDIFImporter *gci, EContact *contact)
{
GList *email, *l;
GList *email_attrs = NULL;
- char *full_name;
+ gchar *full_name;
/* set file_as to full_name so we don't later try and figure
out a first/last name for the list. */
@@ -415,7 +415,7 @@ resolve_list_card (LDIFImporter *gci, EContact *contact)
email = e_contact_get (contact, E_CONTACT_EMAIL);
for (l = email; l; l = l->next) {
/* mozilla stuffs dn's in the EMAIL list for contact lists */
- char *dn = l->data;
+ gchar *dn = l->data;
EContact *dn_contact = g_hash_table_lookup (gci->dn_contact_hash, dn);
/* break list chains here, since we don't support them just yet */
@@ -467,12 +467,12 @@ add_to_notes (EContact *contact, EContactField field)
}
static gboolean
-ldif_import_contacts(void *d)
+ldif_import_contacts(gpointer d)
{
LDIFImporter *gci = d;
EContact *contact;
GSList *iter;
- int count = 0;
+ gint count = 0;
/* We process all normal cards immediately and keep the list
ones till the end */
@@ -563,8 +563,8 @@ static const gchar *supported_extensions[2] = {
static gboolean
ldif_supported(EImport *ei, EImportTarget *target, EImportImporter *im)
{
- char *ext;
- int i;
+ gchar *ext;
+ gint i;
EImportTargetURI *s;
if (target->type != E_IMPORT_TARGET_URI)
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c
index 1ec623d098..169c6413d1 100644
--- a/addressbook/importers/evolution-vcard-importer.c
+++ b/addressbook/importers/evolution-vcard-importer.c
@@ -51,9 +51,9 @@ typedef struct {
guint idle_id;
- int state; /* 0 - importing, 1 - cancelled/complete */
- int total;
- int count;
+ gint state; /* 0 - importing, 1 - cancelled/complete */
+ gint total;
+ gint count;
ESource *primary;
@@ -115,8 +115,8 @@ vcard_import_contact(VCardImporter *gci, EContact *contact)
GList *v = e_vcard_attribute_get_values (a);
if (v && v->data) {
- if (!strncmp ((char*)v->data, "<?xml", 5)) {
- EDestination *dest = e_destination_import ((char*)v->data);
+ if (!strncmp ((gchar *)v->data, "<?xml", 5)) {
+ EDestination *dest = e_destination_import ((gchar *)v->data);
e_destination_export_to_vcard_attribute (dest, a);
@@ -155,9 +155,9 @@ vcard_import_contact(VCardImporter *gci, EContact *contact)
vs = e_vcard_attribute_param_get_values (p);
for (v = vs; v; v = v->next) {
- if (!g_ascii_strcasecmp ((char*)v->data, "WORK") ||
- !g_ascii_strcasecmp ((char*)v->data, "HOME") ||
- !g_ascii_strcasecmp ((char*)v->data, "OTHER"))
+ if (!g_ascii_strcasecmp ((gchar *)v->data, "WORK") ||
+ !g_ascii_strcasecmp ((gchar *)v->data, "HOME") ||
+ !g_ascii_strcasecmp ((gchar *)v->data, "OTHER"))
no_location = FALSE;
else
location_only = FALSE;
@@ -204,8 +204,8 @@ vcard_import_contact(VCardImporter *gci, EContact *contact)
vs = e_vcard_attribute_param_get_values (p);
for (v = vs; v; v = v->next) {
- if (!g_ascii_strcasecmp ((char*)v->data, "WORK") ||
- !g_ascii_strcasecmp ((char*)v->data, "HOME"))
+ if (!g_ascii_strcasecmp ((gchar *)v->data, "WORK") ||
+ !g_ascii_strcasecmp ((gchar *)v->data, "HOME"))
no_location = FALSE;
}
}
@@ -228,10 +228,10 @@ vcard_import_contact(VCardImporter *gci, EContact *contact)
}
static gboolean
-vcard_import_contacts(void *data)
+vcard_import_contacts(gpointer data)
{
VCardImporter *gci = data;
- int count = 0;
+ gint count = 0;
GList *iterator = gci->iterator;
if (gci->state == 0) {
@@ -319,11 +319,11 @@ typedef enum _VCardEncoding VCardEncoding;
/* Actually check the contents of this file */
static VCardEncoding
-guess_vcard_encoding (const char *filename)
+guess_vcard_encoding (const gchar *filename)
{
FILE *handle;
- char line[4096];
- char *line_utf8;
+ gchar line[4096];
+ gchar *line_utf8;
VCardEncoding encoding = VCARD_ENCODING_NONE;
handle = g_fopen (filename, "r");
@@ -455,7 +455,7 @@ static void
vcard_import(EImport *ei, EImportTarget *target, EImportImporter *im)
{
VCardImporter *gci;
- char *contents;
+ gchar *contents;
VCardEncoding encoding;
EBook *book;
EImportTargetURI *s = (EImportTargetURI *)target;