compatibility and portability fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29736 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-02-25 10:00:48 +00:00
parent f6f61cb578
commit 62939c969a
12 changed files with 124 additions and 36 deletions

View file

@ -1,3 +1,18 @@
2010-02-25 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: Add test for socklen_t type
* configure: regenerate
* Headers/Additions/GNUstepBase/config.h.in: regenerate
* Source/GSNetwork.h:
* Source/NSSocketPort.m: Fix for socklen_t
* Source/NSMapTable.m:
* Source/GSHTTPURLHandle.m:
* Source/NSConcreteMapTable.m:
* Source/NSConcreteHashTable.m:
* Headers/Foundation/NSHashTable.h:
* Headers/Foundation/NSMapTable.h:
Use NSUInteger values for OSX API compatibility
2010-02-25 Richard Frith-Macdonald <rfm@gnu.org>
* Source/ObjectiveC2/runtime.c:

View file

@ -214,6 +214,9 @@
/* Define to 1 if you have the <objc/runtime.h> header file. */
#undef HAVE_OBJC_RUNTIME_H
/* Define to 1 if you have the `objc_setProperty' function. */
#undef HAVE_OBJC_SETPROPERTY
/* Define to 1 if you have the `objc_sync_enter' function. */
#undef HAVE_OBJC_SYNC_ENTER
@ -292,6 +295,9 @@
/* Define to 1 if you have the `sigsetjmp' function. */
#undef HAVE_SIGSETJMP
/* Define to 1 if the system has the type `socklen_t'. */
#undef HAVE_SOCKLEN_T
/* Define to 1 if you have the `statvfs' function. */
#undef HAVE_STATVFS
@ -486,31 +492,31 @@
/* Define to 1 if the `setpgrp' function takes no argument. */
#undef SETPGRP_VOID
/* The size of a `double', as computed by sizeof. */
/* The size of `double', as computed by sizeof. */
#undef SIZEOF_DOUBLE
/* The size of a `float', as computed by sizeof. */
/* The size of `float', as computed by sizeof. */
#undef SIZEOF_FLOAT
/* The size of a `int', as computed by sizeof. */
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of a `long', as computed by sizeof. */
/* The size of `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of a `long long', as computed by sizeof. */
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of a `pthread_cond_t', as computed by sizeof. */
/* The size of `pthread_cond_t', as computed by sizeof. */
#undef SIZEOF_PTHREAD_COND_T
/* The size of a `pthread_mutex_t', as computed by sizeof. */
/* The size of `pthread_mutex_t', as computed by sizeof. */
#undef SIZEOF_PTHREAD_MUTEX_T
/* The size of a `short', as computed by sizeof. */
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of a `void*', as computed by sizeof. */
/* The size of `void*', as computed by sizeof. */
#undef SIZEOF_VOIDP
/* Define to 1 if you have the ANSI C header files. */
@ -538,5 +544,5 @@
#undef inline
#endif
/* Define to `unsigned' if <sys/types.h> does not define. */
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

View file

