From 948235c3d1076dbe6ed2e57a24c16a083bbd9f01 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 27 May 2009 10:29:19 -0400 Subject: Prefer GLib basic types over C types. --- smime/gui/ca-trust-dialog.c | 4 +- smime/gui/cert-trust-dialog.c | 4 +- smime/gui/certificate-manager.c | 16 +++--- smime/gui/certificate-viewer.c | 12 ++-- smime/gui/component.c | 12 ++-- smime/gui/e-cert-selector.c | 8 +-- smime/gui/e-cert-selector.h | 4 +- smime/lib/e-asn1-object.c | 36 ++++++------ smime/lib/e-asn1-object.h | 12 ++-- smime/lib/e-cert-db.c | 116 +++++++++++++++++++------------------- smime/lib/e-cert-db.h | 28 ++++----- smime/lib/e-cert-trust.c | 10 ++-- smime/lib/e-cert-trust.h | 10 ++-- smime/lib/e-cert.c | 122 ++++++++++++++++++++-------------------- smime/lib/e-cert.h | 38 ++++++------- smime/lib/e-pkcs12.c | 46 +++++++-------- smime/lib/e-pkcs12.h | 4 +- smime/tests/import-cert.c | 4 +- 18 files changed, 243 insertions(+), 243 deletions(-) (limited to 'smime') diff --git a/smime/gui/ca-trust-dialog.c b/smime/gui/ca-trust-dialog.c index f3a47e1181..1f79754757 100644 --- a/smime/gui/ca-trust-dialog.c +++ b/smime/gui/ca-trust-dialog.c @@ -75,8 +75,8 @@ ca_trust_dialog_show (ECert *cert, gboolean importing) { CATrustDialogData *ctd_data; GtkWidget *w; - char *txt; - char *gladefile; + gchar *txt; + gchar *gladefile; ctd_data = g_new0 (CATrustDialogData, 1); diff --git a/smime/gui/cert-trust-dialog.c b/smime/gui/cert-trust-dialog.c index 0e4af90edc..b32a7c58c7 100644 --- a/smime/gui/cert-trust-dialog.c +++ b/smime/gui/cert-trust-dialog.c @@ -51,7 +51,7 @@ typedef struct { } CertTrustDialogData; static void -free_data (void *data) +free_data (gpointer data) { CertTrustDialogData *ctd = data; @@ -116,7 +116,7 @@ cert_trust_dialog_show (ECert *cert) { CertTrustDialogData *ctd_data; CERTCertificate *icert; - char *gladefile; + gchar *gladefile; ctd_data = g_new0 (CertTrustDialogData, 1); diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c index f697b32330..ed49bfbe67 100644 --- a/smime/gui/certificate-manager.c +++ b/smime/gui/certificate-manager.c @@ -94,7 +94,7 @@ static void add_ca_cert (CertificateManagerData *cfm, ECert *cert); static void handle_selection_changed (GtkTreeSelection *selection, - int cert_column, + gint cert_column, GtkWidget *view_button, GtkWidget *edit_button, GtkWidget *delete_button) @@ -154,7 +154,7 @@ import_your (GtkWidget *widget, CertificateManagerData *cfm) gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (filesel), filter); if (GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (filesel))) { - char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel)); + gchar *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel)); /* destroy dialog to get rid of it in the GUI */ gtk_widget_destroy (filesel); @@ -401,7 +401,7 @@ import_contact (GtkWidget *widget, CertificateManagerData *cfm) gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (filesel), filter); if (GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (filesel))) { - char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel)); + gchar *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel)); /* destroy dialog to get rid of it in the GUI */ gtk_widget_destroy (filesel); @@ -628,7 +628,7 @@ import_ca (GtkWidget *widget, CertificateManagerData *cfm) gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (filesel), filter); if (GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (filesel))) { - char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel)); + gchar *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel)); /* destroy dialog to get rid of it in the GUI */ gtk_widget_destroy (filesel); @@ -740,7 +740,7 @@ add_user_cert (CertificateManagerData *cfm, ECert *cert) { GtkTreeIter iter; GtkTreeIter *parent_iter = NULL; - const char *organization = e_cert_get_org (cert); + const gchar *organization = e_cert_get_org (cert); GtkTreeModel *model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (cfm->yourcerts_streemodel)); if (organization) { @@ -784,7 +784,7 @@ add_contact_cert (CertificateManagerData *cfm, ECert *cert) { GtkTreeIter iter; GtkTreeIter *parent_iter = NULL; - const char *organization = e_cert_get_org (cert); + const gchar *organization = e_cert_get_org (cert); GtkTreeModel *model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (cfm->contactcerts_streemodel)); if (organization) { @@ -826,7 +826,7 @@ add_ca_cert (CertificateManagerData *cfm, ECert *cert) { GtkTreeIter iter; GtkTreeIter *parent_iter = NULL; - const char *organization = e_cert_get_org (cert); + const gchar *organization = e_cert_get_org (cert); GtkTreeModel *model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (cfm->authoritycerts_streemodel)); if (organization) { @@ -996,7 +996,7 @@ certificate_manager_config_init (EShell *shell) CertificateManagerData *cfm_data; GtkWidget *preferences_window; GtkWidget *widget; - char *gladefile; + gchar *gladefile; g_return_if_fail (E_IS_SHELL (shell)); diff --git a/smime/gui/certificate-viewer.c b/smime/gui/certificate-viewer.c index 997bbace46..37289c3e8b 100644 --- a/smime/gui/certificate-viewer.c +++ b/smime/gui/certificate-viewer.c @@ -64,8 +64,8 @@ static void fill_in_general (CertificateViewerData *cvm_data, ECert *cert) { GtkWidget *label; - const char *text; - char *markup; + const gchar *text; + gchar *markup; /* issued to */ label = glade_xml_get_widget (cvm_data->gui, "issued-to-cn"); @@ -225,7 +225,7 @@ fields_selection_changed (GtkTreeSelection *selection, CertificateViewerData *cv &model, &iter)) { EASN1Object *asn1_object; - const char *value; + const gchar *value; gtk_tree_model_get (model, &iter, @@ -296,7 +296,7 @@ fill_in_details (CertificateViewerData *cvm_data, ECert *cert) cvm_data->cert_chain = g_list_reverse (cvm_data->cert_chain); for (l = cvm_data->cert_chain; l; l = l->next) { ECert *c = l->data; - const char *str; + const gchar *str; GtkTreeIter new_iter; str = e_cert_get_cn (c); @@ -319,8 +319,8 @@ GtkWidget* certificate_viewer_show (ECert *cert) { CertificateViewerData *cvm_data; - char *title; - char *gladefile; + gchar *title; + gchar *gladefile; cvm_data = g_new0 (CertificateViewerData, 1); diff --git a/smime/gui/component.c b/smime/gui/component.c index 1096aa2a5e..48546bf75f 100644 --- a/smime/gui/component.c +++ b/smime/gui/component.c @@ -36,10 +36,10 @@ #include "pk11func.h" static gboolean -smime_pk11_passwd (ECertDB *db, PK11SlotInfo* slot, gboolean retry, char **passwd, gpointer arg) +smime_pk11_passwd (ECertDB *db, PK11SlotInfo* slot, gboolean retry, gchar **passwd, gpointer arg) { - char *prompt; - char *slot_name = g_strdup (PK11_GetSlotName (slot)); + gchar *prompt; + gchar *slot_name = g_strdup (PK11_GetSlotName (slot)); g_strchomp (slot_name); @@ -58,9 +58,9 @@ smime_pk11_passwd (ECertDB *db, PK11SlotInfo* slot, gboolean retry, char **passw } static gboolean -smime_pk11_change_passwd (ECertDB *db, char **old_passwd, char **passwd, gpointer arg) +smime_pk11_change_passwd (ECertDB *db, gchar **old_passwd, gchar **passwd, gpointer arg) { - char *prompt; + gchar *prompt; /* XXX need better strings here, just copy mozilla's? */ @@ -86,7 +86,7 @@ static gboolean smime_confirm_ca_cert_import (ECertDB *db, ECert *cert, gboolean *trust_ssl, gboolean *trust_email, gboolean *trust_objsign, gpointer arg) { GtkWidget *dialog = ca_trust_dialog_show (cert, TRUE); - int response; + gint response; response = gtk_dialog_run (GTK_DIALOG (dialog)); diff --git a/smime/gui/e-cert-selector.c b/smime/gui/e-cert-selector.c index 0ac946b5b8..e84b933a81 100644 --- a/smime/gui/e-cert-selector.c +++ b/smime/gui/e-cert-selector.c @@ -68,7 +68,7 @@ ecs_find_current(ECertSelector *ecs) { struct _ECertSelectorPrivate *p = ecs->priv; CERTCertListNode *node; - int n; + gint n; if (p->certlist == NULL || CERT_LIST_EMPTY(p->certlist)) return NULL; @@ -141,7 +141,7 @@ ecs_cert_changed(GtkWidget *w, ECertSelector *ecs) * Return value: A dialogue to be shown. **/ GtkWidget * -e_cert_selector_new(int type, const char *currentid) +e_cert_selector_new(gint type, const gchar *currentid) { ECertSelector *ecs; struct _ECertSelectorPrivate *p; @@ -150,8 +150,8 @@ e_cert_selector_new(int type, const char *currentid) CERTCertListNode *node; GladeXML *gui; GtkWidget *w; - int n=0, active=0; - char *gladefile; + gint n=0, active=0; + gchar *gladefile; ecs = g_object_new(e_cert_selector_get_type(), NULL); p = ecs->priv; diff --git a/smime/gui/e-cert-selector.h b/smime/gui/e-cert-selector.h index 85cfa0ba9f..5520b5621c 100644 --- a/smime/gui/e-cert-selector.h +++ b/smime/gui/e-cert-selector.h @@ -49,7 +49,7 @@ struct _ECertSelector { struct _ECertSelectorClass { GtkDialogClass parent_class; - void (*selected)(ECertSelector *, const char *certid); + void (*selected)(ECertSelector *, const gchar *certid); }; enum _e_cert_selector_type { @@ -58,7 +58,7 @@ enum _e_cert_selector_type { }; GType e_cert_selector_get_type (void); -GtkWidget *e_cert_selector_new (int type, const char *currentid); +GtkWidget *e_cert_selector_new (gint type, const gchar *currentid); #ifdef cplusplus } diff --git a/smime/lib/e-asn1-object.c b/smime/lib/e-asn1-object.c index b3cfe9e726..6e490f6123 100644 --- a/smime/lib/e-asn1-object.c +++ b/smime/lib/e-asn1-object.c @@ -54,10 +54,10 @@ struct _EASN1ObjectPrivate { GList *children; - char *display_name; - char *value; + gchar *display_name; + gchar *value; - char *data; + gchar *data; guint data_len; }; @@ -137,9 +137,9 @@ e_asn1_object_get_type (void) ASN1. */ static int -get_integer_256 (unsigned char *data, unsigned int nb) +get_integer_256 (guchar *data, guint nb) { - int val; + gint val; switch (nb) { case 1: @@ -171,10 +171,10 @@ get_integer_256 (unsigned char *data, unsigned int nb) */ static guint32 -get_der_item_length (unsigned char *data, unsigned char *end, +get_der_item_length (guchar *data, guchar *end, unsigned long *bytesUsed, gboolean *indefinite) { - unsigned char lbyte = *data++; + guchar lbyte = *data++; PRInt32 length = -1; *indefinite = FALSE; @@ -205,13 +205,13 @@ get_der_item_length (unsigned char *data, unsigned char *end, } static gboolean -build_from_der (EASN1Object *parent, char *data, char *end) +build_from_der (EASN1Object *parent, gchar *data, gchar *end) { unsigned long bytesUsed; gboolean indefinite; PRInt32 len; PRUint32 type; - unsigned char code, tagnum; + guchar code, tagnum; EASN1Object *asn1object = NULL; if (data >= end) @@ -221,7 +221,7 @@ build_from_der (EASN1Object *parent, char *data, char *end) A DER item has the form of |tag|len|data tag is one byte and describes the type of elment we are dealing with. - len is a DER encoded int telling us how long the data is + len is a DER encoded gint telling us how long the data is data is a buffer that is len bytes long and has to be interpreted according to its type. */ @@ -237,7 +237,7 @@ build_from_der (EASN1Object *parent, char *data, char *end) return FALSE; } data++; - len = get_der_item_length ((unsigned char *)data, (unsigned char *)end, &bytesUsed, &indefinite); + len = get_der_item_length ((guchar *)data, (guchar *)end, &bytesUsed, &indefinite); data += bytesUsed; if ((len < 0) || ((data+len) > end)) return FALSE; @@ -277,7 +277,7 @@ build_from_der (EASN1Object *parent, char *data, char *end) asn1object->priv->type = tagnum; asn1object->priv->tag = tagnum; - /*printableItem->SetData((char*)data, len);*/ + /*printableItem->SetData((gchar *)data, len);*/ } data += len; @@ -288,7 +288,7 @@ build_from_der (EASN1Object *parent, char *data, char *end) } EASN1Object* -e_asn1_object_new_from_der (char *data, guint32 len) +e_asn1_object_new_from_der (gchar *data, guint32 len) { EASN1Object *obj = g_object_new (E_TYPE_ASN1_OBJECT, NULL); @@ -348,33 +348,33 @@ e_asn1_object_append_child (EASN1Object *parent, EASN1Object *child) } void -e_asn1_object_set_display_name (EASN1Object *obj, const char *name) +e_asn1_object_set_display_name (EASN1Object *obj, const gchar *name) { g_free (obj->priv->display_name); obj->priv->display_name = g_strdup (name); } -const char* +const gchar * e_asn1_object_get_display_name (EASN1Object *obj) { return obj->priv->display_name; } void -e_asn1_object_set_display_value (EASN1Object *obj, const char *value) +e_asn1_object_set_display_value (EASN1Object *obj, const gchar *value) { g_free (obj->priv->value); obj->priv->value = g_strdup (value); } -const char* +const gchar * e_asn1_object_get_display_value (EASN1Object *obj) { return obj->priv->value; } void -e_asn1_object_get_data (EASN1Object *obj, char **data, guint32 *len) +e_asn1_object_get_data (EASN1Object *obj, gchar **data, guint32 *len) { *data = obj->priv->data; *len = obj->priv->data_len; diff --git a/smime/lib/e-asn1-object.h b/smime/lib/e-asn1-object.h index 0c976dd827..35824967d4 100644 --- a/smime/lib/e-asn1-object.h +++ b/smime/lib/e-asn1-object.h @@ -85,7 +85,7 @@ struct _EASN1ObjectClass { void (*_ecert_reserved4) (void); }; -EASN1Object *e_asn1_object_new_from_der (char *data, guint32 len); +EASN1Object *e_asn1_object_new_from_der (gchar *data, guint32 len); EASN1Object *e_asn1_object_new (void); void e_asn1_object_set_valid_container (EASN1Object *obj, gboolean flag); @@ -94,12 +94,12 @@ PRUint32 e_asn1_object_get_asn1_type (EASN1Object *obj); PRUint32 e_asn1_object_get_asn1_tag (EASN1Object *obj); GList *e_asn1_object_get_children (EASN1Object *obj); void e_asn1_object_append_child (EASN1Object *parent, EASN1Object *child); -void e_asn1_object_set_display_name (EASN1Object *obj, const char *name); -const char *e_asn1_object_get_display_name (EASN1Object *obj); -void e_asn1_object_set_display_value (EASN1Object *obj, const char *value); -const char *e_asn1_object_get_display_value (EASN1Object *obj); +void e_asn1_object_set_display_name (EASN1Object *obj, const gchar *name); +const gchar *e_asn1_object_get_display_name (EASN1Object *obj); +void e_asn1_object_set_display_value (EASN1Object *obj, const gchar *value); +const gchar *e_asn1_object_get_display_value (EASN1Object *obj); -void e_asn1_object_get_data (EASN1Object *obj, char **data, guint32 *len); +void e_asn1_object_get_data (EASN1Object *obj, gchar **data, guint32 *len); GType e_asn1_object_get_type (void); diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c index ae8a79ae23..d0528f7d2f 100644 --- a/smime/lib/e-cert-db.c +++ b/smime/lib/e-cert-db.c @@ -93,7 +93,7 @@ struct _ECertDBPrivate { #define PARENT_TYPE G_TYPE_OBJECT static GObjectClass *parent_class; -static CERTDERCerts* e_cert_db_get_certs_from_package (PRArenaPool *arena, char *data, guint32 length); +static CERTDERCerts* e_cert_db_get_certs_from_package (PRArenaPool *arena, gchar *data, guint32 length); @@ -117,22 +117,22 @@ e_cert_db_dispose (GObject *object) #ifdef notyet PRBool ucs2_ascii_conversion_fn (PRBool toUnicode, - unsigned char *inBuf, - unsigned int inBufLen, - unsigned char *outBuf, - unsigned int maxOutBufLen, - unsigned int *outBufLen, + guchar *inBuf, + guint inBufLen, + guchar *outBuf, + guint maxOutBufLen, + guint *outBufLen, PRBool swapBytes) { printf ("in ucs2_ascii_conversion_fn\n"); } #endif -static char* PR_CALLBACK -pk11_password (PK11SlotInfo* slot, PRBool retry, void* arg) +static gchar * PR_CALLBACK +pk11_password (PK11SlotInfo* slot, PRBool retry, gpointer arg) { - char *pwd; - char *nsspwd; + gchar *pwd; + gchar *nsspwd; gboolean rv = FALSE; @@ -155,7 +155,7 @@ pk11_password (PK11SlotInfo* slot, PRBool retry, void* arg) static void initialize_nss (void) { - char *evolution_dir_path; + gchar *evolution_dir_path; gboolean success; #ifdef G_OS_WIN32 @@ -207,7 +207,7 @@ install_loadable_roots (void) SECMODModuleList *list = SECMOD_GetDefaultModuleList (); SECMODListLock *lock = SECMOD_GetDefaultModuleListLock (); SECMODModule *RootsModule = NULL; - int i; + gint i; SECMOD_GetReadLock (lock); while (!RootsModule && list) { @@ -270,7 +270,7 @@ install_loadable_roots (void) }; for (i = 0; i < G_N_ELEMENTS (paths_to_check); i ++) { - char *dll_path = g_module_build_path (paths_to_check [i], "nssckbi"); + gchar *dll_path = g_module_build_path (paths_to_check [i], "nssckbi"); if (g_file_test (dll_path, G_FILE_TEST_EXISTS)) { PRInt32 modType; @@ -395,16 +395,16 @@ e_cert_db_shutdown (void) /* searching for certificates */ ECert* e_cert_db_find_cert_by_nickname (ECertDB *certdb, - const char *nickname, + const gchar *nickname, GError **error) { /* nsNSSShutDownPreventionLock locker;*/ CERTCertificate *cert = NULL; /*PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Getting \"%s\"\n", asciiname));*/ - cert = PK11_FindCertFromNickname((char*)nickname, NULL); + cert = PK11_FindCertFromNickname((gchar *)nickname, NULL); if (!cert) { - cert = CERT_FindCertByNickname(CERT_GetDefaultCertDB(), (char*)nickname); + cert = CERT_FindCertByNickname(CERT_GetDefaultCertDB(), (gchar *)nickname); } @@ -422,7 +422,7 @@ e_cert_db_find_cert_by_nickname (ECertDB *certdb, #ifdef notyet ECert* e_cert_db_find_cert_by_key (ECertDB *certdb, - const char *db_key, + const gchar *db_key, GError **error) { /* nsNSSShutDownPreventionLock locker;*/ @@ -471,14 +471,14 @@ e_cert_db_get_cert_nicknames (ECertDB *certdb, ECert* e_cert_db_find_email_encryption_cert (ECertDB *certdb, - const char *nickname, + const gchar *nickname, GError **error) { } ECert* e_cert_db_find_email_signing_cert (ECertDB *certdb, - const char *nickname, + const gchar *nickname, GError **error) { } @@ -486,13 +486,13 @@ e_cert_db_find_email_signing_cert (ECertDB *certdb, ECert* e_cert_db_find_cert_by_email_address (ECertDB *certdb, - const char *email, + const gchar *email, GError **error) { /* nsNSSShutDownPreventionLock locker; */ ECert *cert; CERTCertificate *any_cert = CERT_FindCertByNicknameOrEmailAddr(CERT_GetDefaultCertDB(), - (char*)email); + (gchar *)email); CERTCertList *certlist; if (!any_cert) { @@ -555,7 +555,7 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) { ECert *certToShow; SECItem der; - char *raw_der = NULL; + gchar *raw_der = NULL; CERTCertificate *tmpCert; /* First thing we have to do is figure out which certificate @@ -587,10 +587,10 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) /* there are multiple certs */ ECert *cert0; ECert *cert1; - const char* cert0SubjectName; - const char* cert0IssuerName; - const char* cert1SubjectName; - const char* cert1IssuerName; + const gchar * cert0SubjectName; + const gchar * cert0IssuerName; + const gchar * cert1SubjectName; + const gchar * cert1IssuerName; cert0 = E_CERT (certs->data); cert1 = E_CERT (certs->next->data); @@ -628,7 +628,7 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) return FALSE; } - der.data = (unsigned char *)raw_der; + der.data = (guchar *)raw_der; { /*PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Creating temp cert\n"));*/ @@ -656,7 +656,7 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) } else { gboolean trust_ssl, trust_email, trust_objsign; - char *nickname; + gchar *nickname; SECStatus srv; CERTCertTrust trust; @@ -709,7 +709,7 @@ handle_ca_cert_download(ECertDB *cert_db, GList *certs, GError **error) continue; /* Let's try to import the rest of 'em */ } nickname.Adopt(CERT_MakeCANickname(tmpCert2)); - CERT_AddTempCertToPerm(tmpCert2, NS_CONST_CAST(char*,nickname.get()), + CERT_AddTempCertToPerm(tmpCert2, NS_CONST_CAST(gchar *,nickname.get()), defaultTrust.GetTrust()); CERT_DestroyCertificate(tmpCert2); } @@ -755,7 +755,7 @@ e_cert_db_delete_cert (ECertDB *certdb, /* importing certificates */ gboolean e_cert_db_import_certs (ECertDB *certdb, - char *data, guint32 length, + gchar *data, guint32 length, ECertType cert_type, GError **error) { @@ -763,7 +763,7 @@ e_cert_db_import_certs (ECertDB *certdb, PRArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); GList *certs = NULL; CERTDERCerts *certCollection = e_cert_db_get_certs_from_package (arena, data, length); - int i; + gint i; gboolean rv; if (!certCollection) { @@ -777,7 +777,7 @@ e_cert_db_import_certs (ECertDB *certdb, SECItem *currItem = &certCollection->rawCerts[i]; ECert *cert; - cert = e_cert_new_from_der ((char*)currItem->data, currItem->len); + cert = e_cert_new_from_der ((gchar *)currItem->data, currItem->len); if (!cert) { /* XXX gerror */ g_list_foreach (certs, (GFunc)g_object_unref, NULL); @@ -806,7 +806,7 @@ e_cert_db_import_certs (ECertDB *certdb, gboolean e_cert_db_import_email_cert (ECertDB *certdb, - char *data, guint32 length, + gchar *data, guint32 length, GError **error) { /*nsNSSShutDownPreventionLock locker;*/ @@ -814,8 +814,8 @@ e_cert_db_import_email_cert (ECertDB *certdb, gboolean rv = TRUE; CERTCertificate * cert; SECItem **rawCerts; - int numcerts; - int i; + gint numcerts; + gint i; PRArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); CERTDERCerts *certCollection = e_cert_db_get_certs_from_package (arena, data, length); @@ -827,7 +827,7 @@ e_cert_db_import_email_cert (ECertDB *certdb, } cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), certCollection->rawCerts, - (char *)NULL, PR_FALSE, PR_TRUE); + (gchar *)NULL, PR_FALSE, PR_TRUE); if (!cert) { /* XXX g_error */ rv = FALSE; @@ -863,16 +863,16 @@ e_cert_db_import_email_cert (ECertDB *certdb, return rv; } -static char * +static gchar * default_nickname (CERTCertificate *cert) { /* nsNSSShutDownPreventionLock locker; */ - char *username = NULL; - char *caname = NULL; - char *nickname = NULL; - char *tmp = NULL; - int count; - const char *nickFmt=NULL; + gchar *username = NULL; + gchar *caname = NULL; + gchar *nickname = NULL; + gchar *tmp = NULL; + gint count; + const gchar *nickFmt=NULL; CERTCertificate *dummycert; PK11SlotInfo *slot=NULL; CK_OBJECT_HANDLE keyHandle; @@ -990,14 +990,14 @@ default_nickname (CERTCertificate *cert) gboolean e_cert_db_import_user_cert (ECertDB *certdb, - char *data, guint32 length, + gchar *data, guint32 length, GError **error) { /* nsNSSShutDownPreventionLock locker;*/ PK11SlotInfo *slot; - char * nickname = NULL; + gchar * nickname = NULL; gboolean rv = FALSE; - int numCACerts; + gint numCACerts; SECItem *CACerts; CERTDERCerts * collectArgs; PRArenaPool *arena; @@ -1016,7 +1016,7 @@ e_cert_db_import_user_cert (ECertDB *certdb, } cert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), collectArgs->rawCerts, - (char *)NULL, PR_FALSE, PR_TRUE); + (gchar *)NULL, PR_FALSE, PR_TRUE); if (!cert) { /* XXX g_error */ goto loser; @@ -1068,7 +1068,7 @@ e_cert_db_import_user_cert (ECertDB *certdb, gboolean e_cert_db_import_server_cert (ECertDB *certdb, - char *data, guint32 length, + gchar *data, guint32 length, GError **error) { /* not c&p'ing this over at the moment, as we don't have a UI @@ -1078,15 +1078,15 @@ e_cert_db_import_server_cert (ECertDB *certdb, gboolean e_cert_db_import_certs_from_file (ECertDB *cert_db, - const char *file_path, + const gchar *file_path, ECertType cert_type, GError **error) { gboolean rv; - int fd; + gint fd; struct stat sb; - char *buf; - int bytes_read; + gchar *buf; + gint bytes_read; switch (cert_type) { case E_CERT_CA: @@ -1156,7 +1156,7 @@ e_cert_db_import_certs_from_file (ECertDB *cert_db, gboolean e_cert_db_import_pkcs12_file (ECertDB *cert_db, - const char *file_path, + const gchar *file_path, GError **error) { EPKCS12 *pkcs12 = e_pkcs12_new (); @@ -1173,7 +1173,7 @@ e_cert_db_import_pkcs12_file (ECertDB *cert_db, #ifdef notyet gboolean e_cert_db_export_pkcs12_file (ECertDB *cert_db, - const char *file_path, + const gchar *file_path, GList *certs, GError **error) { @@ -1188,7 +1188,7 @@ e_cert_db_login_to_slot (ECertDB *cert_db, PK11_Logout (slot); if (PK11_NeedUserInit (slot)) { - char *pwd; + gchar *pwd; gboolean rv = FALSE; printf ("initializing slot password\n"); @@ -1219,7 +1219,7 @@ e_cert_db_login_to_slot (ECertDB *cert_db, static SECStatus PR_CALLBACK -collect_certs(void *arg, SECItem **certs, int numcerts) +collect_certs(gpointer arg, SECItem **certs, gint numcerts) { CERTDERCerts *collectArgs; SECItem *cert; @@ -1247,7 +1247,7 @@ collect_certs(void *arg, SECItem **certs, int numcerts) static CERTDERCerts* e_cert_db_get_certs_from_package (PRArenaPool *arena, - char *data, + gchar *data, guint32 length) { /*nsNSSShutDownPreventionLock locker;*/ @@ -1261,7 +1261,7 @@ e_cert_db_get_certs_from_package (PRArenaPool *arena, collectArgs->arena = arena; sec_rv = CERT_DecodeCertPackage(data, length, collect_certs, - (void *)collectArgs); + (gpointer)collectArgs); if (sec_rv != SECSuccess) return NULL; diff --git a/smime/lib/e-cert-db.h b/smime/lib/e-cert-db.h index f628ba2073..30d20448cb 100644 --- a/smime/lib/e-cert-db.h +++ b/smime/lib/e-cert-db.h @@ -48,8 +48,8 @@ struct _ECertDBClass { GObjectClass parent_class; /* signals */ - gboolean (*pk11_passwd) (ECertDB *db, PK11SlotInfo *slot, gboolean retry, char **passwd); - gboolean (*pk11_change_passwd) (ECertDB *db, char **orig_passwd, char **passwd); + gboolean (*pk11_passwd) (ECertDB *db, PK11SlotInfo *slot, gboolean retry, gchar **passwd); + gboolean (*pk11_change_passwd) (ECertDB *db, gchar **orig_passwd, gchar **passwd); gboolean (*confirm_ca_cert_import) (ECertDB *db, ECert *cert, gboolean *trust_ssl, gboolean *trust_email, gboolean *trust_objsign); /* Padding for future expansion */ @@ -69,12 +69,12 @@ void e_cert_db_shutdown (void); /* searching for certificates */ ECert* e_cert_db_find_cert_by_nickname (ECertDB *certdb, - const char *nickname, + const gchar *nickname, GError **error); #ifdef notyet ECert* e_cert_db_find_cert_by_key (ECertDB *certdb, - const char *db_key, + const gchar *db_key, GError **error); GList* e_cert_db_get_cert_nicknames (ECertDB *certdb, @@ -83,16 +83,16 @@ GList* e_cert_db_get_cert_nicknames (ECertDB *certdb, ECert* e_cert_db_find_email_encryption_cert (ECertDB *certdb, - const char *nickname, + const gchar *nickname, GError **error); ECert* e_cert_db_find_email_signing_cert (ECertDB *certdb, - const char *nickname, + const gchar *nickname, GError **error); #endif ECert* e_cert_db_find_cert_by_email_address (ECertDB *certdb, - const char *nickname, + const gchar *nickname, GError **error); /* deleting certificates */ @@ -101,34 +101,34 @@ gboolean e_cert_db_delete_cert (ECertDB *certdb, /* importing certificates */ gboolean e_cert_db_import_certs (ECertDB *certdb, - char *data, guint32 length, + gchar *data, guint32 length, ECertType cert_type, GError **error); gboolean e_cert_db_import_email_cert (ECertDB *certdb, - char *data, guint32 length, + gchar *data, guint32 length, GError **error); gboolean e_cert_db_import_user_cert (ECertDB *certdb, - char *data, guint32 length, + gchar *data, guint32 length, GError **error); gboolean e_cert_db_import_server_cert (ECertDB *certdb, - char *data, guint32 length, + gchar *data, guint32 length, GError **error); gboolean e_cert_db_import_certs_from_file (ECertDB *cert_db, - const char *file_path, + const gchar *file_path, ECertType cert_type, GError **error); gboolean e_cert_db_import_pkcs12_file (ECertDB *cert_db, - const char *file_path, + const gchar *file_path, GError **error); #ifdef notyet gboolean e_cert_db_export_pkcs12_file (ECertDB *cert_db, - const char *file_path, + const gchar *file_path, GList *certs, GError **error); #endif diff --git a/smime/lib/e-cert-trust.c b/smime/lib/e-cert-trust.c index 8509f3ffee..8a8329c7f8 100644 --- a/smime/lib/e-cert-trust.c +++ b/smime/lib/e-cert-trust.c @@ -53,9 +53,9 @@ e_cert_trust_init (CERTCertTrust *trust) void e_cert_trust_init_with_values (CERTCertTrust *trust, - unsigned int ssl, - unsigned int email, - unsigned int objsign) + guint ssl, + guint email, + guint objsign) { memset(trust, 0, sizeof(CERTCertTrust)); e_cert_trust_add_trust(&trust->sslFlags, ssl); @@ -389,13 +389,13 @@ e_cert_trust_has_trusted_peer (CERTCertTrust *trust, } void -e_cert_trust_add_trust (unsigned int *t, unsigned int v) +e_cert_trust_add_trust (guint *t, guint v) { *t |= v; } PRBool -e_cert_trust_has_trust (unsigned int t, unsigned int v) +e_cert_trust_has_trust (guint t, guint v) { return (t & v); } diff --git a/smime/lib/e-cert-trust.h b/smime/lib/e-cert-trust.h index 6b515b1a24..71608f8415 100644 --- a/smime/lib/e-cert-trust.h +++ b/smime/lib/e-cert-trust.h @@ -32,9 +32,9 @@ G_BEGIN_DECLS void e_cert_trust_init (CERTCertTrust *trust); void e_cert_trust_init_with_values (CERTCertTrust *trust, - unsigned int ssl, - unsigned int email, - unsigned int objsign); + guint ssl, + guint email, + guint objsign); void e_cert_trust_copy (CERTCertTrust *dst_trust, CERTCertTrust *src_trust); void e_cert_trust_add_ca_trust (CERTCertTrust *trust, PRBool ssl, PRBool email, PRBool objSign); void e_cert_trust_add_peer_trust (CERTCertTrust *trust, PRBool ssl, PRBool email, PRBool objSign); @@ -79,8 +79,8 @@ PRBool e_cert_trust_has_trusted_peer (CERTCertTrust *trust, PRBool checkSSL, PRBool checkEmail, PRBool checkObjSign); -void e_cert_trust_add_trust (unsigned int *t, unsigned int v); -PRBool e_cert_trust_has_trust (unsigned int t, unsigned int v); +void e_cert_trust_add_trust (guint *t, guint v); +PRBool e_cert_trust_has_trust (guint t, guint v); G_END_DECLS diff --git a/smime/lib/e-cert.c b/smime/lib/e-cert.c index 2146fc3d32..8367b7b8fd 100644 --- a/smime/lib/e-cert.c +++ b/smime/lib/e-cert.c @@ -60,26 +60,26 @@ struct _ECertPrivate { /* pointers we cache since the nss implementation allocs the string */ - char *org_name; - char *org_unit_name; - char *cn; + gchar *org_name; + gchar *org_unit_name; + gchar *cn; - char *issuer_org_name; - char *issuer_org_unit_name; - char *issuer_cn; + gchar *issuer_org_name; + gchar *issuer_org_unit_name; + gchar *issuer_cn; PRTime issued_on; PRTime expires_on; - char *issued_on_string; - char *expires_on_string; + gchar *issued_on_string; + gchar *expires_on_string; - char *serial_number; + gchar *serial_number; - char *usage_string; + gchar *usage_string; - char *sha1_fingerprint; - char *md5_fingerprint; + gchar *sha1_fingerprint; + gchar *md5_fingerprint; EASN1Object *asn1; @@ -195,7 +195,7 @@ static void e_cert_populate (ECert *cert) { CERTCertificate *c = cert->priv->cert; - unsigned char fingerprint[20]; + guchar fingerprint[20]; SECItem fpItem; cert->priv->org_name = CERT_GetOrgName (&c->subject); @@ -210,7 +210,7 @@ e_cert_populate (ECert *cert) if (SECSuccess == CERT_GetCertTimes (c, &cert->priv->issued_on, &cert->priv->expires_on)) { PRExplodedTime explodedTime; struct tm exploded_tm; - char buf[32]; + gchar buf[32]; PR_ExplodeTime (cert->priv->issued_on, PR_LocalTimeParameters, &explodedTime); exploded_tm.tm_sec = explodedTime.tm_sec; @@ -265,7 +265,7 @@ e_cert_new (CERTCertificate *cert) } ECert* -e_cert_new_from_der (char *data, guint32 len) +e_cert_new_from_der (gchar *data, guint32 len) { CERTCertificate *cert = CERT_DecodeCertFromPackage (data, len); @@ -289,13 +289,13 @@ e_cert_get_internal_cert (ECert *cert) } gboolean -e_cert_get_raw_der (ECert *cert, char **data, guint32 *len) +e_cert_get_raw_der (ECert *cert, gchar **data, guint32 *len) { /* XXX do we really need to check if cert->priv->cert is NULL here? it should always be non-null if we have the ECert.. */ if (cert->priv->cert) { - *data = (char*)cert->priv->cert->derCert.data; + *data = (gchar *)cert->priv->cert->derCert.data; *len = (guint32)cert->priv->cert->derCert.len; return TRUE; } @@ -305,7 +305,7 @@ e_cert_get_raw_der (ECert *cert, char **data, guint32 *len) } -const char* +const gchar * e_cert_get_window_title (ECert *cert) { if (cert->priv->cert->nickname) @@ -316,61 +316,61 @@ e_cert_get_window_title (ECert *cert) return cert->priv->cert->subjectName; } -const char* +const gchar * e_cert_get_nickname (ECert *cert) { return cert->priv->cert->nickname; } -const char* +const gchar * e_cert_get_email (ECert *cert) { return cert->priv->cert->emailAddr; } -const char* +const gchar * e_cert_get_org (ECert *cert) { return cert->priv->org_name; } -const char* +const gchar * e_cert_get_org_unit (ECert *cert) { return cert->priv->org_unit_name; } -const char* +const gchar * e_cert_get_cn (ECert *cert) { return cert->priv->cn; } -const char* +const gchar * e_cert_get_issuer_name (ECert *cert) { return cert->priv->cert->issuerName; } -const char* +const gchar * e_cert_get_issuer_cn (ECert *cert) { return cert->priv->issuer_cn; } -const char* +const gchar * e_cert_get_issuer_org (ECert *cert) { return cert->priv->issuer_org_name; } -const char* +const gchar * e_cert_get_issuer_org_unit (ECert *cert) { return cert->priv->issuer_org_unit_name; } -const char* +const gchar * e_cert_get_subject_name (ECert *cert) { return cert->priv->cert->subjectName; @@ -382,7 +382,7 @@ e_cert_get_issued_on_time (ECert *cert) return cert->priv->issued_on; } -const char* +const gchar * e_cert_get_issued_on (ECert *cert) { return cert->priv->issued_on_string; @@ -394,26 +394,26 @@ e_cert_get_expires_on_time (ECert *cert) return cert->priv->expires_on; } -const char* +const gchar * e_cert_get_expires_on (ECert *cert) { return cert->priv->expires_on_string; } static struct { - int bit; - const char *text; + gint bit; + const gchar *text; } usageinfo[] = { /* x509 certificate usage types */ { certificateUsageEmailSigner, N_("Sign") }, { certificateUsageEmailRecipient, N_("Encrypt") }, }; -const char* +const gchar * e_cert_get_usage(ECert *cert) { if (cert->priv->usage_string == NULL) { - int i; + gint i; GString *str = g_string_new(""); CERTCertificate *icert = e_cert_get_internal_cert (cert); @@ -432,19 +432,19 @@ e_cert_get_usage(ECert *cert) return cert->priv->usage_string; } -const char* +const gchar * e_cert_get_serial_number (ECert *cert) { return cert->priv->serial_number; } -const char* +const gchar * e_cert_get_sha1_fingerprint (ECert *cert) { return cert->priv->sha1_fingerprint; } -const char* +const gchar * e_cert_get_md5_fingerprint (ECert *cert) { return cert->priv->md5_fingerprint; @@ -547,7 +547,7 @@ static gboolean process_serial_number_der (SECItem *serialItem, EASN1Object **retItem) { - char *serialNumber; + gchar *serialNumber; EASN1Object *item = e_asn1_object_new (); e_asn1_object_set_display_name (item, _("Serial Number")); @@ -563,14 +563,14 @@ process_serial_number_der (SECItem *serialItem, static gboolean get_default_oid_format (SECItem *oid, - char **text) + gchar **text) { - char buf[300]; - unsigned int len; - int written; + gchar buf[300]; + guint len; + gint written; unsigned long val = oid->data[0]; - unsigned int i = val % 40; + guint i = val % 40; val /= 40; written = PR_snprintf(buf, 300, "%lu %u ", val, i); if (written < 0) @@ -607,10 +607,10 @@ get_default_oid_format (SECItem *oid, } static gboolean -get_oid_text (SECItem *oid, char **text) +get_oid_text (SECItem *oid, gchar **text) { SECOidTag oidTag = SECOID_FindOIDTag(oid); - char *temp; + gchar *temp; switch (oidTag) { case SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION: @@ -678,7 +678,7 @@ get_oid_text (SECItem *oid, char **text) static gboolean -process_raw_bytes (SECItem *data, char **text) +process_raw_bytes (SECItem *data, gchar **text) { /* This function is used to display some DER bytes that we have not added support for decoding. @@ -689,7 +689,7 @@ process_raw_bytes (SECItem *data, char **text) */ GString *str = g_string_new (""); PRUint32 i; - char buffer[5]; + gchar buffer[5]; for (i=0; ilen; i++) { PR_snprintf(buffer, 5, "%02x ", data->data[i]); g_string_append (str, buffer); @@ -706,7 +706,7 @@ process_sec_algorithm_id (SECAlgorithmID *algID, EASN1Object **retSequence) { EASN1Object *sequence = e_asn1_object_new (); - char *text; + gchar *text; *retSequence = NULL; @@ -747,7 +747,7 @@ process_subject_public_key_info (CERTSubjectPublicKeyInfo *spki, EASN1Object *sequenceItem; EASN1Object *printableItem; SECItem data; - char *text; + gchar *text; e_asn1_object_set_display_name (spkiSequence, _("Subject Public Key Info")); @@ -784,7 +784,7 @@ process_ns_cert_type_extensions (SECItem *extData, GString *text) { SECItem decoded; - unsigned char nsCertType; + guchar nsCertType; decoded.data = NULL; decoded.len = 0; @@ -833,7 +833,7 @@ static gboolean process_key_usage_extensions (SECItem *extData, GString *text) { SECItem decoded; - unsigned char keyUsage; + guchar keyUsage; decoded.data = NULL; decoded.len = 0; @@ -891,7 +891,7 @@ process_extension_data (SECOidTag oidTag, SECItem *extData, rv = process_key_usage_extensions (extData, str); break; default: { - char *text; + gchar *text; rv = process_raw_bytes (extData, &text); g_string_append (str, text); g_free (text); @@ -906,7 +906,7 @@ process_single_extension (CERTCertExtension *extension, EASN1Object **retExtension) { GString *str = g_string_new (""); - char *text; + gchar *text; EASN1Object *extensionItem; SECOidTag oidTag = SECOID_FindOIDTag(&extension->id); @@ -961,7 +961,7 @@ process_extensions (CERTCertExtension **extensions, } static gboolean -process_name (CERTName *name, char **value) +process_name (CERTName *name, gchar **value) { CERTRDN** rdns; CERTRDN** rdn; @@ -970,9 +970,9 @@ process_name (CERTName *name, char **value) SECItem *decodeItem = NULL; GString *final_string = g_string_new (""); - char *type; + gchar *type; GString *avavalue; - char *temp; + gchar *temp; CERTRDN **lastRdn; rdns = name->rdns; @@ -1012,7 +1012,7 @@ process_name (CERTName *name, char **value) return FALSE; } - avavalue = g_string_new_len ((char*)decodeItem->data, decodeItem->len); + avavalue = g_string_new_len ((gchar *)decodeItem->data, decodeItem->len); SECITEM_FreeItem(decodeItem, PR_TRUE); @@ -1053,7 +1053,7 @@ create_tbs_certificate_asn1_struct (ECert *cert, EASN1Object **seq) ** and then add more user friendly text for that field. */ EASN1Object *sequence = e_asn1_object_new (); - char *text; + gchar *text; EASN1Object *subitem; SECItem data; @@ -1176,7 +1176,7 @@ create_asn1_struct (ECert *cert) { EASN1Object *sequence; SECItem temp; - char *text; + gchar *text; cert->priv->asn1 = e_asn1_object_new (); @@ -1248,8 +1248,8 @@ e_cert_mark_for_deletion (ECert *cert) ECertType e_cert_get_cert_type (ECert *ecert) { - const char *nick = e_cert_get_nickname (ecert); - const char *email = e_cert_get_email (ecert); + const gchar *nick = e_cert_get_nickname (ecert); + const gchar *email = e_cert_get_email (ecert); CERTCertificate *cert = ecert->priv->cert; if (nick) { diff --git a/smime/lib/e-cert.h b/smime/lib/e-cert.h index 63125c1871..8c70bcded2 100644 --- a/smime/lib/e-cert.h +++ b/smime/lib/e-cert.h @@ -67,33 +67,33 @@ struct _ECertClass { GType e_cert_get_type (void); ECert* e_cert_new (CERTCertificate *cert); -ECert* e_cert_new_from_der (char *data, guint32 len); +ECert* e_cert_new_from_der (gchar *data, guint32 len); CERTCertificate* e_cert_get_internal_cert (ECert *cert); -gboolean e_cert_get_raw_der (ECert *cert, char **data, guint32 *len); -const char* e_cert_get_window_title (ECert *cert); -const char* e_cert_get_nickname (ECert *cert); -const char* e_cert_get_email (ECert *cert); -const char* e_cert_get_org (ECert *cert); -const char* e_cert_get_org_unit (ECert *cert); -const char* e_cert_get_cn (ECert *cert); -const char* e_cert_get_subject_name (ECert *cert); +gboolean e_cert_get_raw_der (ECert *cert, gchar **data, guint32 *len); +const gchar * e_cert_get_window_title (ECert *cert); +const gchar * e_cert_get_nickname (ECert *cert); +const gchar * e_cert_get_email (ECert *cert); +const gchar * e_cert_get_org (ECert *cert); +const gchar * e_cert_get_org_unit (ECert *cert); +const gchar * e_cert_get_cn (ECert *cert); +const gchar * e_cert_get_subject_name (ECert *cert); -const char* e_cert_get_issuer_name (ECert *cert); -const char* e_cert_get_issuer_cn (ECert *cert); -const char* e_cert_get_issuer_org (ECert *cert); -const char* e_cert_get_issuer_org_unit (ECert *cert); +const gchar * e_cert_get_issuer_name (ECert *cert); +const gchar * e_cert_get_issuer_cn (ECert *cert); +const gchar * e_cert_get_issuer_org (ECert *cert); +const gchar * e_cert_get_issuer_org_unit (ECert *cert); PRTime e_cert_get_issued_on_time (ECert *cert); -const char* e_cert_get_issued_on (ECert *cert); +const gchar * e_cert_get_issued_on (ECert *cert); PRTime e_cert_get_expires_on_time (ECert *cert); -const char* e_cert_get_expires_on (ECert *cert); -const char* e_cert_get_usage(ECert *cert); +const gchar * e_cert_get_expires_on (ECert *cert); +const gchar * e_cert_get_usage(ECert *cert); -const char* e_cert_get_serial_number (ECert *cert); -const char* e_cert_get_sha1_fingerprint (ECert *cert); -const char* e_cert_get_md5_fingerprint (ECert *cert); +const gchar * e_cert_get_serial_number (ECert *cert); +const gchar * e_cert_get_sha1_fingerprint (ECert *cert); +const gchar * e_cert_get_md5_fingerprint (ECert *cert); GList* e_cert_get_chain (ECert *cert); ECert * e_cert_get_ca_cert (ECert *ecert); diff --git a/smime/lib/e-pkcs12.c b/smime/lib/e-pkcs12.c index 759a7fd1d6..5caa13e4f4 100644 --- a/smime/lib/e-pkcs12.c +++ b/smime/lib/e-pkcs12.c @@ -65,16 +65,16 @@ #include "secerr.h" struct _EPKCS12Private { - int mumble; + gint mumble; }; #define PARENT_TYPE G_TYPE_OBJECT static GObjectClass *parent_class; /* static callback functions for the NSS PKCS#12 library */ -static SECItem * PR_CALLBACK nickname_collision(SECItem *, PRBool *, void *); +static SECItem * PR_CALLBACK nickname_collision(SECItem *, PRBool *, gpointer ); -static gboolean handle_error(int myerr); +static gboolean handle_error(gint myerr); #define PKCS12_BUFFER_SIZE 2048 #define PKCS12_RESTORE_OK 1 @@ -155,12 +155,12 @@ e_pkcs12_new (void) } static gboolean -input_to_decoder (SEC_PKCS12DecoderContext *dcx, const char *path, GError **error) +input_to_decoder (SEC_PKCS12DecoderContext *dcx, const gchar *path, GError **error) { /* nsNSSShutDownPreventionLock locker; */ SECStatus srv; - int amount; - char buf[PKCS12_BUFFER_SIZE]; + gint amount; + gchar buf[PKCS12_BUFFER_SIZE]; FILE *fp; /* open path */ @@ -180,7 +180,7 @@ input_to_decoder (SEC_PKCS12DecoderContext *dcx, const char *path, GError **erro /* feed the file data into the decoder */ srv = SEC_PKCS12DecoderUpdate(dcx, - (unsigned char*) buf, + (guchar *) buf, amount); if (srv) { /* XXX g_error */ @@ -198,9 +198,9 @@ input_to_decoder (SEC_PKCS12DecoderContext *dcx, const char *path, GError **erro e_cert_db_login_to_slot stuff, instead of a direct gui dep here.. for now, though, it stays. */ static gboolean -prompt_for_password (char *title, char *prompt, SECItem *pwd) +prompt_for_password (gchar *title, gchar *prompt, SECItem *pwd) { - char *passwd; + gchar *passwd; passwd = e_passwords_ask_password (title, "SMIME-PKCS12", "", prompt, E_PASSWORDS_REMEMBER_NEVER|E_PASSWORDS_SECRET, NULL, @@ -208,8 +208,8 @@ prompt_for_password (char *title, char *prompt, SECItem *pwd) if (passwd) { size_t len = strlen (passwd); - const char *inptr = passwd; - unsigned char *outptr; + const gchar *inptr = passwd; + guchar *outptr; gunichar2 c; SECITEM_AllocItem(NULL, pwd, sizeof (gunichar2) * (len + 1)); @@ -218,8 +218,8 @@ prompt_for_password (char *title, char *prompt, SECItem *pwd) while (inptr && (c = (gunichar2) (g_utf8_get_char (inptr) & 0xffff))) { inptr = g_utf8_next_char (inptr); c = GUINT16_TO_BE (c); - *outptr++ = ((char *) &c)[0]; - *outptr++ = ((char *) &c)[1]; + *outptr++ = ((gchar *) &c)[0]; + *outptr++ = ((gchar *) &c)[1]; } *outptr++ = 0; @@ -234,7 +234,7 @@ prompt_for_password (char *title, char *prompt, SECItem *pwd) static gboolean import_from_file_helper (EPKCS12 *pkcs12, PK11SlotInfo *slot, - const char *path, gboolean *aWantRetry, GError **error) + const gchar *path, gboolean *aWantRetry, GError **error) { /*nsNSSShutDownPreventionLock locker; */ gboolean rv; @@ -310,7 +310,7 @@ import_from_file_helper (EPKCS12 *pkcs12, PK11SlotInfo *slot, } gboolean -e_pkcs12_import_from_file (EPKCS12 *pkcs12, const char *path, GError **error) +e_pkcs12_import_from_file (EPKCS12 *pkcs12, const gchar *path, GError **error) { /*nsNSSShutDownPreventionLock locker;*/ gboolean rv = TRUE; @@ -332,7 +332,7 @@ e_pkcs12_import_from_file (EPKCS12 *pkcs12, const char *path, GError **error) } gboolean -e_pkcs12_export_to_file (EPKCS12 *pkcs12, const char *path, GList *certs, GError **error) +e_pkcs12_export_to_file (EPKCS12 *pkcs12, const gchar *path, GList *certs, GError **error) { return FALSE; } @@ -340,12 +340,12 @@ e_pkcs12_export_to_file (EPKCS12 *pkcs12, const char *path, GList *certs, GError /* what to do when the nickname collides with one already in the db. TODO: not handled, throw a dialog allowing the nick to be changed? */ static SECItem * PR_CALLBACK -nickname_collision(SECItem *oldNick, PRBool *cancel, void *wincx) +nickname_collision(SECItem *oldNick, PRBool *cancel, gpointer wincx) { /* nsNSSShutDownPreventionLock locker; */ - int count = 1; - char *nickname = NULL; - char *default_nickname = _("Imported Certificate"); + gint count = 1; + gchar *nickname = NULL; + gchar *default_nickname = _("Imported Certificate"); SECItem *new_nick; *cancel = PR_FALSE; @@ -397,13 +397,13 @@ nickname_collision(SECItem *oldNick, PRBool *cancel, void *wincx) new_nick = PR_Malloc (sizeof (SECItem)); new_nick->type = siAsciiString; - new_nick->data = (unsigned char *)nickname; - new_nick->len = strlen((char*)new_nick->data); + new_nick->data = (guchar *)nickname; + new_nick->len = strlen((gchar *)new_nick->data); return new_nick; } static gboolean -handle_error(int myerr) +handle_error(gint myerr) { printf ("handle_error (%d)\n", myerr); diff --git a/smime/lib/e-pkcs12.h b/smime/lib/e-pkcs12.h index 5717edb14c..444afcaadd 100644 --- a/smime/lib/e-pkcs12.h +++ b/smime/lib/e-pkcs12.h @@ -63,7 +63,7 @@ EPKCS12* e_pkcs12_new (void); gboolean e_pkcs12_set_token (void); #endif -gboolean e_pkcs12_import_from_file (EPKCS12 *pkcs12, const char *path, GError **error); -gboolean e_pkcs12_export_to_file (EPKCS12 *pkcs12, const char *path, GList *certs, GError **error); +gboolean e_pkcs12_import_from_file (EPKCS12 *pkcs12, const gchar *path, GError **error); +gboolean e_pkcs12_export_to_file (EPKCS12 *pkcs12, const gchar *path, GList *certs, GError **error); #endif /* _E_CERT_H_ */ diff --git a/smime/tests/import-cert.c b/smime/tests/import-cert.c index b202053e6d..850590789a 100644 --- a/smime/tests/import-cert.c +++ b/smime/tests/import-cert.c @@ -23,8 +23,8 @@ #include "e-cert-db.h" #include "e-pkcs12.h" -int -main (int argc, char **argv) +gint +main (gint argc, gchar **argv) { ECertDB *db; EPKCS12 *pkcs12; -- cgit v1.2.3