diff --git a/NEWS b/NEWS index b2cc936e..ef259714 100644 --- a/NEWS +++ b/NEWS @@ -1,21 +1,29 @@ -$Id: NEWS,v 1.122 2008/04/24 07:28:00 rocky Exp $ +$Id: NEWS,v 1.123 2008/06/03 08:40:14 rocky Exp $ version 0.81cvs - license of manual now GFDL 1.2 or later, with no invariant sections. + Source is GPL 3. + + Thanks to Karl Berry. - Nero image handling more complete. CD-Text processing. DAO in read_audio_sectors. - ISRC processing. + ISRC processing. - ISRC query for image files. + Thanks to Robert William Fuller on the above two items + - Allow reading pregap of a track via get_track_pregap_lsn(). Add Section on "CD-DA pregap" in libcdio manual - Allow cross-compiling to mingw32. Patch from Peter Hartley. +- Make iso9660 time setting/getting routines (iso9660_{g,s}et_{d,l}time) + reentrant and remove bugs in that code. Courtesy Nicolas Boullis. + version 0.80 2008-03-15 @@ -419,4 +427,4 @@ version 0.1 Routines split off from VCDImager. -$Id: NEWS,v 1.122 2008/04/24 07:28:00 rocky Exp $ +$Id: NEWS,v 1.123 2008/06/03 08:40:14 rocky Exp $ diff --git a/lib/iso9660/iso9660.c b/lib/iso9660/iso9660.c index f7e8996f..88fa04f3 100644 --- a/lib/iso9660/iso9660.c +++ b/lib/iso9660/iso9660.c @@ -1,5 +1,5 @@ /* - $Id: iso9660.c,v 1.39 2008/05/31 12:18:33 rocky Exp $ + $Id: iso9660.c,v 1.40 2008/06/03 08:40:15 rocky Exp $ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Rocky Bernstein @@ -77,7 +77,7 @@ timegm(struct tm *tm) } #endif -static const char _rcsid[] = "$Id: iso9660.c,v 1.39 2008/05/31 12:18:33 rocky Exp $"; +static const char _rcsid[] = "$Id: iso9660.c,v 1.40 2008/06/03 08:40:15 rocky Exp $"; /* Variables to hold debugger-helping enumerations */ enum iso_enum1_s iso_enums1; @@ -229,33 +229,26 @@ iso9660_get_ltime (const iso9660_ltime_t *p_ldate, set_ltime_field(tm_min, lt_minute, 0); set_ltime_field(tm_sec, lt_second, 0); p_tm->tm_isdst= -1; /* information not available */ +#ifndef HAVE_TM_GMTOFF p_tm->tm_sec += p_ldate->lt_gmtoff * (15 * 60); +#endif /* Recompute tm_wday and tm_yday via mktime. mktime will also renormalize date values to account for the timezone offset. */ { time_t t; struct tm temp_tm; - char *old_tzname=getenv("TZ"); - char psz_gmt_tzset[]="TZ=GMT"; - /* Put old_tzname at the beginning of the environment string, - so it can be restored as is with putenv. */ - if (old_tzname) - old_tzname -= sizeof("TZ=")-1; - - putenv(psz_gmt_tzset); - tzset(); t = mktime(p_tm); - gmtime_r(&t, &temp_tm); - if (old_tzname) - putenv(old_tzname); - else - unsetenv("TZ"); - - p_tm->tm_wday = temp_tm.tm_wday; - p_tm->tm_yday = temp_tm.tm_yday; + + localtime_r(&t, &temp_tm); + + memcpy(p_tm, &temp_tm, sizeof(struct tm)); } + p_tm->tm_isdst= -1; /* information not available */ +#ifdef HAVE_TM_GMTOFF + p_tm->tm_gmtoff = -p_ldate->lt_gmtoff * (15 * 60); +#endif return true; } diff --git a/test/testiso9660.c b/test/testiso9660.c index 866d43df..de42edf0 100644 --- a/test/testiso9660.c +++ b/test/testiso9660.c @@ -1,5 +1,5 @@ /* - $Id: testiso9660.c,v 1.22 2008/05/28 01:48:38 rocky Exp $ + $Id: testiso9660.c,v 1.23 2008/06/03 08:40:15 rocky Exp $ Copyright (C) 2003, 2006, 2007, 2008 Rocky Bernstein @@ -62,18 +62,15 @@ time_compare(struct tm *p_tm1, struct tm *p_tm2) okay=false; } if (p_tm1->tm_min != p_tm2->tm_min) { - printf("minute aren't equal. get: %d, set %d\n", + printf("minutes aren't equal. get: %d, set %d\n", p_tm1->tm_min, p_tm2->tm_min); okay=false; } -#if FIXED - /* Differences in daylight savings time may make these different.*/ if (p_tm1->tm_hour != p_tm2->tm_hour) { printf("hours aren't equal. get: %d, set %d\n", p_tm1->tm_hour, p_tm2->tm_hour); okay=false; } -#endif if (p_tm1->tm_sec != p_tm2->tm_sec) { printf("seconds aren't equal. get: %d, set %d\n", p_tm1->tm_sec, p_tm2->tm_sec); @@ -95,6 +92,7 @@ time_compare(struct tm *p_tm1, struct tm *p_tm2) p_tm1->tm_isdst, p_tm2->tm_isdst); okay=false; } +#endif #ifdef HAVE_TM_GMTOFF if (p_tm1->tm_gmtoff != p_tm2->tm_gmtoff) { printf("GMT offsets aren't equal. get: %ld, set %ld\n", @@ -102,6 +100,7 @@ time_compare(struct tm *p_tm1, struct tm *p_tm2) okay=false; } if (p_tm1 != p_tm2 && p_tm1 && p_tm2) { +#ifdef FIXED if (strcmp(p_tm1->tm_zone, p_tm2->tm_zone) != 0) { printf("Time Zone values. get: %s, set %s\n", p_tm1->tm_zone, p_tm2->tm_zone); @@ -109,8 +108,8 @@ time_compare(struct tm *p_tm1, struct tm *p_tm2) Let's not call this a failure if everything else was okay. */ } - } #endif + } #endif return okay; } @@ -262,9 +261,7 @@ main (int argc, const char *argv[]) } { - time_t t1, t2; p_tm = localtime(&now); - t1 = mktime(p_tm); iso9660_set_ltime(p_tm, <ime); if (!iso9660_get_ltime(<ime, &tm)) { @@ -272,21 +269,16 @@ main (int argc, const char *argv[]) return 44; } -#ifdef FIXED - t2 = mktime(&tm); - if ( t1 != t2 && ! time_compare(p_tm, &tm) ) { + if ( ! time_compare(p_tm, &tm) ) { printf("local time retrieved with iso9660_get_ltime() not\n"); printf("same as that set with iso9660_set_ltime().\n"); return 45; } -#endif p_tm = gmtime(&now); - t1 = mktime(p_tm); iso9660_set_ltime(p_tm, <ime); iso9660_get_ltime(<ime, &tm); - t2 = mktime(&tm); - if ( t1 != t2 && ! time_compare(p_tm, &tm) ) { + if ( ! time_compare(p_tm, &tm) ) { printf("GMT time retrieved with iso9660_get_ltime() not\n"); printf("same as that set with iso9660_set_ltime().\n"); return 46;