X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gedcom%2Fdate.c;h=9c086e7e2494ccb4de39d7517826ff574acbe710;hb=d2dbc2834cae06a5de0dec22c0e7a530b7dd1589;hp=40cb18a7115eca0c5a86f2600e6c73b54b311dee;hpb=31fb8432ef01f9d5a08cc801a785a07b4e9d12bd;p=gedcom-parse.git diff --git a/gedcom/date.c b/gedcom/date.c index 40cb18a..9c086e7 100644 --- a/gedcom/date.c +++ b/gedcom/date.c @@ -336,7 +336,7 @@ int numbers_to_strings(struct date *d) if (d->day != -1) sprintf(d->day_str, "%d", d->day); - if (d->month != -1) + if (d->month > 0 && d->month <= max_month[d->cal]) strcpy(d->month_str, month_name[d->cal][d->month - 1]); if (d->year_type == YEAR_SINGLE) @@ -405,12 +405,14 @@ struct date_value* gedcom_new_date_value(const struct date_value* copy_from) struct date_value gedcom_parse_date(const char* line_value) { int result = 0; + init_date(&dv_s.date1); + init_date(&dv_s.date2); init_date(&date_s); init_date(&def_date); curr_line_value = line_value; if (compat_mode(C_NO_REQUIRED_VALUES) - && !strncmp(curr_line_value, "-", 2)) { - gedcom_date_error(_("Empty value changed to '-'")); + && !strncmp(curr_line_value, VALUE_IF_MISSING, 2)) { + gedcom_date_error(_("Empty value changed to '%s'"), VALUE_IF_MISSING); result = 1; } else { @@ -424,7 +426,7 @@ struct date_value gedcom_parse_date(const char* line_value) } if (result != 0) { gedcom_date_error(_("Putting date in 'phrase' member")); - make_date_value(DV_PHRASE, &def_date, &def_date, curr_line_value); + make_date_value(DV_PHRASE, &dv_s.date1, &dv_s.date2, curr_line_value); } return dv_s; }