]> git.deb.at Git - pkg/abook.git/blobdiff - filter.c
Minor cast fixes
[pkg/abook.git] / filter.c
index 15370fbf7d606ae64e6043b5a990e9baf4e77d5d..a4399399b168d267d47b4ed18374c501b77afc8a 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -134,7 +134,7 @@ get_real_name()
 
        pwent = getpwnam(username);
 
-       if( (tmp = malloc(strlen(pwent->pw_gecos) +1)) == NULL)
+       if( (tmp = (char *)malloc(strlen(pwent->pw_gecos) +1)) == NULL)
                return strdup(username);
 
        rtn = sscanf(pwent->pw_gecos, "%[^,]", tmp);
@@ -647,7 +647,7 @@ mutt_read_line(FILE *in, char **alias, char **rest)
        while( ! ISSPACE(*ptr) )
                ptr++;
 
-       if( (*alias = malloc(ptr-tmp+1)) == NULL)
+       if( (*alias = (char *)malloc(ptr-tmp+1)) == NULL)
                return 1;
 
        strncpy(*alias, tmp, ptr-tmp);
@@ -820,10 +820,14 @@ html_export_database(FILE *out, struct db_enumerator e)
 
        db_enumerate_items(e) {
                get_first_email(tmp, e.item);
-               fprintf(out, "<tr>\n<td><a href=\"mailto:%s\">%s</a>\n",
-                               tmp,
-                               database[e.item][NAME] );
-                               
+               if (*tmp)
+                   fprintf(out, "<tr>\n<td><a href=\"mailto:%s\">%s</a>\n",
+                           tmp,
+                           database[e.item][NAME] );
+               else
+                   fprintf(out, "<tr>\n<td>%s>\n",
+                           database[e.item][NAME] );
+
                fprintf(out, "<td>%s\n<td>%s\n",
                                database[e.item][EMAIL],
                                safe_str(database[e.item][extra_column]) );
@@ -896,7 +900,7 @@ pine_convert_emails(char *s)
                *tmp=0;
        
        for(i=1; ( tmp = strchr(s, ',') ) != NULL ; i++, s=tmp+1 )
-               if( i > 3 ) {
+               if( i > MAX_EMAILS - 1 ) {
                        *tmp = 0;
                        break;  
                }
@@ -950,7 +954,7 @@ pine_parse_file(FILE *in)
        
        while(!feof(in)) {
                for(i=2;;i++) {
-                       buf = realloc(buf, i*LINESIZE);
+                       buf = (char *) realloc(buf, i*LINESIZE);
                        if(i==2)
                                strcpy(buf, line);
                        fgets(line, LINESIZE, in);
@@ -962,8 +966,10 @@ pine_parse_file(FILE *in)
                                
                        strcat(buf, ptr);
                }
-               if( *buf == '#' )
+               if( *buf == '#' ) {
+                       my_free(buf);
                        continue;
+               }
                pine_fixbuf(buf);
 
                pine_parse_buf(buf);
@@ -1218,14 +1224,8 @@ text_write_address_eu(FILE *out, int i) {
 
                if(database[i][CITY])
                        fprintf(out, "%s", database[i][CITY]);
-               /*
-               fprintf(out, "\n%s %s",
-                               safe_str(database[i][ZIP]),
-                               safe_str(database[i] [CITY]));
-                               */
        }
        
-
        if (database[i][STATE])
                fprintf(out, "\n%s", database[i][STATE]);