Add Yavor Doganov's patches

This commit is contained in:
Richard Frith-Macdonald 2023-08-01 14:46:44 +01:00
parent 0aaa5307c8
commit ef9ad60627
3 changed files with 27 additions and 7 deletions

View file

@ -15,6 +15,18 @@
* Source/NSFileManager.m:
Fixed NSFileManager thread safety.
2023-07-17 Yavor Doganov <yavor@gnu.org>
* Tests/base/NSTimeZone/localtime.m (testTZDB): Skip tests relying
on 64bit time_t on all 32bit architectures.
* Source/NSTimeZone.m: Move #include "tzdb.h" a bit earlier so
that the POSIX_TZONES preprocessor conditional is correct.
([GSTimeZoneDetail
initWithTimeZone:withAbbrev:withOffset:withDST:]): Retain abbrev.
([GSTimeZoneDetail dealloc]): Release abbrev.
([NSTimeZone timeZoneArray]): Skip files *.zi, *.list and
leapseconds which are not zone files.
2023-06-10 Riccardo Mottola <rm@gnu.org>
* Tests/base/NSURL/Helpers/Launch.h:

View file

@ -153,6 +153,11 @@
/* Many systems have this file */
#define SYSTEM_TIME_FILE @"/etc/localtime"
/* Include public domain code (modified for use here) to parse standard
* posix time zone files.
*/
#include "tzdb.h"
/* If TZDIR told us where the zoneinfo files are, don't append anything else */
#ifdef TZDIR
#define POSIX_TZONES @""
@ -163,11 +168,6 @@
#define BUFFER_SIZE 512
#define WEEK_MILLISECONDS (7.0*24.0*60.0*60.0*1000.0)
/* Include public domain code (modified for use here) to parse standard
* posix time zone files.
*/
#include "tzdb.h"
#if GS_USE_ICU == 1
static inline int
_NSToICUTZDisplayStyle(NSTimeZoneNameStyle style)
@ -806,6 +806,7 @@ static NSMapTable *absolutes = 0;
- (void) dealloc
{
RELEASE(abbrev);
RELEASE(timeZone);
DEALLOC
}
@ -824,7 +825,7 @@ static NSMapTable *absolutes = 0;
withDST: (BOOL)isDST
{
timeZone = RETAIN(aZone);
abbrev = anAbbrev; // NB. Depend on this being retained in aZone
abbrev = RETAIN(anAbbrev);
offset = anOffset;
is_dst = isDST;
return self;
@ -1849,12 +1850,17 @@ localZoneString, [zone name], sign, s/3600, (s/60)%60);
while ((name = [enumerator nextObject]) != nil)
{
NSTimeZone *zone = nil;
NSString *ext;
BOOL isDir;
path = [zonedir stringByAppendingPathComponent: name];
ext = [path pathExtension];
if ([mgr fileExistsAtPath: path isDirectory: &isDir]
&& isDir == NO
&& [[path pathExtension] isEqual: @"tab"] == NO)
&& [ext isEqual: @"tab"] == NO
&& [ext isEqual: @"zi"] == NO
&& [ext isEqual: @"list"] == NO
&& [ext isEqual: @"leapseconds"] == NO)
{
zone = [zoneDictionary objectForKey: name];
if (zone == nil)

View file

@ -41,6 +41,7 @@ testTZDB(NSString *fileName, const char *message, bool beyond2038)
"post-1996 DST time offset vs UTC found for user-supplied %s",
message);
#if __LP64__
/* After 32bit value seconds-since-1970 using TZDB v2+ file */
if (beyond2038) {
date = [NSDate dateWithString: @"2039-01-16 23:59:59 -0200"];
@ -48,6 +49,7 @@ testTZDB(NSString *fileName, const char *message, bool beyond2038)
"post-2038 standard time offset vs UTC found for user-supplied %s",
message);
}
#endif
return;
}