replaced date parser by shorter but more complicated code

This commit is contained in:
Mario Hüttel 2018-06-11 15:16:40 +02:00
parent 3ed83c1146
commit f913976a44

View File

@ -349,6 +349,9 @@ void scan_library_references(gpointer library_list_item, gpointer user)
void gds_parse_date(const char *buffer, int length, struct gds_time_field *mod_date, struct gds_time_field *access_date) void gds_parse_date(const char *buffer, int length, struct gds_time_field *mod_date, struct gds_time_field *access_date)
{ {
struct gds_time_field *temp_date;
if (!access_date || !mod_date) { if (!access_date || !mod_date) {
GDS_WARN("Date structures invalid"); GDS_WARN("Date structures invalid");
return; return;
@ -359,32 +362,23 @@ void gds_parse_date(const char *buffer, int length, struct gds_time_field *mod_d
return; return;
} }
mod_date->year = gds_convert_unsigend_int16(buffer); for (temp_date = mod_date; 1; temp_date = access_date) {
buffer += 2; temp_date->year = gds_convert_unsigend_int16(buffer);
mod_date->month = gds_convert_unsigend_int16(buffer); buffer += 2;
buffer += 2; temp_date->month = gds_convert_unsigend_int16(buffer);
mod_date->day = gds_convert_unsigend_int16(buffer); buffer += 2;
buffer += 2; temp_date->day = gds_convert_unsigend_int16(buffer);
mod_date->hour = gds_convert_unsigend_int16(buffer); buffer += 2;
buffer += 2; temp_date->hour = gds_convert_unsigend_int16(buffer);
mod_date->minute = gds_convert_unsigend_int16(buffer); buffer += 2;
buffer += 2; temp_date->minute = gds_convert_unsigend_int16(buffer);
mod_date->second = gds_convert_unsigend_int16(buffer); buffer += 2;
buffer += 2; temp_date->second = gds_convert_unsigend_int16(buffer);
buffer += 2;
access_date->year = gds_convert_unsigend_int16(buffer);
buffer += 2;
access_date->month = gds_convert_unsigend_int16(buffer);
buffer += 2;
access_date->day = gds_convert_unsigend_int16(buffer);
buffer += 2;
access_date->hour = gds_convert_unsigend_int16(buffer);
buffer += 2;
access_date->minute = gds_convert_unsigend_int16(buffer);
buffer += 2;
access_date->second = gds_convert_unsigend_int16(buffer);
if (temp_date == access_date)
break;
}
} }
int parse_gds_from_file(const char *filename, GList **library_list) int parse_gds_from_file(const char *filename, GList **library_list)