From 1a7ab679cde366290535a3c9dd9feca58c4b3d6c Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 14 Apr 2010 12:00:43 +0200 Subject: [PATCH] Extended effect of iso_write_opts_set_pvd_times() parameter uuid to creation time, to keep it consistent with modification time. --- libisofs/ecma119.c | 11 ++++++++++- libisofs/ecma119.h | 8 ++++---- libisofs/libisofs.h | 11 ++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/libisofs/ecma119.c b/libisofs/ecma119.c index 2e9c233..98724ba 100644 --- a/libisofs/ecma119.c +++ b/libisofs/ecma119.c @@ -438,7 +438,16 @@ int ecma119_writer_write_vol_desc(IsoImageWriter *writer) strncpy_pad((char*)vol.abstract_file_id, abstract_file_id, 37); strncpy_pad((char*)vol.bibliographic_file_id, biblio_file_id, 37); - if (t->vol_creation_time > 0) + if (t->vol_uuid[0]) { + for(i = 0; i < 16; i++) + if(t->vol_uuid[i] < '0' || t->vol_uuid[i] > '9') + break; + else + vol.vol_creation_time[i] = t->vol_uuid[i]; + for(; i < 16; i++) + vol.vol_creation_time[i] = '1'; + vol.vol_creation_time[16] = 0; + } else if (t->vol_creation_time > 0) iso_datetime_17(vol.vol_creation_time, t->vol_creation_time, t->always_gmt); else diff --git a/libisofs/ecma119.h b/libisofs/ecma119.h index b679365..dcdc43b 100644 --- a/libisofs/ecma119.h +++ b/libisofs/ecma119.h @@ -313,8 +313,8 @@ struct iso_write_opts { time_t vol_modification_time; time_t vol_expiration_time; time_t vol_effective_time; - /* To eventually override vol_modification_time by unconverted string - * and timezone 0 + /* To eventually override vol_creation_time and vol_modification_time + * by unconverted string with timezone 0 */ char vol_uuid[17]; @@ -537,8 +537,8 @@ struct ecma119_image time_t vol_modification_time; time_t vol_expiration_time; time_t vol_effective_time; - /* To eventually override vol_modification_time by unconverted string - * and timezone 0 + /* To eventually override vol_creation_time and vol_modification_time + * by unconverted string with timezone 0 */ char vol_uuid[17]; }; diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index ce0f3f1..3299471 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -1733,11 +1733,12 @@ int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768], * When "the information in the volume may be used." * A value of 0 means that not such retention is intended. * @param uuid - * If this text is not empty, then it overrides vol_modification_time - * by copying the first 16 decimal digits from uuid, eventually - * padding up with decimal '1', and writing a NUL-byte as timezone. - * Other than with vol_modification_time the resulting string in the ISO - * image is fully predictable and free of timezone pitfalls. + * If this text is not empty, then it overrides vol_creation_time and + * vol_modification_time by copying the first 16 decimal digits from + * uuid, eventually padding up with decimal '1', and writing a NUL-byte + * as timezone. + * Other than with vol_*_time the resulting string in the ISO image + * is fully predictable and free of timezone pitfalls. * It should express a reasonable time in form YYYYMMDDhhmmsscc * E.g.: "2010040711405800" = 7 Apr 2010 11:40:58 (+0 centiseconds) *