Mostly deprectation changes, one possible obscure buffer overrun fix.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26621 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2008-06-10 11:17:13 +00:00
parent e0711a3b8d
commit 714fcdff11
14 changed files with 54 additions and 17 deletions

View file

@ -1,3 +1,21 @@
2008-06-10 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: Check for stdlib.h
* Headers/Additions/GNUstepBase/config.h.in: add stdlib.h
* configure: Regenerate
* Source/NSString.m: Don't use realpath unless PATH_MAX is known
* Headers/Foundation/NSObject.h:
* Headers/Foundation/NSString.h:
* Headers/Foundation/NSBundle.h:
* Headers/Foundation/NSSerialization.h:
* Headers/Foundation/NSProcessInfo.h:
* Headers/Foundation/NSMethodSignature.h:
* Headers/Foundation/NSHost.h:
* Headers/Foundation/NSArchiver.h:
* Headers/Foundation/NSInvocation.h:
Mark non-OSX methods as deprecated so we can move them to the
additions library or delete them if we want to.
2008-06-08 Richard Frith-Macdonald <rfm@gnu.org>
* COPYINGv3:

View file

@ -298,6 +298,9 @@
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define if libxml available */
#undef HAVE_LIBXML

View file

@ -92,7 +92,7 @@ extern "C" {
#endif
@end
#if OS_API_VERSION(GS_API_NONE,GS_API_NONE)
#if OS_API_VERSION(GS_API_NONE,011700)
@interface NSArchiver (GNUstep)
/*

View file

@ -414,7 +414,7 @@ GS_EXPORT NSString* const NSLoadedClasses;
#endif
@end
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
#if OS_API_VERSION(GS_API_NONE, 011700)
/**
* Augments [NSBundle], including methods for handling libraries in the GNUstep
* fashion, for rapid localization, and other purposes.

View file

@ -112,6 +112,8 @@ extern "C" {
@end
#if OS_API_VERSION(GS_API_NONE,011700)
/**
* Adds synonym for +currentHost.
*/
@ -122,6 +124,7 @@ extern "C" {
*/
+ (NSHost*) localHost; /* All local IP addresses */
@end
#endif
#if defined(__cplusplus)
}

View file

@ -95,7 +95,7 @@ extern "C" {
@end
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
#if OS_API_VERSION(GS_API_NONE, 011700)
@interface NSInvocation (GNUstep)
/**
* Returns the status of the flag set by -setSendsToSuper:

View file

@ -153,7 +153,7 @@ typedef struct {
@end
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
#if OS_API_VERSION(GS_API_NONE, 011700)
/**
* Declares a convenience method for getting the entire array of raw type and
* size information.

View file

@ -305,6 +305,7 @@ GS_EXPORT NSRecursiveLock *gnustep_global_lock;
Removed because OpenStep has -(NSString*)name; */
@end
#if GS_API_VERSION(GS_API_NONE, 011700)
@interface NSObject (GNUstep)
- (BOOL) isInstance;
- (id) makeImmutableCopyOnFail: (BOOL)force;
@ -315,6 +316,7 @@ GS_EXPORT NSRecursiveLock *gnustep_global_lock;
- (id) read: (TypedStream*)aStream;
- (id) write: (TypedStream*)aStream;
@end
#endif
/**
* Provides a number of GNUstep-specific methods that are used to aid

View file

@ -199,7 +199,7 @@ enum {
#endif
@end
#if OS_API_VERSION(GS_API_NONE,GS_API_NONE)
#if OS_API_VERSION(GS_API_NONE,011700)
/**
* Provides GNUstep-specific methods for controlled debug logging (a GNUstep

View file

@ -92,7 +92,7 @@ extern "C" {
intoData: (NSMutableData*)d;
@end
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
#if OS_API_VERSION(GS_API_NONE, 011700)
/**
* GNUstep extends serialization by having the option to make the
* resulting data more compact by ensuring that repeated strings

View file

@ -757,7 +757,7 @@ typedef NSUInteger NSStringEncodingConversionOptions;
extern struct objc_class _NSConstantStringClassReference;
#endif
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
#if OS_API_VERSION(GS_API_NONE, 011700)
@interface NSMutableString (GNUstep)
- (NSString*) immutableProxy;

View file

@ -79,7 +79,12 @@
#include "Foundation/NSKeyedArchiver.h"
#include "GNUstepBase/GSMime.h"
#include "GSPrivate.h"
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@ -3824,16 +3829,20 @@ static NSFileManager *fm = nil;
#if defined(__MINGW32__)
return IMMUTABLE(self);
#else
#ifndef MAX_PATH
#define MAX_PATH 1024
#ifndef PATH_MAX
#define PATH_MAX 1024
/* Don't use realpath unless we know we have the correct path size limit */
#ifdef HAVE_REALPATH
#undef HAVE_REALPATH
#endif
char newBuf[MAX_PATH];
#endif
char newBuf[PATH_MAX];
#ifdef HAVE_REALPATH
if (realpath([self fileSystemRepresentation], newBuf) == 0)
return IMMUTABLE(self);
#else
char extra[MAX_PATH];
char extra[PATH_MAX];
char *dest;
const char *name = [self fileSystemRepresentation];
const char *start;
@ -3842,7 +3851,7 @@ static NSFileManager *fm = nil;
if (name[0] != '/')
{
if (!getcwd(newBuf, MAX_PATH))
if (!getcwd(newBuf, PATH_MAX))
{
return IMMUTABLE(self); /* Couldn't get directory. */
}
@ -3900,7 +3909,7 @@ static NSFileManager *fm = nil;
{
*dest++ = '/';
}
if (&dest[len] >= &newBuf[MAX_PATH])
if (&dest[len] >= &newBuf[PATH_MAX])
{
return IMMUTABLE(self); /* Resolved name too long. */
}
@ -3914,20 +3923,20 @@ static NSFileManager *fm = nil;
}
if (S_ISLNK(st.st_mode))
{
char buf[MAX_PATH];
char buf[PATH_MAX];
if (++num_links > MAXSYMLINKS)
{
return IMMUTABLE(self); /* Too many links. */
}
n = readlink(newBuf, buf, MAX_PATH);
n = readlink(newBuf, buf, PATH_MAX);
if (n < 0)
{
return IMMUTABLE(self); /* Couldn't resolve. */
}
buf[n] = '\0';
if ((n + strlen(end)) >= MAX_PATH)
if ((n + strlen(end)) >= PATH_MAX)
{
return IMMUTABLE(self); /* Path too long. */
}

3
configure vendored
View file

@ -13629,7 +13629,8 @@ _ACEOF
for ac_header in libc.h limits.h malloc.h memory.h string.h signal.h sys/signal.h sys/wait.h sys/file.h sys/fcntl.h sys/ioctl.h sys/stropts.h unistd.h utime.h stdint.h inttypes.h sys/inttypes.h
for ac_header in libc.h limits.h malloc.h memory.h string.h signal.h stdlib.h sys/signal.h sys/wait.h sys/file.h sys/fcntl.h sys/ioctl.h sys/stropts.h unistd.h utime.h stdint.h inttypes.h sys/inttypes.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then

View file

@ -1521,6 +1521,7 @@ AC_DEFINE_UNQUOTED(HAVE_PTS_STREAM_MODULES, $HAVE_PTS_STREAM_MODULES,
AC_SUBST(HAVE_PTS_STREAM_MODULES)
AC_CHECK_HEADERS(libc.h limits.h malloc.h memory.h string.h signal.h dnl
stdlib.h dnl
sys/signal.h sys/wait.h sys/file.h sys/fcntl.h sys/ioctl.h dnl
sys/stropts.h unistd.h utime.h stdint.h inttypes.h sys/inttypes.h)