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)
return result;
}
-struct date_value* gedcom_new_date_value(struct date_value* copy_from)
+struct date_value* gedcom_new_date_value(const struct date_value* copy_from)
{
struct date_value* dv_ptr;
dv_ptr = (struct date_value*) malloc(sizeof(struct date_value));
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 {
return dv_s;
}
-void write_date(struct date* d)
+void write_date(const struct date* d)
{
if (! d->year_str[0] || d->year <= 0 || d->sdn1 <= 0)
gedcom_error(_("Date is not normalized: some fields are invalid"));
}
}
-char* gedcom_date_to_string(struct date_value* val)
+char* gedcom_date_to_string(const struct date_value* val)
{
init_buffer(&date_buffer);
reset_buffer(&date_buffer);