make bitfield flags obey consistency standards for BOOL ... set based on a C truth value, get a YES or a NO

This commit is contained in:
Richard Frith-Macdonald 2022-11-22 14:43:19 +00:00
parent 8cb9495ad7
commit 4a03bbc328

View file

@ -2631,7 +2631,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
- (void) _setSkipHidden: (BOOL)flag
{
_flags.skipHidden = flag;
_flags.skipHidden = flag ? 1 : 0;
}
- (void) _setErrorHandler: (GSDirEnumErrorHandler) handler
@ -2651,17 +2651,17 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
{
//TODO: the justContents flag is currently basically useless and should be
// removed
_DIR *dir_pointer;
_DIR *dir_pointer;
const GSNativeChar *localPath;
_mgr = RETAIN(mgr);
_stack = NSZoneMalloc([self zone], sizeof(GSIArray_t));
GSIArrayInitWithZoneAndCapacity(_stack, [self zone], 64);
_flags.isRecursive = recurse;
_flags.isFollowing = follow;
_flags.justContents = justContents;
_flags.skipHidden = skipHidden;
_flags.isRecursive = recurse ? 1 : 0;
_flags.isFollowing = follow ? 1 : 0;
_flags.justContents = justContents ? 1 : 0;
_flags.skipHidden = skipHidden ? 1 : 0;
_errorHandler = handler;
_topPath = [[NSString alloc] initWithString: path];
@ -2745,7 +2745,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
- (NSDictionary*) directoryAttributes
{
return [_mgr fileAttributesAtPath: _topPath
traverseLink: _flags.isFollowing];
traverseLink: _flags.isFollowing ? YES : NO];
}
/**
@ -2757,7 +2757,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
- (NSDictionary*) fileAttributes
{
return [_mgr fileAttributesAtPath: _currentFilePath
traverseLink: _flags.isFollowing];
traverseLink: _flags.isFollowing ? YES : NO];
}
/**
@ -2825,8 +2825,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
if (dirname)
{
// Skip it if it is hidden and flag is yes...
if (dirname[0] == '.'
&& _flags.skipHidden == YES)
if (dirname[0] == '.' && _flags.skipHidden)
{
continue;
}
@ -2868,7 +2867,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X)
_currentFilePath = RETAIN([_topPath stringByAppendingPathComponent:
returnFileName]);
if (_flags.isRecursive == YES)
if (_flags.isRecursive)
{
// Do not follow links
#ifdef S_IFLNK