]> git.deb.at Git - pkg/abook.git/blobdiff - edit.c
* max_len should be size_t
[pkg/abook.git] / edit.c
diff --git a/edit.c b/edit.c
index ef956ef80c364ae4813842ec49335422f8cc3093..5f889f47f03a2c9e6667b9d5ca1a01f084edc614 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -289,7 +289,7 @@ editor_print_data(int tab, int item)
  *  valid string
  */
 static int
-change_field(char *msg, char **field, int max_len)
+change_field(char *msg, char **field, size_t max_len)
 {
        char *old;
        int ret = 0;
@@ -314,7 +314,7 @@ change_field(char *msg, char **field, int max_len)
 }
 
 static int
-change_name_field(char *msg, char **field, int max_len)
+change_name_field(char *msg, char **field, size_t max_len)
 {
        char *tmp;
        int ret;
@@ -500,8 +500,12 @@ edit_date(int item, int nb)
 
        /* ISO 8601 date, of the YYYY-MM-DD or --MM-DD format */
        if(is_valid_date(date[0], date[1], date[2])) {
-               s = strdup_printf(date[2] ? "%04d-%02d-%02d" : "%c-%02d-%02d",
-                       date[2] ? date[2] : '-', date[1], date[0]);
+               if(date[2])
+                       s = strdup_printf("%04d-%02d-%02d",
+                               date[2], date[1], date[0]);
+               else
+                       s = strdup_printf("--%02d-%02d", date[1], date[0]);
+
                db_fput_byid(item, nb, xstrdup(s));
        } else
                statusline_msg(_("Invalid date"));