X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gedcom%2Fdate.c;h=19fd43459f2aba436161c804c05e709eaf1a12c3;hb=681b182b6f003e91a47a098b7e8ac632315f61a6;hp=40cb18a7115eca0c5a86f2600e6c73b54b311dee;hpb=31fb8432ef01f9d5a08cc801a785a07b4e9d12bd;p=gedcom-parse.git diff --git a/gedcom/date.c b/gedcom/date.c index 40cb18a..19fd434 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 { @@ -423,8 +425,9 @@ struct date_value gedcom_parse_date(const char* line_value) result |= numbers_to_sdn(&dv_s.date2); } if (result != 0) { - gedcom_date_error(_("Putting date in 'phrase' member")); - make_date_value(DV_PHRASE, &def_date, &def_date, curr_line_value); + gedcom_date_error(_("Putting date '%s' in 'phrase' member"), + curr_line_value); + make_date_value(DV_PHRASE, &dv_s.date1, &dv_s.date2, curr_line_value); } return dv_s; }