Patch : another batch of clean-ups



	Hi all,
all is in the subject ;-)
Patch is against 1.2.0 (like the previous one).
Bye
Manu
diff -u balsa-1.2.0/libbalsa/address-entry.c test/balsa-1.2.0/libbalsa/address-entry.c
--- balsa-1.2.0/libbalsa/address-entry.c	Sat Oct 13 14:06:15 2001
+++ test/balsa-1.2.0/libbalsa/address-entry.c	Sat Oct 13 14:09:35 2001
@@ -639,14 +639,16 @@
 {
     inputData *input;
     emailData *addy;
+    guint len;
 
     g_return_if_fail(address_entry != NULL);
     g_return_if_fail(LIBBALSA_IS_ADDRESS_ENTRY(address_entry));
 
     input = address_entry->input;
     addy = input->active->data;
-    if (addy->cursor < strlen(addy->user)) {
-	addy->cursor = strlen(addy->user);
+    len=strlen(addy->user);
+    if (addy->cursor < len) {
+	addy->cursor = len;
     } else {
 	libbalsa_force_no_match(addy);
 	if (g_list_next(input->active)) {
@@ -779,7 +781,10 @@
     if (input->active != input->list)
 	addy->cursor = addy->cursor - 1; /* Compensate for the ',' */
     if (addy->cursor < 0) addy->cursor = 0;
-    else if (addy->cursor > strlen(addy->user)) addy->cursor = strlen(addy->user);
+    else {
+	guint len=strlen(addy->user);
+	if (addy->cursor > len) addy->cursor = len;
+    }
 
     return input;
 }
@@ -2303,6 +2308,7 @@
     gchar *str, *left, *right, *new;
     emailData *addy;
     gint i;
+    guint len;
 
     g_return_if_fail(address_entry != NULL);
     g_return_if_fail(LIBBALSA_IS_ADDRESS_ENTRY(address_entry));
@@ -2340,9 +2346,10 @@
 	g_free(addy->user);
 	addy->user = new;
 	addy->cursor = start_pos;
-	if (addy->cursor > strlen(addy->user))
-	    addy->cursor = strlen(addy->user);
-	if (addy->cursor < 0)
+	len=strlen(addy->user);
+	if (addy->cursor > len)
+	    addy->cursor = len;
+	else if (addy->cursor < 0)
 	    addy->cursor = 0;
     } else {
 	/*
@@ -2357,8 +2364,9 @@
 	addy->user = left;
 	addy->cursor = start_pos;
 	address_entry->input->active = start;
-	if (addy->cursor > strlen(addy->user))
-	    addy->cursor = strlen(addy->user);
+	len=strlen(addy->user);
+	if (addy->cursor > len)
+	    addy->cursor = len;
 	
 	/*
 	 * Set the end data.
diff -u balsa-1.2.0/src/balsa-message.c test/balsa-1.2.0/src/balsa-message.c
--- balsa-1.2.0/src/balsa-message.c	Wed Aug 29 13:56:38 2001
+++ test/balsa-1.2.0/src/balsa-message.c	Sat Oct 13 14:01:53 2001
@@ -603,9 +603,10 @@
     gtk_text_insert(GTK_TEXT(bm->header_text), fnt, NULL, NULL, label, -1);
 
     if (value && *value != '\0') {
-	if (strlen(label) < 15)
+	guint len=strlen(label);
+	if (len < 15)
 	    gtk_text_insert(GTK_TEXT(bm->header_text), fnt, NULL, NULL,
-			    pad, 15 - strlen(label));
+			    pad, 15 - len);
 	else
 	    gtk_text_insert(GTK_TEXT(bm->header_text), fnt, NULL, NULL,
 			    pad, 1);
@@ -960,6 +961,7 @@
     gchar *res;
     const gchar *ptr = base, *postfix = NULL;
     int dash_cnt = 0, len, i;
+    guint tmplen;
 
     g_return_val_if_fail(base != NULL, NULL);
     g_return_val_if_fail(charset >= 0, NULL);
@@ -991,11 +993,12 @@
     /* if(dash_cnt>12) len--; */
     if (len < 1)
 	len = 1;
-    res = (gchar *) g_malloc (len + strlen(postfix) + 2);
+    tmplen=strlen(postfix);
+    res = (gchar *) g_malloc (len + tmplen + 2);
     if (balsa_app.debug)
 	fprintf(stderr, "* base font name: %s\n*    and postfix: %s\n"
 		"*    mallocating: %d bytes\n", base, postfix,
-		len + strlen(postfix) + 2);
+		len + tmplen + 2);
 
     if (len > 1)
 	strncpy(res, base, len);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]