mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Merge branch 'master' into nstimezone
This commit is contained in:
commit
1e8ff8e628
26 changed files with 376 additions and 496 deletions
142
.travis.yml
142
.travis.yml
|
@ -1,142 +0,0 @@
|
|||
---
|
||||
language: cpp
|
||||
dist: focal
|
||||
jobs:
|
||||
include:
|
||||
- name: "Linux GCC"
|
||||
os: linux
|
||||
compiler: gcc
|
||||
env: LIBRARY_COMBO=gnu-gnu-gnu
|
||||
- name: "Linux Clang gnustep-1.9"
|
||||
os: linux
|
||||
compiler: clang
|
||||
env: LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-1.9
|
||||
- name: "Linux Clang gnustep-1.9 disable-mixedabi"
|
||||
os: linux
|
||||
compiler: clang
|
||||
env: LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-1.9 BASE_ABI=--disable-mixedabi
|
||||
- name: "Linux Clang gnustep-2.0"
|
||||
os: linux
|
||||
compiler: clang
|
||||
env: LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-2.0
|
||||
- name: "Linux Clang gnustep-2.0 disable-mixedabi"
|
||||
os: linux
|
||||
compiler: clang
|
||||
env: LIBRARY_COMBO=ng-gnu-gnu RUNTIME_VERSION=gnustep-2.0 BASE_ABI=--disable-mixedabi
|
||||
- name: "Windows GCC MinGW-w64 i686"
|
||||
os: windows
|
||||
compiler: gcc
|
||||
env: LIBRARY_COMBO=gnu-gnu-gnu MSYSTEM=mingw32 ARCH=i686
|
||||
- name: "Windows GCC MinGW-w64 x86_64"
|
||||
os: windows
|
||||
compiler: gcc
|
||||
env: LIBRARY_COMBO=gnu-gnu-gnu MSYSTEM=mingw64 ARCH=x86_64
|
||||
# allow Windows builds to fail (remove once all tests are passing on Windows)
|
||||
allow_failures:
|
||||
- os: windows
|
||||
before_install: |
|
||||
case $TRAVIS_OS_NAME in
|
||||
linux)
|
||||
sudo apt-get -qq update
|
||||
sudo apt-get install -y cmake pkg-config libgnutls28-dev libgmp-dev libffi-dev libicu-dev libxml2-dev libxslt1-dev libssl-dev libavahi-client-dev zlib1g-dev
|
||||
case $LIBRARY_COMBO in
|
||||
gnu-gnu-gnu)
|
||||
if [ $CC = 'gcc' ]; then
|
||||
sudo apt-get install -y gobjc
|
||||
fi
|
||||
sudo apt-get install -y libobjc-9-dev libblocksruntime-dev
|
||||
;;
|
||||
ng-gnu-gnu)
|
||||
curl -s -o - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
||||
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" && sudo apt-get update -qq
|
||||
sudo apt-get install -y clang-9 libkqueue-dev libpthread-workqueue-dev
|
||||
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-9 10 \
|
||||
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-9
|
||||
export PATH=$(echo "$PATH" | sed -e 's/:\/usr\/local\/clang-7.0.0\/bin//')
|
||||
if [ "$RUNTIME_VERSION" = "gnustep-2.0" ]; then
|
||||
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 10
|
||||
fi;
|
||||
## libdispatch requires a fairly recent version of cmake
|
||||
curl -LO https://cmake.org/files/v3.15/cmake-3.15.5-Linux-x86_64.tar.gz
|
||||
tar xf cmake-3.15.5-Linux-x86_64.tar.gz
|
||||
mv cmake-3.15.5-Linux-x86_64 $HOME/cmake
|
||||
export PATH=$HOME/cmake/:$HOME/cmake/bin:$PATH
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
windows)
|
||||
## from https://docs.travis-ci.com/user/reference/windows/#how-do-i-use-msys2
|
||||
[[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64
|
||||
choco uninstall -y mingw
|
||||
choco upgrade --no-progress -y msys2
|
||||
export msys2='cmd //C RefreshEnv.cmd '
|
||||
export msys2+='& set MSYS=winsymlinks:nativestrict '
|
||||
export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start'
|
||||
export mingw="$msys2 -$MSYSTEM -full-path -here -c "\"\$@"\" --"
|
||||
export msys2+=" -msys2 -c "\"\$@"\" --"
|
||||
## Install MSYS2 packages required by GNUstep
|
||||
$msys2 pacman --sync --noconfirm --needed \
|
||||
mingw-w64-$ARCH-gcc-objc \
|
||||
make \
|
||||
pkg-config \
|
||||
libxml2-devel \
|
||||
libxslt-devel \
|
||||
libffi-devel \
|
||||
libgnutls-devel \
|
||||
icu-devel \
|
||||
mingw-w64-$ARCH-pkg-config \
|
||||
mingw-w64-$ARCH-libxml2 \
|
||||
mingw-w64-$ARCH-libxslt \
|
||||
mingw-w64-$ARCH-libffi \
|
||||
mingw-w64-$ARCH-gnutls \
|
||||
mingw-w64-$ARCH-icu \
|
||||
##
|
||||
taskkill //IM gpg-agent.exe //F # https://travis-ci.community/t/4967
|
||||
export PATH=/C/tools/msys64/$MSYSTEM/bin:$PATH
|
||||
## disable conversion to native-form paths when configuring GNUstep Make in travis-deps.sh
|
||||
## https://www.msys2.org/wiki/Porting/#filesystem-namespaces
|
||||
export MSYS2_ARG_CONV_EXCL="--prefix="
|
||||
;;
|
||||
esac
|
||||
install: ./travis-deps.sh
|
||||
before_script: |
|
||||
case $TRAVIS_OS_NAME in
|
||||
linux)
|
||||
DEP_ROOT=$HOME/staging
|
||||
export PATH=$DEP_ROOT/bin:$PATH
|
||||
;;
|
||||
windows)
|
||||
DEP_ROOT=/c/staging
|
||||
setx -m PATH "C:\staging;%PATH%"
|
||||
CONFIGURE_OPTS=--without-unwind
|
||||
;;
|
||||
esac
|
||||
export LIBRARY_PATH=$DEP_ROOT/lib:$DEP_ROOT/lib64:$LIBRARY_PATH
|
||||
export LD_LIBRARY_PATH=$DEP_ROOT/lib:$DEP_ROOT/lib64:$LD_LIBRARY_PATH
|
||||
case $LIBRARY_COMBO in
|
||||
gnu-gnu-gnu)
|
||||
export CPATH=/usr/lib/gcc/x86_64-linux-gnu/9/include
|
||||
;;
|
||||
ng-gnu-gnu)
|
||||
export CPATH=$DEP_ROOT/include
|
||||
;;
|
||||
esac
|
||||
export GNUSTEP_MAKEFILES=$DEP_ROOT/share/GNUstep/Makefiles
|
||||
. $GNUSTEP_MAKEFILES/GNUstep.sh
|
||||
script:
|
||||
# configure and make need to be executed via MinGW shell on Windows ($mingw is undefined on Linux)
|
||||
- $mingw ./configure $BASE_ABI $CONFIGURE_OPTS || (cat config.log && false)
|
||||
- ($mingw make || (cat config.log && false)) && $mingw make install && $mingw make check || (cat Tests/tests.log && false)
|
||||
|
||||
# set up packages cache (currently used on Windows only)
|
||||
before_cache: |
|
||||
case $TRAVIS_OS_NAME in
|
||||
windows)
|
||||
# https://unix.stackexchange.com/a/137322/107554
|
||||
$msys2 pacman --sync --clean --noconfirm
|
||||
;;
|
||||
esac
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/AppData/Local/Temp/chocolatey
|
||||
- /C/tools/msys64
|
|
@ -28,6 +28,15 @@
|
|||
transition in the file, but I'm not convinced it works properly, so
|
||||
this may need to be revisited.
|
||||
|
||||
2021-08-10 Frederik Seiffert <frederik@algoriddim.com>
|
||||
|
||||
* Source/NSObject:
|
||||
* Source/NSProcessInfo.m:
|
||||
* Source/NSSocketPort.m:
|
||||
* Source:libgnustep-base-entry.m:
|
||||
Initialize Windows Sockets in NSObject only and update to Windows
|
||||
Socket version 2.2.
|
||||
|
||||
2021-08-03 Frederik Seiffert <frederik@algoriddim.com>
|
||||
|
||||
* Headers/GNUstepBase/config.h.in:
|
||||
|
|
|
@ -97,6 +97,18 @@ GS_EXPORT_CLASS
|
|||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||
+ (instancetype) fileURLWithPath: (NSString*)aPath isDirectory: (BOOL)isDir;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
+ (instancetype) fileURLWithPath: (NSString *)aPath
|
||||
isDirectory: (BOOL)isDir
|
||||
relativeToURL: (NSURL *)baseURL;
|
||||
|
||||
/** Create and return a file URL with the supplied path, relative to a base URL.
|
||||
*/
|
||||
+ (instancetype) fileURLWithPath: (NSString *)aPath
|
||||
relativeToURL: (NSURL *)baseURL;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create and return a URL with the supplied string, which should
|
||||
* be a string (containing percent escape codes where necessary)
|
||||
|
@ -145,6 +157,33 @@ GS_EXPORT_CLASS
|
|||
isDirectory: (BOOL)isDir;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11, GS_API_LATEST)
|
||||
/**
|
||||
* Initialise as a file URL with the specified path (which must
|
||||
* be a valid path on the local filesystem) relative to the base URL.<br />
|
||||
* Raises NSInvalidArgumentException if aPath is nil.<br />
|
||||
* Converts relative paths to absolute ones.<br />
|
||||
* Appends a trailing slash to the path when necessary if it
|
||||
* specifies a directory.<br />
|
||||
* Calls -initWithScheme:host:path:
|
||||
*/
|
||||
- (instancetype) initFileURLWithPath: (NSString *)aPath
|
||||
relativeToURL: (NSURL *)baseURL;
|
||||
|
||||
/**
|
||||
* Initialise as a file URL with the specified path (which must
|
||||
* be a valid path on the local filesystem) relative to the base URL.<br />
|
||||
* Raises NSInvalidArgumentException if aPath is nil.<br />
|
||||
* Converts relative paths to absolute ones.<br />
|
||||
* Appends a trailing slash to the path when necessary if it
|
||||
* specifies a directory.<br />
|
||||
* Calls -initWithScheme:host:path:
|
||||
*/
|
||||
- (instancetype) initFileURLWithPath: (NSString *)aPath
|
||||
isDirectory: (BOOL)isDir
|
||||
relativeToURL: (NSURL *)baseURL;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initialise by building a URL string from the supplied parameters
|
||||
* and calling -initWithString:relativeToURL:<br />
|
||||
|
@ -418,8 +457,8 @@ GS_EXPORT_CLASS
|
|||
* directory.<br />
|
||||
* See [NSString-stringByAppendingPathComponent:].
|
||||
*/
|
||||
- (NSURL *) URLByAppendingPathComponent:(NSString *)pathComponent
|
||||
isDirectory:(BOOL)isDirectory;
|
||||
- (NSURL *) URLByAppendingPathComponent: (NSString *)pathComponent
|
||||
isDirectory: (BOOL)isDirectory;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
|
||||
|
@ -632,10 +671,10 @@ GS_NSURLQueryItem_IVARS;
|
|||
}
|
||||
|
||||
// Creating query items.
|
||||
+ (instancetype)queryItemWithName:(NSString *)name
|
||||
value:(NSString *)value;
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
value:(NSString *)value;
|
||||
+ (instancetype)queryItemWithName: (NSString *)name
|
||||
value: (NSString *)value;
|
||||
- (instancetype)initWithName: (NSString *)name
|
||||
value: (NSString *)value;
|
||||
|
||||
// Reading a name and value from a query
|
||||
- (NSString *) name;
|
||||
|
@ -666,14 +705,14 @@ GS_NSURLComponents_IVARS;
|
|||
#endif
|
||||
}
|
||||
// Creating URL components...
|
||||
+ (instancetype) componentsWithString:(NSString *)URLString;
|
||||
+ (instancetype) componentsWithURL:(NSURL *)url
|
||||
resolvingAgainstBaseURL:(BOOL)resolve;
|
||||
+ (instancetype) componentsWithString: (NSString *)URLString;
|
||||
+ (instancetype) componentsWithURL: (NSURL *)url
|
||||
resolvingAgainstBaseURL: (BOOL)resolve;
|
||||
- (instancetype) init;
|
||||
- (instancetype)initWithString:(NSString *)URLString;
|
||||
- (instancetype) initWithString: (NSString *)URLString;
|
||||
|
||||
- (instancetype)initWithURL:(NSURL *)url
|
||||
resolvingAgainstBaseURL:(BOOL)resolve;
|
||||
- (instancetype) initWithURL: (NSURL *)url
|
||||
resolvingAgainstBaseURL: (BOOL)resolve;
|
||||
|
||||
// Getting the URL
|
||||
- (NSString *) string;
|
||||
|
|
|
@ -994,16 +994,17 @@ GSIMapCountByEnumeratingWithStateObjectsCount(GSIMapTable map,
|
|||
NSInteger count;
|
||||
NSInteger i;
|
||||
|
||||
/* We can store a GSIMapEnumerator inside the extra buffer in state on all
|
||||
* platforms that don't suck beyond belief (i.e. everything except win64),
|
||||
* but we can't on anything where long is 32 bits and pointers are 64 bits,
|
||||
* so we have to construct it here to avoid breaking on that platform.
|
||||
/* We can store a GSIMapEnumerator inside the extra buffer in state, but we
|
||||
* need to handle platforms like Win64 where long is 32 bits and pointers are
|
||||
* 64 bits, so we have to construct it here to avoid breaking on such
|
||||
* platforms.
|
||||
*/
|
||||
struct GSPartMapEnumerator
|
||||
{
|
||||
GSIMapNode node;
|
||||
uintptr_t bucket;
|
||||
};
|
||||
#define GS_PART_MAP_ENUMERATOR(state) ((struct GSPartMapEnumerator*)(uintptr_t)((state)->extra))
|
||||
GSIMapEnumerator_t enumerator;
|
||||
|
||||
count = MIN(len, map->nodeCount - state->state);
|
||||
|
@ -1016,8 +1017,8 @@ GSIMapCountByEnumeratingWithStateObjectsCount(GSIMapTable map,
|
|||
else
|
||||
{
|
||||
enumerator.map = map;
|
||||
enumerator.node = ((struct GSPartMapEnumerator*)(state->extra))->node;
|
||||
enumerator.bucket = ((struct GSPartMapEnumerator*)(state->extra))->bucket;
|
||||
enumerator.node = GS_PART_MAP_ENUMERATOR(state)->node;
|
||||
enumerator.bucket = GS_PART_MAP_ENUMERATOR(state)->bucket;
|
||||
}
|
||||
/* Get the next count objects and put them in the stack buffer. */
|
||||
for (i = 0; i < count; i++)
|
||||
|
@ -1033,8 +1034,8 @@ GSIMapCountByEnumeratingWithStateObjectsCount(GSIMapTable map,
|
|||
}
|
||||
}
|
||||
/* Store the important bits of the enumerator in the caller. */
|
||||
((struct GSPartMapEnumerator*)(state->extra))->node = enumerator.node;
|
||||
((struct GSPartMapEnumerator*)(state->extra))->bucket = enumerator.bucket;
|
||||
GS_PART_MAP_ENUMERATOR(state)->node = enumerator.node;
|
||||
GS_PART_MAP_ENUMERATOR(state)->bucket = enumerator.bucket;
|
||||
/* Update the rest of the state. */
|
||||
state->state += count;
|
||||
state->itemsPtr = stackbuf;
|
||||
|
|
|
@ -1525,8 +1525,8 @@ setNonBlocking(SOCKET fd)
|
|||
|
||||
- (NSString*) description
|
||||
{
|
||||
return [NSString stringWithFormat: @"%@ sock %d loopID %p",
|
||||
[super description], _sock, _loopID];
|
||||
return [NSString stringWithFormat: @"%@ sock %lld loopID %p",
|
||||
[super description], (long long)_sock, _loopID];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
|
@ -2077,7 +2077,7 @@ setNonBlocking(SOCKET fd)
|
|||
#ifndef NDEBUG
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"NSStream", @"%@ EVENTS 0x%x",
|
||||
NSDebugMLLog(@"NSStream", @"%@ EVENTS 0x%lx",
|
||||
self, events.lNetworkEvents);
|
||||
}
|
||||
#endif
|
||||
|
@ -2539,7 +2539,7 @@ setNonBlocking(SOCKET fd)
|
|||
#ifndef NDEBUG
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"NSStream", @"%@ EVENTS 0x%x",
|
||||
NSDebugMLLog(@"NSStream", @"%@ EVENTS 0x%lx",
|
||||
self, events.lNetworkEvents);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1530,6 +1530,8 @@ retrieve_callback(gnutls_session_t session,
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Certificates retrieved for sending to peer -\n"
|
||||
@"None: not a request for an X509 certificate.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1022,8 +1022,9 @@ descriptorOrComparator: (id)descriptorOrComparator
|
|||
r1 = runStack[i];
|
||||
r2 = runStack[i+1];
|
||||
NSDebugMLLog(@"GSTimSort",
|
||||
@"Merging stack location %lu (stack size: %lu, run %@ with %@)", i,
|
||||
stackSize, NSStringFromRange(r1), NSStringFromRange(r2));
|
||||
@"Merging stack location %lu (stack size: %lu, run %@ with %@)",
|
||||
(unsigned long)i, (unsigned long)stackSize,
|
||||
NSStringFromRange(r1), NSStringFromRange(r2));
|
||||
|
||||
/* Do some housekeeping on the stack: We combine the two runs
|
||||
* being merged and move around the last run on the stack
|
||||
|
@ -1050,7 +1051,7 @@ descriptorOrComparator: (id)descriptorOrComparator
|
|||
}
|
||||
NSDebugMLLog(@"GSTimSort",
|
||||
@"Insertion point for r2 in r1: %lu, r1 for the merge is now %@.",
|
||||
insert, NSStringFromRange(r1));
|
||||
(unsigned long)insert, NSStringFromRange(r1));
|
||||
|
||||
// Find an insertion point for the last element of r1 into r2. Subtracting the
|
||||
// location from that point gives us the length of the subrange we need to
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"%4ld", [components year]];
|
||||
s = [NSString stringWithFormat: @"%4ld", (long)[components year]];
|
||||
result = [result stringByAppendingString: s];
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"%2ld", [components month]];
|
||||
s = [NSString stringWithFormat: @"%2ld", (long)[components month]];
|
||||
result = [result stringByAppendingString: s];
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"%2ld", [components day]];
|
||||
s = [NSString stringWithFormat: @"%2ld", (long)[components day]];
|
||||
result = [result stringByAppendingString: s];
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"%2ld", [components hour]];
|
||||
s = [NSString stringWithFormat: @"%2ld", (long)[components hour]];
|
||||
result = [result stringByAppendingString: s];
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"%2ld", [components minute]];
|
||||
s = [NSString stringWithFormat: @"%2ld", (long)[components minute]];
|
||||
result = [result stringByAppendingString: s];
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"%2ld", [components second]];
|
||||
s = [NSString stringWithFormat: @"%2ld", (long)[components second]];
|
||||
result = [result stringByAppendingString: s];
|
||||
}
|
||||
|
||||
|
|
|
@ -844,7 +844,7 @@ GS_ROOT_CLASS @interface GSDistantObjectPlaceHolder
|
|||
{
|
||||
if (debug_proxy > 3)
|
||||
NSLog(@"retain count for connection (%p) is now %lx\n",
|
||||
_connection, [_connection retainCount]);
|
||||
_connection, (unsigned long)[_connection retainCount]);
|
||||
/*
|
||||
* A proxy for local object retains its target - so we release it.
|
||||
* For a local object the connection also retains this proxy, so we
|
||||
|
|
|
@ -1265,12 +1265,12 @@ GSPrivateReturnAddresses(NSUInteger **returns)
|
|||
if ((fromSym)(hProcess, (DWORD64)addr, 0, symbol))
|
||||
{
|
||||
syms[i] = [NSString stringWithFormat:
|
||||
@"%s - %p", symbol->Name, addr];
|
||||
@"%s - %lx", symbol->Name, (unsigned long)addr];
|
||||
}
|
||||
else
|
||||
{
|
||||
syms[i] = [NSString stringWithFormat:
|
||||
@"unknown - %p", symbol->Name, addr];
|
||||
@"unknown - %lx", (unsigned long)addr];
|
||||
}
|
||||
}
|
||||
GS_MUTEX_UNLOCK(traceLock);
|
||||
|
|
|
@ -3752,8 +3752,8 @@ static NSSet *fileKeys = nil;
|
|||
DWORD dwErrorCode = 0;
|
||||
|
||||
dwErrorCode = GetLastError();
|
||||
NSDebugMLog(@"Error %d getting file handle for '%S'",
|
||||
dwErrorCode, _path);
|
||||
NSDebugMLog(@"Error %lu getting file handle for '%ls'",
|
||||
dwErrorCode, (const unichar *)_path);
|
||||
return group;
|
||||
}
|
||||
|
||||
|
@ -3776,8 +3776,8 @@ static NSSet *fileKeys = nil;
|
|||
DWORD dwErrorCode = 0;
|
||||
|
||||
dwErrorCode = GetLastError();
|
||||
NSDebugMLog(@"Error %d getting security info for '%S'",
|
||||
dwErrorCode, _path);
|
||||
NSDebugMLog(@"Error %lu getting security info for '%ls'",
|
||||
dwErrorCode, (const unichar *)_path);
|
||||
return group;
|
||||
}
|
||||
|
||||
|
@ -3798,16 +3798,18 @@ static NSSet *fileKeys = nil;
|
|||
|
||||
dwErrorCode = GetLastError();
|
||||
if (dwErrorCode == ERROR_NONE_MAPPED)
|
||||
NSDebugMLog(@"Error %d in LookupAccountSid for '%S'", _path);
|
||||
NSDebugMLog(@"Error %lu in LookupAccountSid for '%ls'",
|
||||
dwErrorCode, (const unichar *)_path);
|
||||
else
|
||||
NSDebugMLog(@"Error %d getting security info for '%S'",
|
||||
dwErrorCode, _path);
|
||||
NSDebugMLog(@"Error %lu getting security info for '%ls'",
|
||||
dwErrorCode, (const unichar *)_path);
|
||||
return group;
|
||||
}
|
||||
|
||||
if (accountSize >= 1024)
|
||||
{
|
||||
NSDebugMLog(@"Account name for '%S' is unreasonably long", _path);
|
||||
NSDebugMLog(@"Account name for '%ls' is unreasonably long",
|
||||
(const unichar *)_path);
|
||||
return group;
|
||||
}
|
||||
return [NSString stringWithCharacters: account length: accountSize];
|
||||
|
@ -3917,8 +3919,8 @@ static NSSet *fileKeys = nil;
|
|||
DWORD dwErrorCode = 0;
|
||||
|
||||
dwErrorCode = GetLastError();
|
||||
NSDebugMLog(@"Error %d getting file handle for '%S'",
|
||||
dwErrorCode, _path);
|
||||
NSDebugMLog(@"Error %lu getting file handle for '%ls'",
|
||||
dwErrorCode, (const unichar *)_path);
|
||||
return owner;
|
||||
}
|
||||
|
||||
|
@ -3941,8 +3943,8 @@ static NSSet *fileKeys = nil;
|
|||
DWORD dwErrorCode = 0;
|
||||
|
||||
dwErrorCode = GetLastError();
|
||||
NSDebugMLog(@"Error %d getting security info for '%S'",
|
||||
dwErrorCode, _path);
|
||||
NSDebugMLog(@"Error %lu getting security info for '%ls'",
|
||||
dwErrorCode, (const unichar *)_path);
|
||||
return owner;
|
||||
}
|
||||
|
||||
|
@ -3963,16 +3965,18 @@ static NSSet *fileKeys = nil;
|
|||
|
||||
dwErrorCode = GetLastError();
|
||||
if (dwErrorCode == ERROR_NONE_MAPPED)
|
||||
NSDebugMLog(@"Error %d in LookupAccountSid for '%S'", _path);
|
||||
NSDebugMLog(@"Error %lu in LookupAccountSid for '%ls'",
|
||||
dwErrorCode, (const unichar *)_path);
|
||||
else
|
||||
NSDebugMLog(@"Error %d getting security info for '%S'",
|
||||
dwErrorCode, _path);
|
||||
NSDebugMLog(@"Error %lu getting security info for '%ls'",
|
||||
dwErrorCode, (const unichar *)_path);
|
||||
return owner;
|
||||
}
|
||||
|
||||
if (accountSize >= 1024)
|
||||
{
|
||||
NSDebugMLog(@"Account name for '%S' is unreasonably long", _path);
|
||||
NSDebugMLog(@"Account name for '%ls' is unreasonably long",
|
||||
(const unichar *)_path);
|
||||
return owner;
|
||||
}
|
||||
return [NSString stringWithCharacters: account length: accountSize];
|
||||
|
|
|
@ -979,11 +979,14 @@ static id gs_weak_load(id obj)
|
|||
if (self == [NSObject class])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
{
|
||||
// See libgnustep-base-entry.m
|
||||
extern void gnustep_base_socket_init(void);
|
||||
gnustep_base_socket_init();
|
||||
}
|
||||
/* Start of sockets so we can get host name and other info */
|
||||
WORD wVersionRequested = MAKEWORD(2, 2);
|
||||
WSADATA wsaData;
|
||||
int wsaResult = WSAStartup(wVersionRequested, &wsaData);
|
||||
if (wsaResult != 0)
|
||||
{
|
||||
fprintf(stderr, "Error %d initializing Windows Sockets\n", wsaResult);
|
||||
}
|
||||
#else /* _WIN32 */
|
||||
|
||||
#ifdef SIGPIPE
|
||||
|
|
|
@ -108,7 +108,7 @@ static SEL remSel;
|
|||
|
||||
reason = [NSString stringWithFormat:
|
||||
@"Index %"PRIuPTR" is out of range %lu (in '%@')",
|
||||
index, count, NSStringFromSelector(sel)];
|
||||
index, (unsigned long)count, NSStringFromSelector(sel)];
|
||||
|
||||
exception = [NSException exceptionWithName: NSRangeException
|
||||
reason: reason
|
||||
|
|
|
@ -164,7 +164,7 @@ For more detailed assistance, please report the error to bug-gnustep@gnu.org.\n\
|
|||
*************************************************************************/
|
||||
@interface _NSConcreteProcessInfo: NSProcessInfo
|
||||
- (id) autorelease;
|
||||
- (void) release;
|
||||
- (oneway void) release;
|
||||
- (id) retain;
|
||||
@end
|
||||
|
||||
|
@ -174,7 +174,7 @@ For more detailed assistance, please report the error to bug-gnustep@gnu.org.\n\
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void) release
|
||||
- (oneway void) release
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -987,21 +987,6 @@ int main(int argc, char *argv[], char *env[])
|
|||
sizeof(_NSConstantStringClassReference));
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
WSADATA lpWSAData;
|
||||
|
||||
// Initialize Windows Sockets
|
||||
if (WSAStartup(MAKEWORD(1,1), &lpWSAData))
|
||||
{
|
||||
printf("Could not startup Windows Sockets\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef __MS_WIN__
|
||||
_MB_init_runtime();
|
||||
#endif /* __MS_WIN__ */
|
||||
|
||||
_gnu_process_args(argc, argv, env);
|
||||
|
||||
/* Call the user defined main function */
|
||||
|
@ -1139,7 +1124,7 @@ static void determineOperatingSystem()
|
|||
* use the information from NSBundle and only get the version info
|
||||
* here.
|
||||
*/
|
||||
_operatingSystemVersion = [[NSString alloc] initWithFormat: @"%d.%d",
|
||||
_operatingSystemVersion = [[NSString alloc] initWithFormat: @"%lu.%lu",
|
||||
osver.dwMajorVersion, osver.dwMinorVersion];
|
||||
#else
|
||||
#if defined(HAVE_SYS_UTSNAME_H)
|
||||
|
|
|
@ -271,7 +271,7 @@
|
|||
*/
|
||||
- (NSString*) description
|
||||
{
|
||||
return [NSString stringWithFormat: @"<%s %lx>",
|
||||
return [NSString stringWithFormat: @"<%s %zx>",
|
||||
GSClassNameFromObject(self), (size_t)self];
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef close
|
||||
#undef close // also defined in common.h
|
||||
#endif
|
||||
#define close closesocket
|
||||
#define OPTLEN int
|
||||
#else
|
||||
|
@ -481,15 +484,15 @@ static Class runLoopClass;
|
|||
|
||||
if (d == INVALID_SOCKET)
|
||||
{
|
||||
NSLog(@"illegal descriptor (%d) for Tcp Handle", d);
|
||||
NSLog(@"illegal descriptor (%lld) for Tcp Handle", (long long)d);
|
||||
return nil;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
dummy = 1;
|
||||
if (ioctlsocket(d, FIONBIO, &dummy) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode on %d - %@",
|
||||
d, [NSError _last]);
|
||||
NSLog(@"unable to set non-blocking mode on %lld - %@",
|
||||
(long long)d, [NSError _last]);
|
||||
return nil;
|
||||
}
|
||||
#else /* !_WIN32 */
|
||||
|
@ -538,13 +541,6 @@ static Class runLoopClass;
|
|||
{
|
||||
tlsLock = [NSLock new];
|
||||
[[NSObject leakAt: &tlsLock] release];
|
||||
#ifdef _WIN32
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 0);
|
||||
WSAStartup(wVersionRequested, &wsaData);
|
||||
#endif
|
||||
mutableArrayClass = [NSMutableArray class];
|
||||
mutableDataClass = [NSMutableData class];
|
||||
portMessageClass = [NSPortMessage class];
|
||||
|
@ -688,8 +684,8 @@ static Class runLoopClass;
|
|||
else
|
||||
{
|
||||
gotAddr = YES;
|
||||
NSDebugMLLog(@"GSTcpHandle", @"Connecting to %@:%d using desc %d",
|
||||
addr, [aPort portNumber], desc);
|
||||
NSDebugMLLog(@"GSTcpHandle", @"Connecting to %@:%d using desc %lld",
|
||||
addr, [aPort portNumber], (long long)desc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -770,7 +766,8 @@ static Class runLoopClass;
|
|||
if (setsockopt(desc, SOL_SOCKET, SO_KEEPALIVE, (char*)&status,
|
||||
(OPTLEN)sizeof(status)) < 0)
|
||||
{
|
||||
NSLog(@"failed to turn on keepalive for connected socket %d", desc);
|
||||
NSLog(@"failed to turn on keepalive for connected socket %lld",
|
||||
(long long)desc);
|
||||
}
|
||||
addrNum = 0;
|
||||
caller = YES;
|
||||
|
@ -794,8 +791,8 @@ static Class runLoopClass;
|
|||
|
||||
- (NSString*) description
|
||||
{
|
||||
return [NSString stringWithFormat: @"<Handle %p (%d) to %@>",
|
||||
self, desc, GSPrivateSockaddrName(&sockAddr)];
|
||||
return [NSString stringWithFormat: @"<Handle %p (%lld) to %@>",
|
||||
self, (long long)desc, GSPrivateSockaddrName(&sockAddr)];
|
||||
}
|
||||
|
||||
- (int) descriptor
|
||||
|
@ -1531,7 +1528,7 @@ static Class runLoopClass;
|
|||
}
|
||||
if (ocurredEvents.lNetworkEvents)
|
||||
{
|
||||
NSLog(@"Event not get %d", ocurredEvents.lNetworkEvents);
|
||||
NSLog(@"Event not get %ld", ocurredEvents.lNetworkEvents);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
@ -1573,8 +1570,8 @@ static Class runLoopClass;
|
|||
|
||||
NSAssert([components count] > 0, NSInternalInconsistencyException);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"Sending message %p %@ on %p(%d) before %@",
|
||||
components, components, self, desc, when);
|
||||
@"Sending message %p %@ on %p(%lld) before %@",
|
||||
components, components, self, (long long)desc, when);
|
||||
M_LOCK(myLock);
|
||||
[wMsgs addObject: components];
|
||||
|
||||
|
@ -2383,8 +2380,8 @@ static Class tcpPortClass;
|
|||
if (setsockopt(desc, SOL_SOCKET, SO_KEEPALIVE, (char*)&status,
|
||||
(OPTLEN)sizeof(status)) < 0)
|
||||
{
|
||||
NSLog(@"failed to turn on keepalive for accepted socket %d",
|
||||
desc);
|
||||
NSLog(@"failed to turn on keepalive for accepted socket %lld",
|
||||
(long long)desc);
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
// reset associated event with new socket
|
||||
|
@ -2438,7 +2435,7 @@ static Class tcpPortClass;
|
|||
#endif
|
||||
else if (type == ET_RPORT) t = "rport";
|
||||
else t = "unknown";
|
||||
NSLog(@"No handle for event %s on descriptor %d", t, desc);
|
||||
NSLog(@"No handle for event %s on descriptor %lld", t, (long long)desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
147
Source/NSURL.m
147
Source/NSURL.m
|
@ -587,6 +587,21 @@ static NSUInteger urlAlign;
|
|||
isDirectory: isDir]);
|
||||
}
|
||||
|
||||
+ (id) fileURLWithPath: (NSString *)aPath
|
||||
isDirectory: (BOOL)isDir
|
||||
relativeToURL: (NSURL *)baseURL
|
||||
{
|
||||
return AUTORELEASE([[NSURL alloc] initFileURLWithPath: aPath
|
||||
isDirectory: isDir
|
||||
relativeToURL: baseURL]);
|
||||
}
|
||||
|
||||
+ (id)fileURLWithPath: (NSString *)aPath relativeToURL: (NSURL *)baseURL
|
||||
{
|
||||
return AUTORELEASE([[NSURL alloc] initFileURLWithPath: aPath
|
||||
relativeToURL: baseURL]);
|
||||
}
|
||||
|
||||
+ (id) fileURLWithPathComponents: (NSArray*)components
|
||||
{
|
||||
return [self fileURLWithPath: [NSString pathWithComponents: components]];
|
||||
|
@ -624,43 +639,29 @@ static NSUInteger urlAlign;
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (id) initFileURLWithPath: (NSString*)aPath
|
||||
- (id) initFileURLWithPath: (NSString *)aPath
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL flag = NO;
|
||||
|
||||
if (nil == aPath)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"[%@ %@] nil string parameter",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||
}
|
||||
if ([aPath isAbsolutePath] == NO)
|
||||
{
|
||||
aPath = [[mgr currentDirectoryPath]
|
||||
stringByAppendingPathComponent: aPath];
|
||||
}
|
||||
if ([mgr fileExistsAtPath: aPath isDirectory: &flag] == YES)
|
||||
{
|
||||
if ([aPath isAbsolutePath] == NO)
|
||||
{
|
||||
aPath = [aPath stringByStandardizingPath];
|
||||
}
|
||||
if (flag == YES && [aPath hasSuffix: @"/"] == NO)
|
||||
{
|
||||
aPath = [aPath stringByAppendingString: @"/"];
|
||||
}
|
||||
}
|
||||
self = [self initWithScheme: NSURLFileScheme
|
||||
host: @""
|
||||
path: aPath];
|
||||
return self;
|
||||
/* isDirectory flag will be overwritten if a directory exists. */
|
||||
return [self initFileURLWithPath: aPath isDirectory: NO relativeToURL: nil];
|
||||
}
|
||||
|
||||
- (id) initFileURLWithPath: (NSString*)aPath isDirectory: (BOOL)isDir
|
||||
- (id) initFileURLWithPath: (NSString *)aPath isDirectory: (BOOL)isDir
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL flag = NO;
|
||||
return [self initFileURLWithPath: aPath isDirectory: isDir relativeToURL: nil];
|
||||
}
|
||||
|
||||
- (id) initFileURLWithPath: (NSString *)aPath relativeToURL: (NSURL *)baseURL
|
||||
{
|
||||
/* isDirectory flag will be overwritten if a directory exists. */
|
||||
return [self initFileURLWithPath: aPath isDirectory: NO relativeToURL: baseURL];
|
||||
}
|
||||
|
||||
- (id) initFileURLWithPath: (NSString *)aPath
|
||||
isDirectory: (BOOL)isDir
|
||||
relativeToURL: (NSURL *)baseURL
|
||||
{
|
||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL flag = NO;
|
||||
|
||||
if (nil == aPath)
|
||||
{
|
||||
|
@ -670,25 +671,31 @@ static NSUInteger urlAlign;
|
|||
}
|
||||
if ([aPath isAbsolutePath] == NO)
|
||||
{
|
||||
aPath = [[mgr currentDirectoryPath]
|
||||
stringByAppendingPathComponent: aPath];
|
||||
if (baseURL)
|
||||
{
|
||||
/* Append aPath to baseURL */
|
||||
aPath
|
||||
= [[baseURL relativePath] stringByAppendingPathComponent: aPath];
|
||||
}
|
||||
else
|
||||
{
|
||||
aPath =
|
||||
[[mgr currentDirectoryPath] stringByAppendingPathComponent: aPath];
|
||||
}
|
||||
}
|
||||
if ([mgr fileExistsAtPath: aPath isDirectory: &flag] == YES)
|
||||
{
|
||||
if ([aPath isAbsolutePath] == NO)
|
||||
{
|
||||
aPath = [aPath stringByStandardizingPath];
|
||||
}
|
||||
{
|
||||
aPath = [aPath stringByStandardizingPath];
|
||||
}
|
||||
isDir = flag;
|
||||
}
|
||||
if (isDir == YES && [aPath hasSuffix: @"/"] == NO)
|
||||
if (isDir == YES && [aPath hasSuffix:@"/"] == NO)
|
||||
{
|
||||
aPath = [aPath stringByAppendingString: @"/"];
|
||||
}
|
||||
self = [self initWithScheme: NSURLFileScheme
|
||||
host: @""
|
||||
path: aPath];
|
||||
return self;
|
||||
return [self initWithScheme: NSURLFileScheme host: @"" path: aPath];
|
||||
}
|
||||
|
||||
- (id) initWithScheme: (NSString*)aScheme
|
||||
|
@ -1971,8 +1978,8 @@ static NSUInteger urlAlign;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (NSURL *) URLByAppendingPathComponent:(NSString *)pathComponent
|
||||
isDirectory:(BOOL)isDirectory
|
||||
- (NSURL *) URLByAppendingPathComponent: (NSString *)pathComponent
|
||||
isDirectory: (BOOL)isDirectory
|
||||
{
|
||||
NSString *path = [[self path] stringByAppendingPathComponent: pathComponent];
|
||||
if (isDirectory)
|
||||
|
@ -2139,8 +2146,8 @@ GS_PRIVATE_INTERNAL(NSURLQueryItem)
|
|||
@implementation NSURLQueryItem
|
||||
|
||||
// Creating query items.
|
||||
+ (instancetype)queryItemWithName:(NSString *)name
|
||||
value:(NSString *)value
|
||||
+ (instancetype)queryItemWithName: (NSString *)name
|
||||
value: (NSString *)value
|
||||
{
|
||||
NSURLQueryItem *newQueryItem = [[NSURLQueryItem alloc] initWithName: name
|
||||
value: value];
|
||||
|
@ -2149,31 +2156,33 @@ GS_PRIVATE_INTERNAL(NSURLQueryItem)
|
|||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [self initWithName:nil value:nil];
|
||||
if(self != nil)
|
||||
self = [self initWithName: nil value: nil];
|
||||
if (self != nil)
|
||||
{
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
value:(NSString *)value
|
||||
- (instancetype) initWithName: (NSString *)name
|
||||
value: (NSString *)value
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
{
|
||||
GS_CREATE_INTERNAL(NSURLQueryItem);
|
||||
if(name)
|
||||
{
|
||||
ASSIGNCOPY(internal->_name, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSIGN(internal->_name, @""); //OSX behaviour is to set an empty string for nil name property
|
||||
}
|
||||
ASSIGNCOPY(internal->_value, value);
|
||||
}
|
||||
if (self != nil)
|
||||
{
|
||||
GS_CREATE_INTERNAL(NSURLQueryItem);
|
||||
if (name)
|
||||
{
|
||||
ASSIGNCOPY(internal->_name, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* OSX behaviour is to set an empty string for nil name property
|
||||
*/
|
||||
ASSIGN(internal->_name, @"");
|
||||
}
|
||||
ASSIGNCOPY(internal->_value, value);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -2303,11 +2312,13 @@ static NSCharacterSet *queryItemCharSet = nil;
|
|||
|
||||
- (instancetype) initWithString: (NSString *)URLString
|
||||
{
|
||||
//OSX behavior is to return nil for a string which cannot be used to initialize valid NSURL object
|
||||
NSURL* url = [NSURL URLWithString:URLString];
|
||||
if(url)
|
||||
/* OSX behavior is to return nil for a string which cannot be
|
||||
* used to initialize valid NSURL object
|
||||
*/
|
||||
NSURL *url = [NSURL URLWithString: URLString];
|
||||
if (url)
|
||||
{
|
||||
return [self initWithURL:url resolvingAgainstBaseURL:NO];
|
||||
return [self initWithURL: url resolvingAgainstBaseURL: NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
/* Redefine some function names when using the MSVC ABI on Windows.
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
# include <io.h>
|
||||
# define strncasecmp _strnicmp
|
||||
# define strcasecmp _stricmp
|
||||
# define write(fd, buffer, count) _write(fd, buffer, count)
|
||||
|
|
|
@ -30,31 +30,10 @@
|
|||
|
||||
/* Only if using Microsoft's tools and libraries */
|
||||
#ifdef __MS_WIN32__
|
||||
#include <stdio.h>
|
||||
WINBOOL WINAPI _CRT_INIT(HINSTANCE hinstDLL, DWORD fdwReason,
|
||||
LPVOID lpReserved);
|
||||
|
||||
// Global errno isn't defined in Microsoft's thread safe C library
|
||||
void errno()
|
||||
{}
|
||||
|
||||
int _MB_init_runtime()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* __MS_WIN32__ */
|
||||
|
||||
void
|
||||
gnustep_base_socket_init()
|
||||
{
|
||||
/* Start of sockets so we can get host name and other info */
|
||||
static WSADATA wsaData;
|
||||
if (WSAStartup(MAKEWORD(2,0), &wsaData))
|
||||
{
|
||||
NSLog(@"Error: Could not startup Windows Sockets.\n");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// DLL entry function for GNUstep Base Library
|
||||
// This function gets called everytime a process/thread attaches to DLL
|
||||
|
@ -65,46 +44,21 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
|||
switch(ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
#ifdef __MS_WIN32__
|
||||
/* Initialize the Microsoft C stdio DLL */
|
||||
_CRT_INIT(hInst, ul_reason_for_call, lpReserved);
|
||||
|
||||
#endif /* __MS_WIN32__ */
|
||||
|
||||
// Initialize Windows Sockets
|
||||
gnustep_base_socket_init();
|
||||
break;
|
||||
}
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
{
|
||||
#ifdef __MS_WIN32__
|
||||
/* Initialize C stdio DLL */
|
||||
_CRT_INIT(hInst, ul_reason_for_call, lpReserved);
|
||||
#endif /* __MS_WIN32__ */
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
{
|
||||
break;
|
||||
#ifdef __MS_WIN32__
|
||||
// CRT_INIT must be called on DLL/thread attach and detach, although
|
||||
// first on attach and last on detach. Since we don't do anything else
|
||||
// in this method we can just always call it.
|
||||
if (!_CRT_INIT(hInst, ul_reason_for_call, lpReserved)) {
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* __MS_WIN32__ */
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifndef __clang__
|
||||
/*
|
||||
This section terminates the list of imports under GCC. If you do not
|
||||
include this then you will have problems when linking with DLLs.
|
||||
*/
|
||||
asm (".section .idata$3\n" ".long 0,0,0,0,0,0,0,0");
|
||||
#endif
|
||||
|
|
|
@ -2103,7 +2103,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (e != ERROR_BROKEN_PIPE && e != ERROR_HANDLE_EOF)
|
||||
{
|
||||
NSLog(@"pipe peek problem %d, %@", e, [NSError _last]);
|
||||
NSLog(@"pipe peek problem %lu: %@", e, [NSError _last]);
|
||||
return;
|
||||
}
|
||||
/* In the case of a broken pipe, we fall through so that a read
|
||||
|
@ -2300,7 +2300,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (type != ET_HANDLE)
|
||||
{
|
||||
NSLog(@"Argh, TRIGGER on socket %"PRIuPTR" %"PRIuPTR
|
||||
" %@ with event %u desc %u",
|
||||
" %@ with event %"PRIuPTR" desc %"PRIuPTR,
|
||||
(uintptr_t)data, (uintptr_t)extra, mode, (uintptr_t)event,
|
||||
(uintptr_t)descriptor);
|
||||
/*
|
||||
|
@ -2318,42 +2318,42 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_CONNECT)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Connect on %x", extra);
|
||||
NSDebugMLLog(@"NSFileHandle", @"Connect on %p", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_CONNECT;
|
||||
[self receivedEventWrite];
|
||||
GSPrivateNotifyASAP(mode);
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_ACCEPT)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Accept on %x", extra);
|
||||
NSDebugMLLog(@"NSFileHandle", @"Accept on %p", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_ACCEPT;
|
||||
[self receivedEventRead];
|
||||
GSPrivateNotifyASAP(mode);
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_WRITE)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Write on %x", extra);
|
||||
NSDebugMLLog(@"NSFileHandle", @"Write on %p", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_WRITE;
|
||||
[self receivedEventWrite];
|
||||
GSPrivateNotifyASAP(mode);
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_READ)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Read on %x", extra);
|
||||
NSDebugMLLog(@"NSFileHandle", @"Read on %p", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_READ;
|
||||
[self receivedEventRead];
|
||||
GSPrivateNotifyASAP(mode);
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_OOB)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"OOB on %x", extra);
|
||||
NSDebugMLLog(@"NSFileHandle", @"OOB on %p", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_OOB;
|
||||
[self receivedEventRead];
|
||||
GSPrivateNotifyASAP(mode);
|
||||
}
|
||||
if (ocurredEvents.lNetworkEvents & FD_CLOSE)
|
||||
{
|
||||
NSDebugMLLog(@"NSFileHandle", @"Close on %x", extra);
|
||||
NSDebugMLLog(@"NSFileHandle", @"Close on %p", extra);
|
||||
ocurredEvents.lNetworkEvents ^= FD_CLOSE;
|
||||
if ([writeInfo count] > 0)
|
||||
{
|
||||
|
@ -2367,7 +2367,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
if (ocurredEvents.lNetworkEvents)
|
||||
{
|
||||
NSLog(@"Event not get %d", ocurredEvents.lNetworkEvents);
|
||||
NSLog(@"Event not get %ld", ocurredEvents.lNetworkEvents);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
@ -2440,7 +2440,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"unable to set pipe non-blocking mode to %s - %d",
|
||||
NSLog(@"unable to set pipe non-blocking mode to %s - %lu",
|
||||
(YES == flag ? "YES" : "NO"), GetLastError());
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -348,8 +348,8 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
port_hd_array = malloc(sizeof(NSInteger)*port_hd_size);
|
||||
[port getFds: port_hd_array count: &port_hd_count];
|
||||
}
|
||||
NSDebugMLLog(@"NSRunLoop", @"listening to %d port handles",
|
||||
port_hd_count);
|
||||
NSDebugMLLog(@"NSRunLoop", @"listening to %ld port handles",
|
||||
(long)port_hd_count);
|
||||
while (port_hd_count--)
|
||||
{
|
||||
NSMapInsert(handleMap,
|
||||
|
@ -587,7 +587,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"NSRunLoop", @"unexpected result %d", wait_return);
|
||||
NSDebugMLLog(@"NSRunLoop", @"unexpected result %lu", wait_return);
|
||||
GSPrivateNotifyASAP(mode);
|
||||
completed = NO;
|
||||
return NO;
|
||||
|
|
|
@ -214,7 +214,7 @@ static Class messagePortClass = 0;
|
|||
toRunLoop: (NSRunLoop*)aLoop
|
||||
forMode: (NSString*)aMode
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort", @"%@ add to 0x%x in mode %@",
|
||||
NSDebugMLLog(@"NSMessagePort", @"%@ add to 0x%p in mode %@",
|
||||
self, aLoop, aMode);
|
||||
NSAssert(PORT(self)->rHandle != INVALID_HANDLE_VALUE,
|
||||
@"Attempt to listen on send port");
|
||||
|
@ -248,7 +248,7 @@ static Class messagePortClass = 0;
|
|||
{
|
||||
internal *this;
|
||||
|
||||
NSDebugMLLog(@"NSMessagePort", @"NSMessagePort 0x%x finalized", self);
|
||||
NSDebugMLLog(@"NSMessagePort", @"NSMessagePort 0x%p finalized", self);
|
||||
[self invalidate];
|
||||
this = PORT(self);
|
||||
if (this != 0)
|
||||
|
@ -275,12 +275,12 @@ static Class messagePortClass = 0;
|
|||
if (d == nil)
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort",
|
||||
@"No delegate to handle incoming message", 0);
|
||||
@"No delegate to handle incoming message");
|
||||
return;
|
||||
}
|
||||
if ([d respondsToSelector: @selector(handlePortMessage:)] == NO)
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort", @"delegate doesn't handle messages", 0);
|
||||
NSDebugMLLog(@"NSMessagePort", @"delegate doesn't handle messages");
|
||||
return;
|
||||
}
|
||||
NSDebugMLLog(@"NSMessagePort", @"%@ asking %@ to handle msg", self, d);
|
||||
|
@ -493,7 +493,7 @@ static Class messagePortClass = 0;
|
|||
|
||||
M_LOCK(this->lock);
|
||||
|
||||
NSDebugMLLog(@"NSMessagePort", @"entered with rWant=%d", this->rWant);
|
||||
NSDebugMLLog(@"NSMessagePort", @"entered with rWant=%lu", this->rWant);
|
||||
|
||||
if (this->rState == RS_MESG)
|
||||
{
|
||||
|
@ -529,7 +529,7 @@ static Class messagePortClass = 0;
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"GetOverlappedResult success ... %u", this->rSize);
|
||||
NSLog(@"GetOverlappedResult success ... %lu", this->rSize);
|
||||
this->rState = RS_NONE;
|
||||
this->rLength = 0;
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ static Class messagePortClass = 0;
|
|||
else
|
||||
{
|
||||
this->rState = RS_DATA;
|
||||
NSDebugMLLog(@"NSMessagePort", @"mailslot size=%d",
|
||||
NSDebugMLLog(@"NSMessagePort", @"mailslot size=%lu",
|
||||
this->rWant);
|
||||
[this->rData setLength: this->rWant];
|
||||
if (ReadFile(this->rHandle,
|
||||
|
@ -568,7 +568,7 @@ static Class messagePortClass = 0;
|
|||
}
|
||||
if (this->rSize != this->rWant)
|
||||
{
|
||||
NSLog(@"only read %d of %d bytes from mailslot '%@' - %@",
|
||||
NSLog(@"only read %lu of %lu bytes from mailslot '%@' - %@",
|
||||
this->rSize, this->rWant, this->name, [NSError _last]);
|
||||
[self invalidate];
|
||||
return;
|
||||
|
@ -612,7 +612,7 @@ static Class messagePortClass = 0;
|
|||
}
|
||||
if (rType != GSP_HEAD && rItems == nil)
|
||||
{
|
||||
NSLog(@"%@ - initial part of message had bad type");
|
||||
NSLog(@"%@ - initial part of message had bad type", self);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -776,7 +776,7 @@ static Class messagePortClass = 0;
|
|||
pm = RETAIN([this->rMsgs objectAtIndex: 0]);
|
||||
[this->rMsgs removeObjectAtIndex: 0];
|
||||
|
||||
NSDebugMLLog(@"NSMessagePort", @"got message %@ on 0x%x", pm, self);
|
||||
NSDebugMLLog(@"NSMessagePort", @"got message %@ on 0x%p", pm, self);
|
||||
M_UNLOCK(this->lock);
|
||||
NS_DURING
|
||||
{
|
||||
|
@ -838,7 +838,7 @@ again:
|
|||
if (this->wData != nil)
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort",
|
||||
@"completed write on 0x%x", self);
|
||||
@"completed write on 0x%p", self);
|
||||
[this->wMsgs removeObjectIdenticalTo: this->wData];
|
||||
this->wData = nil;
|
||||
}
|
||||
|
@ -863,8 +863,8 @@ again:
|
|||
&this->wOv);
|
||||
if (rc > 0)
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort", @"Write of %d performs %d",
|
||||
[this->wData length] - this->wLength, this->wSize);
|
||||
NSDebugMLLog(@"NSMessagePort", @"Write of %lu performs %lu",
|
||||
(unsigned long)([this->wData length] - this->wLength), this->wSize);
|
||||
this->wLength += this->wSize;
|
||||
goto again;
|
||||
}
|
||||
|
@ -873,15 +873,15 @@ again:
|
|||
/* This is probably an end of file
|
||||
* eg. when the process at the other end has terminated.
|
||||
*/
|
||||
NSDebugMLog(@"NSMessagePort",
|
||||
NSDebugMLLog(@"NSMessagePort",
|
||||
@"unable to write to mailslot '%@' - %@",
|
||||
this->name, [NSError _last]);
|
||||
[self invalidate];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort", @"Write of %d queued",
|
||||
[this->wData length] - this->wLength);
|
||||
NSDebugMLLog(@"NSMessagePort", @"Write of %lu queued",
|
||||
(unsigned long)([this->wData length] - this->wLength));
|
||||
}
|
||||
}
|
||||
M_UNLOCK(this->lock);
|
||||
|
@ -910,7 +910,7 @@ again:
|
|||
else
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort",
|
||||
@"got event on invalidated port 0x%x in mode %@", self, mode);
|
||||
@"got event on invalidated port 0x%p in mode %@", self, mode);
|
||||
}
|
||||
RELEASE(self);
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ again:
|
|||
fromRunLoop: (NSRunLoop*)aLoop
|
||||
forMode: (NSString*)aMode
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort", @"%@ remove from 0x%x in mode %@",
|
||||
NSDebugMLLog(@"NSMessagePort", @"%@ remove from 0x%p in mode %@",
|
||||
self, aLoop, aMode);
|
||||
[aLoop removeEvent: (void*)(uintptr_t)PORT(self)->rEvent
|
||||
type: ET_HANDLE
|
||||
|
@ -941,7 +941,7 @@ again:
|
|||
return sizeof(GSPortItemHeader) + sizeof(GSPortMsgHeader);
|
||||
}
|
||||
|
||||
- (void) release
|
||||
- (oneway void) release
|
||||
{
|
||||
/* We lock the port table while checking, to prevent
|
||||
* another thread from grabbing this port while we are
|
||||
|
@ -964,7 +964,7 @@ again:
|
|||
}
|
||||
|
||||
- (BOOL) sendBeforeDate: (NSDate*)when
|
||||
msgid: (int)msgId
|
||||
msgid: (NSInteger)msgId
|
||||
components: (NSMutableArray*)components
|
||||
from: (NSPort*)receivingPort
|
||||
reserved: (NSUInteger)length
|
||||
|
@ -1006,7 +1006,7 @@ again:
|
|||
*/
|
||||
if (length != [self reservedSpaceLength])
|
||||
{
|
||||
NSLog(@"bad reserved length - %u", length);
|
||||
NSLog(@"bad reserved length - %lu", (unsigned long)length);
|
||||
return NO;
|
||||
}
|
||||
NSAssert([receivingPort isKindOfClass: messagePortClass] == YES,
|
||||
|
|
|
@ -65,7 +65,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
NSString *dPath;
|
||||
|
||||
dPath = [registryPrefix stringByAppendingString: domain];
|
||||
NSLog(@"Failed to close registry HKEY_CURRENT_USER\\%@ (%x)",
|
||||
NSLog(@"Failed to close registry HKEY_CURRENT_USER\\%@ (%lx)",
|
||||
dPath, rc);
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
NSString *dPath;
|
||||
|
||||
dPath = [registryPrefix stringByAppendingString: domain];
|
||||
NSLog(@"Failed to close registry HKEY_LOCAL_MACHINE\\%@ (%x)",
|
||||
NSLog(@"Failed to close registry HKEY_LOCAL_MACHINE\\%@ (%lx)",
|
||||
dPath, rc);
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
}
|
||||
else if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
NSLog(@"Failed to open registry HKEY_CURRENT_USER\\%@ (%x)",
|
||||
NSLog(@"Failed to open registry HKEY_CURRENT_USER\\%@ (%lx)",
|
||||
dPath, rc);
|
||||
return nil;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
}
|
||||
else if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
NSLog(@"Failed to open registry HKEY_LOCAL_MACHINE\\%@ (%x)",
|
||||
NSLog(@"Failed to open registry HKEY_LOCAL_MACHINE\\%@ (%lx)",
|
||||
dPath, rc);
|
||||
return nil;
|
||||
}
|
||||
|
@ -254,7 +254,8 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
}
|
||||
break;
|
||||
default:
|
||||
NSLog(@"Bad registry type %d for '%S'", type, name);
|
||||
NSLog(@"Bad registry type %lu for '%ls'", type,
|
||||
(const unichar *)name);
|
||||
v = 0;
|
||||
}
|
||||
v = [v propertyList];
|
||||
|
@ -266,7 +267,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
NSLog(@"Bad registry value for '%S'", name);
|
||||
NSLog(@"Bad registry value for '%ls'", (const unichar *)name);
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
else if (rc == ERROR_MORE_DATA)
|
||||
|
@ -289,7 +290,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"RegEnumValueW error %d", rc);
|
||||
NSLog(@"RegEnumValueW error %ld", rc);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
@ -350,7 +351,8 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
}
|
||||
break;
|
||||
default:
|
||||
NSLog(@"Bad registry type %d for '%S'", type, name);
|
||||
NSLog(@"Bad registry type %lu for '%ls'", type,
|
||||
(const unichar *)name);
|
||||
v = 0;
|
||||
}
|
||||
v = [v propertyList];
|
||||
|
@ -362,7 +364,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
NSLog(@"Bad registry value for '%S'", name);
|
||||
NSLog(@"Bad registry value for '%ls'", (const unichar *)name);
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
else if (rc == ERROR_MORE_DATA)
|
||||
|
@ -385,7 +387,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"RegEnumValueW error %d", rc);
|
||||
NSLog(@"RegEnumValueW error %ld", rc);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
@ -431,7 +433,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
NSString *dName = [@"HKEY_CURRENT_USER\\"
|
||||
stringByAppendingString: dPath];
|
||||
|
||||
NSLog(@"Failed to query modify time on registry %@ (%x)",
|
||||
NSLog(@"Failed to query modify time on registry %@ (%lx)",
|
||||
dName, rc);
|
||||
NSEndMapTableEnumeration(&iter);
|
||||
return YES;
|
||||
|
@ -461,7 +463,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
NSString *dName = [@"HKEY_CURRENT_USER\\"
|
||||
stringByAppendingString: dPath];
|
||||
|
||||
NSLog(@"Failed to open registry %@ (%x)", dName, rc);
|
||||
NSLog(@"Failed to open registry %@ (%lx)", dName, rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -476,7 +478,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
NULL, NULL, (PFILETIME)&lasttime);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
NSLog(@"Failed to query time on HKEY_LOCAL_MACHINE\\%@ (%x)",
|
||||
NSLog(@"Failed to query time on HKEY_LOCAL_MACHINE\\%@ (%lx)",
|
||||
dPath, rc);
|
||||
NSEndMapTableEnumeration(&iter);
|
||||
return YES;
|
||||
|
@ -502,7 +504,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
}
|
||||
else if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
NSLog(@"Failed to open registry HKEY_LOCAL_MACHINE\\%@ (%x)",
|
||||
NSLog(@"Failed to open registry HKEY_LOCAL_MACHINE\\%@ (%lx)",
|
||||
dPath, rc);
|
||||
}
|
||||
else
|
||||
|
@ -569,7 +571,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
NULL);
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
NSLog(@"Failed to create registry HKEY_CURRENT_USER\\%@ (%x)",
|
||||
NSLog(@"Failed to create registry HKEY_CURRENT_USER\\%@ (%lx)",
|
||||
dPath, rc);
|
||||
return NO;
|
||||
}
|
||||
|
@ -596,7 +598,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
2*(wcslen(ptr) + 1));
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
NSLog(@"Failed to insert HKEY_CURRENT_USER\\%@\\%@ (%x)",
|
||||
NSLog(@"Failed to insert HKEY_CURRENT_USER\\%@\\%@ (%lx)",
|
||||
dPath, valName, rc);
|
||||
return NO;
|
||||
}
|
||||
|
@ -612,7 +614,7 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
rc = RegDeleteValueW(dinfo->userKey, UNISTR(valName));
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
NSLog(@"Failed to delete HKEY_CURRENT_USER\\%@\\%@ (%x)",
|
||||
NSLog(@"Failed to delete HKEY_CURRENT_USER\\%@\\%@ (%lx)",
|
||||
dPath, valName, rc);
|
||||
return NO;
|
||||
}
|
||||
|
|
0
Tests/base/NSFastEnumeration/TestInfo
Normal file
0
Tests/base/NSFastEnumeration/TestInfo
Normal file
95
Tests/base/NSFastEnumeration/basic.m
Normal file
95
Tests/base/NSFastEnumeration/basic.m
Normal file
|
@ -0,0 +1,95 @@
|
|||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSSet.h>
|
||||
#import <Foundation/NSOrderedSet.h>
|
||||
#import "ObjectTesting.h"
|
||||
#import "../../../Source/GSFastEnumeration.h"
|
||||
|
||||
void fast_enumeration_mutation_add(id mutableCollection)
|
||||
{
|
||||
NSUInteger i = 0;
|
||||
FOR_IN(id, o, mutableCollection)
|
||||
if (i == [mutableCollection count]/2) {
|
||||
if ([mutableCollection isKindOfClass:[NSMutableDictionary class]]) {
|
||||
[mutableCollection setObject:@"boom" forKey:@"boom"];
|
||||
} else {
|
||||
[mutableCollection addObject:@"boom"];
|
||||
}
|
||||
}
|
||||
i++;
|
||||
END_FOR_IN(mutableCollection)
|
||||
}
|
||||
|
||||
void fast_enumeration_mutation_remove(id mutableCollection)
|
||||
{
|
||||
NSUInteger i = 0;
|
||||
FOR_IN(id, o, mutableCollection)
|
||||
if (i == [mutableCollection count]/2) {
|
||||
if ([mutableCollection isKindOfClass:[NSMutableDictionary class]]) {
|
||||
[mutableCollection removeObjectForKey:o];
|
||||
} else {
|
||||
[mutableCollection removeObject:o];
|
||||
}
|
||||
}
|
||||
i++;
|
||||
END_FOR_IN(mutableCollection)
|
||||
}
|
||||
|
||||
void test_fast_enumeration(id collection, NSArray *objects)
|
||||
{
|
||||
NSMutableArray *returnedObjects = [[NSMutableArray alloc] init];
|
||||
FOR_IN(id, o, collection)
|
||||
[returnedObjects addObject:o];
|
||||
END_FOR_IN(collection)
|
||||
if (!([collection isKindOfClass:[NSArray class]] ||
|
||||
[collection isKindOfClass:[NSOrderedSet class]])) {
|
||||
[returnedObjects sortUsingSelector:@selector(compare:)];
|
||||
}
|
||||
PASS_EQUAL(returnedObjects, objects, "fast enumeration returns all objects");
|
||||
|
||||
id mutableCollection = [collection mutableCopy];
|
||||
PASS_EXCEPTION(
|
||||
fast_enumeration_mutation_add(mutableCollection),
|
||||
NSGenericException,
|
||||
"Fast enumeration mutation add properly calls @\"NSGenericException\"");
|
||||
PASS_EXCEPTION(
|
||||
fast_enumeration_mutation_remove(mutableCollection),
|
||||
NSGenericException,
|
||||
"Fast enumeration mutation remove properly calls @\"NSGenericException\"");
|
||||
[mutableCollection release];
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
|
||||
NSMutableArray *objects = [NSMutableArray array];
|
||||
int i;
|
||||
for (i = 0; i < 10000; i++) {
|
||||
[objects addObject:[NSString stringWithFormat:@"%.4d", i]];
|
||||
}
|
||||
|
||||
START_SET("NSArray")
|
||||
id array = [NSArray arrayWithArray:objects];
|
||||
test_fast_enumeration(array, objects);
|
||||
END_SET("NSArray")
|
||||
|
||||
START_SET("NSSet")
|
||||
id set = [NSSet setWithArray:objects];
|
||||
test_fast_enumeration(set, objects);
|
||||
END_SET("NSSet")
|
||||
|
||||
START_SET("NSOrderedSet")
|
||||
id orderedSet = [NSOrderedSet orderedSetWithArray:objects];
|
||||
test_fast_enumeration(orderedSet, objects);
|
||||
END_SET("NSOrderedSet")
|
||||
|
||||
START_SET("NSDictionary")
|
||||
id dict = [NSDictionary dictionaryWithObjects:objects forKeys:objects];
|
||||
test_fast_enumeration(dict, objects);
|
||||
END_SET("NSDictionary")
|
||||
|
||||
[arp release]; arp = nil;
|
||||
return 0;
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
#! /usr/bin/env sh
|
||||
|
||||
set -ex
|
||||
|
||||
DEP_SRC=$HOME/dependency_source/
|
||||
|
||||
case $TRAVIS_OS_NAME in
|
||||
linux)
|
||||
DEP_ROOT=$HOME/staging
|
||||
;;
|
||||
windows)
|
||||
DEP_ROOT=/c/staging
|
||||
;;
|
||||
esac
|
||||
|
||||
install_gnustep_make() {
|
||||
cd $DEP_SRC
|
||||
git clone https://github.com/gnustep/tools-make.git
|
||||
cd tools-make
|
||||
if [ -n "$RUNTIME_VERSION" ]
|
||||
then
|
||||
WITH_RUNTIME_ABI="--with-runtime-abi=${RUNTIME_VERSION}"
|
||||
else
|
||||
WITH_RUNTIME_ABI=""
|
||||
fi
|
||||
$mingw ./configure --prefix=$DEP_ROOT --with-library-combo=$LIBRARY_COMBO $WITH_RUNTIME_ABI
|
||||
$mingw make install
|
||||
echo Objective-C build flags: `$DEP_ROOT/bin/gnustep-config --objc-flags`
|
||||
}
|
||||
|
||||
install_ng_runtime() {
|
||||
cd $DEP_SRC
|
||||
git clone https://github.com/gnustep/libobjc2.git
|
||||
cd libobjc2
|
||||
git submodule init
|
||||
git submodule sync
|
||||
git submodule update
|
||||
cd ..
|
||||
mkdir libobjc2/build
|
||||
cd libobjc2/build
|
||||
export CC="clang"
|
||||
export CXX="clang++"
|
||||
export CXXFLAGS="-std=c++11"
|
||||
cmake \
|
||||
-DTESTS=off \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DGNUSTEP_INSTALL_TYPE=NONE \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$DEP_ROOT \
|
||||
../
|
||||
make install
|
||||
}
|
||||
|
||||
install_libdispatch() {
|
||||
cd $DEP_SRC
|
||||
# will reference upstream after https://github.com/apple/swift-corelibs-libdispatch/pull/534 is merged
|
||||
git clone -b system-blocksruntime https://github.com/ngrewe/swift-corelibs-libdispatch.git
|
||||
mkdir swift-corelibs-libdispatch/build
|
||||
cd swift-corelibs-libdispatch/build
|
||||
export CC="clang"
|
||||
export CXX="clang++"
|
||||
export LIBRARY_PATH=$DEP_ROOT/lib;
|
||||
export LD_LIBRARY_PATH=$DEP_ROOT/lib:$LD_LIBRARY_PATH;
|
||||
export CPATH=$DEP_ROOT/include;
|
||||
cmake \
|
||||
-DBUILD_TESTING=off \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=$DEP_ROOT \
|
||||
-DINSTALL_PRIVATE_HEADERS=1 \
|
||||
-DBlocksRuntime_INCLUDE_DIR=$DEP_ROOT/include \
|
||||
-DBlocksRuntime_LIBRARIES=$DEP_ROOT/lib/libobjc.so \
|
||||
../
|
||||
make install
|
||||
}
|
||||
|
||||
mkdir -p $DEP_SRC
|
||||
if [ "$LIBRARY_COMBO" = 'ng-gnu-gnu' ]
|
||||
then
|
||||
install_ng_runtime
|
||||
install_libdispatch
|
||||
fi
|
||||
|
||||
install_gnustep_make
|
Loading…
Reference in a new issue