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));
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);