@ -157,11 +157,11 @@ typedef struct { void *map; void *node; size_t bucket; } NSHashEnumerator;
/** Callback functions for an NSHashTable. See NSCreateHashTable() . <br />*/
typedef struct _NSHashTableCallBacks
{
/** <code>unsigned int (*hash)(NSHashTable *, const void *)</code> ...
/** <code>NSUInteger (*hash)(NSHashTable *, const void *)</code> ...
* Hashing function. NOTE: Elements with equal values must have equal hash
* function values. The default if NULL uses the pointer addresses
* directly. <br/>*/
unsigned int (*hash)(NSHashTable *, const void *);
NSUInteger (*hash)(NSHashTable *, const void *);
/** <code>BOOL (*isEqual)(NSHashTable *, const void *, const void *)</code>
* ... Comparison function. The default if NULL uses '<code>==</code>'.
@ -192,11 +192,11 @@ GS_EXPORT const NSHashTableCallBacks NSPointerToStructHashCallBacks;
GS_EXPORT NSHashTable *
NSCreateHashTable(NSHashTableCallBacks callBacks,
unsigned int capacity);
NSUInteger capacity);
GS_EXPORT NSHashTable *
NSCreateHashTableWithZone(NSHashTableCallBacks callBacks,
unsigned int capacity,
NSUInteger capacity,
NSZone *zone);
GS_EXPORT NSHashTable *
@ -211,7 +211,7 @@ NSResetHashTable(NSHashTable *table);
GS_EXPORT BOOL
NSCompareHashTables(NSHashTable *table1, NSHashTable *table2);
GS_EXPORT unsigned int
GS_EXPORT NSUInteger
NSCountHashTable(NSHashTable *table);
GS_EXPORT void *

View file

@ -159,7 +159,7 @@ typedef struct _NSMapTableKeyCallBacks
* NOTE: Elements with equal values must
* have equal hash function values.
*/
unsigned (*hash)(NSMapTable *, const void *);
NSUInteger (*hash)(NSMapTable *, const void *);
/**
* Comparison function. Must not modify either key.
@ -242,12 +242,12 @@ GS_EXPORT const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks;
GS_EXPORT NSMapTable *
NSCreateMapTable(NSMapTableKeyCallBacks keyCallBacks,
NSMapTableValueCallBacks valueCallBacks,
unsigned int capacity);
NSUInteger capacity);
GS_EXPORT NSMapTable *
NSCreateMapTableWithZone(NSMapTableKeyCallBacks keyCallBacks,
NSMapTableValueCallBacks valueCallBacks,
unsigned int capacity,
NSUInteger capacity,
NSZone *zone);
GS_EXPORT NSMapTable *
@ -262,7 +262,7 @@ NSResetMapTable(NSMapTable *table);
GS_EXPORT BOOL
NSCompareMapTables(NSMapTable *table1, NSMapTable *table2);
GS_EXPORT unsigned int
GS_EXPORT NSUInteger
NSCountMapTable(NSMapTable *table);
GS_EXPORT BOOL

View file

@ -69,7 +69,7 @@
* in case the remote server is buggy and requires particular
* captialisation of headers (some http software is faulty like that).
*/
static unsigned int
static NSUInteger
_id_hash(void *table, NSString* o)
{
return [[o uppercaseString] hash];
@ -81,7 +81,7 @@ _id_is_equal(void *table, NSString *o, NSString *p)
return ([o caseInsensitiveCompare: p] == NSOrderedSame) ? YES : NO;
}
typedef unsigned int (*NSMT_hash_func_t)(NSMapTable *, const void *);
typedef NSUInteger (*NSMT_hash_func_t)(NSMapTable *, const void *);
typedef BOOL (*NSMT_is_equal_func_t)(NSMapTable *, const void *, const void *);
typedef void (*NSMT_retain_func_t)(NSMapTable *, const void *);
typedef void (*NSMT_release_func_t)(NSMapTable *, void *);

View file

@ -82,8 +82,10 @@
#define IN6ADDRSZ 16
#endif
#ifndef socklen_t
#define socklen_t uint32_t
#if !defined(HAVE_SOCKLEN_T)
# if !defined(socklen_t)
# define socklen_t uint32_t
# endif
#endif
#endif

View file

@ -259,7 +259,7 @@ NSCopyHashTableWithZone(NSHashTable *table, NSZone *zone)
/**
* Returns the number of items in the table.
*/
unsigned int
NSUInteger
NSCountHashTable(NSHashTable *table)
{
return [table count];
@ -275,7 +275,7 @@ NSCountHashTable(NSHashTable *table)
NSHashTable *
NSCreateHashTable(
NSHashTableCallBacks callBacks,
unsigned int capacity)
NSUInteger capacity)
{
return NSCreateHashTableWithZone(callBacks, capacity, NSDefaultMallocZone());
}
@ -292,7 +292,7 @@ NSCreateHashTable(
NSHashTable *
NSCreateHashTableWithZone(
NSHashTableCallBacks k,
unsigned int capacity,
NSUInteger capacity,
NSZone *zone)
{
GSIMapTable table;
@ -726,7 +726,7 @@ NSStringFromHashTable(NSHashTable *table)
/* These are to increase readabilty locally. */
typedef unsigned int (*NSHT_hash_func_t)(NSHashTable *, const void *);
typedef NSUInteger (*NSHT_hash_func_t)(NSHashTable *, const void *);
typedef BOOL (*NSHT_isEqual_func_t)(NSHashTable *, const void *, const void *);
typedef void (*NSHT_retain_func_t)(NSHashTable *, const void *);
typedef void (*NSHT_release_func_t)(NSHashTable *, void *);
@ -855,7 +855,7 @@ const NSHashTableCallBacks NSPointerToStructHashCallBacks =
- (NSArray*) allObjects
{
NSHashEnumerator enumerator;
unsigned index;
NSUInteger index;
NSArray *a;
GS_BEGINITEMBUF(objects, nodeCount, id);

View file

@ -385,7 +385,7 @@ NSCopyMapTableWithZone(NSMapTable *table, NSZone *zone)
/**
* Returns the number of key/value pairs in the table.
*/
unsigned int
NSUInteger
NSCountMapTable(NSMapTable *table)
{
if (table == nil)
@ -411,7 +411,7 @@ NSMapTable *
NSCreateMapTable(
NSMapTableKeyCallBacks keyCallBacks,
NSMapTableValueCallBacks valueCallBacks,
unsigned int capacity)
NSUInteger capacity)
{
return NSCreateMapTableWithZone(keyCallBacks, valueCallBacks,
capacity, NSDefaultMallocZone());
@ -430,7 +430,7 @@ NSMapTable *
NSCreateMapTableWithZone(
NSMapTableKeyCallBacks k,
NSMapTableValueCallBacks v,
unsigned int capacity,
NSUInteger capacity,
NSZone *zone)
{
GSIMapTable table;
@ -1002,7 +1002,7 @@ NSStringFromMapTable(NSMapTable *table)
/* These are to increase readabilty locally. */
typedef unsigned int (*NSMT_hash_func_t)(NSMapTable *, const void *);
typedef NSUInteger (*NSMT_hash_func_t)(NSMapTable *, const void *);
typedef BOOL (*NSMT_is_equal_func_t)(NSMapTable *, const void *, const void *);
typedef void (*NSMT_retain_func_t)(NSMapTable *, const void *);
typedef void (*NSMT_release_func_t)(NSMapTable *, void *);

View file

@ -133,14 +133,16 @@ static Class concreteClass = 0;
- (NSUInteger) count
{
return (NSUInteger)[self subclassResponsibility: _cmd];
[self subclassResponsibility: _cmd];
return (NSUInteger)0;
}
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
objects: (id*)stackbuf
count: (NSUInteger)len
{
return (NSUInteger)[self subclassResponsibility: _cmd];
[self subclassResponsibility: _cmd];
return (NSUInteger)0;
}
- (NSDictionary*) dictionaryRepresentation
@ -201,7 +203,7 @@ static Class concreteClass = 0;
- (void) removeAllObjects
{
unsigned count = [self count];
NSUInteger count = [self count];
if (count > 0)
{

View file

@ -2150,7 +2150,7 @@ static Class tcpPortClass;
#endif
{
struct sockaddr_in sockAddr;
size_t size = sizeof(sockAddr);
socklen_t size = sizeof(sockAddr);
desc = accept(listener, (struct sockaddr*)&sockAddr, &size);
if (desc == INVALID_SOCKET)

62
configure vendored
View file

@ -11372,6 +11372,68 @@ fi
done
{ echo "$as_me:$LINENO: checking for socklen_t" >&5
echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; }
if test "${ac_cv_type_socklen_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
typedef socklen_t ac__type_new_;
int
main ()
{
if ((ac__type_new_ *) 0)
return 0;
if (sizeof (ac__type_new_))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_cv_type_socklen_t=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_socklen_t=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; }
if test $ac_cv_type_socklen_t = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_SOCKLEN_T 1
_ACEOF
fi
#--------------------------------------------------------------------
# These headers/functions needed for stacktrace in NSException.m

View file

@ -802,6 +802,7 @@ fi
# These headers/functions needed by GSTcpPort.m
#--------------------------------------------------------------------
AC_CHECK_HEADERS(sys/socket.h netinet/in.h)
AC_CHECK_TYPES([socklen_t])
dnl AC_REPLACE_FUNCS(recvfrom)
#--------------------------------------------------------------------