[Commits] callbacks.c 1.16 1.17 contactwindow.c 1.13 1.14 extension-loader.c 1.6 1.7 gtk-utils.c 1.6 1.7 plugin-loader.c 1.8 1.9 printing.c 1.5 1.6 utils.c 1.12 1.13
miras at claws-mail.org
miras at claws-mail.org
Wed Dec 21 23:02:55 CET 2011
Update of /home/claws-mail/contacts/src
In directory claws-mail:/tmp/cvs-serv31493/src
Modified Files:
callbacks.c contactwindow.c extension-loader.c gtk-utils.c
plugin-loader.c printing.c utils.c
Log Message:
2011-12-21 [mir] 0.6.0cvs56
* src/callbacks.c
* src/contactwindow.c
* src/extension-loader.c
* src/gtk-utils.c
* src/plugin-loader.c
* src/printing.c
* src/utils.c
* xmllib/parser.c
Improve public functions error resistens.
Index: contactwindow.c
===================================================================
RCS file: /home/claws-mail/contacts/src/contactwindow.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- contactwindow.c 18 Dec 2011 15:54:19 -0000 1.13
+++ contactwindow.c 21 Dec 2011 22:02:52 -0000 1.14
@@ -896,20 +896,23 @@
contact_dump(cw->contact, stderr);
AttribDef* attr = g_hash_table_lookup(cw->contact->data, "image");
if (attr) {
- photo = attr->value.string;
+ photo = g_strdup(attr->value.string);
if (photo) {
pixbuf = contact_load_image(cw->main->window, photo);
- if (! pixbuf)
+ if (! pixbuf) {
+ g_free(photo);
photo = NULL;
+ }
}
}
}
if (! photo) {
- photo = PIXDIR"/anonymous.xpm";
+ photo = g_strdup_printf("%s/%s", PIXDIR, "anonymous.xpm");
pixbuf = gdk_pixbuf_new_from_file_at_scale(
photo, PHOTO_WIDTH, PHOTO_HEIGHT, TRUE, &err);
}
+ g_free(photo);
pix_event_box = gtk_event_box_new();
gtk_widget_set_tooltip_text(pix_event_box,
Index: gtk-utils.c
===================================================================
RCS file: /home/claws-mail/contacts/src/gtk-utils.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- gtk-utils.c 13 Dec 2011 14:29:42 -0000 1.6
+++ gtk-utils.c 21 Dec 2011 22:02:52 -0000 1.7
@@ -452,6 +452,8 @@
void row_data_free(gpointer row) {
RowData* data = (RowData *) row;
+
+ cm_return_if_fail(data != NULL);
data->plugin = NULL;
data->abook = NULL;
@@ -461,6 +463,9 @@
void dialog_set_focus(GtkDialog* dialog, const gchar* button_label) {
GList *children, *cur;
+ cm_return_if_fail(dialog != NULL);
+ cm_return_if_fail(GTK_IS_DIALOG(dialog));
+
children = gtk_container_get_children(
GTK_CONTAINER(GTK_DIALOG(dialog)->action_area));
for (cur = children; cur; cur = g_list_next(cur)) {
Index: utils.c
===================================================================
RCS file: /home/claws-mail/contacts/src/utils.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- utils.c 17 Dec 2011 02:52:22 -0000 1.12
+++ utils.c 21 Dec 2011 22:02:52 -0000 1.13
@@ -269,6 +269,8 @@
}
void hash_table_free(GHashTable** hash_table) {
+ cm_return_if_fail(hash_table != NULL);
+
if (*hash_table == NULL)
return;
@@ -300,6 +302,8 @@
gboolean create_file(const gchar* path, gchar** error) {
gboolean fail = FALSE;
+ cm_return_val_if_fail(path != NULL, FALSE);
+
debug_print("Creating: %s\n", path);
mode_t mode = umask(0);
if (g_mkdir(path, 0700) < 0) {
@@ -401,6 +405,8 @@
void hash_table_keys_to_slist(gpointer key, gpointer value, gpointer slist) {
GSList** list = (GSList **) slist;
AttribDef* attrdef;
+
+ cm_return_if_fail(slist != NULL);
attrdef = g_new0(AttribDef, 1);
attrdef->attrib_name = g_strdup((gchar *) key);
@@ -414,6 +420,8 @@
int num;
ConfiguredBooks* cf_books;
ClosedBooks* cl_books;
+
+ cm_return_if_fail(config != NULL);
if (! config->key_file) {
config_open(config, error);
@@ -472,6 +480,8 @@
gchar** str;
gsize len = 0;
gsize num;
+
+ cm_return_if_fail(config != NULL);
if (! config->key_file) {
if (! config->path) {
@@ -588,6 +598,8 @@
gsize len;
gsize num;
+ cm_return_val_if_fail(config != NULL, FALSE);
+
if (! config->key_file || ! group || ! key) {
return FALSE;
}
@@ -605,6 +617,8 @@
const gchar* key, GSList* values) {
gchar** list;
int num;
+
+ cm_return_val_if_fail(config != NULL, FALSE);
if (! config->key_file || ! group || ! key) {
return FALSE;
@@ -777,6 +791,9 @@
gboolean result = FALSE;
gint res;
AttribType ctype;
+
+ cm_return_val_if_fail(a != NULL, FALSE);
+ cm_return_val_if_fail(b != NULL, FALSE);
if (type >= 0)
ctype = type;
@@ -917,6 +934,8 @@
AddressBook* address_book_copy(AddressBook* a, gboolean deep) {
AddressBook* b = g_new0(AddressBook, 1);
GList* cur;
+
+ cm_return_val_if_fail(a != NULL, NULL);
b->abook_name = g_strdup(a->abook_name);
b->URL = g_strdup(a->URL);
@@ -974,6 +993,8 @@
void contact_dump(const Contact* contact, FILE* f) {
GSList* cur;
+
+ cm_return_if_fail(contact != NULL);
if (f)
fprintf(f, "Contact data\n");
@@ -992,6 +1013,8 @@
}
void email_dump(Email* email, FILE* f) {
+ cm_return_if_fail(email != NULL);
+
if (f)
fprintf(f, "Alias: %s Email: %s Remarks: %s\n",
email->alias, email->email, email->remarks);
@@ -1021,6 +1044,8 @@
gchar* base64;
gsize length;
+ cm_return_val_if_fail(path != NULL, NULL);
+
g_file_get_contents(path, &contents, &length, NULL);
base64 = g_base64_encode((const guchar *) contents, length);
g_free(contents);
@@ -1095,6 +1120,8 @@
GHashTableIter iter;
gpointer key, value;
GHashTable* data;
+
+ cm_return_if_fail(contact != NULL);
if (contact->data) {
data = hash_table_new();
@@ -1137,6 +1164,8 @@
gboolean attribute_supported(Plugin* plugin, const gchar* attribute) {
GSList *attribs, *cur;
gboolean found = FALSE;
+
+ cm_return_val_if_fail(plugin != NULL, FALSE);
attribs = plugin->attrib_list();
@@ -1168,6 +1197,9 @@
AttribDef* attr = (AttribDef *) value;
const gchar* type = NULL;
+ cm_return_if_fail(value != NULL);
+ cm_return_if_fail(data != NULL);
+
switch (attr->type) {
case ATTRIB_TYPE_INT: type = "INT"; break;
case ATTRIB_TYPE_CHAR: type = "CHAR"; break;
@@ -1281,6 +1313,8 @@
GSList *cur, *ptr;
AttribDef *cur_attr, *ptr_attr;
gboolean found;
+
+ cm_return_if_fail(neddle != NULL);
if (neddle->type == LIST) {
for (cur = neddle->attr.list; cur; cur = g_slist_next(cur)) {
@@ -1638,6 +1672,8 @@
GSList* get_basic_attributes(Contact* contact) {
GSList *list = NULL, *cur;
gchar* value = NULL;
+
+ cm_return_val_if_fail(contact != NULL, NULL);
extract_data(contact->data, "nick-name", (void **) &value);
if (value) {
@@ -1797,6 +1833,8 @@
Compare* comp = (Compare *) data;
AttribDef *attr;
const gchar* term;
+
+ cm_return_if_fail(value != NULL);
term = ((AttribDef *) value)->value.string;
@@ -1895,7 +1933,10 @@
gpointer key1, key2, val1, val2;
ContactChange* c;
GSList /**emaila, *emailb, *cura, *curb*/ *cur;
-
+
+ cm_return_val_if_fail(a != NULL, FALSE);
+ cm_return_val_if_fail(b != NULL, FALSE);
+
g_hash_table_iter_init(&iter, a->data);
while (g_hash_table_iter_next(&iter, &key1, &val1)) {
AttribDef* attr1 = (AttribDef *) val1;
@@ -2033,6 +2074,8 @@
GError *err = NULL;
guchar* image_buf;
gsize len;
+
+ cm_return_val_if_fail(base64_png != NULL, NULL);
image_buf = g_base64_decode(base64_png, &len);
@@ -2084,6 +2127,8 @@
GError *err = NULL;
gsize len;
+ cm_return_val_if_fail(jpeg != NULL, NULL);
+
image_buf = g_new0(guchar, length * 3 / 4 );
pl = gdk_pixbuf_loader_new();
@@ -2114,6 +2159,8 @@
}
const gchar* native2ldap(const gchar* attr) {
+ cm_return_val_if_fail(attr != NULL, NULL);
+
if (strcasecmp(attr, "email") == 0)
return "mail";
else if (strcasecmp(attr, "first-name") == 0)
@@ -2129,6 +2176,8 @@
}
const gchar* ldap2native(const gchar* attr) {
+ cm_return_val_if_fail(attr != NULL, NULL);
+
if (strcasecmp(attr, "mail") == 0)
return "email";
else if (strcasecmp(attr, "givenName") == 0)
Index: extension-loader.c
===================================================================
RCS file: /home/claws-mail/contacts/src/extension-loader.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- extension-loader.c 14 Dec 2011 08:27:03 -0000 1.6
+++ extension-loader.c 21 Dec 2011 22:02:52 -0000 1.7
@@ -254,6 +254,9 @@
}
void extension_unload(Extension** extension, gchar** error) {
+
+ cm_return_if_fail(extension != NULL);
+
if (! g_hash_table_remove(extensions, &(*extension)->id)) {
if (error)
*error = g_strdup(_("Extension was not found"));
Index: plugin-loader.c
===================================================================
RCS file: /home/claws-mail/contacts/src/plugin-loader.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- plugin-loader.c 20 Nov 2011 21:24:20 -0000 1.8
+++ plugin-loader.c 21 Dec 2011 22:02:52 -0000 1.9
@@ -608,6 +608,8 @@
plugin_remaining_attribs, plugin_inactive_attribs, plugin_addrbook_names_all,
plugin_closed_books_get, plugin_need_credentials, plugin_extra_config;
+ cm_return_val_if_fail(filename != NULL, NULL);
+
plugin = g_new0(Plugin, 1);
if (plugin == NULL) {
*error = g_strdup(_("Failed to allocate memory for Plugin"));
@@ -775,6 +777,8 @@
void plugin_unload(Plugin* plugin) {
gboolean (*plugin_done) (void);
gboolean can_unload = TRUE;
+
+ cm_return_if_fail(plugin != NULL);
debug_print("trying to unload `%s'\n", plugin_get_name(plugin));
if (plugin->error) {
@@ -899,6 +903,8 @@
GSList *loaded, *cur;
Plugin* plugin = NULL;
+ cm_return_val_if_fail(name != NULL, NULL);
+
loaded = plugin_get_list();
for (cur = loaded; cur; cur = g_slist_next(cur)) {
@@ -916,6 +922,8 @@
GSList *cur1, *cur2, *books;
gboolean found_book = FALSE;
Reference* ref = NULL;
+
+ cm_return_val_if_fail(name != NULL, NULL);
books = address_books_get();
Index: printing.c
===================================================================
RCS file: /home/claws-mail/contacts/src/printing.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- printing.c 28 Nov 2011 21:45:28 -0000 1.5
+++ printing.c 21 Dec 2011 22:02:52 -0000 1.6
@@ -229,6 +229,8 @@
GError* error = NULL;
GList* cur;
+ cm_return_if_fail(info != NULL);
+
print_data = g_new0(PrintData, 1);
if (! info->contact) {
if (info->print_book) {
Index: callbacks.c
===================================================================
RCS file: /home/claws-mail/contacts/src/callbacks.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- callbacks.c 18 Dec 2011 01:00:42 -0000 1.16
+++ callbacks.c 21 Dec 2011 22:02:52 -0000 1.17
@@ -508,6 +508,9 @@
GtkTreeModel* model;
gchar *cn, *first, *last, *mail = NULL;
+ cm_return_if_fail(view != NULL);
+ cm_return_if_fail(contact != NULL);
+
cn = first = last = mail = NULL;
model = gtk_tree_view_get_model(view);
store = GTK_LIST_STORE(model);
@@ -539,6 +542,9 @@
Contact* new) {
gchar* error = NULL;
+ cm_return_val_if_fail(plugin != NULL, _("Missing plugin"));
+ cm_return_val_if_fail(abook != NULL, _("Missing address book"));
+
if (! plugin->readonly) {
if (! plugin->update_contact(abook, new, &error)) {
abook->contacts = g_list_remove(abook->contacts, old);
@@ -559,6 +565,8 @@
GValue value={0,};
AddressBook* abook = NULL;
+ cm_return_val_if_fail(view != NULL, NULL);
+
row = gtk_tree_view_get_selection(view);
if (row) {
if (gtk_tree_selection_get_selected(row, &model, &iter)) {
@@ -573,9 +581,7 @@
void set_selected_address_book(GtkTreeView* view, AddressBook* book) {
if (! view || ! book)
- return;
-
-
+ return;
}
Plugin* get_selected_plugin(GtkTreeView* view) {
@@ -585,6 +591,8 @@
GValue value={0,};
Plugin* plugin = NULL;
+ cm_return_val_if_fail(view != NULL, NULL);
+
row = gtk_tree_view_get_selection(view);
if (row) {
if (gtk_tree_selection_get_selected(row, &model, &iter)) {
@@ -604,6 +612,8 @@
GValue value={0,};
Contact* contact = NULL;
+ cm_return_val_if_fail(view != NULL, NULL);
+
row = gtk_tree_view_get_selection(view);
if (row) {
if (gtk_tree_selection_get_selected(row, &model, &iter)) {
@@ -623,6 +633,8 @@
GtkTreeIter *iter,
gpointer data) {
gchar* name;
+
+ cm_return_if_fail(renderer != NULL);
gtk_tree_model_get(model, iter, BOOK_NAME_COLUMN, &name, -1);
if (! name || strcmp(name, MISSING) == 0) {
More information about the Commits
mailing list