mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Merged changes from HEAD.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/NibCompatibility@22359 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
08c4bdcb59
commit
799dfc4bcf
55 changed files with 1499 additions and 1028 deletions
162
ChangeLog
162
ChangeLog
|
@ -3,6 +3,168 @@
|
|||
* Source/NSKeyedUnarchiver.m: Added private method replaceObject:
|
||||
withObject:.
|
||||
|
||||
2006-01-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSAutoreleasePool.m: ([addObject:]) fix error in check for
|
||||
missing pool during thread exit.
|
||||
|
||||
2006-01-19 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Tools/plget.m: remove unused variable
|
||||
* Source/GGSString.m: optimise ([canBeConvertedToEncoding:])
|
||||
* Source/NSURL.m: correct misleading/wrong exception text.
|
||||
* Source/NSString.m: mingw path handling tweaks ... build new
|
||||
paths using native separator by default.
|
||||
|
||||
2006-01-19 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Foundation/NSThread.h:
|
||||
* Source/NSAutoreleasePool.m:
|
||||
* Source/NSThread.m:
|
||||
Mimic MacOS-X behavior and create an autorelease pool if necessary
|
||||
to catch any autorelease objects during thread exit.
|
||||
As suggested by Wim Oudshoorn..
|
||||
|
||||
2006-01-18 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Additions/Unicode.m: fix for rare case where we could corrupt
|
||||
the stack ... spotted by Wim Oudshoorn.
|
||||
|
||||
2006-01-18 Andrew Ruder <aeruder@ksu.edu>
|
||||
|
||||
* config/addlibrarypath.m4: new file
|
||||
* configure.ac: Use new function to set library paths for netbsd
|
||||
* configure: regenerate
|
||||
|
||||
2006-01-17 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Tools/plget.m: New file to extract a string from a plist.
|
||||
* Tools/pldes.1: Include plget
|
||||
* Tools/GNUmakefile: build/install plget.
|
||||
|
||||
2006-01-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/win32/NSMessagePortNameServerWin32.m:
|
||||
* Source/win32/NSMessagePortWin32.m:
|
||||
Add hack to cope with bug reading registry ... better solution welcome
|
||||
if anyone knows one.
|
||||
Add security attributes to message port stuff ... should only let
|
||||
current user on current machine access message ports I hope.
|
||||
|
||||
2006-01-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSPathUtilities.m: Fix possible read off end of buffer
|
||||
when parsing config file.
|
||||
|
||||
2006-01-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Documentation/GNUmakefile:
|
||||
* Documentation/General/GNUmakefile:
|
||||
Fix path to autogsdoc for mingw where the 'obj' symlink doesn't work.
|
||||
|
||||
2006-01-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Additions/GNUstepBase/GSUnion.h:
|
||||
* Headers/Foundation/NSByteOrder.h:
|
||||
* Headers/Foundation/NSPort.h:
|
||||
* Source/GSFileHandle.m:
|
||||
* Source/GSFormat.m:
|
||||
* Source/NSData.m:
|
||||
* Source/NSDistantObject.m:
|
||||
* Source/NSMessagePort.m:
|
||||
* Source/NSPortCoder.m:
|
||||
* Source/NSSerializer.m:
|
||||
* Source/NSSocketPort.m:
|
||||
* Source/NSSocketPortNameServer.m:
|
||||
* Source/NSString.m:
|
||||
* Source/NSTimeZone.m:
|
||||
* Source/NSUnarchiver.m:
|
||||
* Source/win32/GSFileHandleWin32.m:
|
||||
* Source/win32/NSMessagePortWin32.m:
|
||||
Update to use sized datatypes from stdint.h now that almost all
|
||||
operating systems support it.
|
||||
* Source/NSCalendarDate.m:
|
||||
Support '%T' and '%t' as supplied by unix date/time locale info.
|
||||
* configure.ac: Ensure uintptr_t and intptr_t exist
|
||||
* configure: regenerate
|
||||
|
||||
2006-01-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/mframe.m:
|
||||
When calculating info about a structure, make sure its alignment is
|
||||
that of its most strictly aligned field and make sure its size is a
|
||||
multiple of its alignment.
|
||||
* Source/NSData.m: ([initWithCoder:]) Fix bug decoding unsigned long
|
||||
into unsigned int variable ... breaks on amd64
|
||||
|
||||
2006-01-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSFileHandle.m:
|
||||
* Source/NSAutoreleasePool.m:
|
||||
* Source/NSCallBacks.m:
|
||||
* Source/NSConnection.m:
|
||||
* Source/NSData.m:
|
||||
* Source/NSDictionary.m:
|
||||
* Source/NSDistantObject.m:
|
||||
* Source/NSMessagePort.m:
|
||||
* Source/NSObject.m:
|
||||
* Source/NSProtocolChecker.m:
|
||||
* Source/NSProxy.m:
|
||||
* Source/NSSocketPort.m:
|
||||
* Source/NSTask.m:
|
||||
* Source/NSThread.m:
|
||||
* Source/NSZone.m:
|
||||
* Source/Additions/GSXML.m:
|
||||
* Source/unix/GSRunLoopCtxt.m:
|
||||
Add explicit casts to avoid compiler warnings where we are on a
|
||||
processor where the size of an integer is not the same as the size
|
||||
of a pointer.
|
||||
* Tools/gdomap.c:
|
||||
Add type casts to fix comparisons on 64bit processor
|
||||
|
||||
2006-01-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/win32/GSRunLoopCtxt.m: Apply patch by Jeremy Bettis with
|
||||
fixups for intentation/formatting and minor correction to avoid waiting
|
||||
for an event when we have handled one in the current run of the loop.
|
||||
|
||||
2006-01-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSPropertyList.m: When generating binary plist, fix bug
|
||||
in case where we have to increase table size.
|
||||
* Source/NSKeyedArchiver.m: Update to use binary plist format
|
||||
by default rather than xml format ... MacOS-X compatible and
|
||||
works when libxml2 is not available.
|
||||
* Source/NSKeyedUnarchiver.m: Print NSLog error if attempting to
|
||||
decode an xml archive when no libxml2 is available.
|
||||
|
||||
2006-01-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSPathUtilities.m: be more consistent in use of defined values
|
||||
from config file.
|
||||
* configure.in: Improve comments/help. Fix error in config where we
|
||||
were attempting OS based decisions before we had determined the OS.
|
||||
Improve default paths on mingw to be relative to the DLL.
|
||||
Load information from make package config fo use during build of
|
||||
base library.
|
||||
Generally try to improve user experience on mingw to make build/install
|
||||
really simple with new config files.
|
||||
* configure: regenerate
|
||||
* Headers/Additions/GNUstepBase/config.h.in: regenerate
|
||||
* Documentation/Base.gsdoc: Attempt to clarify config file operation.
|
||||
|
||||
2006-01-07 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSPropertyList.m (BinaryPLGenerator - storeCount:) Handle
|
||||
count > 256*256. Patch by Derek Zhou <dzhou@nvidia.com>.
|
||||
|
||||
2006-01-04 David Ayers <d.ayers@inode.at>
|
||||
|
||||
Bug #15353
|
||||
* Source/NSProcessInfo.m (fallbackInitialisation): Move
|
||||
initialization to avoid compiler error. Reported by
|
||||
Stefan van den Oord (stefan.vandenoord@gmail.com).
|
||||
|
||||
2005-12-21 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Version 1.11.2
|
||||
|
|
|
@ -457,7 +457,8 @@ notice and this notice are preserved.
|
|||
location of this file depends on how the Base library was
|
||||
configured and/or what operating system it was configured
|
||||
on. On a GNU/Linux system, the default would be
|
||||
/etc/GNUstep/GNUstep.conf, for instance.<br />
|
||||
/etc/GNUstep/GNUstep.conf for instance, while on mswindows
|
||||
it would be ./GNUstep.conf.<br />
|
||||
The location of this file can be specified when the base library
|
||||
is configured ... using the <code>--with-config-file=</code>
|
||||
option of the <code>configure</code> script.<br />
|
||||
|
@ -603,17 +604,20 @@ notice and this notice are preserved.
|
|||
Firstly, wariables in the configuration file which define
|
||||
paths, are expected to by full path specifications, except
|
||||
for the special case in which they begin with dot-slash (./).
|
||||
In this case the dot-slash is replaced by the path to the
|
||||
directory containing the configuration file (or specified to
|
||||
contain the configuration file if no configuration file exists).
|
||||
In this case the text after the dot-slash is appended to
|
||||
the path to the directory containing the configuration file
|
||||
(or specified to contain the configuration file if no
|
||||
configuration file exists) to form the value used.
|
||||
</p>
|
||||
<p>
|
||||
Secondly, If the value specified by GNUSTEP_CONFIG_FILE (or
|
||||
built into the base library) itself begins with a dot and
|
||||
slash (./) then the path used for that file is made relative
|
||||
to the base library.<br />
|
||||
ie the dot-slash is replaced by the path to the directory
|
||||
containing the gnustep-base library.
|
||||
Secondly, If the value of the path built in to the base library
|
||||
as the location of the config file (or specified by
|
||||
the GNUSTEP_CONFIG_FILE environment variable if that option
|
||||
was enabled when the base library was configured)
|
||||
begins with a dot and slash (./) then the path used for that
|
||||
file is made relative to the base library.<br />
|
||||
ie the text after the dot-slash is appended to the path of the
|
||||
directory containing the gnustep-base library.
|
||||
</p>
|
||||
<p>
|
||||
So you can bundle the whole lot together in one directory,
|
||||
|
|
|
@ -86,7 +86,7 @@ ReleaseNotes.gsdoc
|
|||
#ReleaseNotes_AGSDOC_FLAGS = -DocumentationDirectory .
|
||||
|
||||
# Use local version of autogsdoc in case it is not installed
|
||||
AUTOGSDOC=../Tools/obj/autogsdoc
|
||||
AUTOGSDOC=../Tools/$(GNUSTEP_OBJ_PREFIX)/autogsdoc
|
||||
BASE_MAKE_LOADED=yes
|
||||
|
||||
#
|
||||
|
|
|
@ -45,7 +45,7 @@ OpenStepCompliance.gsdoc \
|
|||
#General_AGSDOC_FLAGS = -DocumentationDirectory .
|
||||
|
||||
# Use local version of autogsdoc in case it is not installed
|
||||
AUTOGSDOC=../../Tools/obj/autogsdoc
|
||||
AUTOGSDOC=../../Tools/$(GNUSTEP_OBJ_PREFIX)/autogsdoc
|
||||
BASE_MAKE_LOADED=yes
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/documentation.make
|
||||
|
|
|
@ -128,7 +128,9 @@ typedef @GS_FLT64@ gsf64;
|
|||
/*
|
||||
* Integer type with same size as a pointer
|
||||
*/
|
||||
typedef @GS_ADDR@ gsaddr;
|
||||
typedef @GS_UADDR@ gsuaddr;
|
||||
typedef @GS_SADDR@ gssaddr;
|
||||
typedef gsuaddr gsaddr;
|
||||
|
||||
/*
|
||||
* Do we have real 64-bit and 128-bit integers or are we just pretending.
|
||||
|
@ -157,8 +159,8 @@ typedef @GS_ADDR@ gsaddr;
|
|||
#define GS_WITH_GC 0
|
||||
#endif
|
||||
#if GS_WITH_GC
|
||||
#define GS_GC_HIDE(obj) ((id)(((gsaddr)obj) | 1))
|
||||
#define GS_GC_UNHIDE(obj) ((id)(((gsaddr)obj) & ~1))
|
||||
#define GS_GC_HIDE(obj) ((id)(((uintptr_t)obj) | 1))
|
||||
#define GS_GC_UNHIDE(obj) ((id)(((uintptr_t)obj) & ~1))
|
||||
#else
|
||||
#define GS_GC_HIDE(obj) ((id)obj)
|
||||
#define GS_GC_UNHIDE(obj) ((id)obj)
|
||||
|
@ -181,6 +183,8 @@ typedef @GS_ADDR@ gsaddr;
|
|||
@DEFINE_UINT32_T@
|
||||
@DEFINE_INT64_T@
|
||||
@DEFINE_UINT64_T@
|
||||
@DEFINE_INTPTR_T@
|
||||
@DEFINE_UINTPTR_T@
|
||||
|
||||
/*
|
||||
* Wide unicode character type.
|
||||
|
|
|
@ -90,20 +90,20 @@ typedef union {
|
|||
const char *cstr;
|
||||
#endif
|
||||
#if ((GSUNION_TYPES) & GSUNION_8B)
|
||||
gss8 s8;
|
||||
gsu8 u8;
|
||||
int8_t s8;
|
||||
uint8_t u8;
|
||||
#endif
|
||||
#if ((GSUNION_TYPES) & GSUNION_16B)
|
||||
gss16 s16;
|
||||
gsu16 u16;
|
||||
int16_t s16;
|
||||
uint16_t u16;
|
||||
#endif
|
||||
#if ((GSUNION_TYPES) & GSUNION_32B)
|
||||
gss32 s32;
|
||||
gsu32 u32;
|
||||
int32_t s32;
|
||||
uint32_t u32;
|
||||
#endif
|
||||
#if ((GSUNION_TYPES) & GSUNION_64B)
|
||||
gss64 s64;
|
||||
gsu64 u64;
|
||||
int64_t s64;
|
||||
uint64_t u64;
|
||||
#endif
|
||||
#if defined(GSUNION_EXTRA)
|
||||
GSUNION_EXTRA ext;
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
/* Define if constructors are automatically loaded */
|
||||
#undef CON_AUTOLOAD
|
||||
|
||||
/* Built in default value for GNUstep config file */
|
||||
#undef GNUSTEP_TARGET_CONFIG_FILE
|
||||
|
||||
/* Built in default value for GNUstep local root */
|
||||
#undef GNUSTEP_TARGET_LOCAL_ROOT
|
||||
|
||||
|
@ -439,11 +442,9 @@
|
|||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
|
||||
if it is not supported. */
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
/*
|
||||
* OPENSTEP type definitions for Byte ordering.
|
||||
*/
|
||||
typedef gsu32 NSSwappedFloat;
|
||||
typedef gsu64 NSSwappedDouble;
|
||||
typedef uint32_t NSSwappedFloat;
|
||||
typedef uint64_t NSSwappedDouble;
|
||||
|
||||
typedef enum {
|
||||
NS_UnknownByteOrder,
|
||||
|
@ -49,48 +49,48 @@ typedef enum {
|
|||
/*
|
||||
* First the GNUstep functions for byte swapping
|
||||
*/
|
||||
static inline gsu16
|
||||
GSSwapI16(gsu16 in) __attribute__((unused));
|
||||
static inline gsu32
|
||||
GSSwapI32(gsu32 in) __attribute__((unused));
|
||||
static inline gsu64
|
||||
GSSwapI64(gsu64 in) __attribute__((unused));
|
||||
static inline uint16_t
|
||||
GSSwapI16(uint16_t in) __attribute__((unused));
|
||||
static inline uint32_t
|
||||
GSSwapI32(uint32_t in) __attribute__((unused));
|
||||
static inline uint64_t
|
||||
GSSwapI64(uint64_t in) __attribute__((unused));
|
||||
static inline gsu128
|
||||
GSSwapI128(gsu128 in) __attribute__((unused));
|
||||
|
||||
static inline gsu16
|
||||
GSSwapBigI16ToHost(gsu16 in) __attribute__((unused));
|
||||
static inline gsu32
|
||||
GSSwapBigI32ToHost(gsu32 in) __attribute__((unused));
|
||||
static inline gsu64
|
||||
GSSwapBigI64ToHost(gsu64 in) __attribute__((unused));
|
||||
static inline uint16_t
|
||||
GSSwapBigI16ToHost(uint16_t in) __attribute__((unused));
|
||||
static inline uint32_t
|
||||
GSSwapBigI32ToHost(uint32_t in) __attribute__((unused));
|
||||
static inline uint64_t
|
||||
GSSwapBigI64ToHost(uint64_t in) __attribute__((unused));
|
||||
static inline gsu128
|
||||
GSSwapBigI128ToHost(gsu128 in) __attribute__((unused));
|
||||
|
||||
static inline gsu16
|
||||
GSSwapHostI16ToBig(gsu16 in) __attribute__((unused));
|
||||
static inline gsu32
|
||||
GSSwapHostI32ToBig(gsu32 in) __attribute__((unused));
|
||||
static inline gsu64
|
||||
GSSwapHostI64ToBig(gsu64 in) __attribute__((unused));
|
||||
static inline uint16_t
|
||||
GSSwapHostI16ToBig(uint16_t in) __attribute__((unused));
|
||||
static inline uint32_t
|
||||
GSSwapHostI32ToBig(uint32_t in) __attribute__((unused));
|
||||
static inline uint64_t
|
||||
GSSwapHostI64ToBig(uint64_t in) __attribute__((unused));
|
||||
static inline gsu128
|
||||
GSSwapHostI128ToBig(gsu128 in) __attribute__((unused));
|
||||
|
||||
static inline gsu16
|
||||
GSSwapLittleI16ToHost(gsu16 in) __attribute__((unused));
|
||||
static inline gsu32
|
||||
GSSwapLittleI32ToHost(gsu32 in) __attribute__((unused));
|
||||
static inline gsu64
|
||||
GSSwapLittleI64ToHost(gsu64 in) __attribute__((unused));
|
||||
static inline uint16_t
|
||||
GSSwapLittleI16ToHost(uint16_t in) __attribute__((unused));
|
||||
static inline uint32_t
|
||||
GSSwapLittleI32ToHost(uint32_t in) __attribute__((unused));
|
||||
static inline uint64_t
|
||||
GSSwapLittleI64ToHost(uint64_t in) __attribute__((unused));
|
||||
static inline gsu128
|
||||
GSSwapLittleI128ToHost(gsu128 in) __attribute__((unused));
|
||||
|
||||
static inline gsu16
|
||||
GSSwapHostI16ToLittle(gsu16 in) __attribute__((unused));
|
||||
static inline gsu32
|
||||
GSSwapHostI32ToLittle(gsu32 in) __attribute__((unused));
|
||||
static inline gsu64
|
||||
GSSwapHostI64ToLittle(gsu64 in) __attribute__((unused));
|
||||
static inline uint16_t
|
||||
GSSwapHostI16ToLittle(uint16_t in) __attribute__((unused));
|
||||
static inline uint32_t
|
||||
GSSwapHostI32ToLittle(uint32_t in) __attribute__((unused));
|
||||
static inline uint64_t
|
||||
GSSwapHostI64ToLittle(uint64_t in) __attribute__((unused));
|
||||
static inline gsu128
|
||||
GSSwapHostI128ToLittle(gsu128 in) __attribute__((unused));
|
||||
|
||||
|
@ -101,12 +101,12 @@ GSSwapHostI128ToLittle(gsu128 in) __attribute__((unused));
|
|||
extern void _gcc3_1_hack(void);
|
||||
#endif
|
||||
|
||||
static inline gsu16
|
||||
GSSwapI16(gsu16 in)
|
||||
static inline uint16_t
|
||||
GSSwapI16(uint16_t in)
|
||||
{
|
||||
union swap {
|
||||
gsu16 num;
|
||||
gsu8 byt[2];
|
||||
uint16_t num;
|
||||
uint8_t byt[2];
|
||||
} dst;
|
||||
union swap *src = (union swap*)∈
|
||||
#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 1)
|
||||
|
@ -117,12 +117,12 @@ GSSwapI16(gsu16 in)
|
|||
return dst.num;
|
||||
}
|
||||
|
||||
static inline gsu32
|
||||
GSSwapI32(gsu32 in)
|
||||
static inline uint32_t
|
||||
GSSwapI32(uint32_t in)
|
||||
{
|
||||
union swap {
|
||||
gsu32 num;
|
||||
gsu8 byt[4];
|
||||
uint32_t num;
|
||||
uint8_t byt[4];
|
||||
} dst;
|
||||
union swap *src = (union swap*)∈
|
||||
#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 1)
|
||||
|
@ -135,12 +135,12 @@ GSSwapI32(gsu32 in)
|
|||
return dst.num;
|
||||
}
|
||||
|
||||
static inline gsu64
|
||||
GSSwapI64(gsu64 in)
|
||||
static inline uint64_t
|
||||
GSSwapI64(uint64_t in)
|
||||
{
|
||||
union swap {
|
||||
gsu64 num;
|
||||
gsu8 byt[8];
|
||||
uint64_t num;
|
||||
uint8_t byt[8];
|
||||
} dst;
|
||||
union swap *src = (union swap*)∈
|
||||
#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 1)
|
||||
|
@ -162,7 +162,7 @@ GSSwapI128(gsu128 in)
|
|||
{
|
||||
union swap {
|
||||
gsu128 num;
|
||||
gsu8 byt[16];
|
||||
uint8_t byt[16];
|
||||
} dst;
|
||||
union swap *src = (union swap*)∈
|
||||
#if (__GNUC__ == 3) && (__GNUC_MINOR__ == 1)
|
||||
|
@ -399,18 +399,18 @@ NSHostByteOrder(void)
|
|||
/*
|
||||
* Swap Big endian to host
|
||||
*/
|
||||
static inline gsu16
|
||||
GSSwapBigI16ToHost(gsu16 in)
|
||||
static inline uint16_t
|
||||
GSSwapBigI16ToHost(uint16_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
static inline gsu32
|
||||
GSSwapBigI32ToHost(gsu32 in)
|
||||
static inline uint32_t
|
||||
GSSwapBigI32ToHost(uint32_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
static inline gsu64
|
||||
GSSwapBigI64ToHost(gsu64 in)
|
||||
static inline uint64_t
|
||||
GSSwapBigI64ToHost(uint64_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
@ -459,18 +459,18 @@ NSSwapBigShortToHost(unsigned short num)
|
|||
/*
|
||||
* Swap Host to Big endian
|
||||
*/
|
||||
static inline gsu16
|
||||
GSSwapHostI16ToBig(gsu16 in)
|
||||
static inline uint16_t
|
||||
GSSwapHostI16ToBig(uint16_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
static inline gsu32
|
||||
GSSwapHostI32ToBig(gsu32 in)
|
||||
static inline uint32_t
|
||||
GSSwapHostI32ToBig(uint32_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
static inline gsu64
|
||||
GSSwapHostI64ToBig(gsu64 in)
|
||||
static inline uint64_t
|
||||
GSSwapHostI64ToBig(uint64_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
@ -519,18 +519,18 @@ NSSwapHostShortToBig(unsigned short num)
|
|||
/*
|
||||
* Swap Little endian to Host
|
||||
*/
|
||||
static inline gsu16
|
||||
GSSwapLittleI16ToHost(gsu16 in)
|
||||
static inline uint16_t
|
||||
GSSwapLittleI16ToHost(uint16_t in)
|
||||
{
|
||||
return GSSwapI16(in);
|
||||
}
|
||||
static inline gsu32
|
||||
GSSwapLittleI32ToHost(gsu32 in)
|
||||
static inline uint32_t
|
||||
GSSwapLittleI32ToHost(uint32_t in)
|
||||
{
|
||||
return GSSwapI32(in);
|
||||
}
|
||||
static inline gsu64
|
||||
GSSwapLittleI64ToHost(gsu64 in)
|
||||
static inline uint64_t
|
||||
GSSwapLittleI64ToHost(uint64_t in)
|
||||
{
|
||||
return GSSwapI64(in);
|
||||
}
|
||||
|
@ -579,18 +579,18 @@ NSSwapLittleShortToHost(unsigned short num)
|
|||
/*
|
||||
* Swap Host to Little endian
|
||||
*/
|
||||
static inline gsu16
|
||||
GSSwapHostI16ToLittle(gsu16 in)
|
||||
static inline uint16_t
|
||||
GSSwapHostI16ToLittle(uint16_t in)
|
||||
{
|
||||
return GSSwapI16(in);
|
||||
}
|
||||
static inline gsu32
|
||||
GSSwapHostI32ToLittle(gsu32 in)
|
||||
static inline uint32_t
|
||||
GSSwapHostI32ToLittle(uint32_t in)
|
||||
{
|
||||
return GSSwapI32(in);
|
||||
}
|
||||
static inline gsu64
|
||||
GSSwapHostI64ToLittle(gsu64 in)
|
||||
static inline uint64_t
|
||||
GSSwapHostI64ToLittle(uint64_t in)
|
||||
{
|
||||
return GSSwapI64(in);
|
||||
}
|
||||
|
@ -649,18 +649,18 @@ NSHostByteOrder(void)
|
|||
/*
|
||||
* Swap Big endian to host
|
||||
*/
|
||||
static inline gsu16
|
||||
GSSwapBigI16ToHost(gsu16 in)
|
||||
static inline uint16_t
|
||||
GSSwapBigI16ToHost(uint16_t in)
|
||||
{
|
||||
return GSSwapI16(in);
|
||||
}
|
||||
static inline gsu32
|
||||
GSSwapBigI32ToHost(gsu32 in)
|
||||
static inline uint32_t
|
||||
GSSwapBigI32ToHost(uint32_t in)
|
||||
{
|
||||
return GSSwapI32(in);
|
||||
}
|
||||
static inline gsu64
|
||||
GSSwapBigI64ToHost(gsu64 in)
|
||||
static inline uint64_t
|
||||
GSSwapBigI64ToHost(uint64_t in)
|
||||
{
|
||||
return GSSwapI64(in);
|
||||
}
|
||||
|
@ -708,18 +708,18 @@ NSSwapBigShortToHost(unsigned short num)
|
|||
/*
|
||||
* Swap Host to Big endian
|
||||
*/
|
||||
static inline gsu16
|
||||
GSSwapHostI16ToBig(gsu16 in)
|
||||
static inline uint16_t
|
||||
GSSwapHostI16ToBig(uint16_t in)
|
||||
{
|
||||
return GSSwapI16(in);
|
||||
}
|
||||
static inline gsu32
|
||||
GSSwapHostI32ToBig(gsu32 in)
|
||||
static inline uint32_t
|
||||
GSSwapHostI32ToBig(uint32_t in)
|
||||
{
|
||||
return GSSwapI32(in);
|
||||
}
|
||||
static inline gsu64
|
||||
GSSwapHostI64ToBig(gsu64 in)
|
||||
static inline uint64_t
|
||||
GSSwapHostI64ToBig(uint64_t in)
|
||||
{
|
||||
return GSSwapI64(in);
|
||||
}
|
||||
|
@ -767,18 +767,18 @@ NSSwapHostShortToBig(unsigned short num)
|
|||
/*
|
||||
* Swap Little endian to Host
|
||||
*/
|
||||
static inline gsu16
|
||||
GSSwapLittleI16ToHost(gsu16 in)
|
||||
static inline uint16_t
|
||||
GSSwapLittleI16ToHost(uint16_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
static inline gsu32
|
||||
GSSwapLittleI32ToHost(gsu32 in)
|
||||
static inline uint32_t
|
||||
GSSwapLittleI32ToHost(uint32_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
static inline gsu64
|
||||
GSSwapLittleI64ToHost(gsu64 in)
|
||||
static inline uint64_t
|
||||
GSSwapLittleI64ToHost(uint64_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
@ -827,18 +827,18 @@ NSSwapLittleShortToHost(unsigned short num)
|
|||
/*
|
||||
* Swap Host to Little endian
|
||||
*/
|
||||
static inline gsu16
|
||||
GSSwapHostI16ToLittle(gsu16 in)
|
||||
static inline uint16_t
|
||||
GSSwapHostI16ToLittle(uint16_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
static inline gsu32
|
||||
GSSwapHostI32ToLittle(gsu32 in)
|
||||
static inline uint32_t
|
||||
GSSwapHostI32ToLittle(uint32_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
static inline gsu64
|
||||
GSSwapHostI64ToLittle(gsu64 in)
|
||||
static inline uint64_t
|
||||
GSSwapHostI64ToLittle(uint64_t in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ typedef SOCKET NSSocketNativeHandle;
|
|||
NSRecursiveLock *myLock;
|
||||
NSHost *host; /* OpenStep host for this port. */
|
||||
NSString *address; /* Forced internet address. */
|
||||
gsu16 portNum; /* TCP port in host byte order. */
|
||||
uint16_t portNum; /* TCP port in host byte order. */
|
||||
SOCKET listener;
|
||||
NSMapTable *handles; /* Handles indexed by socket. */
|
||||
#if defined(__MINGW32__)
|
||||
|
@ -215,7 +215,7 @@ typedef SOCKET NSSocketNativeHandle;
|
|||
* Look up and return an existing <code>NSSocketPort</code> given a host and
|
||||
* number, or return nil if one has not been created.
|
||||
*/
|
||||
+ (NSSocketPort*) existingPortWithNumber: (gsu16)number
|
||||
+ (NSSocketPort*) existingPortWithNumber: (uint16_t)number
|
||||
onHost: (NSHost*)aHost;
|
||||
|
||||
/**
|
||||
|
@ -230,7 +230,7 @@ typedef SOCKET NSSocketNativeHandle;
|
|||
* remote host, the port will use the first address that works.<br/>
|
||||
* shouldListen specifies whether to listen on the port initially.
|
||||
*/
|
||||
+ (NSSocketPort*) portWithNumber: (gsu16)number
|
||||
+ (NSSocketPort*) portWithNumber: (uint16_t)number
|
||||
onHost: (NSHost*)aHost
|
||||
forceAddress: (NSString*)addr
|
||||
listener: (BOOL)shouldListen;
|
||||
|
@ -259,7 +259,7 @@ typedef SOCKET NSSocketNativeHandle;
|
|||
/**
|
||||
* Returns port number of underlying socket.
|
||||
*/
|
||||
- (gsu16) portNumber;
|
||||
- (uint16_t) portNumber;
|
||||
|
||||
// This is the OS X interface
|
||||
/*
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
id _target;
|
||||
id _arg;
|
||||
SEL _selector;
|
||||
BOOL _active;
|
||||
@public
|
||||
BOOL _active;
|
||||
NSHandler *_exception_handler;
|
||||
NSMutableDictionary *_thread_dictionary;
|
||||
struct autorelease_thread_vars _autorelease_vars;
|
||||
|
|
|
@ -250,7 +250,7 @@ static NSMapTable *attrNames = 0;
|
|||
{
|
||||
if ([desc isEqual: val] == YES)
|
||||
{
|
||||
return (int)key;
|
||||
return (int)(intptr_t)key;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
@ -258,7 +258,7 @@ static NSMapTable *attrNames = 0;
|
|||
|
||||
+ (NSString*) descriptionFromType: (int)type
|
||||
{
|
||||
NSString *desc = (NSString*)NSMapGet(attrNames, (void*)type);
|
||||
NSString *desc = (NSString*)NSMapGet(attrNames, (void*)(intptr_t)type);
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
@ -270,8 +270,9 @@ static NSMapTable *attrNames = 0;
|
|||
|
||||
- (NSString*) typeDescription
|
||||
{
|
||||
NSString *desc = (NSString*)NSMapGet(attrNames, (void*)[self type]);
|
||||
NSString *desc;
|
||||
|
||||
desc = (NSString*)NSMapGet(attrNames, (void*)(intptr_t)[self type]);
|
||||
if (desc == nil)
|
||||
{
|
||||
desc = @"Unknown attribute type";
|
||||
|
@ -415,7 +416,7 @@ static NSMapTable *attrNames = 0;
|
|||
|
||||
- (unsigned) hash
|
||||
{
|
||||
return (((unsigned)lib) >> 3);
|
||||
return (((unsigned)(uintptr_t)lib) >> 3);
|
||||
}
|
||||
|
||||
- (id) init
|
||||
|
@ -561,7 +562,7 @@ static NSMapTable *nsNames = 0;
|
|||
*/
|
||||
+ (NSString*) descriptionFromType: (int)type
|
||||
{
|
||||
NSString *desc = (NSString*)NSMapGet(nsNames, (void*)type);
|
||||
NSString *desc = (NSString*)NSMapGet(nsNames, (void*)(intptr_t)type);
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
@ -599,7 +600,7 @@ static NSMapTable *nsNames = 0;
|
|||
{
|
||||
if ([desc isEqual: val] == YES)
|
||||
{
|
||||
return (int)key;
|
||||
return (int)(intptr_t)key;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
@ -618,7 +619,7 @@ static NSMapTable *nsNames = 0;
|
|||
|
||||
- (unsigned) hash
|
||||
{
|
||||
return (((unsigned)lib) >> 3);
|
||||
return (((unsigned)(uintptr_t)lib) >> 3);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -692,8 +693,9 @@ static NSMapTable *nsNames = 0;
|
|||
*/
|
||||
- (NSString*) typeDescription
|
||||
{
|
||||
NSString *desc = (NSString*)NSMapGet(nsNames, (void*)[self type]);
|
||||
NSString *desc;
|
||||
|
||||
desc = (NSString*)NSMapGet(nsNames, (void*)(intptr_t)[self type]);
|
||||
if (desc == nil)
|
||||
{
|
||||
desc = @"Unknown namespace type";
|
||||
|
@ -738,7 +740,7 @@ static NSMapTable *nodeNames = 0;
|
|||
*/
|
||||
+ (NSString*) descriptionFromType: (int)type
|
||||
{
|
||||
NSString *desc = (NSString*)NSMapGet(nodeNames, (void*)type);
|
||||
NSString *desc = (NSString*)NSMapGet(nodeNames, (void*)(intptr_t)type);
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
@ -826,7 +828,7 @@ static NSMapTable *nodeNames = 0;
|
|||
{
|
||||
if ([desc isEqual: val] == YES)
|
||||
{
|
||||
return (int)key;
|
||||
return (int)(intptr_t)key;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
@ -1077,7 +1079,7 @@ static NSMapTable *nodeNames = 0;
|
|||
|
||||
- (unsigned) hash
|
||||
{
|
||||
return (((unsigned)lib) >> 3);
|
||||
return (((unsigned)(uintptr_t)lib) >> 3);
|
||||
}
|
||||
|
||||
- (id) init
|
||||
|
@ -1546,8 +1548,9 @@ static NSMapTable *nodeNames = 0;
|
|||
*/
|
||||
- (NSString*) typeDescription
|
||||
{
|
||||
NSString *desc = (NSString*)NSMapGet(nodeNames, (void*)[self type]);
|
||||
NSString *desc;
|
||||
|
||||
desc = (NSString*)NSMapGet(nodeNames, (void*)(intptr_t)[self type]);
|
||||
if (desc == nil)
|
||||
{
|
||||
desc = @"Unknown node type";
|
||||
|
|
|
@ -1050,15 +1050,14 @@ if (dst == 0) \
|
|||
* adjust the offset into the local buffer on the \
|
||||
* stack and pretend the buffer has grown. \
|
||||
*/ \
|
||||
ptr = buf - dpos; \
|
||||
if (extra == 0) \
|
||||
{ \
|
||||
ptr -= BUFSIZ; \
|
||||
bsize += BUFSIZ; \
|
||||
bsize = dpos + BUFSIZ; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
ptr -= BUFSIZ-1; \
|
||||
bsize += BUFSIZ-1; \
|
||||
bsize = dpos + BUFSIZ - 1; \
|
||||
} \
|
||||
} \
|
||||
else if (zone == 0) \
|
||||
|
@ -1550,9 +1549,6 @@ tables:
|
|||
NSZoneFree(zone, ptr);
|
||||
}
|
||||
|
||||
if (dst)
|
||||
NSCAssert(*dst != buf, @"attempted to pass out pointer to internal buffer");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1567,15 +1563,14 @@ if (dst == 0) \
|
|||
* adjust the offset into the local buffer on the \
|
||||
* stack and pretend the buffer has grown. \
|
||||
*/ \
|
||||
ptr = buf - dpos; \
|
||||
if (extra == 0) \
|
||||
{ \
|
||||
ptr -= BUFSIZ; \
|
||||
bsize += BUFSIZ; \
|
||||
bsize = dpos + BUFSIZ; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
ptr -= BUFSIZ-1; \
|
||||
bsize += BUFSIZ-1; \
|
||||
bsize = dpos + BUFSIZ - 1; \
|
||||
} \
|
||||
} \
|
||||
else if (zone == 0) \
|
||||
|
@ -1837,14 +1832,12 @@ GSFromUnicode(unsigned char **dst, unsigned int *size, const unichar *src,
|
|||
sl = 6;
|
||||
}
|
||||
|
||||
/* make sure we have enough space for it */
|
||||
while (dpos + sl >= bsize)
|
||||
{
|
||||
GROW();
|
||||
}
|
||||
|
||||
if (sl == 1)
|
||||
{
|
||||
if (dpos >= bsize)
|
||||
{
|
||||
GROW();
|
||||
}
|
||||
ptr[dpos++] = u & 0x7f;
|
||||
}
|
||||
else
|
||||
|
@ -1859,10 +1852,18 @@ GSFromUnicode(unsigned char **dst, unsigned int *size, const unichar *src,
|
|||
u = u >> 6;
|
||||
}
|
||||
|
||||
if (dpos >= bsize)
|
||||
{
|
||||
GROW();
|
||||
}
|
||||
ptr[dpos++] = reversed[sl-1] | ((0xff << (8-sl)) & 0xff);
|
||||
/* add bytes into the output sequence */
|
||||
for (i = sl - 2; i >= 0; i--)
|
||||
{
|
||||
if (dpos >= bsize)
|
||||
{
|
||||
GROW();
|
||||
}
|
||||
ptr[dpos++] = reversed[i] | 0x80;
|
||||
}
|
||||
}
|
||||
|
@ -2234,9 +2235,6 @@ tables:
|
|||
NSZoneFree(zone, ptr);
|
||||
}
|
||||
|
||||
if (dst)
|
||||
NSCAssert(*dst != buf, @"attempted to pass out pointer to internal buffer");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -208,14 +208,14 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
}
|
||||
if (*ptr == '\0' && val <= 0xffff)
|
||||
{
|
||||
gsu16 v = val;
|
||||
uint16_t v = val;
|
||||
|
||||
sin->sin_port = GSSwapHostI16ToBig(v);
|
||||
return YES;
|
||||
}
|
||||
else if (strcmp(ptr, "gdomap") == 0)
|
||||
{
|
||||
gsu16 v;
|
||||
uint16_t v;
|
||||
#ifdef GDOMAP_PORT_OVERRIDE
|
||||
v = GDOMAP_PORT_OVERRIDE;
|
||||
#else
|
||||
|
@ -1138,12 +1138,12 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
- (id) initWithNativeHandle: (void*)hdl
|
||||
{
|
||||
return [self initWithFileDescriptor: (gsaddr)hdl closeOnDealloc: NO];
|
||||
return [self initWithFileDescriptor: (uintptr_t)hdl closeOnDealloc: NO];
|
||||
}
|
||||
|
||||
- (id) initWithNativeHandle: (void*)hdl closeOnDealloc: (BOOL)flag
|
||||
{
|
||||
return [self initWithFileDescriptor: (gsaddr)hdl closeOnDealloc: flag];
|
||||
return [self initWithFileDescriptor: (uintptr_t)hdl closeOnDealloc: flag];
|
||||
}
|
||||
|
||||
- (void) checkAccept
|
||||
|
@ -1248,7 +1248,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
- (void*) nativeHandle
|
||||
{
|
||||
return (void*)descriptor;
|
||||
return (void*)(intptr_t)descriptor;
|
||||
}
|
||||
|
||||
// Synchronous I/O operations
|
||||
|
@ -1752,7 +1752,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
for (i = 0; i < [modes count]; i++)
|
||||
{
|
||||
[l removeEvent: (void*)(gsaddr)descriptor
|
||||
[l removeEvent: (void*)(uintptr_t)descriptor
|
||||
type: ET_RDESC
|
||||
forMode: [modes objectAtIndex: i]
|
||||
all: YES];
|
||||
|
@ -1760,7 +1760,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else
|
||||
{
|
||||
[l removeEvent: (void*)(gsaddr)descriptor
|
||||
[l removeEvent: (void*)(uintptr_t)descriptor
|
||||
type: ET_RDESC
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: YES];
|
||||
|
@ -1792,7 +1792,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
for (i = 0; i < [modes count]; i++)
|
||||
{
|
||||
[l removeEvent: (void*)(gsaddr)descriptor
|
||||
[l removeEvent: (void*)(uintptr_t)descriptor
|
||||
type: ET_WDESC
|
||||
forMode: [modes objectAtIndex: i]
|
||||
all: YES];
|
||||
|
@ -1800,7 +1800,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else
|
||||
{
|
||||
[l removeEvent: (void*)(gsaddr)descriptor
|
||||
[l removeEvent: (void*)(uintptr_t)descriptor
|
||||
type: ET_WDESC
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: YES];
|
||||
|
@ -1824,7 +1824,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
for (i = 0; i < [modes count]; i++)
|
||||
{
|
||||
[l addEvent: (void*)(gsaddr)descriptor
|
||||
[l addEvent: (void*)(uintptr_t)descriptor
|
||||
type: ET_RDESC
|
||||
watcher: self
|
||||
forMode: [modes objectAtIndex: i]];
|
||||
|
@ -1833,7 +1833,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else
|
||||
{
|
||||
[l addEvent: (void*)(gsaddr)descriptor
|
||||
[l addEvent: (void*)(uintptr_t)descriptor
|
||||
type: ET_RDESC
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
|
@ -1861,7 +1861,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
for (i = 0; i < [modes count]; i++)
|
||||
{
|
||||
[l addEvent: (void*)(gsaddr)descriptor
|
||||
[l addEvent: (void*)(uintptr_t)descriptor
|
||||
type: ET_WDESC
|
||||
watcher: self
|
||||
forMode: [modes objectAtIndex: i]];
|
||||
|
@ -1869,7 +1869,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else
|
||||
{
|
||||
[l addEvent: (void*)(gsaddr)descriptor
|
||||
[l addEvent: (void*)(uintptr_t)descriptor
|
||||
type: ET_WDESC
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
#ifdef HAVE_WCHAR_H
|
||||
#include <wchar.h>
|
||||
#else
|
||||
typedef gsu32 wint_t;
|
||||
typedef uint32_t wint_t;
|
||||
#endif
|
||||
#ifdef HAVE_SYS_INTTYPES_H
|
||||
#include <sys/inttypes.h>
|
||||
|
|
|
@ -797,60 +797,135 @@ boolValue_u(GSStr self)
|
|||
static inline BOOL
|
||||
canBeConvertedToEncoding_c(GSStr self, NSStringEncoding enc)
|
||||
{
|
||||
if (enc == intEnc)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL result = (*convertImp)((id)self, convertSel, enc);
|
||||
unsigned c = self->_count;
|
||||
BOOL result = YES;
|
||||
|
||||
return result;
|
||||
/*
|
||||
* If the length is zero, or we are already using the required encoding,
|
||||
* or the required encoding is unicode (can hold any character) then we
|
||||
* can assume that a conversion would succeed.
|
||||
* We also know a conversion must succeed if the internal encoding is
|
||||
* ascii and the required encoding has ascii as a subset.
|
||||
*/
|
||||
if (c > 0
|
||||
&& enc != intEnc
|
||||
&& enc != NSUTF8StringEncoding
|
||||
&& enc != NSUnicodeStringEncoding
|
||||
&& ((intEnc != NSASCIIStringEncoding)
|
||||
|| ((enc != NSISOLatin1StringEncoding)
|
||||
&& (enc != NSISOLatin2StringEncoding)
|
||||
&& (enc != NSNEXTSTEPStringEncoding)
|
||||
&& (enc != NSNonLossyASCIIStringEncoding))))
|
||||
{
|
||||
unsigned l = 0;
|
||||
unichar *r = 0;
|
||||
|
||||
/*
|
||||
* To check whether conversion is possible, we first convert to
|
||||
* unicode and then check to see whether it is possible to convert
|
||||
* to the desired encoding.
|
||||
*/
|
||||
result = GSToUnicode(&r, &l, self->_contents.c, self->_count, intEnc,
|
||||
NSDefaultMallocZone(), GSUniStrict);
|
||||
if (result == YES)
|
||||
{
|
||||
if (enc == NSISOLatin1StringEncoding)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/*
|
||||
* If all the unicode characters are in the 0 to 255 range
|
||||
* they are all latin1.
|
||||
*/
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
if (r[i] > 255)
|
||||
{
|
||||
result = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (enc == NSASCIIStringEncoding)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/*
|
||||
* If all the unicode characters are in the 0 to 127 range
|
||||
* they are all ascii.
|
||||
*/
|
||||
for (i = 0; i < l; i++)
|
||||
{
|
||||
if (r[i] > 127)
|
||||
{
|
||||
result = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned dummy = 0; // Hold returned length.
|
||||
|
||||
result = GSFromUnicode(0, &dummy, r, l, enc, 0, GSUniStrict);
|
||||
}
|
||||
|
||||
// Temporary unicode string no longer needed.
|
||||
NSZoneFree(NSDefaultMallocZone(), r);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline BOOL
|
||||
canBeConvertedToEncoding_u(GSStr self, NSStringEncoding enc)
|
||||
{
|
||||
BOOL result = YES;
|
||||
unsigned c = self->_count;
|
||||
BOOL result = YES;
|
||||
|
||||
if (enc == NSISOLatin1StringEncoding)
|
||||
if (c > 0 && enc != NSUTF8StringEncoding && enc != NSUnicodeStringEncoding)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/*
|
||||
* If all the unicode characters are in the 0 to 255 range
|
||||
* they are all latin1.
|
||||
*/
|
||||
for (i = 0; i < self->_count; i++)
|
||||
if (enc == NSISOLatin1StringEncoding)
|
||||
{
|
||||
if (self->_contents.u[i] > 255)
|
||||
unsigned i;
|
||||
|
||||
/*
|
||||
* If all the unicode characters are in the 0 to 255 range
|
||||
* they are all latin1.
|
||||
*/
|
||||
for (i = 0; i < self->_count; i++)
|
||||
{
|
||||
result = NO;
|
||||
break;
|
||||
if (self->_contents.u[i] > 255)
|
||||
{
|
||||
result = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (enc == NSASCIIStringEncoding)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/*
|
||||
* If all the unicode characters are in the 0 to 127 range
|
||||
* they are all ascii.
|
||||
*/
|
||||
for (i = 0; i < self->_count; i++)
|
||||
else if (enc == NSASCIIStringEncoding)
|
||||
{
|
||||
if (self->_contents.u[i] > 127)
|
||||
unsigned i;
|
||||
|
||||
/*
|
||||
* If all the unicode characters are in the 0 to 127 range
|
||||
* they are all ascii.
|
||||
*/
|
||||
for (i = 0; i < self->_count; i++)
|
||||
{
|
||||
result = NO;
|
||||
break;
|
||||
if (self->_contents.u[i] > 127)
|
||||
{
|
||||
result = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = (*convertImp)((id)self, convertSel, enc);
|
||||
else
|
||||
{
|
||||
unsigned dummy = 0; // Hold returned length.
|
||||
|
||||
result = GSFromUnicode(0, &dummy, self->_contents.u, c, enc,
|
||||
0, GSUniStrict);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@
|
|||
hash += val.c[i];
|
||||
return hash;
|
||||
#elif TYPE_ORDER == 2
|
||||
return (unsigned)(gsaddr)data;
|
||||
return (unsigned)(uintptr_t)data;
|
||||
#elif TYPE_ORDER == 3
|
||||
return (data.length ^ data.location);
|
||||
#elif TYPE_ORDER == 4
|
||||
|
|
|
@ -228,8 +228,15 @@ static IMP initImp;
|
|||
|
||||
+ (void) addObject: (id)anObj
|
||||
{
|
||||
NSAutoreleasePool *pool = ARP_THREAD_VARS->current_pool;
|
||||
NSThread *t = GSCurrentThread();
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = t->_autorelease_vars.current_pool;
|
||||
if (pool == nil && t->_active == NO)
|
||||
{
|
||||
[self new]; // Don't leak while exiting thread.
|
||||
pool = t->_autorelease_vars.current_pool;
|
||||
}
|
||||
if (pool != nil)
|
||||
{
|
||||
(*pool->_addImp)(pool, @selector(addObject:), anObj);
|
||||
|
@ -354,7 +361,7 @@ static IMP initImp;
|
|||
{
|
||||
id anObject = objects[i];
|
||||
Class c = GSObjCClass(anObject);
|
||||
unsigned hash = (((unsigned)c) >> 3) & 0x0f;
|
||||
unsigned hash = (((unsigned)(uintptr_t)c) >> 3) & 0x0f;
|
||||
|
||||
objects[i] = nil;
|
||||
if (classes[hash] != c)
|
||||
|
|
|
@ -690,6 +690,14 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
{
|
||||
sub = @"%I:%M:%S %p";
|
||||
}
|
||||
else if (c == 'T')
|
||||
{
|
||||
sub = @"%H:%M:%S";
|
||||
}
|
||||
else if (c == 't')
|
||||
{
|
||||
sub = @"\t";
|
||||
}
|
||||
else if (c == 'X')
|
||||
{
|
||||
sub = [locale objectForKey: NSTimeFormatString];
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
unsigned int
|
||||
_NS_int_hash(void *table, void* i)
|
||||
{
|
||||
return (unsigned int) i;
|
||||
return (unsigned)(uintptr_t)i;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
@ -67,7 +67,7 @@ _NS_int_release(void *table, void* i)
|
|||
NSString *
|
||||
_NS_int_describe(void *table, void* i)
|
||||
{
|
||||
return [NSString stringWithFormat: @"%d", (int)i];
|
||||
return [NSString stringWithFormat: @"%d", (int)(intptr_t)i];
|
||||
}
|
||||
|
||||
/** For owned `void *' **/
|
||||
|
@ -76,7 +76,7 @@ unsigned int
|
|||
_NS_owned_void_p_hash(void *table, void *p)
|
||||
{
|
||||
/* P may be aligned, so we need to compensate. */
|
||||
return ((unsigned int)p)/4;
|
||||
return ((unsigned)(uintptr_t)p)/4;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
@ -177,7 +177,7 @@ _NS_id_describe(void *table, id <NSObject> o)
|
|||
unsigned int
|
||||
_NS_non_owned_void_p_hash(void *table, void *p)
|
||||
{
|
||||
return ((unsigned int)p)/4;
|
||||
return ((unsigned)(uintptr_t)p)/4;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
@ -209,7 +209,7 @@ _NS_non_owned_void_p_describe(void *table, void *p)
|
|||
unsigned int
|
||||
_NS_int_p_hash(void *table, int *p)
|
||||
{
|
||||
return ((unsigned int)p)/4;
|
||||
return ((unsigned)(uintptr_t)p)/4;
|
||||
}
|
||||
|
||||
BOOL
|
||||
|
|
|
@ -273,7 +273,7 @@ rootObjectForInPort(NSPort *aPort)
|
|||
id rootObject;
|
||||
|
||||
F_LOCK(root_object_map_gate);
|
||||
rootObject = (id)NSMapGet(root_object_map, (void*)(gsaddr)aPort);
|
||||
rootObject = (id)NSMapGet(root_object_map, (void*)(uintptr_t)aPort);
|
||||
F_UNLOCK(root_object_map_gate);
|
||||
return rootObject;
|
||||
}
|
||||
|
@ -285,17 +285,17 @@ setRootObjectForInPort(id anObj, NSPort *aPort)
|
|||
id oldRootObject;
|
||||
|
||||
F_LOCK(root_object_map_gate);
|
||||
oldRootObject = (id)NSMapGet(root_object_map, (void*)(gsaddr)aPort);
|
||||
oldRootObject = (id)NSMapGet(root_object_map, (void*)(uintptr_t)aPort);
|
||||
if (oldRootObject != anObj)
|
||||
{
|
||||
if (anObj != nil)
|
||||
{
|
||||
NSMapInsert(root_object_map, (void*)(gsaddr)aPort,
|
||||
(void*)(gsaddr)anObj);
|
||||
NSMapInsert(root_object_map, (void*)(uintptr_t)aPort,
|
||||
(void*)(uintptr_t)anObj);
|
||||
}
|
||||
else /* anObj == nil && oldRootObject != nil */
|
||||
{
|
||||
NSMapRemove(root_object_map, (void*)(gsaddr)aPort);
|
||||
NSMapRemove(root_object_map, (void*)(uintptr_t)aPort);
|
||||
}
|
||||
}
|
||||
F_UNLOCK(root_object_map_gate);
|
||||
|
@ -618,7 +618,9 @@ static NSLock *cached_proxies_gate = nil;
|
|||
if ([item countdown] == NO)
|
||||
{
|
||||
NSDistantObject *obj = [item obj];
|
||||
NSMapRemove(targetToCached, (void*)((ProxyStruct*)obj)->_handle);
|
||||
|
||||
NSMapRemove(targetToCached,
|
||||
(void*)(uintptr_t)((ProxyStruct*)obj)->_handle);
|
||||
}
|
||||
}
|
||||
if ([cached_locals count] == 0)
|
||||
|
@ -697,7 +699,7 @@ static NSLock *cached_proxies_gate = nil;
|
|||
- (NSString*) description
|
||||
{
|
||||
return [NSString stringWithFormat: @"%@ recv: 0x%x send 0x%x",
|
||||
[super description], (gsaddr)[self receivePort], (gsaddr)[self sendPort]];
|
||||
[super description], (uintptr_t)[self receivePort], (uintptr_t)[self sendPort]];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1886,7 +1888,7 @@ static void retEncoder (DOContext *ctxt)
|
|||
[self _sendOutRmc: ctxt.encoder type: METHOD_REQUEST];
|
||||
ctxt.encoder = nil;
|
||||
NSDebugMLLog(@"NSConnection", @"Sent message (%s) to 0x%x",
|
||||
GSNameFromSelector(sel), (gsaddr)self);
|
||||
GSNameFromSelector(sel), (uintptr_t)self);
|
||||
|
||||
if (needsResponse == NO)
|
||||
{
|
||||
|
@ -2011,7 +2013,7 @@ static void retEncoder (DOContext *ctxt)
|
|||
}
|
||||
|
||||
[self _sendOutRmc: op type: METHOD_REQUEST];
|
||||
NSDebugMLLog(@"NSConnection", @"Sent message to 0x%x", (gsaddr)self);
|
||||
NSDebugMLLog(@"NSConnection", @"Sent message to 0x%x", (uintptr_t)self);
|
||||
|
||||
if (needsResponse == NO)
|
||||
{
|
||||
|
@ -2437,7 +2439,7 @@ static void callEncoder (DOContext *ctxt)
|
|||
|
||||
if (debug_connection > 1)
|
||||
{
|
||||
NSLog(@"Handling message from %@", (gsaddr)self);
|
||||
NSLog(@"Handling message from %@", (uintptr_t)self);
|
||||
}
|
||||
_reqInCount++; /* Handling an incoming request. */
|
||||
|
||||
|
@ -3111,7 +3113,7 @@ static void callEncoder (DOContext *ctxt)
|
|||
|
||||
if (debug_connection > 2)
|
||||
NSLog(@"add local object (0x%x) target (0x%x) "
|
||||
@"to connection (%@)", (gsaddr)object, target, self);
|
||||
@"to connection (%@)", (uintptr_t)object, target, self);
|
||||
|
||||
M_UNLOCK(_proxiesGate);
|
||||
}
|
||||
|
@ -3185,12 +3187,12 @@ static void callEncoder (DOContext *ctxt)
|
|||
repeats: YES];
|
||||
}
|
||||
item = [CachedLocalObject newWithObject: prox time: 5];
|
||||
NSMapInsert(targetToCached, (void*)target, item);
|
||||
NSMapInsert(targetToCached, (void*)(uintptr_t)target, item);
|
||||
M_UNLOCK(cached_proxies_gate);
|
||||
RELEASE(item);
|
||||
if (debug_connection > 3)
|
||||
NSLog(@"placed local object (0x%x) target (0x%x) in cache",
|
||||
(gsaddr)anObj, target);
|
||||
(uintptr_t)anObj, target);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3206,7 +3208,7 @@ static void callEncoder (DOContext *ctxt)
|
|||
|
||||
if (debug_connection > 2)
|
||||
NSLog(@"removed local object (0x%x) target (0x%x) "
|
||||
@"from connection (%@) (ref %d)", (gsaddr)anObj, target, self, val);
|
||||
@"from connection (%@) (ref %d)", (uintptr_t)anObj, target, self, val);
|
||||
}
|
||||
M_UNLOCK(_proxiesGate);
|
||||
}
|
||||
|
@ -3276,7 +3278,7 @@ static void callEncoder (DOContext *ctxt)
|
|||
CachedLocalObject *cached;
|
||||
|
||||
M_LOCK(cached_proxies_gate);
|
||||
cached = NSMapGet (targetToCached, (void*)target);
|
||||
cached = NSMapGet (targetToCached, (void*)(uintptr_t)target);
|
||||
if (cached != nil)
|
||||
{
|
||||
proxy = [cached obj];
|
||||
|
@ -3286,7 +3288,7 @@ static void callEncoder (DOContext *ctxt)
|
|||
*/
|
||||
ASSIGN(((ProxyStruct*)proxy)->_connection, self);
|
||||
[self addLocalObject: proxy];
|
||||
NSMapRemove(targetToCached, (void*)target);
|
||||
NSMapRemove(targetToCached, (void*)(uintptr_t)target);
|
||||
if (debug_connection > 3)
|
||||
NSLog(@"target (0x%x) moved from cache", target);
|
||||
}
|
||||
|
|
127
Source/NSData.m
127
Source/NSData.m
|
@ -335,19 +335,10 @@ failure:
|
|||
*/
|
||||
@implementation NSData
|
||||
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
static unsigned gsu16Align;
|
||||
static unsigned gsu32Align;
|
||||
#endif
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSData class])
|
||||
{
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
gsu16Align = objc_alignof_type(@encode(gsu16));
|
||||
gsu32Align = objc_alignof_type(@encode(gsu32));
|
||||
#endif
|
||||
NSDataAbstract = self;
|
||||
NSMutableDataAbstract = [NSMutableData class];
|
||||
dataMalloc = [NSDataMalloc class];
|
||||
|
@ -1170,7 +1161,7 @@ failure:
|
|||
}
|
||||
case _C_CHARPTR:
|
||||
{
|
||||
gss32 length;
|
||||
int32_t length;
|
||||
|
||||
[self deserializeBytes: &length
|
||||
length: sizeof(length)
|
||||
|
@ -1340,7 +1331,7 @@ failure:
|
|||
}
|
||||
case _C_CLASS:
|
||||
{
|
||||
gsu16 ni;
|
||||
uint16_t ni;
|
||||
|
||||
[self deserializeBytes: &ni
|
||||
length: sizeof(ni)
|
||||
|
@ -1372,8 +1363,8 @@ failure:
|
|||
}
|
||||
case _C_SEL:
|
||||
{
|
||||
gsu16 ln;
|
||||
gsu16 lt;
|
||||
uint16_t ln;
|
||||
uint16_t lt;
|
||||
|
||||
[self deserializeBytes: &ln
|
||||
length: sizeof(ln)
|
||||
|
@ -1588,7 +1579,7 @@ failure:
|
|||
atCursor: (unsigned int*)cursor
|
||||
{
|
||||
[self deserializeDataAt: (void*)tag
|
||||
ofObjCType: @encode(gsu8)
|
||||
ofObjCType: @encode(uint8_t)
|
||||
atCursor: cursor
|
||||
context: nil];
|
||||
if (*tag & _GSC_MAYX)
|
||||
|
@ -1601,10 +1592,10 @@ failure:
|
|||
}
|
||||
case _GSC_X_1:
|
||||
{
|
||||
gsu8 x;
|
||||
uint8_t x;
|
||||
|
||||
[self deserializeDataAt: (void*)&x
|
||||
ofObjCType: @encode(gsu8)
|
||||
ofObjCType: @encode(uint8_t)
|
||||
atCursor: cursor
|
||||
context: nil];
|
||||
*ref = (unsigned int)x;
|
||||
|
@ -1612,10 +1603,10 @@ failure:
|
|||
}
|
||||
case _GSC_X_2:
|
||||
{
|
||||
gsu16 x;
|
||||
uint16_t x;
|
||||
|
||||
[self deserializeDataAt: (void*)&x
|
||||
ofObjCType: @encode(gsu16)
|
||||
ofObjCType: @encode(uint16_t)
|
||||
atCursor: cursor
|
||||
context: nil];
|
||||
*ref = (unsigned int)x;
|
||||
|
@ -1623,10 +1614,10 @@ failure:
|
|||
}
|
||||
default:
|
||||
{
|
||||
gsu32 x;
|
||||
uint32_t x;
|
||||
|
||||
[self deserializeDataAt: (void*)&x
|
||||
ofObjCType: @encode(gsu32)
|
||||
ofObjCType: @encode(uint32_t)
|
||||
atCursor: cursor
|
||||
context: nil];
|
||||
*ref = (unsigned int)x;
|
||||
|
@ -1770,7 +1761,7 @@ failure:
|
|||
unsigned length = [self length];
|
||||
void *bytes = [self mutableBytes];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned long)
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned int)
|
||||
at: &length];
|
||||
if (length)
|
||||
{
|
||||
|
@ -1802,7 +1793,7 @@ failure:
|
|||
zone = [self zone];
|
||||
#endif
|
||||
|
||||
[aCoder decodeValueOfObjCType: @encode(unsigned long) at: &l];
|
||||
[aCoder decodeValueOfObjCType: @encode(unsigned int) at: &l];
|
||||
if (l)
|
||||
{
|
||||
void *b = NSZoneMalloc(zone, l);
|
||||
|
@ -2045,17 +2036,17 @@ failure:
|
|||
|
||||
case _C_CHARPTR:
|
||||
{
|
||||
gsu32 len;
|
||||
gsu32 ni;
|
||||
uint32_t len;
|
||||
uint32_t ni;
|
||||
|
||||
if (!*(void**)data)
|
||||
{
|
||||
ni = (gsu32)-1;
|
||||
ni = (uint32_t)-1;
|
||||
ni = GSSwapHostI32ToBig(ni);
|
||||
[self appendBytes: (void*)&ni length: sizeof(ni)];
|
||||
return;
|
||||
}
|
||||
len = (gsu32)strlen(*(void**)data);
|
||||
len = (uint32_t)strlen(*(void**)data);
|
||||
ni = GSSwapHostI32ToBig(len);
|
||||
[self appendBytes: (void*)&ni length: sizeof(ni)];
|
||||
[self appendBytes: *(void**)data length: len];
|
||||
|
@ -2158,8 +2149,8 @@ failure:
|
|||
case _C_CLASS:
|
||||
{
|
||||
const char *name = *(Class*)data?GSNameFromClass(*(Class*)data):"";
|
||||
gsu16 ln = (gsu16)strlen(name);
|
||||
gsu16 ni;
|
||||
uint16_t ln = (uint16_t)strlen(name);
|
||||
uint16_t ni;
|
||||
|
||||
ni = GSSwapHostI16ToBig(ln);
|
||||
[self appendBytes: &ni length: sizeof(ni)];
|
||||
|
@ -2172,10 +2163,10 @@ failure:
|
|||
case _C_SEL:
|
||||
{
|
||||
const char *name = *(SEL*)data?GSNameFromSelector(*(SEL*)data):"";
|
||||
gsu16 ln = (name == 0) ? 0 : (gsu16)strlen(name);
|
||||
uint16_t ln = (name == 0) ? 0 : (uint16_t)strlen(name);
|
||||
const char *types = *(SEL*)data?GSTypesFromSelector(*(SEL*)data):"";
|
||||
gsu16 lt = (types == 0) ? 0 : (gsu16)strlen(types);
|
||||
gsu16 ni;
|
||||
uint16_t lt = (types == 0) ? 0 : (uint16_t)strlen(types);
|
||||
uint16_t ni;
|
||||
|
||||
ni = GSSwapHostI16ToBig(ln);
|
||||
[self appendBytes: &ni length: sizeof(ni)];
|
||||
|
@ -2337,38 +2328,38 @@ failure:
|
|||
{
|
||||
if (xref <= 0xff)
|
||||
{
|
||||
gsu8 x = (gsu8)xref;
|
||||
uint8_t x = (uint8_t)xref;
|
||||
|
||||
tag = (tag & ~_GSC_SIZE) | _GSC_X_1;
|
||||
[self serializeDataAt: (void*)&tag
|
||||
ofObjCType: @encode(unsigned char)
|
||||
context: nil];
|
||||
[self serializeDataAt: (void*)&x
|
||||
ofObjCType: @encode(gsu8)
|
||||
ofObjCType: @encode(uint8_t)
|
||||
context: nil];
|
||||
}
|
||||
else if (xref <= 0xffff)
|
||||
{
|
||||
gsu16 x = (gsu16)xref;
|
||||
uint16_t x = (uint16_t)xref;
|
||||
|
||||
tag = (tag & ~_GSC_SIZE) | _GSC_X_2;
|
||||
[self serializeDataAt: (void*)&tag
|
||||
ofObjCType: @encode(unsigned char)
|
||||
context: nil];
|
||||
[self serializeDataAt: (void*)&x
|
||||
ofObjCType: @encode(gsu16)
|
||||
ofObjCType: @encode(uint16_t)
|
||||
context: nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
gsu32 x = (gsu32)xref;
|
||||
uint32_t x = (uint32_t)xref;
|
||||
|
||||
tag = (tag & ~_GSC_SIZE) | _GSC_X_4;
|
||||
[self serializeDataAt: (void*)&tag
|
||||
ofObjCType: @encode(unsigned char)
|
||||
context: nil];
|
||||
[self serializeDataAt: (void*)&x
|
||||
ofObjCType: @encode(gsu32)
|
||||
ofObjCType: @encode(uint32_t)
|
||||
context: nil];
|
||||
}
|
||||
}
|
||||
|
@ -2493,7 +2484,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
}
|
||||
case _C_CHARPTR:
|
||||
{
|
||||
gss32 len;
|
||||
int32_t len;
|
||||
|
||||
[self deserializeBytes: &len
|
||||
length: sizeof(len)
|
||||
|
@ -2644,7 +2635,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
}
|
||||
case _C_CLASS:
|
||||
{
|
||||
gsu16 ni;
|
||||
uint16_t ni;
|
||||
|
||||
getBytes((void*)&ni, bytes, sizeof(ni), length, cursor);
|
||||
ni = GSSwapBigI16ToHost(ni);
|
||||
|
@ -2672,8 +2663,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
}
|
||||
case _C_SEL:
|
||||
{
|
||||
gsu16 ln;
|
||||
gsu16 lt;
|
||||
uint16_t ln;
|
||||
uint16_t lt;
|
||||
|
||||
getBytes((void*)&ln, bytes, sizeof(ln), length, cursor);
|
||||
ln = GSSwapBigI16ToHost(ln);
|
||||
|
@ -2760,7 +2751,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
}
|
||||
case _GSC_X_2:
|
||||
{
|
||||
gsu16 x;
|
||||
uint16_t x;
|
||||
|
||||
if (*cursor >= length-1)
|
||||
{
|
||||
|
@ -2769,18 +2760,18 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
*cursor, length];
|
||||
}
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
if ((*cursor % gsu16Align) != 0)
|
||||
if ((*cursor % __alignof__(uint16_t)) != 0)
|
||||
memcpy(&x, (bytes + *cursor), 2);
|
||||
else
|
||||
#endif
|
||||
x = *(gsu16*)(bytes + *cursor);
|
||||
x = *(uint16_t*)(bytes + *cursor);
|
||||
*cursor += 2;
|
||||
*ref = (unsigned int)GSSwapBigI16ToHost(x);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
{
|
||||
gsu32 x;
|
||||
uint32_t x;
|
||||
|
||||
if (*cursor >= length-3)
|
||||
{
|
||||
|
@ -2789,11 +2780,11 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
*cursor, length];
|
||||
}
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
if ((*cursor % gsu32Align) != 0)
|
||||
if ((*cursor % __alignof__(uint32_t)) != 0)
|
||||
memcpy(&x, (bytes + *cursor), 4);
|
||||
else
|
||||
#endif
|
||||
x = *(gsu32*)(bytes + *cursor);
|
||||
x = *(uint32_t*)(bytes + *cursor);
|
||||
*cursor += 4;
|
||||
*ref = (unsigned int)GSSwapBigI32ToHost(x);
|
||||
return;
|
||||
|
@ -3288,8 +3279,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
case _C_CHARPTR:
|
||||
{
|
||||
unsigned len;
|
||||
gss32 ni;
|
||||
gsu32 minimum;
|
||||
int32_t ni;
|
||||
uint32_t minimum;
|
||||
|
||||
if (!*(void**)data)
|
||||
{
|
||||
|
@ -3320,7 +3311,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
unsigned size;
|
||||
unsigned count = atoi(++type);
|
||||
unsigned i;
|
||||
gsu32 minimum;
|
||||
uint32_t minimum;
|
||||
|
||||
while (isdigit(*type))
|
||||
{
|
||||
|
@ -3421,9 +3412,9 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
case _C_CLASS:
|
||||
{
|
||||
const char *name = *(Class*)data?GSNameFromClass(*(Class*)data):"";
|
||||
gsu16 ln = (gsu16)strlen(name);
|
||||
gsu32 minimum = length + ln + sizeof(gsu16);
|
||||
gsu16 ni;
|
||||
uint16_t ln = (uint16_t)strlen(name);
|
||||
uint32_t minimum = length + ln + sizeof(uint16_t);
|
||||
uint16_t ni;
|
||||
|
||||
if (minimum > capacity)
|
||||
{
|
||||
|
@ -3442,11 +3433,11 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
case _C_SEL:
|
||||
{
|
||||
const char *name = *(SEL*)data?GSNameFromSelector(*(SEL*)data):"";
|
||||
gsu16 ln = (name == 0) ? 0 : (gsu16)strlen(name);
|
||||
uint16_t ln = (name == 0) ? 0 : (uint16_t)strlen(name);
|
||||
const char *types = *(SEL*)data?GSTypesFromSelector(*(SEL*)data):"";
|
||||
gsu16 lt = (types == 0) ? 0 : (gsu16)strlen(types);
|
||||
gsu32 minimum = length + ln + lt + 2*sizeof(gsu16);
|
||||
gsu16 ni;
|
||||
uint16_t lt = (types == 0) ? 0 : (uint16_t)strlen(types);
|
||||
uint32_t minimum = length + ln + lt + 2*sizeof(uint16_t);
|
||||
uint16_t ni;
|
||||
|
||||
if (minimum > capacity)
|
||||
{
|
||||
|
@ -3495,49 +3486,49 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
{
|
||||
[self _grow: length + 2];
|
||||
}
|
||||
*(gsu8*)(bytes + length++) = tag;
|
||||
*(gsu8*)(bytes + length++) = xref;
|
||||
*(uint8_t*)(bytes + length++) = tag;
|
||||
*(uint8_t*)(bytes + length++) = xref;
|
||||
}
|
||||
else if (xref <= 0xffff)
|
||||
{
|
||||
gsu16 x = (gsu16)xref;
|
||||
uint16_t x = (uint16_t)xref;
|
||||
|
||||
tag = (tag & ~_GSC_SIZE) | _GSC_X_2;
|
||||
if (length + 3 >= capacity)
|
||||
{
|
||||
[self _grow: length + 3];
|
||||
}
|
||||
*(gsu8*)(bytes + length++) = tag;
|
||||
*(uint8_t*)(bytes + length++) = tag;
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
if ((length % gsu16Align) != 0)
|
||||
if ((length % __alignof__(uint16_t)) != 0)
|
||||
{
|
||||
x = GSSwapHostI16ToBig(x);
|
||||
memcpy((bytes + length), &x, 2);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
*(gsu16*)(bytes + length) = GSSwapHostI16ToBig(x);
|
||||
*(uint16_t*)(bytes + length) = GSSwapHostI16ToBig(x);
|
||||
length += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
gsu32 x = (gsu32)xref;
|
||||
uint32_t x = (uint32_t)xref;
|
||||
|
||||
tag = (tag & ~_GSC_SIZE) | _GSC_X_4;
|
||||
if (length + 5 >= capacity)
|
||||
{
|
||||
[self _grow: length + 5];
|
||||
}
|
||||
*(gsu8*)(bytes + length++) = tag;
|
||||
*(uint8_t*)(bytes + length++) = tag;
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
if ((length % gsu32Align) != 0)
|
||||
if ((length % __alignof__(uint32_t)) != 0)
|
||||
{
|
||||
x = GSSwapHostI32ToBig(x);
|
||||
memcpy((bytes + length), &x, 4);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
*(gsu32*)(bytes + length) = GSSwapHostI32ToBig(x);
|
||||
*(uint32_t*)(bytes + length) = GSSwapHostI32ToBig(x);
|
||||
length += 4;
|
||||
}
|
||||
}
|
||||
|
@ -3758,7 +3749,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
size, GSLastErrorStr(errno)];
|
||||
}
|
||||
tmp = shmat(newid, 0, 0);
|
||||
if ((int)tmp == -1) /* Attached memory? */
|
||||
if ((intptr_t)tmp == -1) /* Attached memory? */
|
||||
{
|
||||
[NSException raise: NSMallocException
|
||||
format: @"Unable to attach to shared memory segment."];
|
||||
|
|
|
@ -837,7 +837,7 @@ compareIt(id o1, id o2, void* context)
|
|||
struct foo *f = (struct foo*)context;
|
||||
o1 = (*f->i)(f->d, @selector(objectForKey:), o1);
|
||||
o2 = (*f->i)(f->d, @selector(objectForKey:), o2);
|
||||
return (int)[o1 performSelector: f->s withObject: o2];
|
||||
return (int)(intptr_t)[o1 performSelector: f->s withObject: o2];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -163,7 +163,7 @@ enum proxyLocation
|
|||
|
||||
+ (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
gsu8 proxy_tag;
|
||||
uint8_t proxy_tag;
|
||||
unsigned target;
|
||||
id decoder_connection;
|
||||
NSDistantObject *o;
|
||||
|
@ -198,7 +198,7 @@ enum proxyLocation
|
|||
|
||||
if (debug_proxy)
|
||||
NSLog(@"Receiving a proxy for local object 0x%x "
|
||||
@"connection 0x%x\n", target, (gsaddr)decoder_connection);
|
||||
@"connection 0x%x\n", target, (uintptr_t)decoder_connection);
|
||||
|
||||
o = [decoder_connection locateLocalTarget: target];
|
||||
if (o == nil)
|
||||
|
@ -212,7 +212,7 @@ enum proxyLocation
|
|||
if (debug_proxy)
|
||||
{
|
||||
NSLog(@"Local object is 0x%x (0x%x)\n",
|
||||
(gsaddr)o, (gsaddr)o ? ((NSDO*)o)->_object : 0);
|
||||
(uintptr_t)o, (uintptr_t)o ? ((NSDO*)o)->_object : 0);
|
||||
}
|
||||
return RETAIN(((NSDO*)o)->_object);
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ enum proxyLocation
|
|||
at: &target];
|
||||
if (debug_proxy)
|
||||
NSLog(@"Receiving a proxy, was local 0x%x connection 0x%x\n",
|
||||
target, (gsaddr)decoder_connection);
|
||||
target, (uintptr_t)decoder_connection);
|
||||
o = [self initWithTarget: target
|
||||
connection: decoder_connection];
|
||||
return o;
|
||||
|
@ -296,7 +296,7 @@ enum proxyLocation
|
|||
|
||||
if (debug_proxy)
|
||||
NSLog(@"Receiving a triangle-connection proxy 0x%x "
|
||||
@"connection 0x%x\n", target, (gsaddr)proxy_connection);
|
||||
@"connection 0x%x\n", target, (uintptr_t)proxy_connection);
|
||||
|
||||
NSAssert(proxy_connection != decoder_connection,
|
||||
NSInternalInconsistencyException);
|
||||
|
@ -444,7 +444,7 @@ enum proxyLocation
|
|||
- (void) encodeWithCoder: (NSCoder*)aRmc
|
||||
{
|
||||
unsigned proxy_target;
|
||||
gsu8 proxy_tag;
|
||||
uint8_t proxy_tag;
|
||||
NSConnection *encoder_connection;
|
||||
|
||||
/*
|
||||
|
@ -478,7 +478,7 @@ enum proxyLocation
|
|||
|
||||
if (debug_proxy)
|
||||
NSLog(@"Sending a proxy, will be remote 0x%x connection 0x%x\n",
|
||||
proxy_target, (gsaddr)_connection);
|
||||
proxy_target, (uintptr_t)_connection);
|
||||
|
||||
[aRmc encodeValueOfObjCType: @encode(typeof(proxy_tag))
|
||||
at: &proxy_tag];
|
||||
|
@ -499,7 +499,7 @@ enum proxyLocation
|
|||
|
||||
if (debug_proxy)
|
||||
NSLog(@"Sending a proxy, will be local 0x%x connection 0x%x\n",
|
||||
proxy_target, (gsaddr)_connection);
|
||||
proxy_target, (uintptr_t)_connection);
|
||||
|
||||
[aRmc encodeValueOfObjCType: @encode(typeof(proxy_tag))
|
||||
at: &proxy_tag];
|
||||
|
@ -537,8 +537,8 @@ enum proxyLocation
|
|||
if (debug_proxy)
|
||||
NSLog(@"Sending triangle-connection proxy 0x%x "
|
||||
@"proxy-conn 0x%x to-proxy 0x%x to-conn 0x%x\n",
|
||||
localProxy->_handle, (gsaddr)localProxy->_connection,
|
||||
proxy_target, (gsaddr)_connection);
|
||||
localProxy->_handle, (uintptr_t)localProxy->_connection,
|
||||
proxy_target, (uintptr_t)_connection);
|
||||
|
||||
/*
|
||||
* It's remote here, so we need to tell other side where to form
|
||||
|
@ -603,7 +603,7 @@ enum proxyLocation
|
|||
|
||||
if (debug_proxy)
|
||||
NSLog(@"Created new local=0x%x object 0x%x target 0x%x connection 0x%x\n",
|
||||
(gsaddr)self, (gsaddr)_object, _handle, (gsaddr)_connection);
|
||||
(uintptr_t)self, (uintptr_t)_object, _handle, (uintptr_t)_connection);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -629,7 +629,7 @@ enum proxyLocation
|
|||
|
||||
if (debug_proxy)
|
||||
NSLog(@"Created new proxy=0x%x target 0x%x connection 0x%x\n",
|
||||
(gsaddr)self, _handle, (gsaddr)_connection);
|
||||
(uintptr_t)self, _handle, (uintptr_t)_connection);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ enum proxyLocation
|
|||
* (implemented in NSObject.m) to examine the protocol contents
|
||||
* without sending any ObjectiveC message to it.
|
||||
*/
|
||||
if ((int)GSObjCClass(_protocol) == 0x2)
|
||||
if ((uintptr_t)GSObjCClass(_protocol) == 0x2)
|
||||
{
|
||||
extern struct objc_method_description*
|
||||
GSDescriptionForInstanceMethod();
|
||||
|
@ -711,7 +711,7 @@ enum proxyLocation
|
|||
}
|
||||
if (mth == 0)
|
||||
{
|
||||
if ((int)GSObjCClass(_protocol) == 0x2)
|
||||
if ((uintptr_t)GSObjCClass(_protocol) == 0x2)
|
||||
{
|
||||
extern struct objc_method_description*
|
||||
GSDescriptionForClassMethod();
|
||||
|
@ -824,7 +824,7 @@ enum proxyLocation
|
|||
{
|
||||
if (debug_proxy > 3)
|
||||
NSLog(@"retain count for connection (0x%x) is now %u\n",
|
||||
(gsaddr)_connection, [_connection retainCount]);
|
||||
(uintptr_t)_connection, [_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
|
||||
|
|
|
@ -786,7 +786,7 @@ static NSDictionary *makeReference(unsigned ref)
|
|||
_obj = [NSMutableArray new]; // Array of objects.
|
||||
[_obj addObject: @"$null"]; // Placeholder.
|
||||
|
||||
_format = NSPropertyListXMLFormat_v1_0; // FIXME ... should be binary.
|
||||
_format = NSPropertyListBinaryFormat_v1_0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -766,6 +766,13 @@ static NSMapTable globalClassMap = 0;
|
|||
errorDescription: &error];
|
||||
if (_archive == nil)
|
||||
{
|
||||
#ifndef HAVE_LIBXML
|
||||
if (format == NSPropertyListXMLFormat_v1_0)
|
||||
{
|
||||
NSLog(@"Unable to parse XML archive as the base "
|
||||
@"library was not configured with libxml2 support.");
|
||||
}
|
||||
#endif
|
||||
DESTROY(self);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
/*
|
||||
* Largest chunk of data possible in DO
|
||||
*/
|
||||
static gsu32 maxDataLength = 32 * 1024 * 1024;
|
||||
static uint32_t maxDataLength = 32 * 1024 * 1024;
|
||||
|
||||
#if 0
|
||||
#define M_LOCK(X) {NSDebugMLLog(@"NSMessagePort",@"lock %@",X); [X lock];}
|
||||
|
@ -121,8 +121,8 @@ typedef enum {
|
|||
* Its contents are transmitted in network byte order.
|
||||
*/
|
||||
typedef struct {
|
||||
gsu32 type; /* A GSPortItemType as a 4-byte number. */
|
||||
gsu32 length; /* The length of the item (excluding header). */
|
||||
uint32_t type; /* A GSPortItemType as a 4-byte number. */
|
||||
uint32_t length; /* The length of the item (excluding header). */
|
||||
} GSPortItemHeader;
|
||||
|
||||
/*
|
||||
|
@ -132,8 +132,8 @@ typedef struct {
|
|||
* NB. additional data counts as part of the same item.
|
||||
*/
|
||||
typedef struct {
|
||||
gsu32 mId; /* The ID for the message starting with this. */
|
||||
gsu32 nItems; /* Number of items (including this one). */
|
||||
uint32_t mId; /* The ID for the message starting with this. */
|
||||
uint32_t nItems; /* Number of items (including this one). */
|
||||
} GSPortMsgHeader;
|
||||
|
||||
typedef struct {
|
||||
|
@ -237,11 +237,11 @@ typedef enum {
|
|||
unsigned wLength; /* Ammount written so far. */
|
||||
NSMutableArray *wMsgs; /* Message in progress. */
|
||||
NSMutableData *rData; /* Buffer for incoming data */
|
||||
gsu32 rLength; /* Amount read so far. */
|
||||
gsu32 rWant; /* Amount desired. */
|
||||
uint32_t rLength; /* Amount read so far. */
|
||||
uint32_t rWant; /* Amount desired. */
|
||||
NSMutableArray *rItems; /* Message in progress. */
|
||||
GSPortItemType rType; /* Type of data being read. */
|
||||
gsu32 rId; /* Id of incoming message. */
|
||||
uint32_t rId; /* Id of incoming message. */
|
||||
unsigned nItems; /* Number of items to be read. */
|
||||
GSHandleState state; /* State of the handle. */
|
||||
unsigned int addrNum; /* Address number within host. */
|
||||
|
@ -392,19 +392,19 @@ static Class runLoopClass;
|
|||
|
||||
state = GS_H_TRYCON;
|
||||
l = [NSRunLoop currentRunLoop];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
watcher: self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
watcher: self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
|
@ -415,19 +415,19 @@ static Class runLoopClass;
|
|||
[l runMode: NSConnectionReplyMode beforeDate: when];
|
||||
}
|
||||
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
|
@ -499,15 +499,15 @@ static Class runLoopClass;
|
|||
|
||||
valid = NO;
|
||||
l = [runLoopClass currentRunLoop];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_RDESC
|
||||
forMode: nil
|
||||
all: YES];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
forMode: nil
|
||||
all: YES];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
forMode: nil
|
||||
all: YES];
|
||||
|
@ -1023,19 +1023,19 @@ static Class runLoopClass;
|
|||
|
||||
RETAIN(self);
|
||||
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
watcher: self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
watcher: self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
|
@ -1049,19 +1049,19 @@ static Class runLoopClass;
|
|||
M_LOCK(myLock);
|
||||
}
|
||||
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
|
@ -1164,17 +1164,10 @@ typedef struct {
|
|||
#define lDesc ((internal*)_internal)->_listener
|
||||
|
||||
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
static unsigned wordAlign;
|
||||
#endif
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSMessagePort class])
|
||||
{
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
wordAlign = objc_alignof_type(@encode(gsu32));
|
||||
#endif
|
||||
messagePortClass = self;
|
||||
messagePortMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
|
@ -1372,7 +1365,7 @@ static unsigned wordAlign;
|
|||
{
|
||||
handle->recvPort = GS_GC_HIDE(self);
|
||||
}
|
||||
NSMapInsert(handles, (void*)(gsaddr)[handle descriptor], (void*)handle);
|
||||
NSMapInsert(handles, (void*)(uintptr_t)[handle descriptor], (void*)handle);
|
||||
M_UNLOCK(myLock);
|
||||
}
|
||||
|
||||
|
@ -1445,7 +1438,7 @@ static unsigned wordAlign;
|
|||
{
|
||||
if (handle->recvPort == recvSelf)
|
||||
{
|
||||
fds[(*count)++] = (int)sock;
|
||||
fds[(*count)++] = (int)(intptr_t)sock;
|
||||
}
|
||||
}
|
||||
NSEndMapTableEnumeration(&me);
|
||||
|
@ -1651,7 +1644,7 @@ static unsigned wordAlign;
|
|||
extra: (void*)extra
|
||||
forMode: (NSString*)mode
|
||||
{
|
||||
int desc = (int)(gsaddr)extra;
|
||||
int desc = (int)(uintptr_t)extra;
|
||||
GSMessageHandle *handle;
|
||||
|
||||
if (desc == lDesc)
|
||||
|
@ -1686,7 +1679,7 @@ static unsigned wordAlign;
|
|||
else
|
||||
{
|
||||
M_LOCK(myLock);
|
||||
handle = (GSMessageHandle*)NSMapGet(handles, (void*)(gsaddr)desc);
|
||||
handle = (GSMessageHandle*)NSMapGet(handles, (void*)(uintptr_t)desc);
|
||||
IF_NO_GC(AUTORELEASE(RETAIN(handle)));
|
||||
M_UNLOCK(myLock);
|
||||
if (handle == nil)
|
||||
|
@ -1733,7 +1726,7 @@ static unsigned wordAlign;
|
|||
{
|
||||
handle->recvPort = nil;
|
||||
}
|
||||
NSMapRemove(handles, (void*)(gsaddr)[handle descriptor]);
|
||||
NSMapRemove(handles, (void*)(uintptr_t)[handle descriptor]);
|
||||
if (lDesc < 0 && NSCountMapTable(handles) == 0)
|
||||
{
|
||||
[self invalidate];
|
||||
|
@ -1862,7 +1855,7 @@ static unsigned wordAlign;
|
|||
* word boundary, so we work with an aligned buffer
|
||||
* and use memcmpy()
|
||||
*/
|
||||
if ((hLength % wordAlign) != 0)
|
||||
if ((hLength % __alignof__(uint32_t)) != 0)
|
||||
{
|
||||
GSPortItemHeader itemHeader;
|
||||
|
||||
|
|
|
@ -152,9 +152,9 @@ static inline unsigned doHash(NSString* key)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
else if (((gsaddr)key) & 1)
|
||||
else if (((uintptr_t)key) & 1)
|
||||
{
|
||||
return (unsigned)(gsaddr)key;
|
||||
return (unsigned)(uintptr_t)key;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ static inline BOOL doEqual(NSString* key1, NSString* key2)
|
|||
{
|
||||
return YES;
|
||||
}
|
||||
else if ((((gsaddr)key1) & 1) || key1 == nil)
|
||||
else if ((((uintptr_t)key1) & 1) || key1 == nil)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ static void obsFree(Observation *o);
|
|||
#include "GNUstepBase/GSIArray.h"
|
||||
|
||||
#define GSI_MAP_RETAIN_KEY(M, X)
|
||||
#define GSI_MAP_RELEASE_KEY(M, X) ({if ((((gsaddr)X.obj) & 1) == 0) \
|
||||
#define GSI_MAP_RELEASE_KEY(M, X) ({if ((((uintptr_t)X.obj) & 1) == 0) \
|
||||
RELEASE(X.obj);})
|
||||
#define GSI_MAP_HASH(M, X) doHash(X.obj)
|
||||
#define GSI_MAP_EQUAL(M, X,Y) doEqual(X.obj, Y.obj)
|
||||
|
@ -535,7 +535,7 @@ purgeMapNode(GSIMapTable map, GSIMapNode node, id observer)
|
|||
* should be treated as objects (notification names) and thise that
|
||||
* should be treated as pointers (notification objects)
|
||||
*/
|
||||
#define CHEATGC(X) (id)(((gsaddr)X) | 1)
|
||||
#define CHEATGC(X) (id)(((uintptr_t)X) | 1)
|
||||
|
||||
|
||||
|
||||
|
@ -641,6 +641,11 @@ static NSNotificationCenter *default_center = nil;
|
|||
* <p>The notification center does not retain observer or object. Therefore,
|
||||
* you should always send removeObserver: or removeObserver:name:object: to
|
||||
* the notification center before releasing these objects.</p>
|
||||
*
|
||||
* <p>NB. For MacOS-X compatibility, adding an observer multiple times will
|
||||
* register it to receive multiple copies of any matching notification, however
|
||||
* removing an observer will remove <em>all</em> of the multiple registrations.
|
||||
* </p>
|
||||
*/
|
||||
- (void) addObserver: (id)observer
|
||||
selector: (SEL)selector
|
||||
|
@ -687,7 +692,7 @@ static NSNotificationCenter *default_center = nil;
|
|||
/*
|
||||
* Record the Observation in one of the linked lists.
|
||||
*
|
||||
* NB. It is possible to register an observr for a notification more than
|
||||
* NB. It is possible to register an observer for a notification more than
|
||||
* once - in which case, the observer will receive multiple messages when
|
||||
* the notification is posted... odd, but the MacOS-X docs specify this.
|
||||
*/
|
||||
|
|
|
@ -1660,7 +1660,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
* In the absence of detailed information, pick a reasonable value
|
||||
* assuming the object will be aligned to an eight byte boundary.
|
||||
*/
|
||||
return (unsigned)self >> 3;
|
||||
return (unsigned)(uintptr_t)self >> 3;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -83,8 +83,8 @@
|
|||
#include <stdio.h>
|
||||
|
||||
/* The global configuration file. The real value is read from config.h */
|
||||
#ifndef GNUSTEP_CONFIG_FILE
|
||||
# define GNUSTEP_CONFIG_FILE /etc/GNUstep/GNUstep.conf
|
||||
#ifndef GNUSTEP_TARGET_CONFIG_FILE
|
||||
# define GNUSTEP_TARGET_CONFIG_FILE "/etc/GNUstep/GNUstep.conf"
|
||||
#endif
|
||||
|
||||
static NSString *gnustep_target_cpu =
|
||||
|
@ -390,8 +390,7 @@ GNUstepConfig(NSDictionary *newConfig)
|
|||
if (file == nil)
|
||||
{
|
||||
fromEnvironment = NO;
|
||||
file = [NSString stringWithCString:
|
||||
STRINGIFY(GNUSTEP_CONFIG_FILE)];
|
||||
file = @GNUSTEP_TARGET_CONFIG_FILE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -475,11 +474,8 @@ GNUstepConfig(NSDictionary *newConfig)
|
|||
*/
|
||||
if ([conf objectForKey: @"GNUSTEP_USER_CONFIG_FILE"] == nil)
|
||||
{
|
||||
NSString *tmp;
|
||||
|
||||
tmp = [NSString stringWithCString:\
|
||||
STRINGIFY(GNUSTEP_USER_CONFIG_FILE)];
|
||||
[conf setObject: tmp forKey: @"GNUSTEP_USER_CONFIG_FILE"];
|
||||
[conf setObject: @GNUSTEP_TARGET_USER_CONFIG_FILE
|
||||
forKey: @"GNUSTEP_USER_CONFIG_FILE"];
|
||||
}
|
||||
if (config != nil)
|
||||
{
|
||||
|
@ -747,6 +743,11 @@ ParseConfigurationFile(NSString *fileName, NSMutableDictionary *dict)
|
|||
wantKey = YES;
|
||||
}
|
||||
|
||||
if (spos >= end)
|
||||
{
|
||||
break; // At end of file ... odd but not fatal
|
||||
}
|
||||
|
||||
if (*spos == '=')
|
||||
{
|
||||
if (wantKey == NO)
|
||||
|
|
|
@ -521,9 +521,9 @@ static IMP _xRefImp; /* Serialize a crossref. */
|
|||
gsu128 bigval;
|
||||
#else
|
||||
#if GS_HAVE_I64
|
||||
gsu64 bigval;
|
||||
uint64_t bigval;
|
||||
#else
|
||||
gsu32 bigval;
|
||||
uint32_t bigval;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -949,27 +949,27 @@ static IMP _xRefImp; /* Serialize a crossref. */
|
|||
{
|
||||
case _GSC_I16: /* Encoded as 16-bit */
|
||||
{
|
||||
gsu16 val;
|
||||
uint16_t val;
|
||||
|
||||
(*_dDesImp)(_src, dDesSel, &val, @encode(gsu16), &_cursor, nil);
|
||||
(*_dDesImp)(_src, dDesSel, &val, @encode(uint16_t), &_cursor, nil);
|
||||
bigval = val;
|
||||
break;
|
||||
}
|
||||
|
||||
case _GSC_I32: /* Encoded as 32-bit */
|
||||
{
|
||||
gsu32 val;
|
||||
uint32_t val;
|
||||
|
||||
(*_dDesImp)(_src, dDesSel, &val, @encode(gsu32), &_cursor, nil);
|
||||
(*_dDesImp)(_src, dDesSel, &val, @encode(uint32_t), &_cursor, nil);
|
||||
bigval = val;
|
||||
break;
|
||||
}
|
||||
|
||||
case _GSC_I64: /* Encoded as 64-bit */
|
||||
{
|
||||
gsu64 val;
|
||||
uint64_t val;
|
||||
|
||||
(*_dDesImp)(_src, dDesSel, &val, @encode(gsu64), &_cursor, nil);
|
||||
(*_dDesImp)(_src, dDesSel, &val, @encode(uint64_t), &_cursor, nil);
|
||||
#if GS_HAVE_I64
|
||||
bigval = val;
|
||||
#else
|
||||
|
@ -988,9 +988,9 @@ static IMP _xRefImp; /* Serialize a crossref. */
|
|||
#else
|
||||
val = GSSwapBigI128ToHost(val);
|
||||
#if GS_HAVE_I64
|
||||
bigval = *(gsu64*)&val;
|
||||
bigval = *(uint64_t*)&val;
|
||||
#else
|
||||
bigval = *(gsu32*)&val;
|
||||
bigval = *(uint32_t*)&val;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
|
|
@ -186,6 +186,8 @@ static NSMutableDictionary *_gnu_environment = nil;
|
|||
// Array of debug levels set.
|
||||
static NSMutableSet *_debug_set = nil;
|
||||
|
||||
// Flag to indicate that fallbackInitialisation was executed.
|
||||
static BOOL fallbackInitialisation = NO;
|
||||
/*************************************************************************
|
||||
*** Implementing the gnustep_base_user_main function
|
||||
*************************************************************************/
|
||||
|
@ -1058,7 +1060,6 @@ int main(int argc, char *argv[], char *env[])
|
|||
@implementation NSProcessInfo (GNUstep)
|
||||
|
||||
static BOOL debugTemporarilyDisabled = NO;
|
||||
static BOOL fallbackInitialisation = NO;
|
||||
|
||||
/**
|
||||
* Fallback method. The developer must call this method to initialize
|
||||
|
|
|
@ -2483,7 +2483,8 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
[plData getBytes: postfix range: NSMakeRange(length-32, 32)];
|
||||
offset_size = postfix[6];
|
||||
index_size = postfix[7];
|
||||
table_start = (postfix[28] << 24) + (postfix[29] << 16) + (postfix[30] << 8) + postfix[31];
|
||||
table_start = (postfix[28] << 24) + (postfix[29] << 16)
|
||||
+ (postfix[30] << 8) + postfix[31];
|
||||
if (offset_size < 1 || offset_size > 4)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
|
@ -2492,9 +2493,11 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
}
|
||||
else if (index_size < 1 || index_size > 4)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Unknown table size %d", index_size];
|
||||
unsigned saved = offset_size;
|
||||
|
||||
DESTROY(self); // Bad format
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Unknown table size %d", saved];
|
||||
}
|
||||
else if (table_start > length - 32)
|
||||
{
|
||||
|
@ -2541,8 +2544,10 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
unsigned char buffer[offset_size];
|
||||
int i;
|
||||
unsigned long num = 0;
|
||||
NSRange r;
|
||||
|
||||
[data getBytes: &buffer range: NSMakeRange(table_start + offset_size*index, offset_size)];
|
||||
r = NSMakeRange(table_start + offset_size*index, offset_size);
|
||||
[data getBytes: &buffer range: r];
|
||||
for (i = 0; i < offset_size; i++)
|
||||
{
|
||||
num = (num << 8) + buffer[i];
|
||||
|
@ -2998,27 +3003,32 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
|
||||
@implementation BinaryPLGenerator
|
||||
|
||||
+ (void) serializePropertyList: (id)aPropertyList intoData: (NSMutableData *)destination
|
||||
+ (void) serializePropertyList: (id)aPropertyList
|
||||
intoData: (NSMutableData *)destination
|
||||
{
|
||||
BinaryPLGenerator *gen;
|
||||
|
||||
gen = [[BinaryPLGenerator alloc] initWithPropertyList: aPropertyList intoData: destination];
|
||||
gen = [[BinaryPLGenerator alloc]
|
||||
initWithPropertyList: aPropertyList intoData: destination];
|
||||
[gen generate];
|
||||
RELEASE(gen);
|
||||
}
|
||||
|
||||
- (id) initWithPropertyList: (id) aPropertyList intoData: (NSMutableData *)destination
|
||||
- (id) initWithPropertyList: (id) aPropertyList
|
||||
intoData: (NSMutableData *)destination
|
||||
{
|
||||
ASSIGN(root, aPropertyList);
|
||||
ASSIGN(dest, destination);
|
||||
[dest setLength: 0];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(root);
|
||||
DESTROY(root);
|
||||
[self cleanup];
|
||||
DESTROY(dest);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -3029,6 +3039,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
|
||||
- (void) setup
|
||||
{
|
||||
[dest setLength: 0];
|
||||
if (index_size == 1)
|
||||
{
|
||||
table_size = 256;
|
||||
|
@ -3048,8 +3059,6 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
|
||||
table = malloc(table_size * sizeof(int));
|
||||
|
||||
// Always restart the destination data
|
||||
[dest setLength: 0];
|
||||
objectsToDoList = [[NSMutableArray alloc] init];
|
||||
objectList = [[NSMutableArray alloc] init];
|
||||
|
||||
|
@ -3059,7 +3068,6 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
|
||||
- (void) cleanup
|
||||
{
|
||||
DESTROY(dest);
|
||||
DESTROY(objectsToDoList);
|
||||
DESTROY(objectList);
|
||||
if (table != NULL)
|
||||
|
@ -3112,7 +3120,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
unsigned int last_offset;
|
||||
|
||||
table_start = [dest length];
|
||||
// This is a bit to much, as the length
|
||||
// This is a bit too much, as the length
|
||||
// of the last object is added.
|
||||
last_offset = table_start;
|
||||
|
||||
|
@ -3135,7 +3143,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
else
|
||||
{
|
||||
[NSException raise: NSRangeException
|
||||
format: @"Object table offset out of bounds %d.", last_offset];
|
||||
format: @"Object table offset out of bounds %d.", last_offset];
|
||||
}
|
||||
|
||||
len = [objectList count];
|
||||
|
@ -3270,7 +3278,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
{
|
||||
unsigned char code;
|
||||
|
||||
if (count <= 256)
|
||||
if (count < 256)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
|
@ -3279,7 +3287,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
c = count;
|
||||
[dest appendBytes: &c length: 1];
|
||||
}
|
||||
else
|
||||
else if (count < 256 * 256)
|
||||
{
|
||||
unsigned short c;
|
||||
|
||||
|
@ -3289,6 +3297,13 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
NSSwapHostShortToBig(c);
|
||||
[dest appendBytes: &c length: 2];
|
||||
}
|
||||
else
|
||||
{
|
||||
code = 0x13;
|
||||
[dest appendBytes: &code length: 1];
|
||||
count = NSSwapHostIntToBig(count);
|
||||
[dest appendBytes: &count length: 4];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) storeData: (NSData*) data
|
||||
|
@ -3342,12 +3357,12 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
[dest appendBytes: [string cString] length: len];
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
code = 0x5F;
|
||||
[dest appendBytes: &code length: 1];
|
||||
[self storeCount: len];
|
||||
[dest appendBytes: [string cString] length: len];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3380,7 +3395,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
}
|
||||
[dest appendBytes: buffer length: sizeof(unichar)*len];
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3477,7 +3492,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
}
|
||||
default:
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Attempt to store number with unknown ObjC type"];
|
||||
format: @"Attempt to store number with unknown ObjC type"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3632,7 +3647,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Unknown object class %@", object);
|
||||
NSLog(@"Unknown object class %@", object);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
*/
|
||||
if (GSObjCIsInstance(_myTarget))
|
||||
{
|
||||
if ((int)GSObjCClass(_myProtocol) == 0x2)
|
||||
if ((uintptr_t)GSObjCClass(_myProtocol) == 0x2)
|
||||
{
|
||||
mth = GSDescriptionForInstanceMethod(_myProtocol, aSelector);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((int)GSObjCClass(_myProtocol) == 0x2)
|
||||
if ((uintptr_t)GSObjCClass(_myProtocol) == 0x2)
|
||||
{
|
||||
mth = GSDescriptionForClassMethod(_myProtocol, aSelector);
|
||||
}
|
||||
|
|
|
@ -312,7 +312,7 @@ extern BOOL __objc_responds_to(id, SEL);
|
|||
* In the absence of detailed information, pick a reasonable value
|
||||
* assuming the object will be aligned to an eight byte boundary.
|
||||
*/
|
||||
return ((unsigned)self)>>3;
|
||||
return ((unsigned)(uintptr_t)self)>>3;
|
||||
}
|
||||
|
||||
/** <init /> <override-subclass />
|
||||
|
|
|
@ -128,10 +128,6 @@ static Class MStringClass = 0;
|
|||
static Class StringClass = 0;
|
||||
static Class NumberClass = 0;
|
||||
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
static unsigned gsu32Align;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
@defs(GSString)
|
||||
} *ivars;
|
||||
|
@ -260,7 +256,7 @@ serializeToInfo(id object, _NSSerializerInfo* info)
|
|||
* word boundary, so we work with an aligned buffer
|
||||
* and use memcmpy()
|
||||
*/
|
||||
if ((dlen % gsu32Align) != 0)
|
||||
if ((dlen % __alignof__(uint32_t)) != 0)
|
||||
{
|
||||
unichar buffer[slen];
|
||||
[object getCharacters: buffer];
|
||||
|
@ -370,9 +366,6 @@ static BOOL shouldBeCompact = NO;
|
|||
{
|
||||
if (self == [NSSerializer class])
|
||||
{
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
gsu32Align = objc_alignof_type(@encode(gsu32));
|
||||
#endif
|
||||
appSel = @selector(appendBytes:length:);
|
||||
datSel = @selector(mutableBytes);
|
||||
lenSel = @selector(length);
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
/*
|
||||
* Largest chunk of data possible in DO
|
||||
*/
|
||||
static gsu32 maxDataLength = 32 * 1024 * 1024;
|
||||
static uint32_t maxDataLength = 32 * 1024 * 1024;
|
||||
|
||||
#if 0
|
||||
#define M_LOCK(X) {NSDebugMLLog(@"GSTcpHandleLock",@"lock %@ in %@",X,[NSThread currentThread]); [X lock];}
|
||||
|
@ -148,8 +148,8 @@ typedef enum {
|
|||
* Its contents are transmitted in network byte order.
|
||||
*/
|
||||
typedef struct {
|
||||
gsu32 type; /* A GSPortItemType as a 4-byte number. */
|
||||
gsu32 length; /* The length of the item (excluding header). */
|
||||
uint32_t type; /* A GSPortItemType as a 4-byte number. */
|
||||
uint32_t length; /* The length of the item (excluding header). */
|
||||
} GSPortItemHeader;
|
||||
|
||||
/*
|
||||
|
@ -159,12 +159,12 @@ typedef struct {
|
|||
* NB. additional data counts as part of the same item.
|
||||
*/
|
||||
typedef struct {
|
||||
gsu32 mId; /* The ID for the message starting with this. */
|
||||
gsu32 nItems; /* Number of items (including this one). */
|
||||
uint32_t mId; /* The ID for the message starting with this. */
|
||||
uint32_t nItems; /* Number of items (including this one). */
|
||||
} GSPortMsgHeader;
|
||||
|
||||
typedef struct {
|
||||
gsu16 num; /* TCP port num */
|
||||
uint16_t num; /* TCP port num */
|
||||
char addr[0]; /* host address */
|
||||
} GSPortInfo;
|
||||
|
||||
|
@ -193,11 +193,11 @@ typedef enum {
|
|||
unsigned wLength; /* Ammount written so far. */
|
||||
NSMutableArray *wMsgs; /* Message in progress. */
|
||||
NSMutableData *rData; /* Buffer for incoming data */
|
||||
gsu32 rLength; /* Amount read so far. */
|
||||
gsu32 rWant; /* Amount desired. */
|
||||
uint32_t rLength; /* Amount read so far. */
|
||||
uint32_t rWant; /* Amount desired. */
|
||||
NSMutableArray *rItems; /* Message in progress. */
|
||||
GSPortItemType rType; /* Type of data being read. */
|
||||
gsu32 rId; /* Id of incoming message. */
|
||||
uint32_t rId; /* Id of incoming message. */
|
||||
unsigned nItems; /* Number of items to be read. */
|
||||
GSHandleState state; /* State of the handle. */
|
||||
unsigned int addrNum; /* Address number within host. */
|
||||
|
@ -253,8 +253,8 @@ decodePort(NSData *data, NSString *defaultAddress)
|
|||
GSPortItemHeader *pih;
|
||||
GSPortInfo *pi;
|
||||
NSString *addr;
|
||||
gsu16 pnum;
|
||||
gsu32 length;
|
||||
uint16_t pnum;
|
||||
uint32_t length;
|
||||
NSHost *host;
|
||||
unichar c;
|
||||
|
||||
|
@ -306,7 +306,7 @@ newDataWithEncodedPort(NSSocketPort *port)
|
|||
NSMutableData *data;
|
||||
unsigned plen;
|
||||
NSString *addr;
|
||||
gsu16 pnum;
|
||||
uint16_t pnum;
|
||||
|
||||
pnum = [port portNumber];
|
||||
addr = [port address];
|
||||
|
@ -569,29 +569,29 @@ static Class runLoopClass;
|
|||
l = [NSRunLoop currentRunLoop];
|
||||
#if defined(__MINGW32__)
|
||||
NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!");
|
||||
[l addEvent: (void*)(gsaddr)event
|
||||
[l addEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
watcher: self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[l addEvent: (void*)(gsaddr)event
|
||||
[l addEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
inReplyMode = YES;
|
||||
#else
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
watcher: self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
watcher: self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
|
@ -606,29 +606,29 @@ static Class runLoopClass;
|
|||
}
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
[l removeEvent: (void*)(gsaddr)event
|
||||
[l removeEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)event
|
||||
[l removeEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
inReplyMode = NO;
|
||||
#else
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
|
@ -722,20 +722,20 @@ static Class runLoopClass;
|
|||
valid = NO;
|
||||
l = [runLoopClass currentRunLoop];
|
||||
#if defined(__MINGW32__)
|
||||
[l removeEvent: (void*)(gsaddr)event
|
||||
[l removeEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
forMode: nil
|
||||
all: YES];
|
||||
#else
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_RDESC
|
||||
forMode: nil
|
||||
all: YES];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
forMode: nil
|
||||
all: YES];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
forMode: nil
|
||||
all: YES];
|
||||
|
@ -1353,29 +1353,29 @@ static Class runLoopClass;
|
|||
|
||||
#if defined(__MINGW32__)
|
||||
NSAssert(event != WSA_INVALID_EVENT, @"Socket without win32 event!");
|
||||
[l addEvent: (void*)(gsaddr)event
|
||||
[l addEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
watcher: self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[l addEvent: (void*)(gsaddr)event
|
||||
[l addEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
inReplyMode = YES;
|
||||
#else
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
watcher: self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
watcher: self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[l addEvent: (void*)(gsaddr)desc
|
||||
[l addEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
|
@ -1402,29 +1402,29 @@ static Class runLoopClass;
|
|||
}
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
[l removeEvent: (void*)(gsaddr)event
|
||||
[l removeEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)event
|
||||
[l removeEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
inReplyMode = NO;
|
||||
#else
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_WDESC
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
[l removeEvent: (void*)(gsaddr)desc
|
||||
[l removeEvent: (void*)(uintptr_t)desc
|
||||
type: ET_EDESC
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
|
@ -1488,17 +1488,10 @@ static NSRecursiveLock *tcpPortLock = nil;
|
|||
static NSMapTable *tcpPortMap = 0;
|
||||
static Class tcpPortClass;
|
||||
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
static unsigned wordAlign;
|
||||
#endif
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSSocketPort class])
|
||||
{
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
wordAlign = objc_alignof_type(@encode(gsu32));
|
||||
#endif
|
||||
tcpPortClass = self;
|
||||
tcpPortMap = NSCreateMapTable(NSIntMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
|
@ -1518,7 +1511,7 @@ static unsigned wordAlign;
|
|||
/*
|
||||
* Look up an existing NSSocketPort given a host and number
|
||||
*/
|
||||
+ (NSSocketPort*) existingPortWithNumber: (gsu16)number
|
||||
+ (NSSocketPort*) existingPortWithNumber: (uint16_t)number
|
||||
onHost: (NSHost*)aHost
|
||||
{
|
||||
NSSocketPort *port = nil;
|
||||
|
@ -1529,7 +1522,7 @@ static unsigned wordAlign;
|
|||
/*
|
||||
* Get the map table of ports with the specified number.
|
||||
*/
|
||||
thePorts = (NSMapTable*)NSMapGet(tcpPortMap, (void*)(gsaddr)number);
|
||||
thePorts = (NSMapTable*)NSMapGet(tcpPortMap, (void*)(uintptr_t)number);
|
||||
if (thePorts != 0)
|
||||
{
|
||||
port = (NSSocketPort*)NSMapGet(thePorts, (void*)aHost);
|
||||
|
@ -1550,7 +1543,7 @@ static unsigned wordAlign;
|
|||
* then, for the local host, the port uses ALL IP addresses, and for a
|
||||
* remote host, the port will use the first address that works.
|
||||
*/
|
||||
+ (NSSocketPort*) portWithNumber: (gsu16)number
|
||||
+ (NSSocketPort*) portWithNumber: (uint16_t)number
|
||||
onHost: (NSHost*)aHost
|
||||
forceAddress: (NSString*)addr
|
||||
listener: (BOOL)shouldListen
|
||||
|
@ -1585,7 +1578,7 @@ static unsigned wordAlign;
|
|||
/*
|
||||
* First try to find a pre-existing port.
|
||||
*/
|
||||
thePorts = (NSMapTable*)NSMapGet(tcpPortMap, (void*)(gsaddr)number);
|
||||
thePorts = (NSMapTable*)NSMapGet(tcpPortMap, (void*)(uintptr_t)number);
|
||||
if (thePorts != 0)
|
||||
{
|
||||
port = (NSSocketPort*)NSMapGet(thePorts, (void*)aHost);
|
||||
|
@ -1719,7 +1712,7 @@ static unsigned wordAlign;
|
|||
* Make sure we have the map table for this port.
|
||||
*/
|
||||
thePorts = (NSMapTable*)NSMapGet(tcpPortMap,
|
||||
(void*)(gsaddr)port->portNum);
|
||||
(void*)(uintptr_t)port->portNum);
|
||||
if (thePorts == 0)
|
||||
{
|
||||
/*
|
||||
|
@ -1728,7 +1721,7 @@ static unsigned wordAlign;
|
|||
*/
|
||||
thePorts = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
NSMapInsert(tcpPortMap, (void*)(gsaddr)port->portNum,
|
||||
NSMapInsert(tcpPortMap, (void*)(uintptr_t)port->portNum,
|
||||
(void*)thePorts);
|
||||
}
|
||||
/*
|
||||
|
@ -1744,7 +1737,7 @@ static unsigned wordAlign;
|
|||
* Make sure we have the map table for this port.
|
||||
*/
|
||||
port->portNum = number;
|
||||
thePorts = (NSMapTable*)NSMapGet(tcpPortMap, (void*)(gsaddr)number);
|
||||
thePorts = (NSMapTable*)NSMapGet(tcpPortMap, (void*)(uintptr_t)number);
|
||||
if (thePorts == 0)
|
||||
{
|
||||
/*
|
||||
|
@ -1753,7 +1746,7 @@ static unsigned wordAlign;
|
|||
*/
|
||||
thePorts = NSCreateMapTable(NSIntMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
NSMapInsert(tcpPortMap, (void*)(gsaddr)number, (void*)thePorts);
|
||||
NSMapInsert(tcpPortMap, (void*)(uintptr_t)number, (void*)thePorts);
|
||||
}
|
||||
/*
|
||||
* Record the port by host.
|
||||
|
@ -1787,10 +1780,10 @@ static unsigned wordAlign;
|
|||
{
|
||||
handle->recvPort = GS_GC_HIDE(self);
|
||||
}
|
||||
NSMapInsert(handles, (void*)(gsaddr)[handle descriptor], (void*)handle);
|
||||
NSMapInsert(handles, (void*)(uintptr_t)[handle descriptor], (void*)handle);
|
||||
#if defined(__MINGW32__)
|
||||
NSMapInsert(events, (void*)(gsaddr)[handle eventHandle],
|
||||
(void*)(gsaddr)[handle descriptor]);
|
||||
NSMapInsert(events, (void*)(uintptr_t)[handle eventHandle],
|
||||
(void*)(uintptr_t)[handle descriptor]);
|
||||
#endif
|
||||
M_UNLOCK(myLock);
|
||||
}
|
||||
|
@ -1864,7 +1857,7 @@ static unsigned wordAlign;
|
|||
*count = 0;
|
||||
if (eventListener != WSA_INVALID_EVENT)
|
||||
{
|
||||
fds[(*count)++] = (gsaddr)eventListener;
|
||||
fds[(*count)++] = (uintptr_t)eventListener;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1875,10 +1868,10 @@ static unsigned wordAlign;
|
|||
me = NSEnumerateMapTable(events);
|
||||
while (NSNextMapEnumeratorPair(&me, &event, (void**)&fd))
|
||||
{
|
||||
handle = (GSTcpHandle*)NSMapGet(handles, (void*)(gsaddr)fd);
|
||||
handle = (GSTcpHandle*)NSMapGet(handles, (void*)(uintptr_t)fd);
|
||||
if (handle->recvPort == recvSelf && handle->inReplyMode == NO)
|
||||
{
|
||||
fds[(*count)++] = (gsaddr)event;
|
||||
fds[(*count)++] = (uintptr_t)event;
|
||||
}
|
||||
}
|
||||
NSEndMapTableEnumeration(&me);
|
||||
|
@ -1919,7 +1912,7 @@ static unsigned wordAlign;
|
|||
{
|
||||
if (handle->recvPort == recvSelf)
|
||||
{
|
||||
fds[(*count)++] = (SOCKET)sock;
|
||||
fds[(*count)++] = (int)(intptr_t)sock;
|
||||
}
|
||||
}
|
||||
NSEndMapTableEnumeration(&me);
|
||||
|
@ -2073,7 +2066,7 @@ static unsigned wordAlign;
|
|||
unsigned i;
|
||||
|
||||
M_LOCK(tcpPortLock);
|
||||
thePorts = NSMapGet(tcpPortMap, (void*)(gsaddr)portNum);
|
||||
thePorts = NSMapGet(tcpPortMap, (void*)(uintptr_t)portNum);
|
||||
if (thePorts != 0)
|
||||
{
|
||||
if (listener >= 0)
|
||||
|
@ -2141,7 +2134,7 @@ static unsigned wordAlign;
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (gsu16) portNumber
|
||||
- (uint16_t) portNumber
|
||||
{
|
||||
return portNum;
|
||||
}
|
||||
|
@ -2155,7 +2148,7 @@ static unsigned wordAlign;
|
|||
WSAEVENT event = (WSAEVENT)extra;
|
||||
SOCKET desc;
|
||||
#else
|
||||
SOCKET desc = (SOCKET)(gsaddr)extra;
|
||||
SOCKET desc = (SOCKET)(uintptr_t)extra;
|
||||
#endif
|
||||
GSTcpHandle *handle;
|
||||
|
||||
|
@ -2204,9 +2197,9 @@ static unsigned wordAlign;
|
|||
{
|
||||
M_LOCK(myLock);
|
||||
#if defined(__MINGW32__)
|
||||
desc = (SOCKET)NSMapGet(events, (void*)(gsaddr)event);
|
||||
desc = (SOCKET)NSMapGet(events, (void*)(uintptr_t)event);
|
||||
#endif
|
||||
handle = (GSTcpHandle*)NSMapGet(handles, (void*)(gsaddr)desc);
|
||||
handle = (GSTcpHandle*)NSMapGet(handles, (void*)(uintptr_t)desc);
|
||||
IF_NO_GC(AUTORELEASE(RETAIN(handle)));
|
||||
M_UNLOCK(myLock);
|
||||
if (handle == nil)
|
||||
|
@ -2262,9 +2255,9 @@ static unsigned wordAlign;
|
|||
{
|
||||
handle->recvPort = nil;
|
||||
}
|
||||
NSMapRemove(handles, (void*)(gsaddr)[handle descriptor]);
|
||||
NSMapRemove(handles, (void*)(uintptr_t)[handle descriptor]);
|
||||
#if defined(__MINGW32__)
|
||||
NSMapRemove(events, (void*)(gsaddr)[handle eventHandle]);
|
||||
NSMapRemove(events, (void*)(uintptr_t)[handle eventHandle]);
|
||||
#endif
|
||||
if (((int) listener) < 0 && NSCountMapTable(handles) == 0)
|
||||
{
|
||||
|
@ -2394,7 +2387,7 @@ static unsigned wordAlign;
|
|||
* word boundary, so we work with an aligned buffer
|
||||
* and use memcmpy()
|
||||
*/
|
||||
if ((hLength % wordAlign) != 0)
|
||||
if ((hLength % __alignof__(uint32_t)) != 0)
|
||||
{
|
||||
GSPortItemHeader itemHeader;
|
||||
|
||||
|
|
|
@ -63,11 +63,11 @@
|
|||
*/
|
||||
@class NSSocketPort;
|
||||
@interface NSSocketPort (Hack)
|
||||
+ (NSSocketPort*) portWithNumber: (gsu16)number
|
||||
+ (NSSocketPort*) portWithNumber: (uint16_t)number
|
||||
onHost: (NSHost*)host
|
||||
forceAddress: (NSString*)addr
|
||||
listener: (BOOL)shouldListen;
|
||||
- (gsu16) portNumber;
|
||||
- (uint16_t) portNumber;
|
||||
@end
|
||||
|
||||
/*
|
||||
|
@ -119,8 +119,9 @@ typedef enum {
|
|||
- (GSPortComState) state;
|
||||
- (void) startListNameServers;
|
||||
- (void) startPortLookup: (NSString*)name onHost: (NSString*)addr;
|
||||
- (void) startPortRegistration: (gsu32)portNumber withName: (NSString*)name;
|
||||
- (void) startPortUnregistration: (gsu32)portNumber withName: (NSString*)name;
|
||||
- (void) startPortRegistration: (uint32_t)portNumber withName: (NSString*)name;
|
||||
- (void) startPortUnregistration: (uint32_t)portNumber
|
||||
withName: (NSString*)name;
|
||||
@end
|
||||
|
||||
@implementation GSPortCom
|
||||
|
@ -259,7 +260,7 @@ typedef enum {
|
|||
}
|
||||
else if (state == GSPC_READ1 && msg.rtype == GDO_SERVERS)
|
||||
{
|
||||
gsu32 numSvrs = GSSwapBigI32ToHost(*(gsu32*)[data bytes]);
|
||||
uint32_t numSvrs = GSSwapBigI32ToHost(*(uint32_t*)[data bytes]);
|
||||
|
||||
if (numSvrs == 0)
|
||||
{
|
||||
|
@ -490,7 +491,7 @@ typedef enum {
|
|||
[self open: host];
|
||||
}
|
||||
|
||||
- (void) startPortRegistration: (gsu32)portNumber withName: (NSString*)name
|
||||
- (void) startPortRegistration: (uint32_t)portNumber withName: (NSString*)name
|
||||
{
|
||||
msg.rtype = GDO_REGISTER; /* Register a port. */
|
||||
msg.ptype = GDO_TCP_GDO; /* Port is TCP port for GNU DO */
|
||||
|
@ -503,7 +504,7 @@ typedef enum {
|
|||
[self open: nil];
|
||||
}
|
||||
|
||||
- (void) startPortUnregistration: (gsu32)portNumber withName: (NSString*)name
|
||||
- (void) startPortUnregistration: (uint32_t)portNumber withName: (NSString*)name
|
||||
{
|
||||
msg.rtype = GDO_UNREG;
|
||||
msg.ptype = GDO_TCP_GDO;
|
||||
|
@ -666,7 +667,7 @@ typedef enum {
|
|||
*/
|
||||
dat = AUTORELEASE(RETAIN([com data]));
|
||||
svrs = (struct in_addr*)([dat bytes] + 4);
|
||||
numSvrs = GSSwapBigI32ToHost(*(gsu32*)[dat bytes]);
|
||||
numSvrs = GSSwapBigI32ToHost(*(uint32_t*)[dat bytes]);
|
||||
if (numSvrs == 0)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
|
@ -759,7 +760,8 @@ typedef enum {
|
|||
[com close];
|
||||
if ([com state] == GSPC_DONE)
|
||||
{
|
||||
*port = GSSwapBigI32ToHost(*(gsu32*)[[com data] bytes]);
|
||||
*port
|
||||
= GSSwapBigI32ToHost(*(uint32_t*)[[com data] bytes]);
|
||||
if (*port != 0)
|
||||
{
|
||||
singleServer = [com addr];
|
||||
|
@ -953,7 +955,7 @@ typedef enum {
|
|||
{
|
||||
unsigned result;
|
||||
|
||||
result = GSSwapBigI32ToHost(*(gsu32*)[[com data] bytes]);
|
||||
result = GSSwapBigI32ToHost(*(uint32_t*)[[com data] bytes]);
|
||||
if (result == 0)
|
||||
{
|
||||
unsigned int portNum;
|
||||
|
@ -1091,7 +1093,7 @@ typedef enum {
|
|||
NSPort *port;
|
||||
unsigned result;
|
||||
|
||||
result = GSSwapBigI32ToHost(*(gsu32*)[[com data] bytes]);
|
||||
result = GSSwapBigI32ToHost(*(uint32_t*)[[com data] bytes]);
|
||||
if (result == 0)
|
||||
{
|
||||
NSLog(@"NSSocketPortNameServer unable to unregister '%@'", name);
|
||||
|
|
|
@ -219,6 +219,42 @@ pathSepMember(unichar c)
|
|||
return NO;
|
||||
}
|
||||
|
||||
inline static unichar
|
||||
pathSepChar()
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
if (GSPathHandlingUnix() == YES)
|
||||
{
|
||||
return '/';
|
||||
}
|
||||
return '\\';
|
||||
#else
|
||||
if (GSPathHandlingWindows() == YES)
|
||||
{
|
||||
return '\\';
|
||||
}
|
||||
return '/';
|
||||
#endif
|
||||
}
|
||||
|
||||
inline static NSString*
|
||||
pathSepString()
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
if (GSPathHandlingUnix() == YES)
|
||||
{
|
||||
return @"/";
|
||||
}
|
||||
return @"\\";
|
||||
#else
|
||||
if (GSPathHandlingWindows() == YES)
|
||||
{
|
||||
return @"\\";
|
||||
}
|
||||
return @"/";
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Find end of 'root' sequence in a string. Characters before this
|
||||
* point in the string cannot be split into path components/extensions.
|
||||
|
@ -336,7 +372,7 @@ static unsigned rootOf(NSString *s, unsigned l)
|
|||
|
||||
|
||||
/* Convert a high-low surrogate pair into Unicode scalar code-point */
|
||||
static inline gsu32
|
||||
static inline uint32_t
|
||||
surrogatePairValue(unichar high, unichar low)
|
||||
{
|
||||
return ((high - (unichar)0xD800) * (unichar)400)
|
||||
|
@ -3285,7 +3321,7 @@ handle_printf_atsign (FILE *stream,
|
|||
unsigned char *buff;
|
||||
unsigned i, j;
|
||||
unichar ch, ch2;
|
||||
gsu32 cp;
|
||||
uint32_t cp;
|
||||
|
||||
buff = (unsigned char *)NSZoneMalloc(NSDefaultMallocZone(), len*3);
|
||||
|
||||
|
@ -3311,10 +3347,10 @@ handle_printf_atsign (FILE *stream,
|
|||
i++;
|
||||
}
|
||||
else
|
||||
cp = (gsu32)ch;
|
||||
cp = (uint32_t)ch;
|
||||
}
|
||||
else
|
||||
cp = (gsu32)ch;
|
||||
cp = (uint32_t)ch;
|
||||
|
||||
if (cp < 0x80)
|
||||
{
|
||||
|
@ -3674,7 +3710,7 @@ static NSFileManager *fm = nil;
|
|||
{
|
||||
length--;
|
||||
}
|
||||
buf[length++] = '/';
|
||||
buf[length++] = pathSepChar();
|
||||
}
|
||||
|
||||
if ((aLength - root) > 0)
|
||||
|
@ -3704,12 +3740,12 @@ static NSFileManager *fm = nil;
|
|||
{
|
||||
if (pathSepMember(buf[aLength]) == YES)
|
||||
{
|
||||
buf[aLength] = '/'; // Standardise
|
||||
buf[aLength] = pathSepChar();
|
||||
if (pathSepMember(buf[aLength-1]) == YES)
|
||||
{
|
||||
unsigned pos;
|
||||
|
||||
buf[aLength-1] = '/'; // Standardise
|
||||
buf[aLength-1] = pathSepChar();
|
||||
for (pos = aLength+1; pos < length; pos++)
|
||||
{
|
||||
buf[pos-1] = buf[pos];
|
||||
|
@ -4347,7 +4383,26 @@ static NSFileManager *fm = nil;
|
|||
{
|
||||
s = AUTORELEASE([self mutableCopy]);
|
||||
}
|
||||
[s replaceString: @"\\" withString: @"/"];
|
||||
#if defined(__MINGW32__)
|
||||
if (GSPathHandlingUnix() == YES)
|
||||
{
|
||||
[s replaceString: @"\\" withString: @"/"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s replaceString: @"/" withString: @"\\"];
|
||||
}
|
||||
#else
|
||||
if (GSPathHandlingWindows() == YES)
|
||||
{
|
||||
[s replaceString: @"/" withString: @"\\"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[s replaceString: @"\\" withString: @"/"];
|
||||
}
|
||||
#endif
|
||||
|
||||
l = [s length];
|
||||
root = rootOf(s, l);
|
||||
|
||||
|
@ -4375,11 +4430,14 @@ static NSFileManager *fm = nil;
|
|||
}
|
||||
// Condense ('/./') sequences.
|
||||
r = (NSRange){root, l-root};
|
||||
while ((r = [s rangeOfString: @"/." options: 0 range: r]).length == 2)
|
||||
while ((r = [s rangeOfString: @"." options: 0 range: r]).length == 1)
|
||||
{
|
||||
if (NSMaxRange(r) == l ||
|
||||
pathSepMember((*caiImp)(s, caiSel, NSMaxRange(r))) == YES)
|
||||
if (r.location > 0
|
||||
&& pathSepMember((*caiImp)(s, caiSel, r.location-1)) == YES
|
||||
&& (NSMaxRange(r) == l
|
||||
|| pathSepMember((*caiImp)(s, caiSel, NSMaxRange(r))) == YES))
|
||||
{
|
||||
r.length++;
|
||||
[s deleteCharactersInRange: r];
|
||||
l -= r.length;
|
||||
}
|
||||
|
@ -4391,7 +4449,7 @@ static NSFileManager *fm = nil;
|
|||
}
|
||||
|
||||
// Strip trailing '/' if present.
|
||||
if (l > root && [s hasSuffix: @"/"])
|
||||
if (l > root && pathSepMember([s characterAtIndex: l - 1]) == YES)
|
||||
{
|
||||
r.length = 1;
|
||||
r.location = l - r.length;
|
||||
|
@ -4418,11 +4476,15 @@ static NSFileManager *fm = nil;
|
|||
#if defined(__MINGW32__)
|
||||
/* Condense `/../' */
|
||||
r = (NSRange){root, l-root};
|
||||
while ((r = [s rangeOfString: @"/.." options: 0 range: r]).length == 3)
|
||||
while ((r = [s rangeOfString: @".." options: 0 range: r]).length == 2)
|
||||
{
|
||||
if (NSMaxRange(r) == l ||
|
||||
pathSepMember((*caiImp)(s, caiSel, NSMaxRange(r))) == YES)
|
||||
if (r.location > 0
|
||||
&& pathSepMember((*caiImp)(s, caiSel, r.location-1)) == YES
|
||||
&& (NSMaxRange(r) == l
|
||||
|| pathSepMember((*caiImp)(s, caiSel, NSMaxRange(r))) == YES))
|
||||
{
|
||||
r.location--;
|
||||
r.length++;
|
||||
if (r.location > root)
|
||||
{
|
||||
NSRange r2 = {root, r.location-root};
|
||||
|
@ -4550,7 +4612,7 @@ static NSFileManager *fm = nil;
|
|||
s = [components objectAtIndex: 0];
|
||||
if ([s length] == 0)
|
||||
{
|
||||
s = @"/";
|
||||
s = pathSepString();
|
||||
}
|
||||
for (i = 1; i < c; i++)
|
||||
{
|
||||
|
@ -4579,7 +4641,7 @@ static NSFileManager *fm = nil;
|
|||
* Any string beginning with '/' is absolute ... except in windows mode
|
||||
* or on windows and not in unix mode.
|
||||
*/
|
||||
if (c == '/')
|
||||
if (c == pathSepChar())
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
if (GSPathHandlingUnix() == YES)
|
||||
|
@ -4662,7 +4724,7 @@ static NSFileManager *fm = nil;
|
|||
*/
|
||||
if (l > root && pathSepMember([s characterAtIndex: l-1]))
|
||||
{
|
||||
[a addObject: @"/"];
|
||||
[a addObject: pathSepString()];
|
||||
}
|
||||
|
||||
r = [a copy];
|
||||
|
|
|
@ -279,7 +279,7 @@ pty_slave(const char* name)
|
|||
- (void) gcFinalize
|
||||
{
|
||||
[tasksLock lock];
|
||||
NSMapRemove(activeTasks, (void*)_taskId);
|
||||
NSMapRemove(activeTasks, (void*)(intptr_t)_taskId);
|
||||
[tasksLock unlock];
|
||||
}
|
||||
|
||||
|
@ -890,7 +890,7 @@ pty_slave(const char* name)
|
|||
- (void) _terminatedChild: (int)status
|
||||
{
|
||||
[tasksLock lock];
|
||||
NSMapRemove(activeTasks, (void*)_taskId);
|
||||
NSMapRemove(activeTasks, (void*)(intptr_t)_taskId);
|
||||
[tasksLock unlock];
|
||||
_terminationStatus = status;
|
||||
_hasCollected = YES;
|
||||
|
@ -1260,7 +1260,7 @@ GSCheckTasks()
|
|||
NSTask *t;
|
||||
|
||||
[tasksLock lock];
|
||||
t = (NSTask*)NSMapGet(activeTasks, (void*)result);
|
||||
t = (NSTask*)NSMapGet(activeTasks, (void*)(intptr_t)result);
|
||||
[tasksLock unlock];
|
||||
if (t != nil)
|
||||
{
|
||||
|
@ -1491,7 +1491,7 @@ GSCheckTasks()
|
|||
ASSIGN(_launchPath, lpath); // Actual path used.
|
||||
|
||||
[tasksLock lock];
|
||||
NSMapInsert(activeTasks, (void*)_taskId, (void*)self);
|
||||
NSMapInsert(activeTasks, (void*)(intptr_t)_taskId, (void*)self);
|
||||
[tasksLock unlock];
|
||||
|
||||
/*
|
||||
|
|
|
@ -703,7 +703,10 @@ gnustep_base_thread_callback(void)
|
|||
DESTROY(_thread_dictionary);
|
||||
DESTROY(_target);
|
||||
DESTROY(_arg);
|
||||
[NSAutoreleasePool _endThread: self];
|
||||
if (_autorelease_vars.pool_cache != 0)
|
||||
{
|
||||
[NSAutoreleasePool _endThread: self];
|
||||
}
|
||||
|
||||
if (_thread_dictionary != nil)
|
||||
{
|
||||
|
@ -711,11 +714,17 @@ gnustep_base_thread_callback(void)
|
|||
* Try again to get rid of thread dictionary.
|
||||
*/
|
||||
DESTROY(_thread_dictionary);
|
||||
[NSAutoreleasePool _endThread: self];
|
||||
if (_autorelease_vars.pool_cache != 0)
|
||||
{
|
||||
[NSAutoreleasePool _endThread: self];
|
||||
}
|
||||
if (_thread_dictionary != nil)
|
||||
{
|
||||
NSLog(@"Oops - leak - thread dictionary is %@", _thread_dictionary);
|
||||
[NSAutoreleasePool _endThread: self];
|
||||
if (_autorelease_vars.pool_cache != 0)
|
||||
{
|
||||
[NSAutoreleasePool _endThread: self];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (self == defaultThread)
|
||||
|
@ -828,7 +837,7 @@ static NSDate *theFuture;
|
|||
}
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
[loop addEvent: (void*)inputFd
|
||||
[loop addEvent: (void*)(intptr_t)inputFd
|
||||
type: ET_RDESC
|
||||
watcher: (id<RunLoopEvents>)self
|
||||
forMode: [m objectAtIndex: i]];
|
||||
|
|
|
@ -176,7 +176,7 @@ struct ttinfo
|
|||
* And this is the structure used in the time zone instances.
|
||||
*/
|
||||
typedef struct {
|
||||
gss32 offset;
|
||||
int32_t offset;
|
||||
BOOL isdst;
|
||||
unsigned char abbr_idx;
|
||||
char pad[2];
|
||||
|
@ -190,7 +190,7 @@ typedef struct {
|
|||
NSData *timeZoneData;
|
||||
unsigned int n_trans;
|
||||
unsigned int n_types;
|
||||
gss32 *trans;
|
||||
int32_t *trans;
|
||||
TypeInfo *types;
|
||||
unsigned char *idxs;
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ static NSMapTable *absolutes = 0;
|
|||
{
|
||||
if (zone_mutex != nil)
|
||||
[zone_mutex lock];
|
||||
NSMapRemove(absolutes, (void*)(gsaddr)offset);
|
||||
NSMapRemove(absolutes, (void*)(uintptr_t)offset);
|
||||
if (zone_mutex != nil)
|
||||
[zone_mutex unlock];
|
||||
}
|
||||
|
@ -619,7 +619,7 @@ static NSMapTable *absolutes = 0;
|
|||
{
|
||||
[zone_mutex lock];
|
||||
}
|
||||
z = (GSAbsTimeZone*)NSMapGet(absolutes, (void*)(gsaddr)anOffset);
|
||||
z = (GSAbsTimeZone*)NSMapGet(absolutes, (void*)(uintptr_t)anOffset);
|
||||
if (z != nil)
|
||||
{
|
||||
IF_NO_GC(RETAIN(z));
|
||||
|
@ -650,7 +650,7 @@ static NSMapTable *absolutes = 0;
|
|||
detail = [[GSAbsTimeZoneDetail alloc] initWithTimeZone: self];
|
||||
offset = anOffset;
|
||||
z = self;
|
||||
NSMapInsert(absolutes, (void*)(gsaddr)anOffset, (void*)z);
|
||||
NSMapInsert(absolutes, (void*)(uintptr_t)anOffset, (void*)z);
|
||||
[zoneDictionary setObject: self forKey: (NSString*)name];
|
||||
}
|
||||
if (zone_mutex != nil)
|
||||
|
@ -2145,8 +2145,8 @@ int dayOfCommonEra(NSTimeInterval when);
|
|||
static TypeInfo*
|
||||
chop(NSTimeInterval since, GSTimeZone *zone)
|
||||
{
|
||||
gss32 when = (gss32)since;
|
||||
gss32 *trans = zone->trans;
|
||||
int32_t when = (int32_t)since;
|
||||
int32_t *trans = zone->trans;
|
||||
unsigned hi = zone->n_trans;
|
||||
unsigned lo = 0;
|
||||
unsigned int i;
|
||||
|
@ -2271,12 +2271,12 @@ newDetailInZoneForType(GSTimeZone *zone, TypeInfo *type)
|
|||
format: @"TZ_MAGIC is incorrect"];
|
||||
}
|
||||
#endif
|
||||
n_trans = GSSwapBigI32ToHost(*(gss32*)header->tzh_timecnt);
|
||||
n_types = GSSwapBigI32ToHost(*(gss32*)header->tzh_typecnt);
|
||||
charcnt = GSSwapBigI32ToHost(*(gss32*)header->tzh_charcnt);
|
||||
n_trans = GSSwapBigI32ToHost(*(int32_t*)header->tzh_timecnt);
|
||||
n_types = GSSwapBigI32ToHost(*(int32_t*)header->tzh_typecnt);
|
||||
charcnt = GSSwapBigI32ToHost(*(int32_t*)header->tzh_charcnt);
|
||||
|
||||
i = pos;
|
||||
i += sizeof(gss32)*n_trans;
|
||||
i += sizeof(int32_t)*n_trans;
|
||||
if (i > length)
|
||||
{
|
||||
[NSException raise: fileException
|
||||
|
@ -2305,19 +2305,19 @@ newDetailInZoneForType(GSTimeZone *zone, TypeInfo *type)
|
|||
* for efficient access ... not the same saze as the data
|
||||
* we received.
|
||||
*/
|
||||
i = n_trans * (sizeof(gss32)+1) + n_types * sizeof(TypeInfo);
|
||||
i = n_trans * (sizeof(int32_t)+1) + n_types * sizeof(TypeInfo);
|
||||
buf = NSZoneMalloc(NSDefaultMallocZone(), i);
|
||||
types = (TypeInfo*)buf;
|
||||
buf += (n_types * sizeof(TypeInfo));
|
||||
trans = (gss32*)buf;
|
||||
buf += (n_trans * sizeof(gss32));
|
||||
trans = (int32_t*)buf;
|
||||
buf += (n_trans * sizeof(int32_t));
|
||||
idxs = (unsigned char*)buf;
|
||||
|
||||
/* Read in transitions. */
|
||||
for (i = 0; i < n_trans; i++)
|
||||
{
|
||||
trans[i] = GSSwapBigI32ToHost(*(gss32*)(bytes + pos));
|
||||
pos += sizeof(gss32);
|
||||
trans[i] = GSSwapBigI32ToHost(*(int32_t*)(bytes + pos));
|
||||
pos += sizeof(int32_t);
|
||||
}
|
||||
for (i = 0; i < n_trans; i++)
|
||||
{
|
||||
|
|
|
@ -825,7 +825,7 @@ static unsigned urlAlign;
|
|||
if (legal(buf->host, "-") == NO)
|
||||
{
|
||||
[NSException raise: NSGenericException format:
|
||||
@"illegal character in user/password part"];
|
||||
@"illegal character in host part"];
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -583,9 +583,9 @@ static Class NSDataMallocClass;
|
|||
gsu128 bigval;
|
||||
#else
|
||||
#if GS_HAVE_I64
|
||||
gsu64 bigval;
|
||||
uint64_t bigval;
|
||||
#else
|
||||
gsu32 bigval;
|
||||
uint32_t bigval;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -707,7 +707,7 @@ static Class NSDataMallocClass;
|
|||
{
|
||||
unsigned cver;
|
||||
NSString *className;
|
||||
gsu16 nameLength;
|
||||
uint16_t nameLength;
|
||||
|
||||
if (xref != GSIArrayCount(clsMap))
|
||||
{
|
||||
|
@ -719,7 +719,8 @@ static Class NSDataMallocClass;
|
|||
* A class is encoded as a 16-bit length, a sequence of
|
||||
* characters providing its name, then a version number.
|
||||
*/
|
||||
(*desImp)(src, desSel, &nameLength, @encode(gsu16), &cursor, nil);
|
||||
(*desImp)(src, desSel, &nameLength, @encode(uint16_t),
|
||||
&cursor, nil);
|
||||
if (nameLength == 0)
|
||||
{
|
||||
className = nil;
|
||||
|
@ -1006,27 +1007,27 @@ static Class NSDataMallocClass;
|
|||
{
|
||||
case _GSC_I16: /* Encoded as 16-bit */
|
||||
{
|
||||
gsu16 val;
|
||||
uint16_t val;
|
||||
|
||||
(*desImp)(src, desSel, &val, @encode(gsu16), &cursor, nil);
|
||||
(*desImp)(src, desSel, &val, @encode(uint16_t), &cursor, nil);
|
||||
bigval = val;
|
||||
break;
|
||||
}
|
||||
|
||||
case _GSC_I32: /* Encoded as 32-bit */
|
||||
{
|
||||
gsu32 val;
|
||||
uint32_t val;
|
||||
|
||||
(*desImp)(src, desSel, &val, @encode(gsu32), &cursor, nil);
|
||||
(*desImp)(src, desSel, &val, @encode(uint32_t), &cursor, nil);
|
||||
bigval = val;
|
||||
break;
|
||||
}
|
||||
|
||||
case _GSC_I64: /* Encoded as 64-bit */
|
||||
{
|
||||
gsu64 val;
|
||||
uint64_t val;
|
||||
|
||||
(*desImp)(src, desSel, &val, @encode(gsu64), &cursor, nil);
|
||||
(*desImp)(src, desSel, &val, @encode(uint64_t), &cursor, nil);
|
||||
#if GS_HAVE_I64
|
||||
bigval = val;
|
||||
#else
|
||||
|
@ -1045,9 +1046,9 @@ static Class NSDataMallocClass;
|
|||
#else
|
||||
val = GSSwapBigI128ToHost(val);
|
||||
#if GS_HAVE_I64
|
||||
bigval = *(gsu64*)&val;
|
||||
bigval = *(uint64_t*)&val;
|
||||
#else
|
||||
bigval = *(gsu32*)&val;
|
||||
bigval = *(uint32_t*)&val;
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
|
|
@ -103,7 +103,8 @@
|
|||
void *
|
||||
GSOutOfMemory(size_t size, BOOL retry)
|
||||
{
|
||||
fprintf(stderr, "GSOutOfMemory ... wanting %u bytes.\n", size);
|
||||
fprintf(stderr, "GSOutOfMemory ... wanting %lu bytes.\n",
|
||||
(unsigned long)size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -384,7 +384,8 @@ mframe_next_arg(const char *typePtr, NSArgumentInfo *info)
|
|||
acc_align = MAX(local.align, def_align);
|
||||
}
|
||||
/*
|
||||
* Continue accumulating structure size.
|
||||
* Continue accumulating structure size
|
||||
* and adjust alignment if necessary
|
||||
*/
|
||||
while (*typePtr != _C_STRUCT_E)
|
||||
{
|
||||
|
@ -395,6 +396,14 @@ mframe_next_arg(const char *typePtr, NSArgumentInfo *info)
|
|||
}
|
||||
acc_size = ROUND(acc_size, local.align);
|
||||
acc_size += local.size;
|
||||
acc_align = MAX(local.align, acc_align);
|
||||
}
|
||||
/*
|
||||
* Size must be a multiple of alignment
|
||||
*/
|
||||
if (acc_size % acc_align != 0)
|
||||
{
|
||||
acc_size += acc_align - acc_size % acc_align;
|
||||
}
|
||||
info->size = acc_size;
|
||||
info->align = acc_align;
|
||||
|
|
|
@ -267,21 +267,21 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
switch (info->type)
|
||||
{
|
||||
case ET_EDESC:
|
||||
fd = (int)info->data;
|
||||
fd = (int)(intptr_t)info->data;
|
||||
setPollfd(fd, POLLPRI, self);
|
||||
NSMapInsert(_efdMap, (void*)fd, info);
|
||||
NSMapInsert(_efdMap, (void*)(intptr_t)fd, info);
|
||||
break;
|
||||
|
||||
case ET_RDESC:
|
||||
fd = (int)info->data;
|
||||
fd = (int)(intptr_t)info->data;
|
||||
setPollfd(fd, POLLIN, self);
|
||||
NSMapInsert(_rfdMap, (void*)fd, info);
|
||||
NSMapInsert(_rfdMap, (void*)(intptr_t)fd, info);
|
||||
break;
|
||||
|
||||
case ET_WDESC:
|
||||
fd = (int)info->data;
|
||||
fd = (int)(intptr_t)info->data;
|
||||
setPollfd(fd, POLLOUT, self);
|
||||
NSMapInsert(_wfdMap, (void*)fd, info);
|
||||
NSMapInsert(_wfdMap, (void*)(intptr_t)fd, info);
|
||||
break;
|
||||
|
||||
case ET_RPORT:
|
||||
|
@ -312,7 +312,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
fd = port_fd_array[port_fd_count];
|
||||
setPollfd(fd, POLLIN, self);
|
||||
NSMapInsert(_rfdMap,
|
||||
(void*)port_fd_array[port_fd_count], info);
|
||||
(void*)(intptr_t)port_fd_array[port_fd_count], info);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -421,7 +421,8 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
*/
|
||||
if (pollfds[fdIndex].revents & (POLLPRI|POLLERR|POLLHUP|POLLNVAL))
|
||||
{
|
||||
watcher = (GSRunLoopWatcher*)NSMapGet(_efdMap, (void*)fd);
|
||||
watcher
|
||||
= (GSRunLoopWatcher*)NSMapGet(_efdMap, (void*)(intptr_t)fd);
|
||||
if (watcher != nil && watcher->_invalidated == NO)
|
||||
{
|
||||
i = [contexts count];
|
||||
|
@ -429,7 +430,10 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
{
|
||||
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
|
||||
|
||||
if (c != self) [c endEvent: (void*)fd type: ET_EDESC];
|
||||
if (c != self)
|
||||
{
|
||||
[c endEvent: (void*)(intptr_t)fd type: ET_EDESC];
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The watcher is still valid - so call its
|
||||
|
@ -437,7 +441,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
*/
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(gsaddr)fd, mode);
|
||||
(void*)(uintptr_t)fd, mode);
|
||||
}
|
||||
GSNotifyASAP();
|
||||
if (completed == YES)
|
||||
|
@ -448,7 +452,8 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
}
|
||||
if (pollfds[fdIndex].revents & (POLLOUT|POLLERR|POLLHUP|POLLNVAL))
|
||||
{
|
||||
watcher = (GSRunLoopWatcher*)NSMapGet(_wfdMap, (void*)fd);
|
||||
watcher
|
||||
= (GSRunLoopWatcher*)NSMapGet(_wfdMap, (void*)(intptr_t)fd);
|
||||
if (watcher != nil && watcher->_invalidated == NO)
|
||||
{
|
||||
i = [contexts count];
|
||||
|
@ -456,7 +461,10 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
{
|
||||
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
|
||||
|
||||
if (c != self) [c endEvent: (void*)fd type: ET_WDESC];
|
||||
if (c != self)
|
||||
{
|
||||
[c endEvent: (void*)(intptr_t)fd type: ET_WDESC];
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The watcher is still valid - so call its
|
||||
|
@ -464,7 +472,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
*/
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(gsaddr)fd, mode);
|
||||
(void*)(uintptr_t)fd, mode);
|
||||
}
|
||||
GSNotifyASAP();
|
||||
if (completed == YES)
|
||||
|
@ -475,7 +483,8 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
}
|
||||
if (pollfds[fdIndex].revents & (POLLIN|POLLERR|POLLHUP|POLLNVAL))
|
||||
{
|
||||
watcher = (GSRunLoopWatcher*)NSMapGet(_rfdMap, (void*)fd);
|
||||
watcher
|
||||
= (GSRunLoopWatcher*)NSMapGet(_rfdMap, (void*)(intptr_t)fd);
|
||||
if (watcher != nil && watcher->_invalidated == NO)
|
||||
{
|
||||
i = [contexts count];
|
||||
|
@ -483,7 +492,10 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
{
|
||||
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
|
||||
|
||||
if (c != self) [c endEvent: (void*)fd type: ET_RDESC];
|
||||
if (c != self)
|
||||
{
|
||||
[c endEvent: (void*)(intptr_t)fd type: ET_RDESC];
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The watcher is still valid - so call its
|
||||
|
@ -491,7 +503,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
*/
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(gsaddr)fd, mode);
|
||||
(void*)(uintptr_t)fd, mode);
|
||||
}
|
||||
GSNotifyASAP();
|
||||
if (completed == YES)
|
||||
|
@ -586,29 +598,29 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
switch (info->type)
|
||||
{
|
||||
case ET_EDESC:
|
||||
fd = (int)info->data;
|
||||
fd = (int)(intptr_t)info->data;
|
||||
if (fd > fdEnd)
|
||||
fdEnd = fd;
|
||||
FD_SET (fd, &exception_fds);
|
||||
NSMapInsert(_efdMap, (void*)fd, info);
|
||||
NSMapInsert(_efdMap, (void*)(intptr_t)fd, info);
|
||||
num_inputs++;
|
||||
break;
|
||||
|
||||
case ET_RDESC:
|
||||
fd = (int)info->data;
|
||||
fd = (int)(intptr_t)info->data;
|
||||
if (fd > fdEnd)
|
||||
fdEnd = fd;
|
||||
FD_SET (fd, &read_fds);
|
||||
NSMapInsert(_rfdMap, (void*)fd, info);
|
||||
NSMapInsert(_rfdMap, (void*)(intptr_t)fd, info);
|
||||
num_inputs++;
|
||||
break;
|
||||
|
||||
case ET_WDESC:
|
||||
fd = (int)info->data;
|
||||
fd = (int)(intptr_t)info->data;
|
||||
if (fd > fdEnd)
|
||||
fdEnd = fd;
|
||||
FD_SET (fd, &write_fds);
|
||||
NSMapInsert(_wfdMap, (void*)fd, info);
|
||||
NSMapInsert(_wfdMap, (void*)(intptr_t)fd, info);
|
||||
num_inputs++;
|
||||
break;
|
||||
|
||||
|
@ -642,7 +654,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
if (fd > fdEnd)
|
||||
fdEnd = fd;
|
||||
NSMapInsert(_rfdMap,
|
||||
(void*)port_fd_array[port_fd_count], info);
|
||||
(void*)(intptr_t)port_fd_array[port_fd_count], info);
|
||||
num_inputs++;
|
||||
}
|
||||
}
|
||||
|
@ -743,7 +755,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
*/
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(gsaddr)fdIndex, mode);
|
||||
(void*)(uintptr_t)fdIndex, mode);
|
||||
}
|
||||
GSNotifyASAP();
|
||||
if (completed == YES)
|
||||
|
@ -772,7 +784,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
*/
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(gsaddr)fdIndex, mode);
|
||||
(void*)(uintptr_t)fdIndex, mode);
|
||||
}
|
||||
GSNotifyASAP();
|
||||
if (completed == YES)
|
||||
|
@ -801,7 +813,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
*/
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(gsaddr)fdIndex, mode);
|
||||
(void*)(uintptr_t)fdIndex, mode);
|
||||
}
|
||||
GSNotifyASAP();
|
||||
if (completed == YES)
|
||||
|
|
|
@ -192,14 +192,14 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
}
|
||||
if (*ptr == '\0' && val <= 0xffff)
|
||||
{
|
||||
gsu16 v = val;
|
||||
uint16_t v = val;
|
||||
|
||||
sin->sin_port = GSSwapHostI16ToBig(v);
|
||||
return YES;
|
||||
}
|
||||
else if (strcmp(ptr, "gdomap") == 0)
|
||||
{
|
||||
gsu16 v;
|
||||
uint16_t v;
|
||||
#ifdef GDOMAP_PORT_OVERRIDE
|
||||
v = GDOMAP_PORT_OVERRIDE;
|
||||
#else
|
||||
|
@ -1771,7 +1771,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
for (i = 0; i < [modes count]; i++)
|
||||
{
|
||||
[l removeEvent: (void*)(gsaddr)event
|
||||
[l removeEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
forMode: [modes objectAtIndex: i]
|
||||
all: YES];
|
||||
|
@ -1779,7 +1779,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else
|
||||
{
|
||||
[l removeEvent: (void*)(gsaddr)event
|
||||
[l removeEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: YES];
|
||||
|
@ -1811,7 +1811,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
for (i = 0; i < [modes count]; i++)
|
||||
{
|
||||
[l removeEvent: (void*)(gsaddr)event
|
||||
[l removeEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
forMode: [modes objectAtIndex: i]
|
||||
all: YES];
|
||||
|
@ -1819,7 +1819,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else
|
||||
{
|
||||
[l removeEvent: (void*)(gsaddr)event
|
||||
[l removeEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: YES];
|
||||
|
@ -1843,7 +1843,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
for (i = 0; i < [modes count]; i++)
|
||||
{
|
||||
[l addEvent: (void*)(gsaddr)event
|
||||
[l addEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
watcher: self
|
||||
forMode: [modes objectAtIndex: i]];
|
||||
|
@ -1852,7 +1852,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else
|
||||
{
|
||||
[l addEvent: (void*)(gsaddr)event
|
||||
[l addEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
|
@ -1880,7 +1880,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
for (i = 0; i < [modes count]; i++)
|
||||
{
|
||||
[l addEvent: (void*)(gsaddr)event
|
||||
[l addEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
watcher: self
|
||||
forMode: [modes objectAtIndex: i]];
|
||||
|
@ -1888,7 +1888,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else
|
||||
{
|
||||
[l addEvent: (void*)(gsaddr)event
|
||||
[l addEvent: (void*)(uintptr_t)event
|
||||
type: ET_HANDLE
|
||||
watcher: self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
|
|
|
@ -136,6 +136,116 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is no msgTarget || there is a generic watcher (watching hwnd == 0),
|
||||
* loop through all events, and send them to the correct
|
||||
* watcher (if there are any) and then process the rest right here.
|
||||
* else if there is a msgTarget,
|
||||
* then loop through watchers and process for their
|
||||
* hwnd's only. Then call msgTarget to clean up the rest of them.
|
||||
* Return a flag to say whether any messages were handled.
|
||||
*/
|
||||
- (BOOL) processAllWindowsMessages:(int)num_winMsgs within: (NSArray*)contexts
|
||||
{
|
||||
MSG msg;
|
||||
GSRunLoopWatcher *generic = nil;
|
||||
unsigned i;
|
||||
BOOL handled = NO;
|
||||
|
||||
if (num_winMsgs > 0)
|
||||
{
|
||||
generic = NSMapGet(winMsgMap,0);
|
||||
}
|
||||
|
||||
if (msgTarget == nil || (generic != nil && generic->_invalidated == NO))
|
||||
{
|
||||
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
|
||||
{
|
||||
if (num_winMsgs > 0)
|
||||
{
|
||||
HANDLE handle;
|
||||
GSRunLoopWatcher *watcher;
|
||||
|
||||
handle = msg.hwnd;
|
||||
watcher = (GSRunLoopWatcher*)NSMapGet(winMsgMap,
|
||||
(void*)handle);
|
||||
if (watcher == nil || watcher->_invalidated == YES)
|
||||
{
|
||||
handle = 0; // Generic
|
||||
watcher
|
||||
= (GSRunLoopWatcher*)NSMapGet(winMsgMap, (void*)handle);
|
||||
}
|
||||
if (watcher != nil && watcher->_invalidated == NO)
|
||||
{
|
||||
i = [contexts count];
|
||||
while (i-- > 0)
|
||||
{
|
||||
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
|
||||
|
||||
if (c != self)
|
||||
{
|
||||
[c endEvent: (void*)handle type: ET_WINMSG];
|
||||
}
|
||||
}
|
||||
completed = YES;
|
||||
handled = YES;
|
||||
/*
|
||||
* The watcher is still valid - so call the
|
||||
* receiver's event handling method.
|
||||
*/
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(uintptr_t)&msg, mode);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_winMsgs > 0)
|
||||
{
|
||||
unsigned num = num_winMsgs;
|
||||
NSMapEnumerator hEnum;
|
||||
HANDLE handle;
|
||||
GSRunLoopWatcher *watcher;
|
||||
|
||||
hEnum = NSEnumerateMapTable(winMsgMap);
|
||||
while (NSNextMapEnumeratorPair(&hEnum, &handle, (void**)&watcher))
|
||||
{
|
||||
if (watcher->_invalidated == NO)
|
||||
{
|
||||
while (PeekMessage(&msg, handle, 0, 0, PM_REMOVE))
|
||||
{
|
||||
i = [contexts count];
|
||||
while (i-- > 0)
|
||||
{
|
||||
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
|
||||
|
||||
if (c != self)
|
||||
{
|
||||
[c endEvent: (void*)handle type: ET_WINMSG];
|
||||
}
|
||||
}
|
||||
completed = YES;
|
||||
handled = YES;
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(uintptr_t)&msg, mode);
|
||||
}
|
||||
}
|
||||
num--;
|
||||
}
|
||||
NSEndMapTableEnumeration(&hEnum);
|
||||
}
|
||||
completed = YES;
|
||||
[msgTarget performSelector: msgSelector withObject: nil];
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
- (BOOL) pollUntil: (int)milliseconds within: (NSArray*)contexts
|
||||
{
|
||||
NSMapEnumerator hEnum;
|
||||
|
@ -147,7 +257,6 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
void *handle;
|
||||
int wait_timeout;
|
||||
DWORD wait_return;
|
||||
BOOL do_wait;
|
||||
|
||||
// Set timeout how much time should wait
|
||||
if (milliseconds >= 0)
|
||||
|
@ -243,166 +352,24 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
NSEndMapTableEnumeration(&hEnum);
|
||||
num_handles = i;
|
||||
|
||||
do_wait = YES;
|
||||
do
|
||||
/* Clear all the windows messages first before we wait,
|
||||
* since MsgWaitForMultipleObjects only signals on NEW messages
|
||||
*/
|
||||
if ([self processAllWindowsMessages: num_winMsgs within: contexts] == YES)
|
||||
{
|
||||
wait_return = MsgWaitForMultipleObjects(num_handles, handleArray,
|
||||
NO, wait_timeout, QS_ALLINPUT);
|
||||
NSDebugMLLog(@"NSRunLoop", @"wait returned %d", wait_return);
|
||||
wait_timeout = 0; // Processed something ... no need to wait.
|
||||
}
|
||||
|
||||
wait_return = MsgWaitForMultipleObjects(num_handles, handleArray,
|
||||
NO, wait_timeout, QS_ALLINPUT);
|
||||
NSDebugMLLog(@"NSRunLoop", @"wait returned %d", wait_return);
|
||||
|
||||
// if there are windows message
|
||||
if (wait_return == WAIT_OBJECT_0 + num_handles)
|
||||
{
|
||||
MSG msg;
|
||||
INT bRet;
|
||||
|
||||
if (msgTarget == nil)
|
||||
{
|
||||
bRet = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
|
||||
if (bRet != 0)
|
||||
{
|
||||
if (msg.message == WM_QUIT)
|
||||
{
|
||||
Class c = NSClassFromString(@"NSApplication");
|
||||
|
||||
if (c == 0)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Received WM_QUIT"];
|
||||
}
|
||||
else
|
||||
{
|
||||
SEL s = NSSelectorFromString(@"sharedApplication");
|
||||
id o = [c performSelector: s];
|
||||
|
||||
s = NSSelectorFromString(@"terminate:");
|
||||
[o performSelector: s withObject: nil];
|
||||
}
|
||||
}
|
||||
|
||||
if (num_winMsgs > 0)
|
||||
{
|
||||
HANDLE handle;
|
||||
|
||||
handle = msg.hwnd;
|
||||
watcher = (GSRunLoopWatcher*)NSMapGet(winMsgMap,
|
||||
(void*)handle);
|
||||
if (watcher == nil || watcher->_invalidated == YES)
|
||||
{
|
||||
handle = 0; // Generic
|
||||
watcher = (GSRunLoopWatcher*)NSMapGet(winMsgMap,
|
||||
(void*)handle);
|
||||
}
|
||||
if (watcher != nil && watcher->_invalidated == NO)
|
||||
{
|
||||
i = [contexts count];
|
||||
while (i-- > 0)
|
||||
{
|
||||
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
|
||||
|
||||
if (c != self)
|
||||
{
|
||||
[c endEvent: (void*)handle type: ET_WINMSG];
|
||||
}
|
||||
}
|
||||
completed = YES;
|
||||
/*
|
||||
* The watcher is still valid - so call the
|
||||
* receiver's event handling method.
|
||||
*/
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(gsaddr)&msg, mode);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_winMsgs > 0)
|
||||
{
|
||||
GSRunLoopWatcher *generic = nil;
|
||||
unsigned num = num_winMsgs;
|
||||
|
||||
hEnum = NSEnumerateMapTable(winMsgMap);
|
||||
while (NSNextMapEnumeratorPair(&hEnum, &handle,
|
||||
(void**)&watcher))
|
||||
{
|
||||
if (watcher->_invalidated == NO)
|
||||
{
|
||||
if (handle == 0 && num > 1)
|
||||
{
|
||||
// Let window specific watchers have first attempt.
|
||||
generic = watcher;
|
||||
continue;
|
||||
}
|
||||
bRet = PeekMessage(&msg, handle, 0, 0, PM_REMOVE);
|
||||
if (bRet != 0)
|
||||
{
|
||||
i = [contexts count];
|
||||
while (i-- > 0)
|
||||
{
|
||||
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
|
||||
|
||||
if (c != self)
|
||||
{
|
||||
[c endEvent: (void*)handle
|
||||
type: ET_WINMSG];
|
||||
}
|
||||
}
|
||||
NSEndMapTableEnumeration(&hEnum);
|
||||
completed = YES;
|
||||
/*
|
||||
* The watcher is still valid - so call the
|
||||
* receiver's event handling method.
|
||||
*/
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(gsaddr)&msg, mode);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
num--;
|
||||
}
|
||||
NSEndMapTableEnumeration(&hEnum);
|
||||
if (generic != nil && generic->_invalidated == NO)
|
||||
{
|
||||
bRet = PeekMessage(&msg, 0, 0, 0, PM_REMOVE);
|
||||
if (bRet != 0)
|
||||
{
|
||||
i = [contexts count];
|
||||
while (i-- > 0)
|
||||
{
|
||||
GSRunLoopCtxt *c = [contexts objectAtIndex: i];
|
||||
|
||||
if (c != self)
|
||||
{
|
||||
[c endEvent: (void*)0 type: ET_WINMSG];
|
||||
}
|
||||
}
|
||||
NSEndMapTableEnumeration(&hEnum);
|
||||
completed = YES;
|
||||
(*generic->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(gsaddr)&msg, mode);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
completed = YES;
|
||||
[msgTarget performSelector: msgSelector withObject: nil];
|
||||
return NO;
|
||||
}
|
||||
--wait_timeout;
|
||||
}
|
||||
else
|
||||
{
|
||||
do_wait = NO;
|
||||
}
|
||||
if (wait_return == WAIT_OBJECT_0 + num_handles)
|
||||
{
|
||||
[self processAllWindowsMessages: num_winMsgs within: contexts];
|
||||
return NO;
|
||||
}
|
||||
while (do_wait && (wait_timeout >= 0));
|
||||
|
||||
// check wait errors
|
||||
if (wait_return == WAIT_FAILED)
|
||||
|
@ -477,7 +444,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
NSDebugMLLog(@"NSRunLoop", @"Event callback found");
|
||||
(*watcher->handleEvent)(watcher->receiver,
|
||||
eventSel, watcher->data, watcher->type,
|
||||
(void*)(gsaddr)handle, mode);
|
||||
(void*)(uintptr_t)handle, mode);
|
||||
}
|
||||
|
||||
GSNotifyASAP();
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "Foundation/NSFileManager.h"
|
||||
#include "Foundation/NSValue.h"
|
||||
#include "Foundation/NSThread.h"
|
||||
#include "Foundation/NSUserDefaults.h"
|
||||
|
||||
#include "GSPortPrivate.h"
|
||||
|
||||
|
@ -49,6 +50,8 @@ static NSMapTable portToNamesMap;
|
|||
static NSString *registry;
|
||||
static HKEY key;
|
||||
|
||||
static SECURITY_ATTRIBUTES security;
|
||||
|
||||
@interface NSMessagePortNameServer (private)
|
||||
+ (NSString *) _query: (NSString *)name;
|
||||
+ (NSString *) _translate: (NSString *)name;
|
||||
|
@ -96,6 +99,10 @@ static void clean_up_names(void)
|
|||
NSObjectMapValueCallBacks, 0);
|
||||
atexit(clean_up_names);
|
||||
|
||||
security.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
security.lpSecurityDescriptor = 0; // Default
|
||||
security.bInheritHandle = TRUE;
|
||||
|
||||
registry = @"Software\\GNUstepNSMessagePort";
|
||||
rc = RegCreateKeyExW(
|
||||
HKEY_CURRENT_USER,
|
||||
|
@ -104,8 +111,8 @@ static void clean_up_names(void)
|
|||
L"",
|
||||
REG_OPTION_VOLATILE,
|
||||
STANDARD_RIGHTS_WRITE|STANDARD_RIGHTS_READ|KEY_SET_VALUE
|
||||
|KEY_QUERY_VALUE,
|
||||
NULL,
|
||||
|KEY_QUERY_VALUE|KEY_NOTIFY,
|
||||
&security,
|
||||
&key,
|
||||
NULL);
|
||||
if (rc == ERROR_SUCCESS)
|
||||
|
@ -156,6 +163,28 @@ static void clean_up_names(void)
|
|||
|
||||
n = [[self class] _translate: name];
|
||||
|
||||
/* FIXME ... wierd hack.
|
||||
* It appears that RegQueryValueExW does not always read from the registry,
|
||||
* but will in fact return cached results (even if you close and re-open the
|
||||
* registry key between the calls to RegQueryValueExW). This is a problem
|
||||
* if we look up a server which is not running, and then try to look it up
|
||||
* again when it is running, or if we have one address recorded but the server
|
||||
* has been restarted and is using a new address.
|
||||
* I couldn't find any mention of this behavior ... but accidentally discovered
|
||||
* that a call to OutputDebugStringW stops it ... presumably something in the
|
||||
* debug system invalidates whatever registry caching is being done.
|
||||
* Anyway, on my XP SP2 system, this next line is needed to fix things.
|
||||
*
|
||||
* You can test this by running a GNUstep application without starting
|
||||
* gdnc beforehand. If the bug is occurring, the app will try to start gdnc
|
||||
* then poll to connect to it, and after 5 seconds will abort because it
|
||||
* hasn't seen the gdnc port registered even though gdnc did start.
|
||||
* If the hack has fixed the bug, the app will just pause briefly during
|
||||
* startup (as it starts gdnc) and then continue when it finds the server
|
||||
* port.
|
||||
*/
|
||||
OutputDebugStringW(L"");
|
||||
|
||||
rc = RegQueryValueExW(
|
||||
key,
|
||||
UNISTR(n),
|
||||
|
@ -180,7 +209,7 @@ static void clean_up_names(void)
|
|||
UNISTR(p),
|
||||
GENERIC_WRITE,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
(LPSECURITY_ATTRIBUTES)0,
|
||||
&security,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
(HANDLE)0);
|
||||
|
|
|
@ -79,8 +79,8 @@ typedef enum {
|
|||
* Its contents are transmitted in network byte order.
|
||||
*/
|
||||
typedef struct {
|
||||
gsu32 type; /* A GSPortItemType as a 4-byte number. */
|
||||
gsu32 length; /* The length of the item (excluding header). */
|
||||
uint32_t type; /* A GSPortItemType as a 4-byte number. */
|
||||
uint32_t length; /* The length of the item (excluding header). */
|
||||
} GSPortItemHeader;
|
||||
|
||||
/*
|
||||
|
@ -90,8 +90,8 @@ typedef struct {
|
|||
* NB. additional data counts as part of the same item.
|
||||
*/
|
||||
typedef struct {
|
||||
gsu32 mId; /* The ID for the message starting with this. */
|
||||
gsu32 nItems; /* Number of items (including this one). */
|
||||
uint32_t mId; /* The ID for the message starting with this. */
|
||||
uint32_t nItems; /* Number of items (including this one). */
|
||||
unsigned char version;
|
||||
unsigned char port[16];
|
||||
} GSPortMsgHeader;
|
||||
|
@ -127,6 +127,8 @@ typedef struct {
|
|||
|
||||
@implementation NSMessagePort
|
||||
|
||||
static SECURITY_ATTRIBUTES security;
|
||||
|
||||
static NSRecursiveLock *messagePortLock = nil;
|
||||
|
||||
/*
|
||||
|
@ -135,10 +137,6 @@ static NSRecursiveLock *messagePortLock = nil;
|
|||
static NSMapTable *ports = 0;
|
||||
static Class messagePortClass = 0;
|
||||
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
static unsigned wordAlign;
|
||||
#endif
|
||||
|
||||
- (BOOL) _setupSendPort
|
||||
{
|
||||
internal *this = (internal*)self->_internal;
|
||||
|
@ -156,7 +154,7 @@ static unsigned wordAlign;
|
|||
UNISTR(path),
|
||||
GENERIC_WRITE,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
(LPSECURITY_ATTRIBUTES)0,
|
||||
&security,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
|
||||
(HANDLE)0);
|
||||
|
@ -183,14 +181,15 @@ static unsigned wordAlign;
|
|||
{
|
||||
if (self == [NSMessagePort class])
|
||||
{
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
wordAlign = objc_alignof_type(@encode(gsu32));
|
||||
#endif
|
||||
messagePortClass = self;
|
||||
ports = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
|
||||
messagePortLock = [GSLazyRecursiveLock new];
|
||||
|
||||
security.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
security.lpSecurityDescriptor = 0; // Default
|
||||
security.bInheritHandle = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,7 +219,7 @@ static unsigned wordAlign;
|
|||
self, aLoop, aMode);
|
||||
NSAssert(PORT(self)->rHandle != INVALID_HANDLE_VALUE,
|
||||
@"Attempt to listen on send port");
|
||||
[aLoop addEvent: (void*)(gsaddr)PORT(self)->rEvent
|
||||
[aLoop addEvent: (void*)(uintptr_t)PORT(self)->rEvent
|
||||
type: ET_HANDLE
|
||||
watcher: (id<RunLoopEvents>)self
|
||||
forMode: aMode];
|
||||
|
@ -329,7 +328,7 @@ static unsigned wordAlign;
|
|||
UNISTR(path),
|
||||
0, /* No max message size. */
|
||||
MAILSLOT_WAIT_FOREVER, /* No read/write timeout. */
|
||||
(LPSECURITY_ATTRIBUTES)0);
|
||||
&security);
|
||||
|
||||
if (this->rHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -917,7 +916,7 @@ again:
|
|||
{
|
||||
NSDebugMLLog(@"NSMessagePort", @"%@ remove from 0x%x in mode %@",
|
||||
self, aLoop, aMode);
|
||||
[aLoop removeEvent: (void*)(gsaddr)PORT(self)->rEvent
|
||||
[aLoop removeEvent: (void*)(uintptr_t)PORT(self)->rEvent
|
||||
type: ET_HANDLE
|
||||
forMode: aMode
|
||||
all: NO];
|
||||
|
@ -1066,11 +1065,11 @@ again:
|
|||
{
|
||||
NSRunLoop *loop = [NSRunLoop currentRunLoop];
|
||||
|
||||
[loop addEvent: (void*)(gsaddr)this->wEvent
|
||||
[loop addEvent: (void*)(uintptr_t)this->wEvent
|
||||
type: ET_HANDLE
|
||||
watcher: (id<RunLoopEvents>)self
|
||||
forMode: NSConnectionReplyMode];
|
||||
[loop addEvent: (void*)(gsaddr)this->wEvent
|
||||
[loop addEvent: (void*)(uintptr_t)this->wEvent
|
||||
type: ET_HANDLE
|
||||
watcher: (id<RunLoopEvents>)self
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
|
@ -1084,11 +1083,11 @@ again:
|
|||
M_LOCK(this->lock);
|
||||
}
|
||||
|
||||
[loop removeEvent: (void*)(gsaddr)this->wEvent
|
||||
[loop removeEvent: (void*)(uintptr_t)this->wEvent
|
||||
type: ET_HANDLE
|
||||
forMode: NSConnectionReplyMode
|
||||
all: NO];
|
||||
[loop removeEvent: (void*)(gsaddr)this->wEvent
|
||||
[loop removeEvent: (void*)(uintptr_t)this->wEvent
|
||||
type: ET_HANDLE
|
||||
forMode: NSDefaultRunLoopMode
|
||||
all: NO];
|
||||
|
|
|
@ -52,7 +52,7 @@ ifeq ($(add),yes)
|
|||
TOOL_NAME = autogsdoc cvtenc plmerge sfparse xmlparse
|
||||
else
|
||||
TOOL_NAME = autogsdoc cvtenc gdnc gspath defaults pl plmerge \
|
||||
plparse sfparse pldes plser pl2link xmlparse
|
||||
plparse sfparse pldes plget plser pl2link xmlparse
|
||||
CTOOL_NAME = gdomap
|
||||
|
||||
SUBPROJECTS = make_strings
|
||||
|
@ -72,6 +72,7 @@ dremove_OBJC_FILES = dremove.m
|
|||
dwrite_OBJC_FILES = dwrite.m
|
||||
pl_OBJC_FILES = pl.m
|
||||
pldes_OBJC_FILES = pldes.m
|
||||
plget_OBJC_FILES = plget.m
|
||||
plser_OBJC_FILES = plser.m
|
||||
plmerge_OBJC_FILES = plmerge.m
|
||||
plparse_OBJC_FILES = plparse.m
|
||||
|
|
|
@ -1553,12 +1553,12 @@ load_iface(const char* from)
|
|||
bcok[interfaces] = 0;
|
||||
bcst[interfaces].s_addr = inet_addr("0.0.0.0");
|
||||
}
|
||||
if (addr[interfaces].s_addr == (unsigned long)-1)
|
||||
if (addr[interfaces].s_addr == (uint32_t)-1)
|
||||
{
|
||||
sprintf(ebuf, "'%s' is not as valid address", buf);
|
||||
gdomap_log(LOG_ERR);
|
||||
}
|
||||
else if (mask[interfaces].s_addr == (unsigned long)-1)
|
||||
else if (mask[interfaces].s_addr == (uint32_t)-1)
|
||||
{
|
||||
sprintf(ebuf, "'%s' is not as valid netmask", ptr);
|
||||
gdomap_log(LOG_ERR);
|
||||
|
@ -4499,7 +4499,7 @@ printf(
|
|||
prb = (plentry*)malloc(sizeof(plentry));
|
||||
memset((char*)prb, '\0', sizeof(plentry));
|
||||
prb->addr.s_addr = inet_addr(buf);
|
||||
if (prb->addr.s_addr == (unsigned long)-1)
|
||||
if (prb->addr.s_addr == (uint32_t)-1)
|
||||
{
|
||||
fprintf(stderr, "'%s' is not as valid address\n", buf);
|
||||
free(prb);
|
||||
|
|
|
@ -15,6 +15,8 @@ pl, pldes, plser, plmerge, plparse, pl2link \- property list tools
|
|||
.nf
|
||||
.BI "pldes " "filename(s)"
|
||||
.nl
|
||||
.BI "plget " "key" [ more keys ]
|
||||
.nl
|
||||
.BI "plser " "filename(s)"
|
||||
.nl
|
||||
.BI "plmerge [ " "destination-file" " ] [ " "input-file(s)" " ]"
|
||||
|
@ -42,6 +44,11 @@ manipulating the various persistent property list representations as files.
|
|||
.IP "\fBpldes\fR \fIfilename(s)\fR" 4
|
||||
Converts a binary serialised property list (class instance) to a text
|
||||
representation.
|
||||
.IP "\fBplget\fR \fIkey\fR" 4
|
||||
Reads a text representation of a dictionary in property list format as
|
||||
standard input, extracts the string value held in that dictionary with
|
||||
the specified key, and writes the result to standard output.
|
||||
Multiple keys may be used to extract values from nested dictionaries.
|
||||
.IP "\fBplser\fR \fIfilename(s)\fR" 4
|
||||
Converts a text representation of a property list to a binary serialized
|
||||
representation.
|
||||
|
@ -67,7 +74,7 @@ Written 1999-2000.
|
|||
This manual page first appeared in gnustep-base 1.9.2 (March 2004).
|
||||
.P
|
||||
.SH AUTHORS
|
||||
.B pldes, plparse, plser
|
||||
.B pldes, plget, plparse, plser
|
||||
were written by Richard Frith-McDonald <rfm@gnu.org>.
|
||||
.PP
|
||||
.B plmerge
|
||||
|
|
478
configure
vendored
478
configure
vendored
|
@ -310,7 +310,7 @@ ac_includes_default="\
|
|||
#endif"
|
||||
|
||||
ac_subdirs_all="$ac_subdirs_all Source/mframe SSL"
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS GNUSTEP_CONFIG_FILE build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP WHOAMI EGREP GS_WORDS_BIGENDIAN GS_SINT8 GS_UINT8 ac_cv_sizeof_short ac_cv_sizeof_int ac_cv_sizeof_long ac_cv_sizeof_long_long ac_cv_sizeof_float ac_cv_sizeof_double ac_cv_sizeof_voidp GS_ADDR GS_SINT16 GS_UINT16 GS_SINT32 GS_UINT32 GS_SINT64 GS_UINT64 GS_HAVE_I64 GS_SINT128 GS_UINT128 GS_HAVE_I128 GS_FLT32 GS_FLT64 _GSC_S_SHT _GSC_S_INT _GSC_S_LNG _GSC_S_LNG_LNG DYNAMIC_LINKER NX_CONST_STRING_OBJCFLAGS NX_CONST_STRING_CLASS HAVE_PTHREAD_H HAVE_PTS_STREAM_MODULES INCLUDE_STDINT DEFINE_INT8_T DEFINE_UINT8_T DEFINE_INT16_T DEFINE_UINT16_T DEFINE_INT32_T DEFINE_UINT32_T DEFINE_INT64_T DEFINE_UINT64_T USE_ZLIB GS_PASS_ARGUMENTS GS_FAKE_MAIN WITH_FFI XML2_CONFIG XML_CONFIG XML_CFLAGS XML_LIBS HAVE_LIBXSLT HAVE_LIBXML USE_GMP INCLUDE_FLAGS LDIR_FLAGS subdirs VERSION MAJOR_VERSION MINOR_VERSION SUBMINOR_VERSION GCC_VERSION LIBOBJS LTLIBOBJS'
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os GNUSTEP_CONFIG_FILE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP WHOAMI EGREP GS_WORDS_BIGENDIAN GS_SINT8 GS_UINT8 ac_cv_sizeof_short ac_cv_sizeof_int ac_cv_sizeof_long ac_cv_sizeof_long_long ac_cv_sizeof_float ac_cv_sizeof_double ac_cv_sizeof_voidp GS_SADDR GS_UADDR GS_SINT16 GS_UINT16 GS_SINT32 GS_UINT32 GS_SINT64 GS_UINT64 GS_HAVE_I64 GS_SINT128 GS_UINT128 GS_HAVE_I128 GS_FLT32 GS_FLT64 _GSC_S_SHT _GSC_S_INT _GSC_S_LNG _GSC_S_LNG_LNG DYNAMIC_LINKER NX_CONST_STRING_OBJCFLAGS NX_CONST_STRING_CLASS HAVE_PTHREAD_H HAVE_PTS_STREAM_MODULES INCLUDE_STDINT DEFINE_INT8_T DEFINE_UINT8_T DEFINE_INT16_T DEFINE_UINT16_T DEFINE_INT32_T DEFINE_UINT32_T DEFINE_INT64_T DEFINE_UINT64_T DEFINE_INTPTR_T DEFINE_UINTPTR_T USE_ZLIB GS_PASS_ARGUMENTS GS_FAKE_MAIN WITH_FFI XML2_CONFIG XML_CONFIG XML_CFLAGS XML_LIBS HAVE_LIBXSLT HAVE_LIBXML USE_GMP INCLUDE_FLAGS LDIR_FLAGS subdirs VERSION MAJOR_VERSION MINOR_VERSION SUBMINOR_VERSION GCC_VERSION LIBOBJS LTLIBOBJS'
|
||||
ac_subst_files=''
|
||||
|
||||
# Initialize some variables set by options.
|
||||
|
@ -857,6 +857,7 @@ Optional Features:
|
|||
library can't be determined at runtime
|
||||
and the leading './' in the config file name
|
||||
is therefore not supported.
|
||||
Normally this should be left disabled.
|
||||
--disable-importing-config-file
|
||||
Disable importing of an existing GNUstep config
|
||||
file and use inbuilt defaults instead.
|
||||
|
@ -876,8 +877,14 @@ Optional Packages:
|
|||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
|
||||
--with-config-file=PATH Specify path to the GNUstep config file.
|
||||
If unspecified, uses the same value as the
|
||||
GNUstep make package.
|
||||
This is the location to be used by the base
|
||||
library to locate oath information at
|
||||
application or tool runtime.
|
||||
If unspecified, this uses the same value as
|
||||
the GNUstep make package on unix-like systems,
|
||||
but uses ./GNUstep.conf on mingw so that
|
||||
it is relative to the location of the
|
||||
base library DLL.
|
||||
If a leading './' is specified, the path
|
||||
is taken to be relative to the base library
|
||||
linked runtime, not all operating systems
|
||||
|
@ -891,7 +898,8 @@ Optional Packages:
|
|||
provide default values for the base library
|
||||
to use at runtime if no GNUstep config file
|
||||
is found at runtime. If this is not specified
|
||||
then the path from --with-config-file is used.
|
||||
then the path from --with-config-file or from
|
||||
the gnustep-make pacakage is used.
|
||||
--with-include-flags=FLAGS Specify all include flags at once
|
||||
--with-library-flags=FLAGS Specify all library flags at once
|
||||
--with-ffi-include=PATH Include path for ffi (ffcall/libffi) headers
|
||||
|
@ -1358,195 +1366,6 @@ echo "$as_me: error: You must have the gnustep-make package installed and set up
|
|||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Location of the GNUstep.conf config file (--with-config-file)
|
||||
#---------------------------------------------------------------------
|
||||
echo "$as_me:$LINENO: checking for GNUstep configuration file to use" >&5
|
||||
echo $ECHO_N "checking for GNUstep configuration file to use... $ECHO_C" >&6
|
||||
|
||||
# Check whether --with-config-file or --without-config-file was given.
|
||||
if test "${with_config_file+set}" = set; then
|
||||
withval="$with_config_file"
|
||||
GNUSTEP_CONFIG_FILE="$withval"
|
||||
else
|
||||
if test "$GNUSTEP_CONFIG_FILE" = ""; then
|
||||
case "$target_os" in
|
||||
mingw*)
|
||||
GNUSTEP_CONFIG_FILE=./GNUstep.conf ;;
|
||||
*)
|
||||
GNUSTEP_CONFIG_FILE=`grep '^GNUSTEP_CONFIG_FILE *=' $GNUSTEP_MAKEFILES/config.make | sed -e 's/GNUSTEP_CONFIG_FILE *= *\(.*\)/\1/'` ;;
|
||||
esac
|
||||
fi
|
||||
fi;
|
||||
echo "$as_me:$LINENO: result: $GNUSTEP_CONFIG_FILE" >&5
|
||||
echo "${ECHO_T}$GNUSTEP_CONFIG_FILE" >&6
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Whether the GNUstep.conf file path can be set in the environment
|
||||
#-----------------------------------------------------------------
|
||||
echo "$as_me:$LINENO: checking whether the GNUstep.conf file path can be set in the environment" >&5
|
||||
echo $ECHO_N "checking whether the GNUstep.conf file path can be set in the environment... $ECHO_C" >&6
|
||||
# Check whether --enable-environment-config-file or --disable-environment-config-file was given.
|
||||
if test "${enable_environment_config_file+set}" = set; then
|
||||
enableval="$enable_environment_config_file"
|
||||
ac_cv_environment_config_file=$enableval
|
||||
else
|
||||
ac_cv_environment_config_file="no"
|
||||
fi;
|
||||
if test "$ac_cv_environment_config_file" = "yes"; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define OPTION_NO_ENVIRONMENT 0
|
||||
_ACEOF
|
||||
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
else
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define OPTION_NO_ENVIRONMENT 1
|
||||
_ACEOF
|
||||
|
||||
echo "$as_me:$LINENO: result: no: disabled from the command-line" >&5
|
||||
echo "${ECHO_T}no: disabled from the command-line" >&6
|
||||
fi
|
||||
|
||||
#
|
||||
# Set 'standard' defaults for values from configuration file.
|
||||
# On mingw, we assume paths for an isolated, standalone, relocatable package.
|
||||
# On unix we assume a standard layout for both development and distribution.
|
||||
#
|
||||
case "$target_os" in
|
||||
mingw*)
|
||||
GNUSTEP_SYSTEM_ROOT=./System
|
||||
GNUSTEP_LOCAL_ROOT=./Local
|
||||
GNUSTEP_NETWORK_ROOT=./Local
|
||||
GNUSTEP_USER_DIR=GNUstep
|
||||
GNUSTEP_USER_DEFAULTS_DIR=GNUstep\\Defaults
|
||||
GNUSTEP_USER_CONFIG_FILE=.GNUstep.conf
|
||||
;;
|
||||
*)
|
||||
GNUSTEP_SYSTEM_ROOT=/usr/GNUstep/System
|
||||
GNUSTEP_LOCAL_ROOT=/usr/GNUstep/Local
|
||||
GNUSTEP_NETWORK_ROOT=/usr/GNUstep/Local
|
||||
GNUSTEP_USER_DIR=GNUstep
|
||||
GNUSTEP_USER_DEFAULTS_DIR=GNUstep/Defaults
|
||||
GNUSTEP_USER_CONFIG_FILE=.GNUstep.conf
|
||||
;;
|
||||
esac
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Now read/import the existing configuration file, if any
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
# Reading/importing an existing configuration file is good as it means
|
||||
# the built-in default paths in the code will match those of your
|
||||
# installation (or of the config file you specify).
|
||||
# It can be annoying in certain cases though; this option lets you
|
||||
# turn it off
|
||||
echo "$as_me:$LINENO: checking if we should import an existing configuration file" >&5
|
||||
echo $ECHO_N "checking if we should import an existing configuration file... $ECHO_C" >&6
|
||||
# Check whether --enable-importing-config-file or --disable-importing-config-file was given.
|
||||
if test "${enable_importing_config_file+set}" = set; then
|
||||
enableval="$enable_importing_config_file"
|
||||
ac_cv_importing_config_file=$enableval
|
||||
else
|
||||
ac_cv_importing_config_file="yes"
|
||||
fi;
|
||||
if test "$ac_cv_importing_config_file" = "no"; then
|
||||
echo "$as_me:$LINENO: result: no: disabled from the command-line" >&5
|
||||
echo "${ECHO_T}no: disabled from the command-line" >&6
|
||||
else
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
fi
|
||||
|
||||
|
||||
if test "$ac_cv_importing_config_file" = "yes" ;
|
||||
then
|
||||
echo "$as_me:$LINENO: checking for default GNUstep configuration file to use" >&5
|
||||
echo $ECHO_N "checking for default GNUstep configuration file to use... $ECHO_C" >&6
|
||||
|
||||
# Check whether --with-default-config or --without-default-config was given.
|
||||
if test "${with_default_config+set}" = set; then
|
||||
withval="$with_default_config"
|
||||
GNUSTEP_DEFAULT_CONFIG="$withval"
|
||||
else
|
||||
if test "$GNUSTEP_DEFAULT_CONFIG" = ""; then
|
||||
GNUSTEP_DEFAULT_CONFIG="$GNUSTEP_CONFIG_FILE"
|
||||
fi
|
||||
fi;
|
||||
echo "$as_me:$LINENO: result: $GNUSTEP_DEFAULT_CONFIG" >&5
|
||||
echo "${ECHO_T}$GNUSTEP_DEFAULT_CONFIG" >&6
|
||||
|
||||
#
|
||||
# Use the default config file to override standard values.
|
||||
#
|
||||
if test ! -f "$GNUSTEP_DEFAULT_CONFIG"; then
|
||||
echo "$as_me:$LINENO: result: fail: file \"$GNUSTEP_DEFAULT_CONFIG\" does not exist" >&5
|
||||
echo "${ECHO_T}fail: file \"$GNUSTEP_DEFAULT_CONFIG\" does not exist" >&6
|
||||
{ echo "$as_me:$LINENO: Please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option" >&5
|
||||
echo "$as_me: Please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option" >&6;}
|
||||
else
|
||||
echo "$as_me:$LINENO: result: trying to import \"$GNUSTEP_DEFAULT_CONFIG\"" >&5
|
||||
echo "${ECHO_T}trying to import \"$GNUSTEP_DEFAULT_CONFIG\"" >&6
|
||||
{ echo "$as_me:$LINENO: If this fails, please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option" >&5
|
||||
echo "$as_me: If this fails, please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option" >&6;}
|
||||
. "$GNUSTEP_DEFAULT_CONFIG"
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Add standard library and header directories for configure to use to locate
|
||||
# plain C developer headers/libraries which haver been installed in the
|
||||
# GNUstep hierarchy.
|
||||
#
|
||||
CPPFLAGS="$CPPFLAGS -I$GNUSTEP_SYSTEM_ROOT/Library/Headers"
|
||||
LDFLAGS="$LDFLAGS -L$GNUSTEP_SYSTEM_ROOT/Library/Libraries"
|
||||
|
||||
#
|
||||
# Set the default configuration file values in config.h to be hard-coded
|
||||
# into NSPathUtilities.m
|
||||
#
|
||||
GNUSTEP_SYSTEM_ROOT=`echo $GNUSTEP_SYSTEM_ROOT|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_SYSTEM_ROOT "$GNUSTEP_SYSTEM_ROOT"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_NETWORK_ROOT=`echo $GNUSTEP_NETWORK_ROOT|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_NETWORK_ROOT "$GNUSTEP_NETWORK_ROOT"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_LOCAL_ROOT=`echo $GNUSTEP_LOCAL_ROOT|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_LOCAL_ROOT "$GNUSTEP_LOCAL_ROOT"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_USER_DIR=`echo $GNUSTEP_USER_DIR|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_USER_DIR "$GNUSTEP_USER_DIR"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_USER_DEFAULTS_DIR=`echo $GNUSTEP_USER_DEFAULTS_DIR|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_USER_DEFAULTS_DIR "$GNUSTEP_USER_DEFAULTS_DIR"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_USER_CONFIG_FILE=`echo $GNUSTEP_USER_CONFIG_FILE|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_USER_CONFIG_FILE "$GNUSTEP_USER_CONFIG_FILE"
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use config.guess, config.sub and install-sh provided by gnustep-make
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -1668,6 +1487,220 @@ test -n "$target_alias" &&
|
|||
NONENONEs,x,x, &&
|
||||
program_prefix=${target_alias}-
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Location of the GNUstep.conf config file (--with-config-file)
|
||||
#---------------------------------------------------------------------
|
||||
echo "$as_me:$LINENO: checking for GNUstep configuration file to use" >&5
|
||||
echo $ECHO_N "checking for GNUstep configuration file to use... $ECHO_C" >&6
|
||||
GNUSTEP_MAKE_CONFIG=`grep '^GNUSTEP_CONFIG_FILE *=' $GNUSTEP_MAKEFILES/config.make | sed -e 's/GNUSTEP_CONFIG_FILE *= *\(.*\)/\1/'`
|
||||
|
||||
# Check whether --with-config-file or --without-config-file was given.
|
||||
if test "${with_config_file+set}" = set; then
|
||||
withval="$with_config_file"
|
||||
GNUSTEP_CONFIG_FILE="$withval"
|
||||
else
|
||||
if test "$GNUSTEP_CONFIG_FILE" = ""; then
|
||||
case "$target_os" in
|
||||
mingw*)
|
||||
GNUSTEP_CONFIG_FILE=./GNUstep.conf ;;
|
||||
*)
|
||||
GNUSTEP_CONFIG_FILE="$GNUSTEP_MAKE_CONFIG" ;;
|
||||
esac
|
||||
fi
|
||||
fi;
|
||||
echo "$as_me:$LINENO: result: $GNUSTEP_CONFIG_FILE" >&5
|
||||
echo "${ECHO_T}$GNUSTEP_CONFIG_FILE" >&6
|
||||
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
# Whether the GNUstep.conf file path can be set in the environment
|
||||
#-----------------------------------------------------------------
|
||||
echo "$as_me:$LINENO: checking whether the GNUstep.conf file path can be set in the environment" >&5
|
||||
echo $ECHO_N "checking whether the GNUstep.conf file path can be set in the environment... $ECHO_C" >&6
|
||||
# Check whether --enable-environment-config-file or --disable-environment-config-file was given.
|
||||
if test "${enable_environment_config_file+set}" = set; then
|
||||
enableval="$enable_environment_config_file"
|
||||
ac_cv_environment_config_file=$enableval
|
||||
else
|
||||
ac_cv_environment_config_file="no"
|
||||
fi;
|
||||
if test "$ac_cv_environment_config_file" = "yes"; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define OPTION_NO_ENVIRONMENT 0
|
||||
_ACEOF
|
||||
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
else
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define OPTION_NO_ENVIRONMENT 1
|
||||
_ACEOF
|
||||
|
||||
echo "$as_me:$LINENO: result: no: disabled from the command-line" >&5
|
||||
echo "${ECHO_T}no: disabled from the command-line" >&6
|
||||
fi
|
||||
|
||||
#
|
||||
# Set 'standard' defaults for values from configuration file.
|
||||
#
|
||||
# On mingw, we assume paths relative to the location of the base library -
|
||||
# Normally that DLL is stored in the Tools directory of the System domain,
|
||||
# so we assume a standard layout relative to that. For standalone deployment
|
||||
# you may want everything in the same directory, in which case the paths for
|
||||
# the domains relative to the DLL need to be modified.
|
||||
#
|
||||
# On unix we assume a standard layout for both development and distribution.
|
||||
#
|
||||
case "$target_os" in
|
||||
mingw*)
|
||||
GNUSTEP_SYSTEM_ROOT=./..\\..\\System
|
||||
GNUSTEP_LOCAL_ROOT=./..\\..\\Local
|
||||
GNUSTEP_NETWORK_ROOT=./..\\..\\Local
|
||||
GNUSTEP_USER_DIR=GNUstep
|
||||
GNUSTEP_USER_DEFAULTS_DIR=GNUstep\\Defaults
|
||||
GNUSTEP_USER_CONFIG_FILE=.GNUstep.conf
|
||||
;;
|
||||
*)
|
||||
GNUSTEP_SYSTEM_ROOT=/usr/GNUstep/System
|
||||
GNUSTEP_LOCAL_ROOT=/usr/GNUstep/Local
|
||||
GNUSTEP_NETWORK_ROOT=/usr/GNUstep/Local
|
||||
GNUSTEP_USER_DIR=GNUstep
|
||||
GNUSTEP_USER_DEFAULTS_DIR=GNUstep/Defaults
|
||||
GNUSTEP_USER_CONFIG_FILE=.GNUstep.conf
|
||||
;;
|
||||
esac
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Now read/import the existing configuration file, if any
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
# Reading/importing an existing configuration file is good as it means
|
||||
# the built-in default paths in the code will match those of your
|
||||
# installation (or of the config file you specify).
|
||||
# It can be annoying in certain cases though; this option lets you
|
||||
# turn it off
|
||||
echo "$as_me:$LINENO: checking if we should import an existing configuration file" >&5
|
||||
echo $ECHO_N "checking if we should import an existing configuration file... $ECHO_C" >&6
|
||||
# Check whether --enable-importing-config-file or --disable-importing-config-file was given.
|
||||
if test "${enable_importing_config_file+set}" = set; then
|
||||
enableval="$enable_importing_config_file"
|
||||
ac_cv_importing_config_file=$enableval
|
||||
else
|
||||
ac_cv_importing_config_file="yes"
|
||||
fi;
|
||||
if test "$ac_cv_importing_config_file" = "no"; then
|
||||
echo "$as_me:$LINENO: result: no: disabled from the command-line" >&5
|
||||
echo "${ECHO_T}no: disabled from the command-line" >&6
|
||||
else
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
fi
|
||||
|
||||
|
||||
if test "$ac_cv_importing_config_file" = "yes" ;
|
||||
then
|
||||
echo "$as_me:$LINENO: checking for default GNUstep configuration file to use" >&5
|
||||
echo $ECHO_N "checking for default GNUstep configuration file to use... $ECHO_C" >&6
|
||||
|
||||
# Check whether --with-default-config or --without-default-config was given.
|
||||
if test "${with_default_config+set}" = set; then
|
||||
withval="$with_default_config"
|
||||
GNUSTEP_DEFAULT_CONFIG="$withval"
|
||||
else
|
||||
if test "$GNUSTEP_DEFAULT_CONFIG" = ""; then
|
||||
if test -f "$GNUSTEP_CONFIG_FILE"; then
|
||||
GNUSTEP_DEFAULT_CONFIG="$GNUSTEP_CONFIG_FILE"
|
||||
fi
|
||||
fi
|
||||
fi;
|
||||
echo "$as_me:$LINENO: result: $GNUSTEP_DEFAULT_CONFIG" >&5
|
||||
echo "${ECHO_T}$GNUSTEP_DEFAULT_CONFIG" >&6
|
||||
|
||||
#
|
||||
# Only try importing if the default config file has been specified.
|
||||
#
|
||||
if test "$GNUSTEP_DEFAULT_CONFIG" != ""; then
|
||||
#
|
||||
# Use the default config file to override standard values.
|
||||
#
|
||||
if test ! -f "$GNUSTEP_DEFAULT_CONFIG"; then
|
||||
echo "$as_me:$LINENO: result: fail: file \"$GNUSTEP_DEFAULT_CONFIG\" does not exist" >&5
|
||||
echo "${ECHO_T}fail: file \"$GNUSTEP_DEFAULT_CONFIG\" does not exist" >&6
|
||||
{ echo "$as_me:$LINENO: Please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option" >&5
|
||||
echo "$as_me: Please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option" >&6;}
|
||||
else
|
||||
echo "$as_me:$LINENO: result: trying to import \"$GNUSTEP_DEFAULT_CONFIG\"" >&5
|
||||
echo "${ECHO_T}trying to import \"$GNUSTEP_DEFAULT_CONFIG\"" >&6
|
||||
{ echo "$as_me:$LINENO: If this fails, please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option" >&5
|
||||
echo "$as_me: If this fails, please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option" >&6;}
|
||||
. "$GNUSTEP_DEFAULT_CONFIG"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Set the default configuration file values in config.h to be hard-coded
|
||||
# into NSPathUtilities.m
|
||||
#
|
||||
GNUSTEP_SYSTEM_ROOT=`echo $GNUSTEP_SYSTEM_ROOT|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_SYSTEM_ROOT "$GNUSTEP_SYSTEM_ROOT"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_NETWORK_ROOT=`echo $GNUSTEP_NETWORK_ROOT|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_NETWORK_ROOT "$GNUSTEP_NETWORK_ROOT"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_LOCAL_ROOT=`echo $GNUSTEP_LOCAL_ROOT|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_LOCAL_ROOT "$GNUSTEP_LOCAL_ROOT"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_USER_DIR=`echo $GNUSTEP_USER_DIR|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_USER_DIR "$GNUSTEP_USER_DIR"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_USER_DEFAULTS_DIR=`echo $GNUSTEP_USER_DEFAULTS_DIR|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_USER_DEFAULTS_DIR "$GNUSTEP_USER_DEFAULTS_DIR"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_USER_CONFIG_FILE=`echo $GNUSTEP_USER_CONFIG_FILE|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_USER_CONFIG_FILE "$GNUSTEP_USER_CONFIG_FILE"
|
||||
_ACEOF
|
||||
|
||||
GNUSTEP_CONFIG_FILE=`echo $GNUSTEP_CONFIG_FILE|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define GNUSTEP_TARGET_CONFIG_FILE "$GNUSTEP_CONFIG_FILE"
|
||||
_ACEOF
|
||||
|
||||
|
||||
#
|
||||
# Now load the values to be used in locating libraries etc used when
|
||||
# building the base library ... as supplied by the gnustep-make package
|
||||
#
|
||||
. "$GNUSTEP_MAKE_CONFIG"
|
||||
|
||||
#
|
||||
# Add standard library and header directories for configure to use to locate
|
||||
# plain C developer headers/libraries which haver been installed in the
|
||||
# GNUstep hierarchy.
|
||||
#
|
||||
CPPFLAGS="$CPPFLAGS -I$GNUSTEP_SYSTEM_ROOT/Library/Headers"
|
||||
LDFLAGS="$LDFLAGS -L$GNUSTEP_SYSTEM_ROOT/Library/Libraries"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Find the compiler
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -6636,13 +6669,16 @@ _ACEOF
|
|||
|
||||
|
||||
if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_int; then
|
||||
GS_ADDR="unsigned int"
|
||||
GS_SADDR="int"
|
||||
GS_UADDR="unsigned int"
|
||||
else
|
||||
if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_long; then
|
||||
GS_ADDR="unsigned long"
|
||||
GS_SADDR="long"
|
||||
GS_UADDR="unsigned long"
|
||||
else
|
||||
if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_long_long; then
|
||||
GS_ADDR="unsigned long long"
|
||||
GS_SADDR="long long"
|
||||
GS_UADDR="unsigned long long"
|
||||
else
|
||||
{ { echo "$as_me:$LINENO: error: Unable to find integer of same size as void*" >&5
|
||||
echo "$as_me: error: Unable to find integer of same size as void*" >&2;}
|
||||
|
@ -6652,6 +6688,7 @@ echo "$as_me: error: Unable to find integer of same size as void*" >&2;}
|
|||
fi
|
||||
|
||||
|
||||
|
||||
if test $ac_cv_sizeof_short = 2; then
|
||||
GS_SINT16="signed short"
|
||||
GS_UINT16="unsigned short"
|
||||
|
@ -12004,6 +12041,8 @@ DEFINE_INT32_T="#define int32_t gss32"
|
|||
DEFINE_UINT32_T="#define uint32_t gsu32"
|
||||
DEFINE_INT64_T="#define int64_t gss64"
|
||||
DEFINE_UINT64_T="#define uint64_t gsu64"
|
||||
DEFINE_INTPTR_T="#define intptr_t gssaddr"
|
||||
DEFINE_UINTPTR_T="#define uintptr_t gsuaddr"
|
||||
else
|
||||
DEFINE_INT8_T=""
|
||||
DEFINE_UINT8_T=""
|
||||
|
@ -12013,6 +12052,8 @@ DEFINE_INT32_T=""
|
|||
DEFINE_UINT32_T=""
|
||||
DEFINE_INT64_T=""
|
||||
DEFINE_UINT64_T=""
|
||||
DEFINE_INTPTR_T=""
|
||||
DEFINE_UINTPTR_T=""
|
||||
fi
|
||||
|
||||
|
||||
|
@ -12025,6 +12066,8 @@ fi
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# These used by GSFileHandle.m and distributed objects
|
||||
#--------------------------------------------------------------------
|
||||
|
@ -13911,8 +13954,16 @@ else
|
|||
ffi_libdir="no"
|
||||
fi;
|
||||
if test ${ffi_libdir} != "no"; then
|
||||
LDFLAGS="$LDFLAGS -L${ffi_libdir}"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -L${ffi_libdir}"
|
||||
|
||||
case "$target_os" in
|
||||
netbsd*)
|
||||
LDFLAGS="$LDFLAGS -L${ffi_libdir} -Wl,-R${ffi_libdir}"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -Wl,-R${ffi_libdir} -L${ffi_libdir}";;
|
||||
*)
|
||||
LDFLAGS="$LDFLAGS -L${ffi_libdir}"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -L${ffi_libdir}";;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
if test "${ac_cv_header_ffi_h+set}" = set; then
|
||||
|
@ -14493,8 +14544,16 @@ else
|
|||
fi;
|
||||
|
||||
if test "$libiconv_libdir" != "no"; then
|
||||
LDFLAGS="$LDFLAGS -L$libiconv_libdir"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -L$libiconv_libdir"
|
||||
|
||||
case "$target_os" in
|
||||
netbsd*)
|
||||
LDFLAGS="$LDFLAGS -L${libiconv_libdir} -Wl,-R${libiconv_libdir}"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -Wl,-R${libiconv_libdir} -L${libiconv_libdir}";;
|
||||
*)
|
||||
LDFLAGS="$LDFLAGS -L${libiconv_libdir}"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -L${libiconv_libdir}";;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
old_LIBS="$LIBS"
|
||||
|
@ -15451,8 +15510,16 @@ if test "$gmp_incdir" != "no"; then
|
|||
INCLUDE_FLAGS="$INCLUDE_FLAGS -I$gmp_incdir"
|
||||
fi
|
||||
if test "$gmp_libdir" != "no"; then
|
||||
LDFLAGS="$LDFLAGS -L$gmp_libdir"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -L$gmp_libdir"
|
||||
|
||||
case "$target_os" in
|
||||
netbsd*)
|
||||
LDFLAGS="$LDFLAGS -L${gmp_libdir} -Wl,-R${gmp_libdir}"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -Wl,-R${gmp_libdir} -L${gmp_libdir}";;
|
||||
*)
|
||||
LDFLAGS="$LDFLAGS -L${gmp_libdir}"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -L${gmp_libdir}";;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
USE_GMP=0
|
||||
|
@ -16492,7 +16559,6 @@ s,@ECHO_C@,$ECHO_C,;t t
|
|||
s,@ECHO_N@,$ECHO_N,;t t
|
||||
s,@ECHO_T@,$ECHO_T,;t t
|
||||
s,@LIBS@,$LIBS,;t t
|
||||
s,@GNUSTEP_CONFIG_FILE@,$GNUSTEP_CONFIG_FILE,;t t
|
||||
s,@build@,$build,;t t
|
||||
s,@build_cpu@,$build_cpu,;t t
|
||||
s,@build_vendor@,$build_vendor,;t t
|
||||
|
@ -16505,6 +16571,7 @@ s,@target@,$target,;t t
|
|||
s,@target_cpu@,$target_cpu,;t t
|
||||
s,@target_vendor@,$target_vendor,;t t
|
||||
s,@target_os@,$target_os,;t t
|
||||
s,@GNUSTEP_CONFIG_FILE@,$GNUSTEP_CONFIG_FILE,;t t
|
||||
s,@CC@,$CC,;t t
|
||||
s,@CFLAGS@,$CFLAGS,;t t
|
||||
s,@LDFLAGS@,$LDFLAGS,;t t
|
||||
|
@ -16525,7 +16592,8 @@ s,@ac_cv_sizeof_long_long@,$ac_cv_sizeof_long_long,;t t
|
|||
s,@ac_cv_sizeof_float@,$ac_cv_sizeof_float,;t t
|
||||
s,@ac_cv_sizeof_double@,$ac_cv_sizeof_double,;t t
|
||||
s,@ac_cv_sizeof_voidp@,$ac_cv_sizeof_voidp,;t t
|
||||
s,@GS_ADDR@,$GS_ADDR,;t t
|
||||
s,@GS_SADDR@,$GS_SADDR,;t t
|
||||
s,@GS_UADDR@,$GS_UADDR,;t t
|
||||
s,@GS_SINT16@,$GS_SINT16,;t t
|
||||
s,@GS_UINT16@,$GS_UINT16,;t t
|
||||
s,@GS_SINT32@,$GS_SINT32,;t t
|
||||
|
@ -16556,6 +16624,8 @@ s,@DEFINE_INT32_T@,$DEFINE_INT32_T,;t t
|
|||
s,@DEFINE_UINT32_T@,$DEFINE_UINT32_T,;t t
|
||||
s,@DEFINE_INT64_T@,$DEFINE_INT64_T,;t t
|
||||
s,@DEFINE_UINT64_T@,$DEFINE_UINT64_T,;t t
|
||||
s,@DEFINE_INTPTR_T@,$DEFINE_INTPTR_T,;t t
|
||||
s,@DEFINE_UINTPTR_T@,$DEFINE_UINTPTR_T,;t t
|
||||
s,@USE_ZLIB@,$USE_ZLIB,;t t
|
||||
s,@GS_PASS_ARGUMENTS@,$GS_PASS_ARGUMENTS,;t t
|
||||
s,@GS_FAKE_MAIN@,$GS_FAKE_MAIN,;t t
|
||||
|
|
139
configure.ac
139
configure.ac
|
@ -27,6 +27,7 @@ builtin(include, config/procfs-exe-link.m4)dnl
|
|||
builtin(include, config/procfs.m4)dnl
|
||||
builtin(include, config/pathxml.m4)dnl
|
||||
builtin(include, config/codeset.m4)dnl
|
||||
builtin(include, config/addlibrarypath.m4)dnl
|
||||
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([Source/NSArray.m])
|
||||
|
@ -35,14 +36,36 @@ if test -z "$GNUSTEP_MAKEFILES"; then
|
|||
AC_MSG_ERROR([You must have the gnustep-make package installed and set up the GNUSTEP_MAKEFILES environment variable to contain the path to the makefiles directory before configuring!])
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use config.guess, config.sub and install-sh provided by gnustep-make
|
||||
#--------------------------------------------------------------------
|
||||
AC_CONFIG_AUX_DIR($GNUSTEP_MAKEFILES)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use a .h file with #define's, instead of -D command-line switches
|
||||
#--------------------------------------------------------------------
|
||||
AC_CONFIG_HEADER(Headers/Additions/GNUstepBase/config.h)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Determine the host, build, and target systems
|
||||
#--------------------------------------------------------------------
|
||||
AC_CANONICAL_TARGET([])
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Location of the GNUstep.conf config file (--with-config-file)
|
||||
#---------------------------------------------------------------------
|
||||
AC_MSG_CHECKING([for GNUstep configuration file to use])
|
||||
GNUSTEP_MAKE_CONFIG=`grep '^GNUSTEP_CONFIG_FILE *=' $GNUSTEP_MAKEFILES/config.make | sed -e 's/GNUSTEP_CONFIG_FILE *= *\(.*\)/\1/'`
|
||||
AC_ARG_WITH(config-file,
|
||||
[ --with-config-file=PATH Specify path to the GNUstep config file.
|
||||
If unspecified, uses the same value as the
|
||||
GNUstep make package.
|
||||
This is the location to be used by the base
|
||||
library to locate oath information at
|
||||
application or tool runtime.
|
||||
If unspecified, this uses the same value as
|
||||
the GNUstep make package on unix-like systems,
|
||||
but uses ./GNUstep.conf on mingw so that
|
||||
it is relative to the location of the
|
||||
base library DLL.
|
||||
If a leading './' is specified, the path
|
||||
is taken to be relative to the base library
|
||||
linked runtime, not all operating systems
|
||||
|
@ -57,7 +80,7 @@ AC_ARG_WITH(config-file,
|
|||
mingw*)
|
||||
GNUSTEP_CONFIG_FILE=./GNUstep.conf ;;
|
||||
*)
|
||||
GNUSTEP_CONFIG_FILE=`grep '^GNUSTEP_CONFIG_FILE *=' $GNUSTEP_MAKEFILES/config.make | sed -e 's/GNUSTEP_CONFIG_FILE *= *\(.*\)/\1/'` ;;
|
||||
GNUSTEP_CONFIG_FILE="$GNUSTEP_MAKE_CONFIG" ;;
|
||||
esac
|
||||
fi])
|
||||
AC_MSG_RESULT($GNUSTEP_CONFIG_FILE)
|
||||
|
@ -78,7 +101,8 @@ AC_ARG_ENABLE(environment-config-file,
|
|||
for platforms where the path to the base
|
||||
library can't be determined at runtime
|
||||
and the leading './' in the config file name
|
||||
is therefore not supported.],
|
||||
is therefore not supported.
|
||||
Normally this should be left disabled.],
|
||||
ac_cv_environment_config_file=$enableval,
|
||||
ac_cv_environment_config_file="no")
|
||||
if test "$ac_cv_environment_config_file" = "yes"; then
|
||||
|
@ -93,14 +117,20 @@ fi
|
|||
|
||||
#
|
||||
# Set 'standard' defaults for values from configuration file.
|
||||
# On mingw, we assume paths for an isolated, standalone, relocatable package.
|
||||
#
|
||||
# On mingw, we assume paths relative to the location of the base library -
|
||||
# Normally that DLL is stored in the Tools directory of the System domain,
|
||||
# so we assume a standard layout relative to that. For standalone deployment
|
||||
# you may want everything in the same directory, in which case the paths for
|
||||
# the domains relative to the DLL need to be modified.
|
||||
#
|
||||
# On unix we assume a standard layout for both development and distribution.
|
||||
#
|
||||
case "$target_os" in
|
||||
mingw*)
|
||||
GNUSTEP_SYSTEM_ROOT=./System
|
||||
GNUSTEP_LOCAL_ROOT=./Local
|
||||
GNUSTEP_NETWORK_ROOT=./Local
|
||||
GNUSTEP_SYSTEM_ROOT=./..\\..\\System
|
||||
GNUSTEP_LOCAL_ROOT=./..\\..\\Local
|
||||
GNUSTEP_NETWORK_ROOT=./..\\..\\Local
|
||||
GNUSTEP_USER_DIR=GNUstep
|
||||
GNUSTEP_USER_DEFAULTS_DIR=GNUstep\\Defaults
|
||||
GNUSTEP_USER_CONFIG_FILE=.GNUstep.conf
|
||||
|
@ -147,34 +177,34 @@ then
|
|||
provide default values for the base library
|
||||
to use at runtime if no GNUstep config file
|
||||
is found at runtime. If this is not specified
|
||||
then the path from --with-config-file is used.],
|
||||
then the path from --with-config-file or from
|
||||
the gnustep-make pacakage is used.],
|
||||
GNUSTEP_DEFAULT_CONFIG="$withval",
|
||||
[if test "$GNUSTEP_DEFAULT_CONFIG" = ""; then
|
||||
GNUSTEP_DEFAULT_CONFIG="$GNUSTEP_CONFIG_FILE"
|
||||
if test -f "$GNUSTEP_CONFIG_FILE"; then
|
||||
GNUSTEP_DEFAULT_CONFIG="$GNUSTEP_CONFIG_FILE"
|
||||
fi
|
||||
fi])
|
||||
AC_MSG_RESULT($GNUSTEP_DEFAULT_CONFIG)
|
||||
|
||||
#
|
||||
# Use the default config file to override standard values.
|
||||
# Only try importing if the default config file has been specified.
|
||||
#
|
||||
if test ! -f "$GNUSTEP_DEFAULT_CONFIG"; then
|
||||
AC_MSG_RESULT([fail: file "$GNUSTEP_DEFAULT_CONFIG" does not exist])
|
||||
AC_MSG_NOTICE([Please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option])
|
||||
else
|
||||
AC_MSG_RESULT([trying to import "$GNUSTEP_DEFAULT_CONFIG"])
|
||||
AC_MSG_NOTICE([If this fails, please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option])
|
||||
. "$GNUSTEP_DEFAULT_CONFIG"
|
||||
if test "$GNUSTEP_DEFAULT_CONFIG" != ""; then
|
||||
#
|
||||
# Use the default config file to override standard values.
|
||||
#
|
||||
if test ! -f "$GNUSTEP_DEFAULT_CONFIG"; then
|
||||
AC_MSG_RESULT([fail: file "$GNUSTEP_DEFAULT_CONFIG" does not exist])
|
||||
AC_MSG_NOTICE([Please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option])
|
||||
else
|
||||
AC_MSG_RESULT([trying to import "$GNUSTEP_DEFAULT_CONFIG"])
|
||||
AC_MSG_NOTICE([If this fails, please run configure again with the --disable-importing-config-file option or specifying an alternative file using the --with-default-config= option])
|
||||
. "$GNUSTEP_DEFAULT_CONFIG"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Add standard library and header directories for configure to use to locate
|
||||
# plain C developer headers/libraries which haver been installed in the
|
||||
# GNUstep hierarchy.
|
||||
#
|
||||
CPPFLAGS="$CPPFLAGS -I$GNUSTEP_SYSTEM_ROOT/Library/Headers"
|
||||
LDFLAGS="$LDFLAGS -L$GNUSTEP_SYSTEM_ROOT/Library/Libraries"
|
||||
|
||||
#
|
||||
# Set the default configuration file values in config.h to be hard-coded
|
||||
# into NSPathUtilities.m
|
||||
|
@ -203,22 +233,24 @@ GNUSTEP_USER_CONFIG_FILE=`echo $GNUSTEP_USER_CONFIG_FILE|sed -e 's/\\\\/\\\\\\\\
|
|||
AC_DEFINE_UNQUOTED(GNUSTEP_TARGET_USER_CONFIG_FILE,
|
||||
"$GNUSTEP_USER_CONFIG_FILE",
|
||||
[Built in default value for GNUstep user config file])
|
||||
GNUSTEP_CONFIG_FILE=`echo $GNUSTEP_CONFIG_FILE|sed -e 's/\\\\/\\\\\\\\/g'`
|
||||
AC_DEFINE_UNQUOTED(GNUSTEP_TARGET_CONFIG_FILE,
|
||||
"$GNUSTEP_CONFIG_FILE",
|
||||
[Built in default value for GNUstep config file])
|
||||
|
||||
#
|
||||
# Now load the values to be used in locating libraries etc used when
|
||||
# building the base library ... as supplied by the gnustep-make package
|
||||
#
|
||||
. "$GNUSTEP_MAKE_CONFIG"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use config.guess, config.sub and install-sh provided by gnustep-make
|
||||
#--------------------------------------------------------------------
|
||||
AC_CONFIG_AUX_DIR($GNUSTEP_MAKEFILES)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Use a .h file with #define's, instead of -D command-line switches
|
||||
#--------------------------------------------------------------------
|
||||
AC_CONFIG_HEADER(Headers/Additions/GNUstepBase/config.h)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Determine the host, build, and target systems
|
||||
#--------------------------------------------------------------------
|
||||
AC_CANONICAL_TARGET([])
|
||||
#
|
||||
# Add standard library and header directories for configure to use to locate
|
||||
# plain C developer headers/libraries which haver been installed in the
|
||||
# GNUstep hierarchy.
|
||||
#
|
||||
CPPFLAGS="$CPPFLAGS -I$GNUSTEP_SYSTEM_ROOT/Library/Headers"
|
||||
LDFLAGS="$LDFLAGS -L$GNUSTEP_SYSTEM_ROOT/Library/Libraries"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Find the compiler
|
||||
|
@ -403,19 +435,23 @@ AC_SUBST(ac_cv_sizeof_double)
|
|||
|
||||
AC_SUBST(ac_cv_sizeof_voidp)
|
||||
if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_int; then
|
||||
GS_ADDR="unsigned int"
|
||||
GS_SADDR="int"
|
||||
GS_UADDR="unsigned int"
|
||||
else
|
||||
if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_long; then
|
||||
GS_ADDR="unsigned long"
|
||||
GS_SADDR="long"
|
||||
GS_UADDR="unsigned long"
|
||||
else
|
||||
if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_long_long; then
|
||||
GS_ADDR="unsigned long long"
|
||||
GS_SADDR="long long"
|
||||
GS_UADDR="unsigned long long"
|
||||
else
|
||||
AC_MSG_ERROR([Unable to find integer of same size as void*])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(GS_ADDR)
|
||||
AC_SUBST(GS_SADDR)
|
||||
AC_SUBST(GS_UADDR)
|
||||
|
||||
if test $ac_cv_sizeof_short = 2; then
|
||||
GS_SINT16="signed short"
|
||||
|
@ -853,6 +889,8 @@ DEFINE_INT32_T="#define int32_t gss32"
|
|||
DEFINE_UINT32_T="#define uint32_t gsu32"
|
||||
DEFINE_INT64_T="#define int64_t gss64"
|
||||
DEFINE_UINT64_T="#define uint64_t gsu64"
|
||||
DEFINE_INTPTR_T="#define intptr_t gssaddr"
|
||||
DEFINE_UINTPTR_T="#define uintptr_t gsuaddr"
|
||||
else
|
||||
DEFINE_INT8_T=""
|
||||
DEFINE_UINT8_T=""
|
||||
|
@ -862,6 +900,8 @@ DEFINE_INT32_T=""
|
|||
DEFINE_UINT32_T=""
|
||||
DEFINE_INT64_T=""
|
||||
DEFINE_UINT64_T=""
|
||||
DEFINE_INTPTR_T=""
|
||||
DEFINE_UINTPTR_T=""
|
||||
fi
|
||||
|
||||
AC_SUBST(INCLUDE_STDINT)
|
||||
|
@ -873,6 +913,8 @@ AC_SUBST(DEFINE_INT32_T)
|
|||
AC_SUBST(DEFINE_UINT32_T)
|
||||
AC_SUBST(DEFINE_INT64_T)
|
||||
AC_SUBST(DEFINE_UINT64_T)
|
||||
AC_SUBST(DEFINE_INTPTR_T)
|
||||
AC_SUBST(DEFINE_UINTPTR_T)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# These used by GSFileHandle.m and distributed objects
|
||||
|
@ -1172,8 +1214,7 @@ AC_ARG_WITH(ffi-library,
|
|||
[ --with-ffi-library=PATH Library path for ffi (ffcall/libffi) libs],
|
||||
ffi_libdir="$withval", ffi_libdir="no")
|
||||
if test ${ffi_libdir} != "no"; then
|
||||
LDFLAGS="$LDFLAGS -L${ffi_libdir}"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -L${ffi_libdir}"
|
||||
GS_ADD_LIBRARY_PATH([${ffi_libdir}])
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(ffi.h, have_libffi=yes, have_libffi=no)
|
||||
|
@ -1288,8 +1329,7 @@ if test $found_iconv = no ; then
|
|||
libiconv_libdir="$withval", libiconv_libdir="no")
|
||||
|
||||
if test "$libiconv_libdir" != "no"; then
|
||||
LDFLAGS="$LDFLAGS -L$libiconv_libdir"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -L$libiconv_libdir"
|
||||
GS_ADD_LIBRARY_PATH([${libiconv_libdir}])
|
||||
fi
|
||||
|
||||
old_LIBS="$LIBS"
|
||||
|
@ -1413,8 +1453,7 @@ if test "$gmp_incdir" != "no"; then
|
|||
INCLUDE_FLAGS="$INCLUDE_FLAGS -I$gmp_incdir"
|
||||
fi
|
||||
if test "$gmp_libdir" != "no"; then
|
||||
LDFLAGS="$LDFLAGS -L$gmp_libdir"
|
||||
LDIR_FLAGS="$LDIR_FLAGS -L$gmp_libdir"
|
||||
GS_ADD_LIBRARY_PATH([${gmp_libdir}])
|
||||
fi
|
||||
|
||||
USE_GMP=0
|
||||
|
|
Loading…
Reference in a new issue