From 7bbdbd4f7c71f89359fb48dd25c7bfa464deae4d Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 22 Feb 2005 09:55:47 +0000 Subject: [PATCH] iso9660_get_dtime hack: we've seen it happen that everything except gmtoff is zero and the expected date is the beginning of the epoch. So we accept 6 numbers being zero. I'm also not sure if using the of the Epoch is also the right thing to do either. --- lib/iso9660/iso9660.c | 28 ++++++++++++++++++++++++++-- test/isofs-m1.right | 14 +++++++------- test/monvoisin.right | 24 ++++++++++++------------ 3 files changed, 45 insertions(+), 21 deletions(-) diff --git a/lib/iso9660/iso9660.c b/lib/iso9660/iso9660.c index 9cdc5066..42dff426 100644 --- a/lib/iso9660/iso9660.c +++ b/lib/iso9660/iso9660.c @@ -1,5 +1,5 @@ /* - $Id: iso9660.c,v 1.7 2005/02/22 04:32:52 rocky Exp $ + $Id: iso9660.c,v 1.8 2005/02/22 09:55:47 rocky Exp $ Copyright (C) 2000 Herbert Valerio Riedel Copyright (C) 2003, 2004, 2005 Rocky Bernstein @@ -48,7 +48,7 @@ const char ISO_STANDARD_ID[] = {'C', 'D', '0', '0', '1'}; #include #endif -static const char _rcsid[] = "$Id: iso9660.c,v 1.7 2005/02/22 04:32:52 rocky Exp $"; +static const char _rcsid[] = "$Id: iso9660.c,v 1.8 2005/02/22 09:55:47 rocky Exp $"; /* Variables to hold debugger-helping enumerations */ enum iso_enums1 iso_enums1; @@ -103,6 +103,30 @@ iso9660_get_dtime (const iso9660_dtime_t *idr_date, bool b_localtime, { if (!idr_date) return false; + + /* + Section 9.1.5 of ECMA 119 says: + If all seven numbers are zero, it shall mean that the date and + time are not specified. + + HACK: However we've seen it happen that everything except gmtoff + is zero and the expected date is the beginning of the epoch. So + we accept 6 numbers being zero. I'm also not sure if using the + beginning of the Epoch is also the right thing to do either. + */ + + if ( 0 == idr_date->dt_year && 0 == idr_date->dt_month && + 0 == idr_date->dt_day && 0 == idr_date->dt_hour && + 0 == idr_date->dt_minute && 0 == idr_date->dt_second ) { + time_t t = 0; + struct tm *p_temp_tm; + p_temp_tm = gmtime(&t); + + memcpy(p_tm, p_temp_tm, sizeof(struct tm)); + return true; + } + + memset(p_tm, 0, sizeof(struct tm)); p_tm->tm_year = idr_date->dt_year; p_tm->tm_mon = idr_date->dt_month - 1; diff --git a/test/isofs-m1.right b/test/isofs-m1.right index f492753f..64260b73 100644 --- a/test/isofs-m1.right +++ b/test/isofs-m1.right @@ -20,13 +20,13 @@ Volume : CDROM Volume Set : ISO9660 filesystem /: - drwxrwxr-x 3 715 715 [LSN 23] 2048 Apr 20 2003 07:26 . - drwxrwxr-x 3 715 715 [LSN 23] 2048 Apr 20 2003 07:26 .. - -rw-r--r-- 1 715 715 [LSN 26] 17992 Jul 29 2002 08:39 COPYING - drwxrwxr-x 2 715 715 [LSN 24] 2048 Apr 20 2003 12:18 doc + drwxrwxr-x 3 715 715 [LSN 23] 2048 Apr 20 2003 07:26 . + drwxrwxr-x 3 715 715 [LSN 23] 2048 Apr 20 2003 07:26 .. + -rw-r--r-- 1 715 715 [LSN 26] 17992 Apr 20 2003 07:26 COPYING + drwxrwxr-x 2 715 715 [LSN 24] 2048 Apr 20 2003 12:18 doc /doc/: - drwxrwxr-x 2 715 715 [LSN 24] 2048 Apr 20 2003 12:18 . - drwxrwxr-x 3 715 715 [LSN 23] 2048 Apr 20 2003 07:26 .. - -rw-rw-r-- 1 715 715 [LSN 35] 648 Apr 20 2003 12:18 readme.txt + drwxrwxr-x 2 715 715 [LSN 24] 2048 Apr 20 2003 12:18 . + drwxrwxr-x 3 715 715 [LSN 23] 2048 Apr 20 2003 07:26 .. + -rw-rw-r-- 1 715 715 [LSN 35] 648 Apr 20 2003 12:18 readme.txt diff --git a/test/monvoisin.right b/test/monvoisin.right index 7d567476..2afb3170 100644 --- a/test/monvoisin.right +++ b/test/monvoisin.right @@ -22,8 +22,8 @@ Volume : MONVOISIN Volume Set : ISO9660 filesystem /: - d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 . - d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 .. + d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jan 01 1970 00:00 . + d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jan 01 1970 00:00 .. d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 Feb 19 2001 16:37 cdi d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Feb 19 2001 16:37 ext d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 Feb 19 2001 16:37 mpegav @@ -31,32 +31,32 @@ ISO9660 filesystem d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Feb 19 2001 16:37 vcd /CDI/: - d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 Dec 31 1969 23:59 . - d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 .. + d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 Jan 01 1970 00:00 . + d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jan 01 1970 00:00 .. ---2-xrxrxr 0 0 [fn 01] [LSN 211] 1494332 ( 1315168) Feb 19 2001 16:37 cdi_imag.rtf ----1xrxrxr 0 0 [fn 01] [LSN 854] 13616 Feb 19 2001 16:37 cdi_text.fnt ----1xrxrxr 0 0 [fn 01] [LSN 861] 102400 Feb 19 2001 16:37 cdi_vcd.app ----1xrxrxr 0 0 [fn 01] [LSN 911] 279 Feb 19 2001 16:37 cdi_vcd.cfg /EXT/: - d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Dec 31 1969 23:59 . - d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 .. + d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Jan 01 1970 00:00 . + d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jan 01 1970 00:00 .. ----1xrxrxr 0 0 [fn 01] [LSN 912] 65536 Feb 19 2001 16:37 lot_x.vcd ----1xrxrxr 0 0 [fn 01] [LSN 944] 24 Feb 19 2001 16:37 psd_x.vcd ----1xrxrxr 0 0 [fn 01] [LSN 945] 114 Feb 19 2001 16:37 scandata.dat /MPEGAV/: - d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 Dec 31 1969 23:59 . - d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 .. + d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 Jan 01 1970 00:00 . + d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jan 01 1970 00:00 .. ---2-xrxrxr 0 0 [fn 01] [LSN 1251] 3655652 ( 3221504) Feb 19 2001 16:37 avseq01.dat /SEGMENT/: - d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Dec 31 1969 23:59 . - d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 .. + d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Jan 01 1970 00:00 . + d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jan 01 1970 00:00 .. /VCD/: - d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Dec 31 1969 23:59 . - d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Dec 31 1969 23:59 .. + d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Jan 01 1970 00:00 . + d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jan 01 1970 00:00 .. ----1xrxrxr 0 0 [fn 00] [LSN 151] 2048 Feb 19 2001 16:37 entries.vcd ----1xrxrxr 0 0 [fn 00] [LSN 150] 2048 Feb 19 2001 16:37 info.vcd ----1xrxrxr 0 0 [fn 00] [LSN 152] 65536 Feb 19 2001 16:37 lot.vcd