More code tidyups and NSError updates.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23921 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-10-20 10:56:27 +00:00
parent 6ba4584136
commit 9e7b96ab0e
87 changed files with 746 additions and 539 deletions

View file

@ -1,3 +1,98 @@
2006-10-20 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSPrivate.m:
* Source/GSFormat.h:
Deleted unused files.
* Headers/Foundation/NSError.h:
* Source/NSError.m:
Updated to current MacOS-X spec.
* Source/NSIndexPath.m:
* Source/NSSocketPortNameServer.m:
* Source/NSTimeZone.m:
* Source/NSHashTable.m:
* Source/NSBundle.m:
* Source/NSPropertyList.m:
* Source/libgnustep-base-entry.m:
* Source/GSConcreteValueTemplate.m:
* Source/NSScanner.m:
* Source/NSProcessInfo.m:
* Source/NSGeometry.m:
* Source/NSSocketPort.m:
* Source/NSUndoManager.m:
* Source/NSMethodSignature.m:
* Source/NSFormatter.m:
* Source/NSUserDefaults.m:
* Source/NSArray.m:
* Source/NSMessagePortNameServer.m:
* Source/objc-gnu2next.m:
* Source/GSStream.m:
* Source/NSDebug.m:
* Source/unix/GSRunLoopCtxt.m:
* Source/GSConcreteValue.m:
* Source/NSDistributedLock.m:
* Source/NSFileHandle.m:
* Source/preface.m:
* Source/NSAssertionHandler.m:
* Source/NSConcreteNumberTemplate.m:
* Source/GSHTTPURLHandle.m:
* Source/NSZone.m:
* Source/NSCallBacks.m:
* Source/NSMessagePort.m:
* Source/GSDictionary.m:
* Source/GSPrivate.h:
* Source/GSCountedSet.m:
* Source/win32/GSFileHandleWin32.m:
* Source/win32/GSRunLoopCtxt.m:
* Source/win32/NSMessagePortWin32.m:
* Source/win32/NSStreamWin32.m:
* Source/NSFileManager.m:
* Source/NSConcreteNumber.m:
* Source/NSNotificationCenter.m:
* Source/externs.m:
* Source/NSRange.m:
* Source/NSException.m:
* Source/NSCopyObject.m:
* Source/mframe.m:
* Source/NSObject.m:
* Source/NSString.m:
* Source/Additions/Unicode.m:
* Source/Additions/GNUmakefile:
* Source/Additions/GSCompatibility.m:
* Source/Additions/GSCategories.m:
* Source/GSSet.m:
* Source/GSString.m:
* Source/NSThread.m:
* Source/NSData.m:
* Source/NSHost.m:
* Source/NSProxy.m:
* Source/NSProtocolChecker.m:
* Source/NSPipe.m:
* Source/GSValue.m:
* Source/NSDictionary.m:
* Source/NSClassDescription.m:
* Source/NSSerializer.m:
* Source/NSNull.m:
* Source/NSValue.m:
* Source/NSCountedSet.m:
* Source/NSLog.m:
* Source/GSFormat.m:
* Source/NSIndexSet.m:
* Source/GSFileHandle.m:
* Source/NSLock.m:
* Source/NSDistantObject.m:
* Source/NSTask.m:
* Source/NSPortNameServer.m:
* Source/NSNumberFormatter.m:
* Source/NSXMLParser.m:
* Source/GSFTPURLHandle.m:
* Source/NSEnumerator.m:
* Source/GSURLPrivate.h:
* SSL/GSSSLHandle.m:
Move from GSPrivate class to GSPrivate functions as majority prefer
that. Make some more private functions use GSPrivate prefix and be
unlinkable outside base. Rationalise error string generation.
Tidy up FSF address in comments.
2006-10-19 Richard Frith-Macdonald <rfm@gnu.org> 2006-10-19 Richard Frith-Macdonald <rfm@gnu.org>
* Documentation/manual/DistributedObjects.texi: Update for current API * Documentation/manual/DistributedObjects.texi: Update for current API

View file

@ -1,5 +1,5 @@
/** Interface for NSError for GNUStep /** Interface for NSError for GNUStep
Copyright (C) 2004 Free Software Foundation, Inc. Copyright (C) 2004,2006 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org> Written by: Richard Frith-Macdonald <rfm@gnu.org>
Date: May 2004 Date: May 2004
@ -27,15 +27,16 @@
#ifndef __NSError_h_GNUSTEP_BASE_INCLUDE #ifndef __NSError_h_GNUSTEP_BASE_INCLUDE
#define __NSError_h_GNUSTEP_BASE_INCLUDE #define __NSError_h_GNUSTEP_BASE_INCLUDE
#ifndef STRICT_OPENSTEP
#include <Foundation/NSObject.h> #include <Foundation/NSObject.h>
#if OS_API_VERSION(100300,GS_API_LATEST)
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
@class NSDictionary, NSString; @class NSArray, NSDictionary, NSString;
/** /**
* Key for user info dictionary component which describes the error in * Key for user info dictionary component which describes the error in
@ -49,6 +50,42 @@ GS_EXPORT NSString* const NSLocalizedDescriptionKey;
*/ */
GS_EXPORT NSString* const NSUnderlyingErrorKey; GS_EXPORT NSString* const NSUnderlyingErrorKey;
#if OS_API_VERSION(100400,GS_API_LATEST)
/**
* This key can be used to store the file path of a resource involved
* in the error (eg unreadable file).
*/
GS_EXPORT NSString* const NSFilePathErrorKey;
/**
* Key for an [NSNumber] containing an NSStringEncoding value.
*/
GS_EXPORT NSString* const NSStringEncodingErrorKey;
/**
* This can be used to store the URLK involved in the error.
*/
GS_EXPORT NSString* const NSURLErrorKey;
/**
* Key to store a string describing what caused the error to occur.
*/
GS_EXPORT NSString* const NSLocalizedFailureReasonErrorKey;
/**
* Key to store an [NSArray] of strings suitable for use as the
* titles of buttons in an alert panel used to attempt error
* recovery in a GUI application.
*/
GS_EXPORT NSString* const NSLocalizedRecoveryOptionsErrorKey;
/**
* Key to store a string providing a hint on how to use the buttons
* in an alert panel.
*/
GS_EXPORT NSString* const NSLocalizedRecoverySuggestionErrorKey;
/**
* Key to store an object which can be used to attempt to recover from
* the error.
*/
GS_EXPORT NSString* const NSRecoveryAttempterErrorKey;
#endif
/** /**
* Domain for system errors (on MACH). * Domain for system errors (on MACH).
*/ */
@ -61,11 +98,21 @@ GS_EXPORT NSString* const NSOSStatusErrorDomain;
* Domain for system and system library errors. * Domain for system and system library errors.
*/ */
GS_EXPORT NSString* const NSPOSIXErrorDomain; GS_EXPORT NSString* const NSPOSIXErrorDomain;
#if OS_API_VERSION(100400,GS_API_LATEST)
/**
* Domain for Foundation and AppKit (base and gui) errors.
*/
GS_EXPORT NSString* const NSCocoaErrorDomain;
#endif
/** /**
* Error information class. * Error information class.<br />
* NSError instances are used to pass information about runtime errors
* from lower levels to higher levels of the program.<br />
* These should be used instead of exceptions where an error is caused
* by external factors (such as a resource file not being present)
* rather than a programming error (where NSException should be used).
*/ */
// TODO: document what this is for, especially since it's not in OS X
@interface NSError : NSObject <NSCopying, NSCoding> @interface NSError : NSObject <NSCopying, NSCoding>
{ {
@private @private
@ -101,13 +148,49 @@ GS_EXPORT NSString* const NSPOSIXErrorDomain;
code: (int)aCode code: (int)aCode
userInfo: (NSDictionary*)aDictionary; userInfo: (NSDictionary*)aDictionary;
/** <override-subclass /> /**
* Return a human readable description for the error.<br /> * Return a human readable description for the error.<br />
* The default implementation uses the value from the user info dictionary * The default implementation uses the value from the user info dictionary
* if it is available, otherwise it generates a generic one from domain * if it is available, otherwise it generates a generic one from domain
* and code. * and code.
*/ */
- (NSString *)localizedDescription; - (NSString *) localizedDescription;
#if OS_API_VERSION(100400,GS_API_LATEST)
/**
* Return a human readable explanation of the reason for the error
* (if known). This should normally be a more discursive explanation
* then the short one provided by the -localizedDescription method.<br />
* The default implementation uses the value from the user info dictionary
* if it is available, otherwise it returns nil.
*/
- (NSString *) localizedFailureReason;
/**
* Returns an array of strings to be used as titles of buttons in an
* alert panel when offering the user optionbs to try to recover from
* the error.<br />
* The default implementation uses the value from the user info dictionary
* if it is available, otherwise it returns nil.
*/
- (NSArray *) localizedRecoveryOptions;
/**
* Returns a string used as the secondary text in an alert panel,
* suggesting how the user might select an option to attempt to
* recover from the error.<br />
* The default implementation uses the value from the user info dictionary
* if it is available, otherwise it returns nil.
*/
- (NSString *) localizedRecoverySuggestion;
/**
* Not yet useful in GNUstep.<br />
* The default implementation uses the value from the user info dictionary
* if it is available, otherwise it returns nil.
*/
- (id) recoveryAttempter;
#endif
/** /**
* Return the user info for this instance (or nil if none is set)<br /> * Return the user info for this instance (or nil if none is set)<br />
@ -124,5 +207,6 @@ GS_EXPORT NSString* const NSPOSIXErrorDomain;
} }
#endif #endif
#endif /* STRICT_OPENSTEP */ #endif
#endif /* __NSError_h_GNUSTEP_BASE_INCLUDE*/ #endif /* __NSError_h_GNUSTEP_BASE_INCLUDE*/

View file

@ -80,10 +80,9 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <errno.h>
static NSString* static NSString*
sslError(int err, int e) sslError(int err)
{ {
NSString *str; NSString *str;
@ -107,8 +106,12 @@ sslError(int err, int e)
str = @"Want X509 Lookup Error"; str = @"Want X509 Lookup Error";
break; break;
case SSL_ERROR_SYSCALL: case SSL_ERROR_SYSCALL:
str = [NSString stringWithFormat: @"Syscall error %d - %@", {
e, [_GSPrivate error: e]]; NSError *e = [NSError _last];
str = [NSString stringWithFormat: @"Syscall error %d - %@",
[e code], [e description]];
}
break; break;
case SSL_ERROR_SSL: case SSL_ERROR_SSL:
str = @"SSL Error: really helpful"; str = @"SSL Error: really helpful";
@ -224,7 +227,6 @@ sslError(int err, int e)
} }
if (ret != 1) if (ret != 1)
{ {
int e = errno;
NSDate *final; NSDate *final;
NSDate *when; NSDate *when;
NSTimeInterval last = 0.0; NSTimeInterval last = 0.0;
@ -253,7 +255,6 @@ sslError(int err, int e)
ret = SSL_accept(ssl); ret = SSL_accept(ssl);
if (ret != 1) if (ret != 1)
{ {
e = errno;
err = SSL_get_error(ssl, ret); err = SSL_get_error(ssl, ret);
} }
else else
@ -271,7 +272,7 @@ sslError(int err, int e)
* Some other error ... not just a timeout or disconnect * Some other error ... not just a timeout or disconnect
*/ */
NSLog(@"unable to accept SSL connection from %@:%@ - %@", NSLog(@"unable to accept SSL connection from %@:%@ - %@",
address, service, sslError(err, e)); address, service, sslError(err));
ERR_print_errors_fp(stderr); ERR_print_errors_fp(stderr);
} }
@ -330,7 +331,6 @@ sslError(int err, int e)
} }
if (ret != 1) if (ret != 1)
{ {
int e = errno;
NSDate *final; NSDate *final;
NSDate *when; NSDate *when;
NSTimeInterval last = 0.0; NSTimeInterval last = 0.0;
@ -359,7 +359,6 @@ sslError(int err, int e)
ret = SSL_connect(ssl); ret = SSL_connect(ssl);
if (ret != 1) if (ret != 1)
{ {
e = errno;
err = SSL_get_error(ssl, ret); err = SSL_get_error(ssl, ret);
} }
else else
@ -371,13 +370,14 @@ sslError(int err, int e)
RELEASE(final); RELEASE(final);
if (err != SSL_ERROR_NONE) if (err != SSL_ERROR_NONE)
{ {
if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE)
if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE)
{ {
/* /*
* Some other error ... not just a timeout or disconnect * Some other error ... not just a timeout or disconnect
*/ */
NSLog(@"unable to make SSL connection to %@:%@ - %@", NSLog(@"unable to make SSL connection to %@:%@ - %@",
address, service, sslError(err, e)); address, service, sslError(err));
ERR_print_errors_fp(stderr); ERR_print_errors_fp(stderr);
} }
RELEASE(self); RELEASE(self);
@ -439,7 +439,7 @@ sslError(int err, int e)
if (ret != 1) if (ret != 1)
{ {
NSLog(@"Failed to set certificate file to %@ - %@", NSLog(@"Failed to set certificate file to %@ - %@",
certFile, sslError(ERR_get_error(), errno)); certFile, sslError(ERR_get_error()));
} }
} }
if ([privateKey length] > 0) if ([privateKey length] > 0)
@ -449,7 +449,7 @@ sslError(int err, int e)
if (ret != 1) if (ret != 1)
{ {
NSLog(@"Failed to set private key file to %@ - %@", NSLog(@"Failed to set private key file to %@ - %@",
privateKey, sslError(ERR_get_error(), errno)); privateKey, sslError(ERR_get_error()));
} }
} }
} }

View file

@ -40,7 +40,6 @@ Additions_OBJC_FILES =\
GSMime.m \ GSMime.m \
GSXML.m \ GSXML.m \
GSFunctions.m \ GSFunctions.m \
GSPrivate.m \
behavior.m behavior.m
ifneq ($(OBJC_RUNTIME_LIB), gnu) ifneq ($(OBJC_RUNTIME_LIB), gnu)

View file

@ -900,6 +900,80 @@ static void MD5Transform (uint32_t buf[4], uint32_t const in[16])
} }
@end @end
/**
* GNUstep specific (non-standard) additions to the NSError class.
* Possibly to be made public
*/
@implementation NSError(GSCategories)
#ifndef HAVE_STRERROR
static const char *
strerror(int eno)
{
extern char *sys_errlist[];
extern int sys_nerr;
if (eno < 0 || eno >= sys_nerr)
{
return("unknown error number");
}
return(sys_errlist[eno]);
}
#endif
/*
* Returns an NSError instance encapsulating the last system error.
* The user info dictionary of this object will be mutable, so that
* additional information can be placed in it by higher level code.
*/
+ (NSError*) _last
{
NSError *error;
NSString *domain;
NSDictionary *info;
long code;
#if defined(__MINGW32__)
LPVOID lpMsgBuf;
NSString *message;
code = GetLastError();
domain = NSOSStatusErrorDomain;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR) &lpMsgBuf, 0, NULL );
message = [NSString stringWithCharacters: lpMsgBuf length: wcslen(lpMsgBuf)];
LocalFree(lpMsgBuf);
info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, NSLocalizedDescriptionKey,
nil];
#else
extern int errno;
NSString *message;
code = errno;
/* FIXME ... not all are POSIX, should we use NSMachErrorDomain for some? */
domain = NSPOSIXErrorDomain;
message = [NSString stringWithCString: strerror(code)
encoding: [NSString defaultCStringEncoding]];
/* FIXME ... can we do better localisation? */
info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, NSLocalizedDescriptionKey,
nil];
#endif
/* NB we use a mutable dictionary so that calling code can add extra
* information to the dictionary before passing it up to higher level
* code.
*/
error = [self errorWithDomain: domain code: code userInfo: info];
return error;
}
@end
/** /**
* GNUstep specific (non-standard) additions to the NSNumber class. * GNUstep specific (non-standard) additions to the NSNumber class.
*/ */

View file

@ -250,7 +250,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0) if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0)
{ {
NSLog(@"unable to create socket - %@", [_GSPrivate error]); NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self); RELEASE(self);
return nil; return nil;
} }
@ -268,7 +268,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) < 0) if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) < 0)
{ {
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr), NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
NSSwapBigShortToHost(sin.sin_port), [_GSPrivate error]); NSSwapBigShortToHost(sin.sin_port), [NSError _last]);
(void) close(net); (void) close(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -276,7 +276,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if (listen(net, 5) < 0) if (listen(net, 5) < 0)
{ {
NSLog(@"unable to listen on port - %@", [_GSPrivate error]); NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) close(net); (void) close(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -284,7 +284,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if (getsockname(net, (struct sockaddr*)&sin, &size) < 0) if (getsockname(net, (struct sockaddr*)&sin, &size) < 0)
{ {
NSLog(@"unable to get socket name - %@", [_GSPrivate error]); NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) close(net); (void) close(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -313,7 +313,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
if (getsockname([self fileDescriptor], (struct sockaddr*)&sin, &size) < 0) if (getsockname([self fileDescriptor], (struct sockaddr*)&sin, &size) < 0)
{ {
NSLog(@"unable to get socket name - %@", [_GSPrivate error]); NSLog(@"unable to get socket name - %@", [NSError _last]);
return nil; return nil;
} }

View file

@ -1,81 +0,0 @@
/* Private internal methods for use within the base library
Copyright (C) 2006 Free Software Foundation, Inc.
Written by: Richard Frith-Macdonald <rfm@gnu.org>
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/
#include "config.h"
#include <string.h>
#include <Foundation/Foundation.h>
#include "GNUstepBase/GSCategories.h"
#include "GNUstepBase/GSLock.h"
#include "GSPrivate.h"
/* Test for ASCII whitespace which is safe for unicode characters */
#define space(C) ((C) > 127 ? NO : isspace(C))
#ifndef HAVE_STRERROR
const char *
strerror(int eno)
{
extern char *sys_errlist[];
extern int sys_nerr;
if (eno < 0 || eno >= sys_nerr)
{
return("unknown error number");
}
return(sys_errlist[eno]);
}
#endif
@implementation GSPrivate
- (NSString*) error
{
#if defined(__MINGW32__)
return [self error: GetLastError()];
#else
extern int errno;
return [self error: errno];
#endif
}
- (NSString*) error: (long)number
{
NSString *text;
#if defined(__MINGW32__)
LPVOID lpMsgBuf;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, number, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR) &lpMsgBuf, 0, NULL );
text = [NSString stringWithCharacters: lpMsgBuf length: wcslen(lpMsgBuf)];
LocalFree(lpMsgBuf);
#else
text = [NSString stringWithCString: strerror(number)
encoding: [NSString defaultCStringEncoding]];
#endif
return text;
}
@end

View file

@ -33,6 +33,7 @@
#include <Foundation/NSArray.h> #include <Foundation/NSArray.h>
#include <Foundation/NSBundle.h> #include <Foundation/NSBundle.h>
#include <Foundation/NSDictionary.h> #include <Foundation/NSDictionary.h>
#include <Foundation/NSError.h>
#include <Foundation/NSException.h> #include <Foundation/NSException.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
#include <Foundation/NSLock.h> #include <Foundation/NSLock.h>
@ -331,7 +332,8 @@ static void GSSetupEncodingTable(void)
} }
} }
static BOOL isEncodingSupported(NSStringEncoding enc) BOOL
GSPrivateIsEncodingSupported(NSStringEncoding enc)
{ {
GSSetupEncodingTable(); GSSetupEncodingTable();
@ -1160,7 +1162,7 @@ tables:
const char *estr = 0; const char *estr = 0;
BOOL done = NO; BOOL done = NO;
if (isEncodingSupported(enc) == YES) if (GSPrivateIsEncodingSupported(enc) == YES)
{ {
estr = encodingTable[enc]->iconv; estr = encodingTable[enc]->iconv;
} }
@ -1181,7 +1183,7 @@ tables:
if (cd == (iconv_t)-1) if (cd == (iconv_t)-1)
{ {
NSLog(@"No iconv for encoding %@ tried to use %s", NSLog(@"No iconv for encoding %@ tried to use %s",
[_GSPrivate encodingName: enc], estr); GSPrivateEncodingName(enc), estr);
result = NO; result = NO;
goto done; goto done;
} }
@ -1853,7 +1855,7 @@ iconv_start:
const char *estr = 0; const char *estr = 0;
BOOL done = NO; BOOL done = NO;
if (isEncodingSupported(enc) == YES) if (GSPrivateIsEncodingSupported(enc) == YES)
{ {
if (strict == NO) if (strict == NO)
{ {
@ -1886,7 +1888,7 @@ iconv_start:
if (cd == (iconv_t)-1) if (cd == (iconv_t)-1)
{ {
NSLog(@"No iconv for encoding %@ tried to use %s", NSLog(@"No iconv for encoding %@ tried to use %s",
[_GSPrivate encodingName: enc], estr); GSPrivateEncodingName(enc), estr);
result = NO; result = NO;
goto done; goto done;
} }
@ -2043,9 +2045,10 @@ iconv_start:
#undef GROW #undef GROW
@implementation GSPrivate (Unicode)
- (NSStringEncoding*) availableEncodings
NSStringEncoding*
GSPrivateAvailableEncodings()
{ {
if (_availableEncodings == 0) if (_availableEncodings == 0)
{ {
@ -2068,7 +2071,7 @@ iconv_start:
pos = 0; pos = 0;
for (i = 0; i < encTableSize+1; i++) for (i = 0; i < encTableSize+1; i++)
{ {
if (isEncodingSupported(i) == YES) if (GSPrivateIsEncodingSupported(i) == YES)
{ {
encodings[pos++] = i; encodings[pos++] = i;
} }
@ -2081,7 +2084,8 @@ iconv_start:
return _availableEncodings; return _availableEncodings;
} }
- (NSStringEncoding) defaultCStringEncoding NSStringEncoding
GSPrivateDefaultCStringEncoding()
{ {
if (defEnc == GSUndefinedEncoding) if (defEnc == GSUndefinedEncoding)
{ {
@ -2233,7 +2237,7 @@ iconv_start:
#endif #endif
defEnc = NSISOLatin1StringEncoding; defEnc = NSISOLatin1StringEncoding;
} }
else if (isEncodingSupported(defEnc) == NO) else if (GSPrivateIsEncodingSupported(defEnc) == NO)
{ {
fprintf(stderr, "WARNING: %s - encoding not implemented as " fprintf(stderr, "WARNING: %s - encoding not implemented as "
"default c string encoding.\n", encoding); "default c string encoding.\n", encoding);
@ -2246,28 +2250,24 @@ iconv_start:
return defEnc; return defEnc;
} }
- (NSString*) encodingName: (NSStringEncoding)encoding NSString*
GSPrivateEncodingName(NSStringEncoding encoding)
{ {
if (isEncodingSupported(encoding) == NO) if (GSPrivateIsEncodingSupported(encoding) == NO)
{ {
return @"Unknown encoding"; return @"Unknown encoding";
} }
return [NSString stringWithUTF8String: encodingTable[encoding]->ename]; return [NSString stringWithUTF8String: encodingTable[encoding]->ename];
} }
- (BOOL) isByteEncoding: (NSStringEncoding)encoding BOOL
GSPrivateIsByteEncoding(NSStringEncoding encoding)
{ {
if (isEncodingSupported(encoding) == NO) if (GSPrivateIsEncodingSupported(encoding) == NO)
{ {
return NO; return NO;
} }
return encodingTable[encoding]->eightBit; return encodingTable[encoding]->eightBit;
} }
- (BOOL) isEncodingSupported: (NSStringEncoding)encoding
{
return isEncodingSupported(encoding);
}
@end

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include "config.h" #include "config.h"

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include "config.h" #include "config.h"

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */

View file

@ -979,7 +979,7 @@ static NSLock *urlLock = nil;
*/ */
[self backgroundLoadDidFailWithReason: [NSString stringWithFormat: [self backgroundLoadDidFailWithReason: [NSString stringWithFormat:
@"Unable to connect to %@:%@ ... %@", @"Unable to connect to %@:%@ ... %@",
host, port, [_GSPrivate error]]]; host, port, [NSError _last]]];
return; return;
} }
cHandle = [[GSTelnetHandle alloc] initWithHandle: sock isConnected: NO]; cHandle = [[GSTelnetHandle alloc] initWithHandle: sock isConnected: NO];

View file

@ -798,7 +798,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1) if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1)
{ {
NSLog(@"unable to create socket - %@", [_GSPrivate error: errno]); NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self); RELEASE(self);
return nil; return nil;
} }
@ -813,7 +813,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (bind(net, (struct sockaddr *)&lsin, sizeof(lsin)) == -1) if (bind(net, (struct sockaddr *)&lsin, sizeof(lsin)) == -1)
{ {
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(lsin.sin_addr), NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(lsin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error: errno]); GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
(void) close(net); (void) close(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -833,7 +833,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
NSLog(@"unable to make connection to %s:%d - %@", NSLog(@"unable to make connection to %s:%d - %@",
inet_ntoa(sin.sin_addr), inet_ntoa(sin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]); GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
RELEASE(self); RELEASE(self);
return nil; return nil;
} }
@ -897,7 +897,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1) if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1)
{ {
NSLog(@"unable to create socket - %@", [_GSPrivate error]); NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self); RELEASE(self);
return nil; return nil;
} }
@ -915,7 +915,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) == -1) if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) == -1)
{ {
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr), NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]); GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
(void) close(net); (void) close(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -923,7 +923,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (listen(net, 256) == -1) if (listen(net, 256) == -1)
{ {
NSLog(@"unable to listen on port - %@", [_GSPrivate error]); NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) close(net); (void) close(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -931,7 +931,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getsockname(net, (struct sockaddr*)&sin, &size) == -1) if (getsockname(net, (struct sockaddr*)&sin, &size) == -1)
{ {
NSLog(@"unable to get socket name - %@", [_GSPrivate error]); NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) close(net); (void) close(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -1097,7 +1097,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (fstat(desc, &sbuf) < 0) if (fstat(desc, &sbuf) < 0)
{ {
NSLog(@"unable to get status of descriptor %d - %@", NSLog(@"unable to get status of descriptor %d - %@",
desc, [_GSPrivate error]); desc, [NSError _last]);
} }
else else
{ {
@ -1319,7 +1319,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"unable to read from descriptor - %@", format: @"unable to read from descriptor - %@",
[_GSPrivate error]]; [NSError _last]];
} }
return d; return d;
} }
@ -1344,7 +1344,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"unable to read from descriptor - %@", format: @"unable to read from descriptor - %@",
[_GSPrivate error]]; [NSError _last]];
} }
return d; return d;
} }
@ -1370,7 +1370,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"unable to read from descriptor - %@", format: @"unable to read from descriptor - %@",
[_GSPrivate error]]; [NSError _last]];
} }
[d setLength: got]; [d setLength: got];
} }
@ -1393,7 +1393,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"unable to read from descriptor - %@", format: @"unable to read from descriptor - %@",
[_GSPrivate error]]; [NSError _last]];
} }
} }
while (len > 0 && got > 0); while (len > 0 && got > 0);
@ -1439,7 +1439,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"unable to write to descriptor - %@", format: @"unable to write to descriptor - %@",
[_GSPrivate error]]; [NSError _last]];
} }
} }
@ -1545,7 +1545,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"failed to move to offset in file - %@", format: @"failed to move to offset in file - %@",
[_GSPrivate error]]; [NSError _last]];
} }
return (unsigned long long)result; return (unsigned long long)result;
} }
@ -1569,7 +1569,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"failed to move to offset in file - %@", format: @"failed to move to offset in file - %@",
[_GSPrivate error]]; [NSError _last]];
} }
return (unsigned long long)result; return (unsigned long long)result;
} }
@ -1593,7 +1593,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"failed to move to offset in file - %@", format: @"failed to move to offset in file - %@",
[_GSPrivate error]]; [NSError _last]];
} }
} }
@ -1929,7 +1929,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSString *s; NSString *s;
s = [NSString stringWithFormat: @"Accept attempt failed - %@", s = [NSString stringWithFormat: @"Accept attempt failed - %@",
[_GSPrivate error]]; [NSError _last]];
[readInfo setObject: s forKey: GSFileHandleNotificationError]; [readInfo setObject: s forKey: GSFileHandleNotificationError];
} }
else else
@ -1997,7 +1997,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSString *s; NSString *s;
s = [NSString stringWithFormat: @"Read attempt failed - %@", s = [NSString stringWithFormat: @"Read attempt failed - %@",
[_GSPrivate error]]; [NSError _last]];
[readInfo setObject: s forKey: GSFileHandleNotificationError]; [readInfo setObject: s forKey: GSFileHandleNotificationError];
[self postReadNotification]; [self postReadNotification];
} }
@ -2033,7 +2033,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSString *s; NSString *s;
s = [NSString stringWithFormat: @"Connect attempt failed - %@", s = [NSString stringWithFormat: @"Connect attempt failed - %@",
[_GSPrivate error]]; [NSError _last]];
[info setObject: s forKey: GSFileHandleNotificationError]; [info setObject: s forKey: GSFileHandleNotificationError];
} }
else else
@ -2066,7 +2066,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSString *s; NSString *s;
s = [NSString stringWithFormat: s = [NSString stringWithFormat:
@"Write attempt failed - %@", [_GSPrivate error]]; @"Write attempt failed - %@", [NSError _last]];
[info setObject: s forKey: GSFileHandleNotificationError]; [info setObject: s forKey: GSFileHandleNotificationError];
[self postWriteNotification]; [self postWriteNotification];
} }
@ -2143,7 +2143,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (fcntl(descriptor, F_SETFL, e) < 0) if (fcntl(descriptor, F_SETFL, e) < 0)
{ {
NSLog(@"unable to set non-blocking mode for %d - %@", NSLog(@"unable to set non-blocking mode for %d - %@",
descriptor, [_GSPrivate error]); descriptor, [NSError _last]);
} }
else else
{ {
@ -2153,7 +2153,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
else else
{ {
NSLog(@"unable to get non-blocking mode for %d - %@", NSLog(@"unable to get non-blocking mode for %d - %@",
descriptor, [_GSPrivate error]); descriptor, [NSError _last]);
} }
} }
} }
@ -2171,7 +2171,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == -1) if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == -1)
{ {
NSLog(@"unable to get socket name - %@", [_GSPrivate error]); NSLog(@"unable to get socket name - %@", [NSError _last]);
} }
else else
{ {
@ -2188,7 +2188,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == -1) if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == -1)
{ {
NSLog(@"unable to get socket name - %@", [_GSPrivate error]); NSLog(@"unable to get socket name - %@", [NSError _last]);
} }
else else
{ {

View file

@ -1,37 +0,0 @@
/* GSFormat - printf-style formatting
Copyright (C) 2000 Free Software Foundation, Inc.
Written by: Kai Henningsen <kai@cats.ms>
Created: Jan 2001
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
*/
#ifndef __GSFormat_H_
#define __GSFormat_H_
#include <Foundation/NSZone.h>
#include "GSPrivate.h"
@class NSDictionary;
void
GSFormat(GSStr fb, const unichar *fmt, va_list ap, NSDictionary *loc);
#endif

View file

@ -73,7 +73,8 @@
#include "Foundation/NSZone.h" #include "Foundation/NSZone.h"
#include "Foundation/NSDebug.h" #include "Foundation/NSDebug.h"
#include "GNUstepBase/GSLocale.h" #include "GNUstepBase/GSLocale.h"
#include "GSFormat.h"
#include "GSPrivate.h"
#include <string.h> // for strstr() #include <string.h> // for strstr()
#include <sys/stat.h> #include <sys/stat.h>
@ -802,7 +803,7 @@ static unichar *group_number (unichar *, unichar *, const char *, NSString *);
/* The function itself. */ /* The function itself. */
void void
GSFormat (GSStr s, const unichar *format, va_list ap, GSPrivateFormat (GSStr s, const unichar *format, va_list ap,
NSDictionary *locale) NSDictionary *locale)
{ {
/* The character used as thousands separator. */ /* The character used as thousands separator. */
@ -1694,7 +1695,8 @@ NSDictionary *locale)
LABEL (form_strerror): LABEL (form_strerror):
/* Print description of error ERRNO. */ /* Print description of error ERRNO. */
string = (unichar *)[[_GSPrivate error: save_errno] errno = save_errno;
string = (unichar *)[[[NSError _last] localizedDescription]
cStringUsingEncoding: NSUnicodeStringEncoding]; cStringUsingEncoding: NSUnicodeStringEncoding];
is_long = 1; /* This is a unicode string. */ is_long = 1; /* This is a unicode string. */
goto LABEL (print_string); goto LABEL (print_string);
@ -1762,7 +1764,7 @@ NSDictionary *locale)
if (enc == GSUndefinedEncoding) if (enc == GSUndefinedEncoding)
{ {
enc = [NSString defaultCStringEncoding]; enc = [NSString defaultCStringEncoding];
byteEncoding = [_GSPrivate isByteEncoding: enc]; byteEncoding = GSPrivateIsByteEncoding(enc);
} }
len = strlen(str); // Number of bytes to convert. len = strlen(str); // Number of bytes to convert.

View file

@ -25,22 +25,22 @@
#include "config.h" #include "config.h"
#include "Foundation/NSArray.h" #include "Foundation/NSArray.h"
#include "Foundation/NSString.h" #include "Foundation/NSByteOrder.h"
#include "Foundation/NSException.h"
#include "Foundation/NSValue.h"
#include "Foundation/NSData.h" #include "Foundation/NSData.h"
#include "Foundation/NSDebug.h"
#include "Foundation/NSException.h"
#include "Foundation/NSFileHandle.h"
#include "Foundation/NSHost.h"
#include "Foundation/NSLock.h"
#include "Foundation/NSMapTable.h"
#include "Foundation/NSNotification.h"
#include "Foundation/NSPathUtilities.h"
#include "Foundation/NSProcessInfo.h"
#include "Foundation/NSRunLoop.h"
#include "Foundation/NSString.h"
#include "Foundation/NSURL.h" #include "Foundation/NSURL.h"
#include "Foundation/NSURLHandle.h" #include "Foundation/NSURLHandle.h"
#include "Foundation/NSNotification.h" #include "Foundation/NSValue.h"
#include "Foundation/NSRunLoop.h"
#include "Foundation/NSByteOrder.h"
#include "Foundation/NSLock.h"
#include "Foundation/NSFileHandle.h"
#include "Foundation/NSDebug.h"
#include "Foundation/NSHost.h"
#include "Foundation/NSProcessInfo.h"
#include "Foundation/NSPathUtilities.h"
#include "Foundation/NSMapTable.h"
#include "GNUstepBase/GSMime.h" #include "GNUstepBase/GSMime.h"
#include "GNUstepBase/GSLock.h" #include "GNUstepBase/GSLock.h"
#include "NSCallBacks.h" #include "NSCallBacks.h"
@ -1269,7 +1269,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
*/ */
[self backgroundLoadDidFailWithReason: [self backgroundLoadDidFailWithReason:
[NSString stringWithFormat: @"Unable to connect to %@:%@ ... %@", [NSString stringWithFormat: @"Unable to connect to %@:%@ ... %@",
host, port, [_GSPrivate error]]]; host, port, [NSError _last]]];
return; return;
} }
RETAIN(sock); RETAIN(sock);

View file

@ -24,6 +24,8 @@
#ifndef _GSPrivate_h_ #ifndef _GSPrivate_h_
#define _GSPrivate_h_ #define _GSPrivate_h_
#include "Foundation/NSError.h"
@class NSNotification; @class NSNotification;
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
@ -218,6 +220,72 @@ typedef enum {
- (const char*) type; - (const char*) type;
@end @end
/* Get error information.
*/
@interface NSError (GSCategories)
+ (NSError*) _last;
@end
/* Used by NSException uncaught exception handler - must not call any
* methods/functions which might cause a recursive exception.
*/
const char*
GSPrivateArgZero() GS_ATTRIB_PRIVATE;
/* get the available string encodings (nul terminated array)
*/
NSStringEncoding *
GSPrivateAvailableEncodings() GS_ATTRIB_PRIVATE;
/* Initialise constant strings
*/
void
GSPrivateBuildStrings(void) GS_ATTRIB_PRIVATE;
/* get the default C-string encoding.
*/
NSStringEncoding
GSPrivateDefaultCStringEncoding() GS_ATTRIB_PRIVATE;
/* Get default locale quickly (usually from cache).
* External apps would cache the locale themselves.
*/
NSDictionary *
GSPrivateDefaultLocale() GS_ATTRIB_PRIVATE;
/* Get one of several standard values.
*/
BOOL
GSPrivateDefaultsFlag(GSUserDefaultFlagType type) GS_ATTRIB_PRIVATE;
/* get the name of a string encoding as an NSString.
*/
NSString *
GSPrivateEncodingName(NSStringEncoding encoding) GS_ATTRIB_PRIVATE;
/* get a flag from an environment variable - return def if not defined.
*/
BOOL
GSPrivateEnvironmentFlag(const char *name, BOOL def) GS_ATTRIB_PRIVATE;
/* Format arguments into an internal string.
*/
void
GSPrivateFormat(GSStr fb, const unichar *fmt, va_list ap, NSDictionary *loc)
GS_ATTRIB_PRIVATE;
/* determine whether data in a particular encoding can
* generally be represented as 8-bit characters including ascii.
*/
BOOL
GSPrivateIsByteEncoding(NSStringEncoding encoding) GS_ATTRIB_PRIVATE;
/* determine whether encoding is currently supported.
*/
BOOL
GSPrivateIsEncodingSupported(NSStringEncoding encoding) GS_ATTRIB_PRIVATE;
/* /*
* Functions used by the NSRunLoop and friends for processing * Functions used by the NSRunLoop and friends for processing
* queued notifications and task completion events. * queued notifications and task completion events.
@ -227,74 +295,6 @@ void GSPrivateNotifyASAP(void) GS_ATTRIB_PRIVATE;
void GSPrivateNotifyIdle(void) GS_ATTRIB_PRIVATE; void GSPrivateNotifyIdle(void) GS_ATTRIB_PRIVATE;
BOOL GSPrivateNotifyMore(void) GS_ATTRIB_PRIVATE; BOOL GSPrivateNotifyMore(void) GS_ATTRIB_PRIVATE;
/* This class exists to encapsulate various otherwise unrelated functions
* so that we expose a single global symbol (the class) whose name marks it
* very clearly as for private/internal use only. Avoiding the exposure
* (and hence possible accidental use) of symbols for each function ...
* The formal implementation of the class is a near empty implementation
* (in Additions/GSPrivate.m), with most methods being provided by other
* categories in the files wishing to expose some functionality for use
* by other parts of the base library.
*/
@interface GSPrivate : NSObject
{
}
/* Return the text describing the last system error to have occurred.
*/
- (NSString*) error;
- (NSString*) error: (long)number;
@end
extern GSPrivate *_GSPrivate;
@interface GSPrivate (ProcessInfo)
/* Used by NSException uncaught exception handler - must not call any
* methods/functions which might cause a recursive exception.
*/
- (const char*) argZero;
/* get a flag from an environment variable - return def if not defined.
*/
- (BOOL) environmentFlag: (const char *)name defaultValue: (BOOL)def;
@end
@interface GSPrivate (Unicode)
/* get the available string encodings (nul terminated array)
*/
- (NSStringEncoding*) availableEncodings;
/* get the default C-string encoding.
*/
- (NSStringEncoding) defaultCStringEncoding;
/* get the name of a string encoding as an NSString.
*/
- (NSString*) encodingName: (NSStringEncoding)encoding;
/* determine whether data in a particular encoding can
* generally be represented as 8-bit characters including ascii.
*/
- (BOOL) isByteEncoding: (NSStringEncoding)encoding;
/* determine whether encoding is currently supported.
*/
- (BOOL) isEncodingSupported: (NSStringEncoding)encoding;
@end
@interface GSPrivate (UserDefaults)
/*
* Get one of several potentially useful flags.
*/
- (BOOL) userDefaultsFlag: (GSUserDefaultFlagType)type;
@end
/* Get default locale quickly (usually from cache).
* External apps would cache the locale themselves.
*/
NSDictionary *
GSPrivateDefaultLocale() GS_ATTRIB_PRIVATE;
#endif /* _GSPrivate_h_ */ #endif /* _GSPrivate_h_ */

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include "config.h" #include "config.h"

View file

@ -28,7 +28,6 @@
#include <Foundation/NSArray.h> #include <Foundation/NSArray.h>
#include <Foundation/NSRunLoop.h> #include <Foundation/NSRunLoop.h>
#include <Foundation/NSException.h> #include <Foundation/NSException.h>
#include <Foundation/NSError.h>
#include <Foundation/NSValue.h> #include <Foundation/NSValue.h>
#include <Foundation/NSHost.h> #include <Foundation/NSHost.h>
#include <Foundation/NSDebug.h> #include <Foundation/NSDebug.h>
@ -365,7 +364,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
theError = [NSError errorWithDomain: NSPOSIXErrorDomain theError = [NSError errorWithDomain: NSPOSIXErrorDomain
code: errno code: errno
userInfo: nil]; userInfo: nil];
NSLog(@"%@ error(%d): - %@", self, errno, [_GSPrivate error]); NSLog(@"%@ error(%d): - %@", self, errno, [NSError _last]);
ASSIGN(_lastError, theError); ASSIGN(_lastError, theError);
_currentStatus = NSStreamStatusError; _currentStatus = NSStreamStatusError;
} }

View file

@ -47,7 +47,6 @@
#include "Foundation/NSDebug.h" #include "Foundation/NSDebug.h"
#include "Foundation/NSObjCRuntime.h" #include "Foundation/NSObjCRuntime.h"
#include "GNUstepBase/GSObjCRuntime.h" #include "GNUstepBase/GSObjCRuntime.h"
#include "GSFormat.h"
#include <limits.h> #include <limits.h>
#include "GSPrivate.h" #include "GSPrivate.h"
@ -58,7 +57,7 @@
static BOOL isByteEncoding(NSStringEncoding enc) static BOOL isByteEncoding(NSStringEncoding enc)
{ {
return [_GSPrivate isByteEncoding: enc]; return GSPrivateIsByteEncoding(enc);
} }
#ifdef NeXT_RUNTIME #ifdef NeXT_RUNTIME
@ -258,7 +257,7 @@ setup(void)
* Cache the default string encoding, and set the internal encoding * Cache the default string encoding, and set the internal encoding
* used by 8-bit character strings to match if possible. * used by 8-bit character strings to match if possible.
*/ */
externalEncoding = [_GSPrivate defaultCStringEncoding]; externalEncoding = GSPrivateDefaultCStringEncoding();
if (isByteEncoding(externalEncoding) == YES) if (isByteEncoding(externalEncoding) == YES)
{ {
internalEncoding = externalEncoding; internalEncoding = externalEncoding;
@ -451,7 +450,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
void *chars = 0; void *chars = 0;
BOOL flag = NO; BOOL flag = NO;
if ([_GSPrivate isEncodingSupported: encoding] == NO) if (GSPrivateIsEncodingSupported(encoding) == NO)
{ {
return nil; // Invalid encoding return nil; // Invalid encoding
} }
@ -494,7 +493,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
BOOL isLatin1 = NO; BOOL isLatin1 = NO;
GSStr me; GSStr me;
if ([_GSPrivate isEncodingSupported: encoding] == NO) if (GSPrivateIsEncodingSupported(encoding) == NO)
{ {
if (flag == YES && bytes != 0) if (flag == YES && bytes != 0)
{ {
@ -704,7 +703,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
/* /*
* Now set up 'f' as a GSMutableString object whose initial buffer is * Now set up 'f' as a GSMutableString object whose initial buffer is
* allocated on the stack. The GSFormat function can write into it. * allocated on the stack. The GSPrivateFormat function can write into it.
*/ */
f.isa = GSMutableStringClass; f.isa = GSMutableStringClass;
f._zone = NSDefaultMallocZone(); f._zone = NSDefaultMallocZone();
@ -713,7 +712,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
f._count = 0; f._count = 0;
f._flags.wide = 0; f._flags.wide = 0;
f._flags.free = 0; f._flags.free = 0;
GSFormat(&f, fmt, argList, locale); GSPrivateFormat(&f, fmt, argList, locale);
if (fmt != fbuf) if (fmt != fbuf)
{ {
objc_free(fmt); objc_free(fmt);
@ -3435,8 +3434,9 @@ agree, create a new GSUnicodeInlineString otherwise.
/* /*
* Make sure we have the format string in a nul terminated array of * Make sure we have the format string in a nul terminated array of
* unichars for passing to GSFormat. Use on-stack memory for performance * unichars for passing to GSPrivateFormat. Use on-stack memory for
* unless the size of the format string is really big (a rare occurrence). * performance unless the size of the format string is really big
* (a rare occurrence).
*/ */
len = [format length]; len = [format length];
if (len >= 1024) if (len >= 1024)
@ -3458,7 +3458,7 @@ agree, create a new GSUnicodeInlineString otherwise.
_zone = GSObjCZone(self); _zone = GSObjCZone(self);
#endif #endif
} }
GSFormat((GSStr)self, fmt, ap, nil); GSPrivateFormat((GSStr)self, fmt, ap, nil);
_flags.hash = 0; // Invalidate the hash for this string. _flags.hash = 0; // Invalidate the hash for this string.
if (fmt != buf) if (fmt != buf)
{ {
@ -3950,7 +3950,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException);
[format getCharacters: fmt]; [format getCharacters: fmt];
fmt[len] = '\0'; fmt[len] = '\0';
GSFormat((GSStr)self, fmt, argList, locale); GSPrivateFormat((GSStr)self, fmt, argList, locale);
if (fmt != fbuf) if (fmt != fbuf)
{ {
objc_free(fmt); objc_free(fmt);

View file

@ -33,7 +33,6 @@
#include "Foundation/NSAutoreleasePool.h" #include "Foundation/NSAutoreleasePool.h"
#include "Foundation/NSData.h" #include "Foundation/NSData.h"
#include "Foundation/NSDictionary.h" #include "Foundation/NSDictionary.h"
#include "Foundation/NSError.h"
#include "Foundation/NSException.h" #include "Foundation/NSException.h"
#include "Foundation/NSHTTPCookie.h" #include "Foundation/NSHTTPCookie.h"
#include "Foundation/NSHTTPCookieStorage.h" #include "Foundation/NSHTTPCookieStorage.h"

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include "config.h" #include "config.h"

View file

@ -55,9 +55,9 @@
static BOOL GSMacOSXCompatiblePropertyLists(void) static BOOL GSMacOSXCompatiblePropertyLists(void)
{ {
#if defined(HAVE_LIBXML) #if defined(HAVE_LIBXML)
if ([_GSPrivate userDefaultsFlag: NSWriteOldStylePropertyLists] == YES) if (GSPrivateDefaultsFlag(NSWriteOldStylePropertyLists) == YES)
return NO; return NO;
return [_GSPrivate userDefaultsFlag: GSMacOSXCompatible]; return GSPrivateDefaultsFlag(GSMacOSXCompatible);
#else #else
return NO; return NO;
#endif #endif

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSAssertionHandler class reference</title> <title>NSAssertionHandler class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -23,7 +23,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSBundle class reference</title> <title>NSBundle class reference</title>

View file

@ -24,7 +24,8 @@
<title>NSCallBacks class reference</title> <title>NSCallBacks class reference</title>
$Date$ $Revision$ $Date$ $Revision$
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. */ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02111 USA. */
/**** Included Headers *******************************************************/ /**** Included Headers *******************************************************/

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSClassDescription class reference</title> <title>NSClassDescription class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include "config.h" #include "config.h"

View file

@ -22,7 +22,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
/* This file should be run through a preprocessor with the macro TYPE_ORDER /* This file should be run through a preprocessor with the macro TYPE_ORDER

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSCopyObject class reference</title> <title>NSCopyObject class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSCountedSet class reference</title> <title>NSCountedSet class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -164,7 +164,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
if (theFile == 0) /* We failed to open the file. */ if (theFile == 0) /* We failed to open the file. */
{ {
NSWarnFLog(@"Open (%@) attempt failed - %@", path, [_GSPrivate error]); NSWarnFLog(@"Open (%@) attempt failed - %@", path, [NSError _last]);
goto failure; goto failure;
} }
@ -175,7 +175,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
if (c != 0) if (c != 0)
{ {
NSWarnFLog(@"Seek to end of file (%@) failed - %@", path, NSWarnFLog(@"Seek to end of file (%@) failed - %@", path,
[_GSPrivate error]); [NSError _last]);
goto failure; goto failure;
} }
@ -186,7 +186,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
fileLength = ftell(theFile); fileLength = ftell(theFile);
if (fileLength == -1) if (fileLength == -1)
{ {
NSWarnFLog(@"Ftell on %@ failed - %@", path, [_GSPrivate error]); NSWarnFLog(@"Ftell on %@ failed - %@", path, [NSError _last]);
goto failure; goto failure;
} }
@ -198,7 +198,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
if (c != 0) if (c != 0)
{ {
NSWarnFLog(@"Fseek to start of file (%@) failed - %@", path, NSWarnFLog(@"Fseek to start of file (%@) failed - %@", path,
[_GSPrivate error]); [NSError _last]);
goto failure; goto failure;
} }
@ -224,7 +224,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
if (tmp == 0) if (tmp == 0)
{ {
NSLog(@"Malloc failed for file (%@) of length %d - %@", path, NSLog(@"Malloc failed for file (%@) of length %d - %@", path,
fileLength + c, [_GSPrivate error]); fileLength + c, [NSError _last]);
goto failure; goto failure;
} }
memcpy(tmp + fileLength, buf, c); memcpy(tmp + fileLength, buf, c);
@ -237,7 +237,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
if (tmp == 0) if (tmp == 0)
{ {
NSLog(@"Malloc failed for file (%@) of length %d - %@", path, NSLog(@"Malloc failed for file (%@) of length %d - %@", path,
fileLength, [_GSPrivate error]); fileLength, [NSError _last]);
goto failure; goto failure;
} }
@ -245,7 +245,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
if (c != (int)fileLength) if (c != (int)fileLength)
{ {
NSWarnFLog(@"read of file (%@) contents failed - %@", path, NSWarnFLog(@"read of file (%@) contents failed - %@", path,
[_GSPrivate error]); [NSError _last]);
goto failure; goto failure;
} }
} }
@ -851,7 +851,7 @@ failure:
strcat(thePath, "XXXXXX"); strcat(thePath, "XXXXXX");
if ((desc = mkstemp(thePath)) < 0) if ((desc = mkstemp(thePath)) < 0)
{ {
NSWarnMLog(@"mkstemp (%s) failed - %@", thePath, [_GSPrivate error]); NSWarnMLog(@"mkstemp (%s) failed - %@", thePath, [NSError _last]);
goto failure; goto failure;
} }
mask = umask(0); mask = umask(0);
@ -880,7 +880,7 @@ failure:
{ {
NSWarnMLog(@"mktemp (%@) failed - %@", NSWarnMLog(@"mktemp (%@) failed - %@",
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)], [NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
[_GSPrivate error]); [NSError _last]);
goto failure; goto failure;
} }
#else #else
@ -888,7 +888,7 @@ failure:
strcat(thePath, "XXXXXX"); strcat(thePath, "XXXXXX");
if (mktemp(thePath) == 0) if (mktemp(thePath) == 0)
{ {
NSWarnMLog(@"mktemp (%s) failed - %@", thePath, [_GSPrivate error]); NSWarnMLog(@"mktemp (%s) failed - %@", thePath, [NSError _last]);
goto failure; goto failure;
} }
#endif #endif
@ -917,9 +917,9 @@ failure:
#if defined(__MINGW32__) #if defined(__MINGW32__)
NSWarnMLog(@"Open (%@) failed - %@", NSWarnMLog(@"Open (%@) failed - %@",
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)], [NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
[_GSPrivate error]); [NSError _last]);
#else #else
NSWarnMLog(@"Open (%s) failed - %@", thePath, [_GSPrivate error]); NSWarnMLog(@"Open (%s) failed - %@", thePath, [NSError _last]);
#endif #endif
goto failure; goto failure;
} }
@ -935,9 +935,9 @@ failure:
#if defined(__MINGW32__) #if defined(__MINGW32__)
NSWarnMLog(@"Fwrite (%@) failed - %@", NSWarnMLog(@"Fwrite (%@) failed - %@",
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)], [NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
[_GSPrivate error]); [NSError _last]);
#else #else
NSWarnMLog(@"Fwrite (%s) failed - %@", thePath, [_GSPrivate error]); NSWarnMLog(@"Fwrite (%s) failed - %@", thePath, [NSError _last]);
#endif #endif
goto failure; goto failure;
} }
@ -952,9 +952,9 @@ failure:
#if defined(__MINGW32__) #if defined(__MINGW32__)
NSWarnMLog(@"Fclose (%@) failed - %@", NSWarnMLog(@"Fclose (%@) failed - %@",
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)], [NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
[_GSPrivate error]); [NSError _last]);
#else #else
NSWarnMLog(@"Fclose (%s) failed - %@", thePath, [_GSPrivate error]); NSWarnMLog(@"Fclose (%s) failed - %@", thePath, [NSError _last]);
#endif #endif
goto failure; goto failure;
} }
@ -1040,10 +1040,10 @@ failure:
length: wcslen(wthePath)], length: wcslen(wthePath)],
[NSString stringWithCharacters: wtheRealPath [NSString stringWithCharacters: wtheRealPath
length: wcslen(wtheRealPath)], length: wcslen(wtheRealPath)],
[_GSPrivate error]); [NSError _last]);
#else #else
NSWarnMLog(@"Rename ('%s' to '%s') failed - %@", NSWarnMLog(@"Rename ('%s' to '%s') failed - %@",
thePath, theRealPath, [_GSPrivate error]); thePath, theRealPath, [NSError _last]);
#endif #endif
goto failure; goto failure;
} }
@ -2916,7 +2916,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
#endif #endif
if (fd < 0) if (fd < 0)
{ {
NSWarnMLog(@"unable to open %@ - %@", path, [_GSPrivate error]); NSWarnMLog(@"unable to open %@ - %@", path, [NSError _last]);
RELEASE(self); RELEASE(self);
return nil; return nil;
} }
@ -2924,7 +2924,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
length = lseek(fd, 0, SEEK_END); length = lseek(fd, 0, SEEK_END);
if (length < 0) if (length < 0)
{ {
NSWarnMLog(@"unable to seek to eof %@ - %@", path, [_GSPrivate error]); NSWarnMLog(@"unable to seek to eof %@ - %@", path, [NSError _last]);
close(fd); close(fd);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -2932,7 +2932,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
/* Position at start of file. */ /* Position at start of file. */
if (lseek(fd, 0, SEEK_SET) != 0) if (lseek(fd, 0, SEEK_SET) != 0)
{ {
NSWarnMLog(@"unable to seek to sof %@ - %@", path, [_GSPrivate error]); NSWarnMLog(@"unable to seek to sof %@ - %@", path, [NSError _last]);
close(fd); close(fd);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -2940,7 +2940,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
bytes = mmap(0, length, PROT_READ, MAP_SHARED, fd, 0); bytes = mmap(0, length, PROT_READ, MAP_SHARED, fd, 0);
if (bytes == MAP_FAILED) if (bytes == MAP_FAILED)
{ {
NSWarnMLog(@"mapping failed for %s - %@", path, [_GSPrivate error]); NSWarnMLog(@"mapping failed for %s - %@", path, [NSError _last]);
close(fd); close(fd);
RELEASE(self); RELEASE(self);
self = [dataMalloc allocWithZone: NSDefaultMallocZone()]; self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
@ -2968,14 +2968,14 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (shmctl(shmid, IPC_STAT, &buf) < 0) if (shmctl(shmid, IPC_STAT, &buf) < 0)
NSLog(@"[NSDataShared -dealloc] shared memory control failed - %@", NSLog(@"[NSDataShared -dealloc] shared memory control failed - %@",
[_GSPrivate error]); [NSError _last]);
else if (buf.shm_nattch == 1) else if (buf.shm_nattch == 1)
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */ if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
NSLog(@"[NSDataShared -dealloc] shared memory delete failed - %@", NSLog(@"[NSDataShared -dealloc] shared memory delete failed - %@",
[_GSPrivate error]); [NSError _last]);
if (shmdt(bytes) < 0) if (shmdt(bytes) < 0)
NSLog(@"[NSDataShared -dealloc] shared memory detach failed - %@", NSLog(@"[NSDataShared -dealloc] shared memory detach failed - %@",
[_GSPrivate error]); [NSError _last]);
bytes = 0; bytes = 0;
length = 0; length = 0;
shmid = -1; shmid = -1;
@ -2992,7 +2992,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (shmid == -1) /* Created memory? */ if (shmid == -1) /* Created memory? */
{ {
NSLog(@"[-initWithBytes:length:] shared mem get failed for %u - %@", NSLog(@"[-initWithBytes:length:] shared mem get failed for %u - %@",
bufferSize, [_GSPrivate error]); bufferSize, [NSError _last]);
RELEASE(self); RELEASE(self);
self = [dataMalloc allocWithZone: NSDefaultMallocZone()]; self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
return [self initWithBytes: aBuffer length: bufferSize]; return [self initWithBytes: aBuffer length: bufferSize];
@ -3002,7 +3002,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (bytes == (void*)-1) if (bytes == (void*)-1)
{ {
NSLog(@"[-initWithBytes:length:] shared mem attach failed for %u - %@", NSLog(@"[-initWithBytes:length:] shared mem attach failed for %u - %@",
bufferSize, [_GSPrivate error]); bufferSize, [NSError _last]);
bytes = 0; bytes = 0;
RELEASE(self); RELEASE(self);
self = [dataMalloc allocWithZone: NSDefaultMallocZone()]; self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
@ -3021,7 +3021,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (shmctl(shmid, IPC_STAT, &buf) < 0) if (shmctl(shmid, IPC_STAT, &buf) < 0)
{ {
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory " NSLog(@"[NSDataShared -initWithShmID:length:] shared memory "
@"control failed - %@", [_GSPrivate error]); @"control failed - %@", [NSError _last]);
RELEASE(self); /* Unable to access memory. */ RELEASE(self); /* Unable to access memory. */
return nil; return nil;
} }
@ -3036,7 +3036,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (bytes == (void*)-1) if (bytes == (void*)-1)
{ {
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory " NSLog(@"[NSDataShared -initWithShmID:length:] shared memory "
@"attach failed - %s", [_GSPrivate error]); @"attach failed - %s", [NSError _last]);
bytes = 0; bytes = 0;
RELEASE(self); /* Unable to attach to memory. */ RELEASE(self); /* Unable to attach to memory. */
return nil; return nil;
@ -3162,7 +3162,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (bytes == 0) if (bytes == 0)
{ {
NSLog(@"[NSMutableDataMalloc -initWithCapacity:] out of memory " NSLog(@"[NSMutableDataMalloc -initWithCapacity:] out of memory "
@"for %u bytes - %@", size, [_GSPrivate error]); @"for %u bytes - %@", size, [NSError _last]);
RELEASE(self); RELEASE(self);
return nil; return nil;
} }
@ -3658,20 +3658,20 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (shmctl(shmid, IPC_STAT, &buf) < 0) if (shmctl(shmid, IPC_STAT, &buf) < 0)
{ {
NSLog(@"[NSMutableDataShared -dealloc] shared memory " NSLog(@"[NSMutableDataShared -dealloc] shared memory "
@"control failed - %@", [_GSPrivate error]); @"control failed - %@", [NSError _last]);
} }
else if (buf.shm_nattch == 1) else if (buf.shm_nattch == 1)
{ {
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */ if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
{ {
NSLog(@"[NSMutableDataShared -dealloc] shared memory " NSLog(@"[NSMutableDataShared -dealloc] shared memory "
@"delete failed - %@", [_GSPrivate error]); @"delete failed - %@", [NSError _last]);
} }
} }
if (shmdt(bytes) < 0) if (shmdt(bytes) < 0)
{ {
NSLog(@"[NSMutableDataShared -dealloc] shared memory " NSLog(@"[NSMutableDataShared -dealloc] shared memory "
@"detach failed - %@", [_GSPrivate error]); @"detach failed - %@", [NSError _last]);
} }
bytes = 0; bytes = 0;
length = 0; length = 0;
@ -3699,7 +3699,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (shmid == -1) /* Created memory? */ if (shmid == -1) /* Created memory? */
{ {
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory " NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
@"get failed for %u - %@", bufferSize, [_GSPrivate error]); @"get failed for %u - %@", bufferSize, [NSError _last]);
RELEASE(self); RELEASE(self);
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()]; self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
return [self initWithCapacity: bufferSize]; return [self initWithCapacity: bufferSize];
@ -3709,7 +3709,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (bytes == (void*)-1) if (bytes == (void*)-1)
{ {
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory " NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
@"attach failed for %u - %@", bufferSize, [_GSPrivate error]); @"attach failed for %u - %@", bufferSize, [NSError _last]);
bytes = 0; bytes = 0;
RELEASE(self); RELEASE(self);
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()]; self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
@ -3729,7 +3729,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (shmctl(shmid, IPC_STAT, &buf) < 0) if (shmctl(shmid, IPC_STAT, &buf) < 0)
{ {
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory " NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory "
@"control failed - %@", [_GSPrivate error]); @"control failed - %@", [NSError _last]);
RELEASE(self); /* Unable to access memory. */ RELEASE(self); /* Unable to access memory. */
return nil; return nil;
} }
@ -3744,7 +3744,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (bytes == (void*)-1) if (bytes == (void*)-1)
{ {
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory " NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory "
@"attach failed - %@", [_GSPrivate error]); @"attach failed - %@", [NSError _last]);
bytes = 0; bytes = 0;
RELEASE(self); /* Unable to attach to memory. */ RELEASE(self); /* Unable to attach to memory. */
return nil; return nil;
@ -3767,7 +3767,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
{ {
[NSException raise: NSMallocException [NSException raise: NSMallocException
format: @"Unable to create shared memory segment (size:%u) - %@.", format: @"Unable to create shared memory segment (size:%u) - %@.",
size, [_GSPrivate error]]; size, [NSError _last]];
} }
tmp = shmat(newid, 0, 0); tmp = shmat(newid, 0, 0);
if ((intptr_t)tmp == -1) /* Attached memory? */ if ((intptr_t)tmp == -1) /* Attached memory? */
@ -3783,20 +3783,20 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
if (shmctl(shmid, IPC_STAT, &buf) < 0) if (shmctl(shmid, IPC_STAT, &buf) < 0)
{ {
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory " NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
@"control failed - %@", [_GSPrivate error]); @"control failed - %@", [NSError _last]);
} }
else if (buf.shm_nattch == 1) else if (buf.shm_nattch == 1)
{ {
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */ if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
{ {
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory " NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
@"delete failed - %@", [_GSPrivate error]); @"delete failed - %@", [NSError _last]);
} }
} }
if (shmdt(bytes) < 0) /* Detach memory. */ if (shmdt(bytes) < 0) /* Detach memory. */
{ {
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory " NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
@"detach failed - %@", [_GSPrivate error]); @"detach failed - %@", [NSError _last]);
} }
} }
bytes = tmp; bytes = tmp;

View file

@ -20,7 +20,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSDebug utilities reference</title> <title>NSDebug utilities reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -49,9 +49,9 @@
static BOOL GSMacOSXCompatiblePropertyLists(void) static BOOL GSMacOSXCompatiblePropertyLists(void)
{ {
#if defined(HAVE_LIBXML) #if defined(HAVE_LIBXML)
if ([_GSPrivate userDefaultsFlag: NSWriteOldStylePropertyLists] == YES) if (GSPrivateDefaultsFlag(NSWriteOldStylePropertyLists) == YES)
return NO; return NO;
return [_GSPrivate userDefaultsFlag: GSMacOSXCompatible]; return GSPrivateDefaultsFlag(GSMacOSXCompatible);
#else #else
return NO; return NO;
#endif #endif

View file

@ -19,8 +19,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
MA 02111 USA. Boston, MA 02111 USA.
<title>NSDistantObject class reference</title> <title>NSDistantObject class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -78,7 +78,7 @@ static NSFileManager *mgr = nil;
if ([mgr removeFileAtPath: _lockPath handler: nil] == NO) if ([mgr removeFileAtPath: _lockPath handler: nil] == NO)
{ {
NSString *err = [_GSPrivate error]; NSString *err = [[NSError _last] localizedDescription];
attributes = [mgr fileAttributesAtPath: _lockPath traverseLink: YES]; attributes = [mgr fileAttributesAtPath: _lockPath traverseLink: YES];
if ([modDate isEqual: [attributes fileModificationDate]] == YES) if ([modDate isEqual: [attributes fileModificationDate]] == YES)
@ -204,7 +204,7 @@ static NSFileManager *mgr = nil;
if (locked == NO) if (locked == NO)
{ {
NSLog(@"Failed to create lock directory '%@' - %@", NSLog(@"Failed to create lock directory '%@' - %@",
_lockPath, [_GSPrivate error]); _lockPath, [NSError _last]);
} }
} }
} }
@ -260,7 +260,7 @@ static NSFileManager *mgr = nil;
{ {
[NSException raise: NSGenericException [NSException raise: NSGenericException
format: @"Failed to remove lock directory '%@' - %@", format: @"Failed to remove lock directory '%@' - %@",
_lockPath, [_GSPrivate error]]; _lockPath, [NSError _last]];
} }
} }
else else

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSEnumerator class reference</title> <title>NSEnumerator class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include <Foundation/NSDictionary.h> #include <Foundation/NSDictionary.h>
@ -26,11 +27,25 @@
#include <Foundation/NSError.h> #include <Foundation/NSError.h>
#include <Foundation/NSCoder.h> #include <Foundation/NSCoder.h>
NSString* const NSFilePathErrorKey = @"NSFilePathErrorKey";
NSString* const NSLocalizedDescriptionKey = @"NSLocalizedDescriptionKey"; NSString* const NSLocalizedDescriptionKey = @"NSLocalizedDescriptionKey";
NSString* const NSStringEncodingErrorKey = @"NSStringEncodingErrorKey";
NSString* const NSURLErrorKey = @"NSURLErrorKey";
NSString* const NSUnderlyingErrorKey = @"NSUnderlyingErrorKey"; NSString* const NSUnderlyingErrorKey = @"NSUnderlyingErrorKey";
NSString* const NSLocalizedFailureReasonErrorKey
= @"NSLocalizedFailureReasonErrorKey";
NSString* const NSLocalizedRecoveryOptionsErrorKey
= @"NSLocalizedRecoveryOptionsErrorKey";
NSString* const NSLocalizedRecoverySuggestionErrorKey
= @"NSLocalizedRecoverySuggestionErrorKey";
NSString* const NSRecoveryAttempterErrorKey
= @"NSRecoveryAttempterErrorKey";
NSString* const NSMACHErrorDomain = @"NSMACHErrorDomain"; NSString* const NSMACHErrorDomain = @"NSMACHErrorDomain";
NSString* const NSOSStatusErrorDomain = @"NSOSStatusErrorDomain"; NSString* const NSOSStatusErrorDomain = @"NSOSStatusErrorDomain";
NSString* const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain"; NSString* const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain";
NSString* const NSCocoaErrorDomain = @"NSCocoaErrorDomain";
@implementation NSError @implementation NSError
@ -64,6 +79,11 @@ NSString* const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain";
[super dealloc]; [super dealloc];
} }
- (NSString*) description
{
return [self localizedDescription];
}
- (NSString*) domain - (NSString*) domain
{ {
return _domain; return _domain;
@ -131,7 +151,7 @@ NSString* const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain";
return self; return self;
} }
- (NSString *)localizedDescription - (NSString *) localizedDescription
{ {
NSString *desc = [_userInfo objectForKey: NSLocalizedDescriptionKey]; NSString *desc = [_userInfo objectForKey: NSLocalizedDescriptionKey];
@ -142,6 +162,26 @@ NSString* const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain";
return desc; return desc;
} }
- (NSString *) localizedFailureReason
{
return [_userInfo objectForKey: NSLocalizedFailureReasonErrorKey];
}
- (NSArray *) localizedRecoveryOptions
{
return [_userInfo objectForKey: NSLocalizedRecoveryOptionsErrorKey];
}
- (NSString *) localizedRecoverySuggestion
{
return [_userInfo objectForKey: NSLocalizedRecoverySuggestionErrorKey];
}
- (id) recoveryAttempter
{
return [_userInfo objectForKey: NSRecoveryAttempterErrorKey];
}
- (NSDictionary*) userInfo - (NSDictionary*) userInfo
{ {
return _userInfo; return _userInfo;

View file

@ -585,8 +585,7 @@ static void _terminate()
#else #else
shouldAbort = NO; // exit() by default. shouldAbort = NO; // exit() by default.
#endif #endif
shouldAbort = [_GSPrivate environmentFlag: "CRASH_ON_ABORT" shouldAbort = GSPrivateEnvironmentFlag("CRASH_ON_ABORT", shouldAbort);
defaultValue: shouldAbort];
if (shouldAbort == YES) if (shouldAbort == YES)
{ {
abort(); abort();
@ -601,7 +600,7 @@ static void
_NSFoundationUncaughtExceptionHandler (NSException *exception) _NSFoundationUncaughtExceptionHandler (NSException *exception)
{ {
fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n", fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n",
[_GSPrivate argZero], GSPrivateArgZero(),
[[exception name] lossyCString], [[exception reason] lossyCString]); [[exception name] lossyCString], [[exception reason] lossyCString]);
fflush(stderr); /* NEEDED UNDER MINGW */ fflush(stderr); /* NEEDED UNDER MINGW */

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSFileHandle class reference</title> <title>NSFileHandle class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -30,7 +30,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSFileManager class reference</title> <title>NSFileManager class reference</title>
$Date$ $Revision$ $Date$ $Revision$
@ -402,7 +403,7 @@ static NSStringEncoding defaultEncoding;
allOk = NO; allOk = NO;
str = [NSString stringWithFormat: str = [NSString stringWithFormat:
@"Unable to change NSFileOwnerAccountID to '%u' - %@", @"Unable to change NSFileOwnerAccountID to '%u' - %@",
num, [_GSPrivate error]]; num, [NSError _last]];
ASSIGN(_lastError, str); ASSIGN(_lastError, str);
} }
} }
@ -426,7 +427,7 @@ static NSStringEncoding defaultEncoding;
allOk = NO; allOk = NO;
str = [NSString stringWithFormat: str = [NSString stringWithFormat:
@"Unable to change NSFileOwnerAccountName to '%@' - %@", @"Unable to change NSFileOwnerAccountName to '%@' - %@",
str, [_GSPrivate error]]; str, [NSError _last]];
ASSIGN(_lastError, str); ASSIGN(_lastError, str);
} }
} }
@ -440,7 +441,7 @@ static NSStringEncoding defaultEncoding;
allOk = NO; allOk = NO;
str = [NSString stringWithFormat: str = [NSString stringWithFormat:
@"Unable to change NSFileGroupOwnerAccountID to '%u' - %@", @"Unable to change NSFileGroupOwnerAccountID to '%u' - %@",
num, [_GSPrivate error]]; num, [NSError _last]];
ASSIGN(_lastError, str); ASSIGN(_lastError, str);
} }
} }
@ -462,7 +463,7 @@ static NSStringEncoding defaultEncoding;
allOk = NO; allOk = NO;
str = [NSString stringWithFormat: str = [NSString stringWithFormat:
@"Unable to change NSFileGroupOwnerAccountName to '%@' - %@", @"Unable to change NSFileGroupOwnerAccountName to '%@' - %@",
str, [_GSPrivate error]]; str, [NSError _last]];
ASSIGN(_lastError, str); ASSIGN(_lastError, str);
} }
} }
@ -476,7 +477,7 @@ static NSStringEncoding defaultEncoding;
allOk = NO; allOk = NO;
str = [NSString stringWithFormat: str = [NSString stringWithFormat:
@"Unable to change NSFilePosixPermissions to '%o' - %@", @"Unable to change NSFilePosixPermissions to '%o' - %@",
num, [_GSPrivate error]]; num, [NSError _last]];
ASSIGN(_lastError, str); ASSIGN(_lastError, str);
} }
} }
@ -520,7 +521,7 @@ static NSStringEncoding defaultEncoding;
allOk = NO; allOk = NO;
str = [NSString stringWithFormat: str = [NSString stringWithFormat:
@"Unable to change NSFileModificationDate to '%@' - %@", @"Unable to change NSFileModificationDate to '%@' - %@",
date, [_GSPrivate error]]; date, [NSError _last]];
ASSIGN(_lastError, str); ASSIGN(_lastError, str);
} }
} }
@ -748,7 +749,7 @@ static NSStringEncoding defaultEncoding;
NSString *s; NSString *s;
s = [NSString stringWithFormat: @"Could not create '%s' - '%@'", s = [NSString stringWithFormat: @"Could not create '%s' - '%@'",
dirpath, [_GSPrivate error]]; dirpath, [NSError _last]];
ASSIGN(_lastError, s); ASSIGN(_lastError, s);
return NO; return NO;
} }
@ -1277,8 +1278,10 @@ static NSStringEncoding defaultEncoding;
if (unlink(lpath) < 0) if (unlink(lpath) < 0)
#endif #endif
{ {
NSString *message = [[NSError _last] localizedDescription];
return [self _proceedAccordingToHandler: handler return [self _proceedAccordingToHandler: handler
forError: [_GSPrivate error] forError: message
inPath: path]; inPath: path];
} }
else else
@ -1311,8 +1314,10 @@ static NSStringEncoding defaultEncoding;
if (_RMDIR([self fileSystemRepresentationWithPath: path]) < 0) if (_RMDIR([self fileSystemRepresentationWithPath: path]) < 0)
{ {
NSString *message = [[NSError _last] localizedDescription];
return [self _proceedAccordingToHandler: handler return [self _proceedAccordingToHandler: handler
forError: [_GSPrivate error] forError: message
inPath: path]; inPath: path];
} }
else else
@ -2032,7 +2037,7 @@ inline void gsedRelease(GSEnumeratedDirectory X)
else else
{ {
NSLog(@"Failed to recurse into directory '%@' - %@", path, NSLog(@"Failed to recurse into directory '%@' - %@", path,
[_GSPrivate error]); [NSError _last]);
} }
return self; return self;
} }
@ -2199,7 +2204,7 @@ inline void gsedRelease(GSEnumeratedDirectory X)
else else
{ {
NSLog(@"Failed to recurse into directory '%@' - %@", NSLog(@"Failed to recurse into directory '%@' - %@",
_currentFilePath, [_GSPrivate error]); _currentFilePath, [NSError _last]);
} }
} }
} }

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSFormatter class reference</title> <title>NSFormatter class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -73,9 +73,9 @@ setupCache(void)
static BOOL GSMacOSXCompatibleGeometry(void) static BOOL GSMacOSXCompatibleGeometry(void)
{ {
if ([_GSPrivate userDefaultsFlag: GSOldStyleGeometry] == YES) if (GSPrivateDefaultsFlag(GSOldStyleGeometry) == YES)
return NO; return NO;
return [_GSPrivate userDefaultsFlag: GSMacOSXCompatible]; return GSPrivateDefaultsFlag(GSMacOSXCompatible);
} }
/**** Function Implementations ***********************************************/ /**** Function Implementations ***********************************************/

View file

@ -21,7 +21,8 @@
* *
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free * License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02111 USA.
* *
* <title>NSHashTable class reference</title> * <title>NSHashTable class reference</title>
* $Date$ $Revision$ * $Date$ $Revision$

View file

@ -20,7 +20,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSHost class reference</title> <title>NSHost class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -18,8 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Fifth Floor, Boston, MA 02111 USA. Boston, MA 02111 USA.
*/ */

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSLock class reference</title> <title>NSLock class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSLog reference</title> <title>NSLog reference</title>
$Date$ $Revision$ $Date$ $Revision$
@ -144,7 +145,7 @@ _NSLog_standard_printf_handler (NSString* message)
OutputDebugStringW(null_terminated_buf); OutputDebugStringW(null_terminated_buf);
if (([_GSPrivate userDefaultsFlag: GSLogSyslog] == YES if ((GSPrivateDefaultsFlag(GSLogSyslog) == YES
|| write(_NSLogDescriptor, buf, len) != (int)len) && !IsDebuggerPresent()) || write(_NSLogDescriptor, buf, len) != (int)len) && !IsDebuggerPresent())
{ {
static HANDLE eventloghandle = 0; static HANDLE eventloghandle = 0;
@ -170,7 +171,7 @@ _NSLog_standard_printf_handler (NSString* message)
#else #else
#if defined(HAVE_SYSLOG) #if defined(HAVE_SYSLOG)
if ([_GSPrivate userDefaultsFlag: GSLogSyslog] == YES if (GSPrivateDefaultsFlag(GSLogSyslog) == YES
|| write(_NSLogDescriptor, buf, len) != (int)len) || write(_NSLogDescriptor, buf, len) != (int)len)
{ {
null_terminated_buf = objc_malloc (sizeof (char) * (len + 1)); null_terminated_buf = objc_malloc (sizeof (char) * (len + 1));
@ -302,9 +303,9 @@ NSLogv (NSString* format, va_list args)
} }
#ifdef HAVE_SYSLOG #ifdef HAVE_SYSLOG
if ([_GSPrivate userDefaultsFlag: GSLogSyslog] == YES) if (GSPrivateDefaultsFlag(GSLogSyslog) == YES)
{ {
if ([_GSPrivate userDefaultsFlag: GSLogThread] == YES) if (GSPrivateDefaultsFlag(GSLogThread) == YES)
{ {
prefix = [NSString stringWithFormat: @"[thread:%x] ", prefix = [NSString stringWithFormat: @"[thread:%x] ",
GSCurrentThread()]; GSCurrentThread()];
@ -317,7 +318,7 @@ NSLogv (NSString* format, va_list args)
else else
#endif #endif
{ {
if ([_GSPrivate userDefaultsFlag: GSLogThread] == YES) if (GSPrivateDefaultsFlag(GSLogThread) == YES)
{ {
prefix = [NSString prefix = [NSString
stringWithFormat: @"%@ %@[%d,%x] ", stringWithFormat: @"%@ %@[%d,%x] ",

View file

@ -18,8 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Boston, MA 02111 USA.
*/ */
#include "config.h" #include "config.h"
@ -304,14 +304,14 @@ static Class runLoopClass;
if (fcntl(d, F_SETFL, e) < 0) if (fcntl(d, F_SETFL, e) < 0)
{ {
NSLog(@"unable to set non-blocking mode on %d - %@", NSLog(@"unable to set non-blocking mode on %d - %@",
d, [_GSPrivate error]); d, [NSError _last]);
return nil; return nil;
} }
} }
else else
{ {
NSLog(@"unable to get non-blocking mode on %d - %@", NSLog(@"unable to get non-blocking mode on %d - %@",
d, [_GSPrivate error]); d, [NSError _last]);
return nil; return nil;
} }
handle = (GSMessageHandle*)NSAllocateObject(self, 0, NSDefaultMallocZone()); handle = (GSMessageHandle*)NSAllocateObject(self, 0, NSDefaultMallocZone());
@ -381,7 +381,7 @@ static Class runLoopClass;
if (errno != EINPROGRESS) if (errno != EINPROGRESS)
{ {
NSLog(@"unable to make connection to %s - %@", NSLog(@"unable to make connection to %s - %@",
sockAddr.sun_path, [_GSPrivate error]); sockAddr.sun_path, [NSError _last]);
M_UNLOCK(myLock); M_UNLOCK(myLock);
return NO; return NO;
} }
@ -607,7 +607,7 @@ static Class runLoopClass;
else if (errno != EINTR && errno != EAGAIN) else if (errno != EINTR && errno != EAGAIN)
{ {
NSDebugMLLog(@"NSMessagePort", NSDebugMLLog(@"NSMessagePort",
@"read failed - %@ on 0x%p", [_GSPrivate error], self); @"read failed - %@ on 0x%p", [NSError _last], self);
M_UNLOCK(myLock); M_UNLOCK(myLock);
[self invalidate]; [self invalidate];
return; return;
@ -906,7 +906,7 @@ static Class runLoopClass;
&& res != 0) && res != 0)
{ {
state = GS_H_UNCON; state = GS_H_UNCON;
NSLog(@"connect attempt failed - %@", [_GSPrivate error]); NSLog(@"connect attempt failed - %@", [NSError _last]);
} }
else else
{ {
@ -923,7 +923,7 @@ static Class runLoopClass;
{ {
state = GS_H_UNCON; state = GS_H_UNCON;
NSLog(@"connect write attempt failed - %@", NSLog(@"connect write attempt failed - %@",
[_GSPrivate error]); [NSError _last]);
} }
RELEASE(d); RELEASE(d);
} }
@ -957,7 +957,7 @@ static Class runLoopClass;
{ {
if (errno != EINTR && errno != EAGAIN) if (errno != EINTR && errno != EAGAIN)
{ {
NSLog(@"write attempt failed - %@", [_GSPrivate error]); NSLog(@"write attempt failed - %@", [NSError _last]);
M_UNLOCK(myLock); M_UNLOCK(myLock);
[self invalidate]; [self invalidate];
return; return;
@ -1249,7 +1249,7 @@ typedef struct {
sizeof(sockAddr.sun_path)); sizeof(sockAddr.sun_path));
if ((desc = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0) if ((desc = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0)
{ {
NSLog(@"unable to create socket - %@", [_GSPrivate error]); NSLog(@"unable to create socket - %@", [NSError _last]);
desc = -1; desc = -1;
} }
else if (bind(desc, (struct sockaddr *)&sockAddr, else if (bind(desc, (struct sockaddr *)&sockAddr,
@ -1264,14 +1264,14 @@ typedef struct {
if ((desc = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0) if ((desc = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0)
{ {
NSLog(@"unable to create socket - %@", NSLog(@"unable to create socket - %@",
[_GSPrivate error]); [NSError _last]);
desc = -1; desc = -1;
} }
else if (bind(desc, (struct sockaddr *)&sockAddr, else if (bind(desc, (struct sockaddr *)&sockAddr,
SUN_LEN(&sockAddr)) < 0) SUN_LEN(&sockAddr)) < 0)
{ {
NSLog(@"unable to bind to %s - %@", NSLog(@"unable to bind to %s - %@",
sockAddr.sun_path, [_GSPrivate error]); sockAddr.sun_path, [NSError _last]);
(void) close(desc); (void) close(desc);
desc = -1; desc = -1;
} }
@ -1279,7 +1279,7 @@ typedef struct {
else else
{ {
NSLog(@"unable to bind to %s - %@", NSLog(@"unable to bind to %s - %@",
sockAddr.sun_path, [_GSPrivate error]); sockAddr.sun_path, [NSError _last]);
(void) close(desc); (void) close(desc);
desc = -1; desc = -1;
} }
@ -1291,13 +1291,13 @@ typedef struct {
} }
else if (listen(desc, 128) < 0) else if (listen(desc, 128) < 0)
{ {
NSLog(@"unable to listen on port - %@", [_GSPrivate error]); NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) close(desc); (void) close(desc);
DESTROY(port); DESTROY(port);
} }
else if (getsockname(desc, (struct sockaddr*)&sockAddr, &i) < 0) else if (getsockname(desc, (struct sockaddr*)&sockAddr, &i) < 0)
{ {
NSLog(@"unable to get socket name - %@", [_GSPrivate error]); NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) close(desc); (void) close(desc);
DESTROY(port); DESTROY(port);
} }
@ -1492,7 +1492,7 @@ typedef struct {
sock = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC); sock = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC);
if (sock < 0) if (sock < 0)
{ {
NSLog(@"unable to create socket - %@", [_GSPrivate error]); NSLog(@"unable to create socket - %@", [NSError _last]);
} }
#ifndef BROKEN_SO_REUSEADDR #ifndef BROKEN_SO_REUSEADDR
/* /*
@ -1505,13 +1505,13 @@ typedef struct {
sizeof(opt)) < 0) sizeof(opt)) < 0)
{ {
(void)close(sock); (void)close(sock);
NSLog(@"unable to set reuse on socket - %@", [_GSPrivate error]); NSLog(@"unable to set reuse on socket - %@", [NSError _last]);
} }
#endif #endif
else if ((handle = [GSMessageHandle handleWithDescriptor: sock]) == nil) else if ((handle = [GSMessageHandle handleWithDescriptor: sock]) == nil)
{ {
(void)close(sock); (void)close(sock);
NSLog(@"unable to create GSMessageHandle - %@", [_GSPrivate error]); NSLog(@"unable to create GSMessageHandle - %@", [NSError _last]);
} }
else else
{ {

View file

@ -16,8 +16,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
MA 02111 USA. Boston, MA 02111 USA.
<title>NSMessagePortNameServer class reference</title> <title>NSMessagePortNameServer class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -20,7 +20,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSMethodSignature class reference</title> <title>NSMethodSignature class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -22,8 +22,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
MA 02111 USA. Boston, MA 02111 USA.
<title>NSNotificationCenter class reference</title> <title>NSNotificationCenter class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -18,8 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
MA 02111 USA. Boston, MA 02111 USA.
<title>NSNull class reference</title> <title>NSNull class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -20,7 +20,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSNumberFormatter class reference</title> <title>NSNumberFormatter class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -161,7 +161,7 @@ static void GSLogZombie(id o, SEL sel)
NSLog(@"Deallocated %@ (0x%x) sent %@", NSLog(@"Deallocated %@ (0x%x) sent %@",
NSStringFromClass(c), o, NSStringFromSelector(sel)); NSStringFromClass(c), o, NSStringFromSelector(sel));
} }
if ([_GSPrivate environmentFlag: "CRASH_ON_ZOMBIE" defaultValue: NO] == YES) if (GSPrivateEnvironmentFlag("CRASH_ON_ZOMBIE", NO) == YES)
{ {
abort(); abort();
} }
@ -882,8 +882,6 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
} }
#endif #endif
GSPrivate *_GSPrivate = nil;
/** /**
* This message is sent to a class once just before it is used for the first * This message is sent to a class once just before it is used for the first
* time. If class has a superclass, its implementation of +initialize is * time. If class has a superclass, its implementation of +initialize is
@ -895,10 +893,6 @@ GSPrivate *_GSPrivate = nil;
{ {
if (self == [NSObject class]) if (self == [NSObject class])
{ {
extern void GSBuildStrings(void); // See externs.m
_GSPrivate = [GSPrivate new];
#ifdef __MINGW32__ #ifdef __MINGW32__
// See libgnustep-base-entry.m // See libgnustep-base-entry.m
extern void gnustep_base_socket_init(void); extern void gnustep_base_socket_init(void);
@ -972,10 +966,8 @@ GSPrivate *_GSPrivate = nil;
zombieMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks, zombieMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 0); NSNonOwnedPointerMapValueCallBacks, 0);
zombieClass = [NSZombie class]; zombieClass = [NSZombie class];
NSZombieEnabled = [_GSPrivate environmentFlag: "NSZombieEnabled" NSZombieEnabled = GSPrivateEnvironmentFlag("NSZombieEnabled", NO);
defaultValue: NO]; NSDeallocateZombies = GSPrivateEnvironmentFlag("NSDeallocateZombies", NO);
NSDeallocateZombies = [_GSPrivate environmentFlag: "NSDeallocateZombies"
defaultValue: NO];
autorelease_class = [NSAutoreleasePool class]; autorelease_class = [NSAutoreleasePool class];
autorelease_sel = @selector(addObject:); autorelease_sel = @selector(addObject:);
@ -987,7 +979,7 @@ GSPrivate *_GSPrivate = nil;
#endif #endif
#endif #endif
NSConstantStringClass = [NSString constantStringClass]; NSConstantStringClass = [NSString constantStringClass];
GSBuildStrings(); GSPrivateBuildStrings();
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
addObserver: self addObserver: self
selector: @selector(_becomeMultiThreaded:) selector: @selector(_becomeMultiThreaded:)
@ -1301,7 +1293,7 @@ GSPrivate *_GSPrivate = nil;
{ {
if (aSelector == 0) if (aSelector == 0)
{ {
if ([_GSPrivate userDefaultsFlag: GSMacOSXCompatible]) if (GSPrivateDefaultsFlag(GSMacOSXCompatible))
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"%@ null selector given", format: @"%@ null selector given",
@ -1874,7 +1866,7 @@ GSPrivate *_GSPrivate = nil;
{ {
if (aSelector == 0) if (aSelector == 0)
{ {
if ([_GSPrivate userDefaultsFlag: GSMacOSXCompatible]) if (GSPrivateDefaultsFlag(GSMacOSXCompatible))
{ {
[NSException raise: NSInvalidArgumentException [NSException raise: NSInvalidArgumentException
format: @"%@ null selector given", format: @"%@ null selector given",

View file

@ -79,7 +79,7 @@
} }
else else
{ {
NSLog(@"Failed to create pipe ... %@", [_GSPrivate error]); NSLog(@"Failed to create pipe ... %@", [NSError _last]);
DESTROY(self); DESTROY(self);
} }
#else #else
@ -99,7 +99,7 @@
} }
else else
{ {
NSLog(@"Failed to create pipe ... %@", [_GSPrivate error]); NSLog(@"Failed to create pipe ... %@", [NSError _last]);
DESTROY(self); DESTROY(self);
} }
#endif #endif

View file

@ -18,8 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
MA 02111 USA. Boston, MA 02111 USA.
<title>NSPortNameServer class reference</title> <title>NSPortNameServer class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -317,7 +317,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
NSMutableSet *mySet; NSMutableSet *mySet;
id obj_argv[argc]; id obj_argv[argc];
int added = 1; int added = 1;
NSStringEncoding enc = [_GSPrivate defaultCStringEncoding]; NSStringEncoding enc = GSPrivateDefaultCStringEncoding();
mySet = [NSMutableSet new]; mySet = [NSMutableSet new];
@ -346,7 +346,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
{ {
NSMutableArray *keys = [NSMutableArray new]; NSMutableArray *keys = [NSMutableArray new];
NSMutableArray *values = [NSMutableArray new]; NSMutableArray *values = [NSMutableArray new];
NSStringEncoding enc = [_GSPrivate defaultCStringEncoding]; NSStringEncoding enc = GSPrivateDefaultCStringEncoding();
#if defined(__MINGW32__) #if defined(__MINGW32__)
if (fallbackInitialisation == NO) if (fallbackInitialisation == NO)
@ -1234,8 +1234,8 @@ BOOL GSDebugSet(NSString *level)
return YES; return YES;
} }
@implementation GSPrivate (ProcessInfo) BOOL
- (BOOL) environmentFlag: (const char *)name defaultValue: (BOOL)def GSPrivateEnvironmentFlag(const char *name, BOOL def)
{ {
const char *c = getenv(name); const char *c = getenv(name);
BOOL a = def; BOOL a = def;
@ -1262,7 +1262,8 @@ BOOL GSDebugSet(NSString *level)
return a; return a;
} }
- (const char*) argZero const char*
GSPrivateArgZero()
{ {
if (_gnu_arg_zero == 0) if (_gnu_arg_zero == 0)
return ""; return "";
@ -1270,5 +1271,3 @@ BOOL GSDebugSet(NSString *level)
return _gnu_arg_zero; return _gnu_arg_zero;
} }
@end

View file

@ -2170,7 +2170,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
{ {
style = NSPropertyListXMLFormat_v1_0; style = NSPropertyListXMLFormat_v1_0;
} }
else if ([_GSPrivate userDefaultsFlag: NSWriteOldStylePropertyLists] == YES) else if (GSPrivateDefaultsFlag(NSWriteOldStylePropertyLists) == YES)
{ {
style = NSPropertyListOpenStepFormat; style = NSPropertyListOpenStepFormat;
} }

View file

@ -20,7 +20,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSProtocolChecker class reference</title> <title>NSProtocolChecker class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSProxy class reference</title> <title>NSProxy class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -18,7 +18,8 @@
* *
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free * License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02111 USA.
<title>NSRange class reference</title> <title>NSRange class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -141,7 +141,7 @@ typedef struct {
NSConstantStringClass = [NSString constantStringClass]; NSConstantStringClass = [NSString constantStringClass];
_holder = (id)NSAllocateObject(GSPlaceholderStringClass, 0, 0); _holder = (id)NSAllocateObject(GSPlaceholderStringClass, 0, 0);
externalEncoding = [NSString defaultCStringEncoding]; externalEncoding = [NSString defaultCStringEncoding];
if ([_GSPrivate isByteEncoding: externalEncoding] == YES) if (GSPrivateIsByteEncoding(externalEncoding) == YES)
{ {
internalEncoding = externalEncoding; internalEncoding = externalEncoding;
} }

View file

@ -18,8 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
MA 02111 USA. Boston, MA 02111 USA.
<title>NSSerializer class reference</title> <title>NSSerializer class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -391,7 +391,7 @@ static Class runLoopClass;
if (ioctlsocket(d, FIONBIO, &dummy) == SOCKET_ERROR) if (ioctlsocket(d, FIONBIO, &dummy) == SOCKET_ERROR)
{ {
NSLog(@"unable to set non-blocking mode on %d - %@", NSLog(@"unable to set non-blocking mode on %d - %@",
d, [_GSPrivate error]); d, [NSError _last]);
return nil; return nil;
} }
#else /* !__MINGW32__ */ #else /* !__MINGW32__ */
@ -401,14 +401,14 @@ static Class runLoopClass;
if (fcntl(d, F_SETFL, e) < 0) if (fcntl(d, F_SETFL, e) < 0)
{ {
NSLog(@"unable to set non-blocking mode on %d - %@", NSLog(@"unable to set non-blocking mode on %d - %@",
d, [_GSPrivate error]); d, [NSError _last]);
return nil; return nil;
} }
} }
else else
{ {
NSLog(@"unable to get non-blocking mode on %d - %@", NSLog(@"unable to get non-blocking mode on %d - %@",
d, [_GSPrivate error]); d, [NSError _last]);
return nil; return nil;
} }
#endif #endif
@ -547,7 +547,7 @@ static Class runLoopClass;
{ {
NSLog(@"unable to make connection to %s:%d - %@", NSLog(@"unable to make connection to %s:%d - %@",
inet_ntoa(sockAddr.sin_addr), inet_ntoa(sockAddr.sin_addr),
GSSwapBigI16ToHost(sockAddr.sin_port), [_GSPrivate error]); GSSwapBigI16ToHost(sockAddr.sin_port), [NSError _last]);
if (addrNum < [addrs count]) if (addrNum < [addrs count])
{ {
BOOL result; BOOL result;
@ -817,7 +817,7 @@ static Class runLoopClass;
#endif /* !__MINGW32__ */ #endif /* !__MINGW32__ */
{ {
NSDebugMLLog(@"GSTcpHandle", NSDebugMLLog(@"GSTcpHandle",
@"read failed - %@ on 0x%p", [_GSPrivate error], self); @"read failed - %@ on 0x%p", [NSError _last], self);
[self invalidate]; [self invalidate];
return; return;
} }
@ -1108,7 +1108,7 @@ static Class runLoopClass;
&& res != 0) && res != 0)
{ {
state = GS_H_UNCON; state = GS_H_UNCON;
NSLog(@"connect attempt failed - %@", [_GSPrivate error]); NSLog(@"connect attempt failed - %@", [NSError _last]);
} }
else else
{ {
@ -1128,7 +1128,7 @@ static Class runLoopClass;
{ {
state = GS_H_UNCON; state = GS_H_UNCON;
NSLog(@"connect write attempt failed - %@", NSLog(@"connect write attempt failed - %@",
[_GSPrivate error]); [NSError _last]);
} }
RELEASE(d); RELEASE(d);
} }
@ -1166,7 +1166,7 @@ static Class runLoopClass;
if (errno != EINTR && errno != EAGAIN) if (errno != EINTR && errno != EAGAIN)
#endif /* !__MINGW32__ */ #endif /* !__MINGW32__ */
{ {
NSLog(@"write attempt failed - %@", [_GSPrivate error]); NSLog(@"write attempt failed - %@", [NSError _last]);
[self invalidate]; [self invalidate];
return; return;
} }
@ -1635,7 +1635,7 @@ static Class tcpPortClass;
else if ((desc = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) else if ((desc = socket(AF_INET, SOCK_STREAM, PF_UNSPEC))
== INVALID_SOCKET) == INVALID_SOCKET)
{ {
NSLog(@"unable to create socket - %@", [_GSPrivate error]); NSLog(@"unable to create socket - %@", [NSError _last]);
DESTROY(port); DESTROY(port);
} }
#ifndef BROKEN_SO_REUSEADDR #ifndef BROKEN_SO_REUSEADDR
@ -1650,7 +1650,7 @@ static Class tcpPortClass;
{ {
(void) close(desc); (void) close(desc);
NSLog(@"unable to set reuse on socket - %@", NSLog(@"unable to set reuse on socket - %@",
[_GSPrivate error]); [NSError _last]);
DESTROY(port); DESTROY(port);
} }
#endif #endif
@ -1658,20 +1658,20 @@ static Class tcpPortClass;
sizeof(sockaddr)) == SOCKET_ERROR) sizeof(sockaddr)) == SOCKET_ERROR)
{ {
NSLog(@"unable to bind to port %s:%d - %@", NSLog(@"unable to bind to port %s:%d - %@",
inet_ntoa(sockaddr.sin_addr), number, [_GSPrivate error]); inet_ntoa(sockaddr.sin_addr), number, [NSError _last]);
(void) close(desc); (void) close(desc);
DESTROY(port); DESTROY(port);
} }
else if (listen(desc, 128) == SOCKET_ERROR) else if (listen(desc, 128) == SOCKET_ERROR)
{ {
NSLog(@"unable to listen on port - %@", [_GSPrivate error]); NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) close(desc); (void) close(desc);
DESTROY(port); DESTROY(port);
} }
else if (getsockname(desc, (struct sockaddr*)&sockaddr, &i) else if (getsockname(desc, (struct sockaddr*)&sockaddr, &i)
== SOCKET_ERROR) == SOCKET_ERROR)
{ {
NSLog(@"unable to get socket name - %@", [_GSPrivate error]); NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) close(desc); (void) close(desc);
DESTROY(port); DESTROY(port);
} }
@ -1971,7 +1971,7 @@ static Class tcpPortClass;
handle = nil; handle = nil;
if ((sock = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET) if ((sock = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET)
{ {
NSLog(@"unable to create socket - %@", [_GSPrivate error]); NSLog(@"unable to create socket - %@", [NSError _last]);
} }
#ifndef BROKEN_SO_REUSEADDR #ifndef BROKEN_SO_REUSEADDR
/* /*
@ -1984,13 +1984,13 @@ static Class tcpPortClass;
sizeof(opt)) < 0) sizeof(opt)) < 0)
{ {
(void)close(sock); (void)close(sock);
NSLog(@"unable to set reuse on socket - %@", [_GSPrivate error]); NSLog(@"unable to set reuse on socket - %@", [NSError _last]);
} }
#endif #endif
else if ((handle = [GSTcpHandle handleWithDescriptor: sock]) == nil) else if ((handle = [GSTcpHandle handleWithDescriptor: sock]) == nil)
{ {
(void)close(sock); (void)close(sock);
NSLog(@"unable to create GSTcpHandle - %@", [_GSPrivate error]); NSLog(@"unable to create GSTcpHandle - %@", [NSError _last]);
} }
else else
{ {

View file

@ -18,8 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
MA 02111 USA. Boston, MA 02111 USA.
$Date$ $Revision$ $Date$ $Revision$
*/ */

View file

@ -77,7 +77,6 @@
#include "Foundation/NSKeyedArchiver.h" #include "Foundation/NSKeyedArchiver.h"
#include "GNUstepBase/GSMime.h" #include "GNUstepBase/GSMime.h"
#include "GSPrivate.h" #include "GSPrivate.h"
#include "GSFormat.h"
#include <limits.h> #include <limits.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
@ -565,8 +564,8 @@ handle_printf_atsign (FILE *stream,
gcrSel = @selector(getCharacters:range:); gcrSel = @selector(getCharacters:range:);
ranSel = @selector(rangeOfComposedCharacterSequenceAtIndex:); ranSel = @selector(rangeOfComposedCharacterSequenceAtIndex:);
_DefaultStringEncoding = [_GSPrivate defaultCStringEncoding]; _DefaultStringEncoding = GSPrivateDefaultCStringEncoding();
_ByteEncodingOk = [_GSPrivate isByteEncoding: _DefaultStringEncoding]; _ByteEncodingOk = GSPrivateIsByteEncoding(_DefaultStringEncoding);
NSStringClass = self; NSStringClass = self;
[self setVersion: 1]; [self setVersion: 1];
@ -1078,7 +1077,7 @@ handle_printf_atsign (FILE *stream,
/* /*
* Now set up 'f' as a GSMutableString object whose initial buffer is * Now set up 'f' as a GSMutableString object whose initial buffer is
* allocated on the stack. The GSFormat function can write into it. * allocated on the stack. The GSPrivateFormat function can write into it.
*/ */
f.isa = GSMutableStringClass; f.isa = GSMutableStringClass;
f._zone = NSDefaultMallocZone(); f._zone = NSDefaultMallocZone();
@ -1087,7 +1086,7 @@ handle_printf_atsign (FILE *stream,
f._count = 0; f._count = 0;
f._flags.wide = 0; f._flags.wide = 0;
f._flags.free = 0; f._flags.free = 0;
GSFormat(&f, fmt, argList, locale); GSPrivateFormat(&f, fmt, argList, locale);
GSStrExternalize(&f); GSStrExternalize(&f);
if (fmt != fbuf) if (fmt != fbuf)
{ {
@ -2683,7 +2682,7 @@ handle_printf_atsign (FILE *stream,
*/ */
+ (NSStringEncoding*) availableStringEncodings + (NSStringEncoding*) availableStringEncodings
{ {
return [_GSPrivate availableEncodings]; return GSPrivateAvailableEncodings();
} }
/** /**
@ -2701,7 +2700,7 @@ handle_printf_atsign (FILE *stream,
*/ */
ourbundle = [NSBundle bundleForLibrary: @"gnustep-base"]; ourbundle = [NSBundle bundleForLibrary: @"gnustep-base"];
ourname = [_GSPrivate encodingName: encoding]; ourname = GSPrivateEncodingName(encoding);
return [ourbundle localizedStringForKey: ourname return [ourbundle localizedStringForKey: ourname
value: ourname value: ourname
table: nil]; table: nil];

View file

@ -1563,7 +1563,7 @@ GSPrivateCheckTasks()
if (result < 0) if (result < 0)
{ {
NSLog(@"waitpid %d, result %d, error %@", NSLog(@"waitpid %d, result %d, error %@",
_taskId, result, [_GSPrivate error]); _taskId, result, [NSError _last]);
[self _terminatedChild: -1]; [self _terminatedChild: -1];
} }
else if (result == _taskId || (result > 0 && errno == 0)) else if (result == _taskId || (result > 0 && errno == 0))
@ -1596,7 +1596,7 @@ GSPrivateCheckTasks()
else else
{ {
NSLog(@"waitpid %d, result %d, error %@", NSLog(@"waitpid %d, result %d, error %@",
_taskId, result, [_GSPrivate error]); _taskId, result, [NSError _last]);
} }
#endif #endif
} }

View file

@ -890,12 +890,12 @@ static NSDate *theFuture;
#if defined(__MINGW32__) #if defined(__MINGW32__)
if (SetEvent(event) == 0) if (SetEvent(event) == 0)
{ {
NSLog(@"Set event failed - %@", [_GSPrivate error]); NSLog(@"Set event failed - %@", [NSError _last]);
} }
#else #else
if (write(outputFd, "0", 1) != 1) if (write(outputFd, "0", 1) != 1)
{ {
NSLog(@"Write to pipe failed - %@", [_GSPrivate error]); NSLog(@"Write to pipe failed - %@", [NSError _last]);
} }
#endif #endif
@ -919,12 +919,12 @@ static NSDate *theFuture;
#if defined(__MINGW32__) #if defined(__MINGW32__)
if (ResetEvent(event) == 0) if (ResetEvent(event) == 0)
{ {
NSLog(@"Reset event failed - %@", [_GSPrivate error]); NSLog(@"Reset event failed - %@", [NSError _last]);
} }
#else #else
if (read(inputFd, &c, 1) != 1) if (read(inputFd, &c, 1) != 1)
{ {
NSLog(@"Read pipe failed - %@", [_GSPrivate error]); NSLog(@"Read pipe failed - %@", [NSError _last]);
} }
#endif #endif

View file

@ -21,7 +21,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSTimeZone class reference</title> <title>NSTimeZone class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -17,7 +17,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSUndoManager class reference</title> <title>NSUndoManager class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -1955,9 +1955,8 @@ static BOOL isLocked = NO;
} }
@end @end
@implementation GSPrivate (UserDefaults) BOOL
GSPrivateDefaultsFlag(GSUserDefaultFlagType type)
- (BOOL) userDefaultsFlag: (GSUserDefaultFlagType)type
{ {
if (sharedDefaults == nil) if (sharedDefaults == nil)
{ {
@ -1965,7 +1964,6 @@ static BOOL isLocked = NO;
} }
return flags[type]; return flags[type];
} }
@end
/* FIXME ... Slightly faster than /* FIXME ... Slightly faster than
* [[NSUserDefaults standardUserDefaults] dictionaryRepresentation] * [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
@ -1975,6 +1973,10 @@ NSDictionary *GSPrivateDefaultLocale()
{ {
NSDictionary *locale; NSDictionary *locale;
if (classLock == nil)
{
[NSUserDefaults standardUserDefaults];
}
[classLock lock]; [classLock lock];
if (sharedDefaults == nil) if (sharedDefaults == nil)
{ {

View file

@ -20,7 +20,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSValue class reference</title> <title>NSValue class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSZone class reference</title> <title>NSZone class reference</title>
$Date$ $Revision$ $Date$ $Revision$

View file

@ -25,7 +25,6 @@
#include "config.h" #include "config.h"
#include "Foundation/NSString.h" #include "Foundation/NSString.h"
#include "Foundation/NSArray.h" #include "Foundation/NSArray.h"
#include "Foundation/NSException.h" #include "Foundation/NSException.h"
@ -231,7 +230,7 @@ NSString *NSClassDescriptionNeededForClassNotification = @"NSClassDescriptionNee
*/ */
void void
GSBuildStrings() GSPrivateBuildStrings()
{ {
static Class NSStringClass = 0; static Class NSStringClass = 0;

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include "config.h" #include "config.h"

View file

@ -18,8 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
MA 02111 USA. Boston, MA 02111 USA.
*/ */
/* These functions can be used for dissecting and making method calls /* These functions can be used for dissecting and making method calls

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include "config.h" #include "config.h"

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include <config.h> #include <config.h>

View file

@ -9,13 +9,14 @@
#include "config.h" #include "config.h"
#include "GNUstepBase/preface.h" #include "GNUstepBase/preface.h"
#include "../GSRunLoopCtxt.h"
#include "../GSRunLoopWatcher.h"
#include "../GSPrivate.h"
#include <Foundation/NSDebug.h> #include <Foundation/NSDebug.h>
#include <Foundation/NSError.h>
#include <Foundation/NSNotificationQueue.h> #include <Foundation/NSNotificationQueue.h>
#include <Foundation/NSPort.h> #include <Foundation/NSPort.h>
#include <Foundation/NSStream.h> #include <Foundation/NSStream.h>
#include "../GSRunLoopCtxt.h"
#include "../GSRunLoopWatcher.h"
#include "../GSPrivate.h"
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
@ -418,7 +419,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
/* xxx We can do something with exception_fds, instead of /* xxx We can do something with exception_fds, instead of
aborting here. */ aborting here. */
NSLog (@"poll() error in -acceptInputForMode:beforeDate: '%@'", NSLog (@"poll() error in -acceptInputForMode:beforeDate: '%@'",
[_GSPrivate error]); [NSError _last]);
abort (); abort ();
} }
} }
@ -799,7 +800,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
/* xxx We can do something with exception_fds, instead of /* xxx We can do something with exception_fds, instead of
aborting here. */ aborting here. */
NSLog (@"select() error in -acceptInputForMode:beforeDate: '%@'", NSLog (@"select() error in -acceptInputForMode:beforeDate: '%@'",
[_GSPrivate error]); [NSError _last]);
abort (); abort ();
} }
} }

View file

@ -793,7 +793,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET) if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET)
{ {
NSLog(@"unable to create socket - %@", [_GSPrivate error]); NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self); RELEASE(self);
return nil; return nil;
} }
@ -808,7 +808,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (bind(net, (struct sockaddr *)&lsin, sizeof(lsin)) == SOCKET_ERROR) if (bind(net, (struct sockaddr *)&lsin, sizeof(lsin)) == SOCKET_ERROR)
{ {
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(lsin.sin_addr), NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(lsin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]); GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
(void) closesocket(net); (void) closesocket(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -828,7 +828,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
NSLog(@"unable to make connection to %s:%d - %@", NSLog(@"unable to make connection to %s:%d - %@",
inet_ntoa(sin.sin_addr), inet_ntoa(sin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]); GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
RELEASE(self); RELEASE(self);
return nil; return nil;
} }
@ -892,7 +892,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET) if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET)
{ {
NSLog(@"unable to create socket - %@", [_GSPrivate error]); NSLog(@"unable to create socket - %@", [NSError _last]);
RELEASE(self); RELEASE(self);
return nil; return nil;
} }
@ -910,7 +910,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) == SOCKET_ERROR) if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) == SOCKET_ERROR)
{ {
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr), NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]); GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
(void) closesocket(net); (void) closesocket(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -918,7 +918,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (listen(net, 256) == SOCKET_ERROR) if (listen(net, 256) == SOCKET_ERROR)
{ {
NSLog(@"unable to listen on port - %@", [_GSPrivate error]); NSLog(@"unable to listen on port - %@", [NSError _last]);
(void) closesocket(net); (void) closesocket(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -926,7 +926,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getsockname(net, (struct sockaddr*)&sin, &size) == SOCKET_ERROR) if (getsockname(net, (struct sockaddr*)&sin, &size) == SOCKET_ERROR)
{ {
NSLog(@"unable to get socket name - %@", [_GSPrivate error]); NSLog(@"unable to get socket name - %@", [NSError _last]);
(void) closesocket(net); (void) closesocket(net);
RELEASE(self); RELEASE(self);
return nil; return nil;
@ -1094,7 +1094,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (_fstat(desc, &sbuf) != 0) if (_fstat(desc, &sbuf) != 0)
{ {
NSLog(@"unable to get status of descriptor %d - %@", NSLog(@"unable to get status of descriptor %d - %@",
desc, [_GSPrivate error]); desc, [NSError _last]);
} }
else else
{ {
@ -1295,7 +1295,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"unable to read from descriptor - %@", format: @"unable to read from descriptor - %@",
[_GSPrivate error]]; [NSError _last]];
} }
return d; return d;
} }
@ -1320,7 +1320,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"unable to read from descriptor - %@", format: @"unable to read from descriptor - %@",
[_GSPrivate error]]; [NSError _last]];
} }
return d; return d;
} }
@ -1346,7 +1346,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"unable to read from descriptor - %@", format: @"unable to read from descriptor - %@",
[_GSPrivate error]]; [NSError _last]];
} }
[d setLength: got]; [d setLength: got];
} }
@ -1369,7 +1369,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"unable to read from descriptor - %@", format: @"unable to read from descriptor - %@",
[_GSPrivate error]]; [NSError _last]];
} }
} }
while (len > 0 && got > 0); while (len > 0 && got > 0);
@ -1416,7 +1416,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"unable to write to descriptor - %@", format: @"unable to write to descriptor - %@",
[_GSPrivate error]]; [NSError _last]];
} }
} }
@ -1522,7 +1522,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"failed to move to offset in file - %@", format: @"failed to move to offset in file - %@",
[_GSPrivate error]]; [NSError _last]];
} }
return (unsigned long long)result; return (unsigned long long)result;
} }
@ -1546,7 +1546,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"failed to move to offset in file - %@", format: @"failed to move to offset in file - %@",
[_GSPrivate error]]; [NSError _last]];
} }
return (unsigned long long)result; return (unsigned long long)result;
} }
@ -1570,7 +1570,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
{ {
[NSException raise: NSFileHandleOperationException [NSException raise: NSFileHandleOperationException
format: @"failed to move to offset in file - %@", format: @"failed to move to offset in file - %@",
[_GSPrivate error]]; [NSError _last]];
} }
} }
@ -1929,7 +1929,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSString *s; NSString *s;
s = [NSString stringWithFormat: @"Accept attempt failed - %@", s = [NSString stringWithFormat: @"Accept attempt failed - %@",
[_GSPrivate error]]; [NSError _last]];
[readInfo setObject: s forKey: GSFileHandleNotificationError]; [readInfo setObject: s forKey: GSFileHandleNotificationError];
} }
else else
@ -1998,7 +1998,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSString *s; NSString *s;
s = [NSString stringWithFormat: @"Read attempt failed - %@", s = [NSString stringWithFormat: @"Read attempt failed - %@",
[_GSPrivate error]]; [NSError _last]];
[readInfo setObject: s forKey: GSFileHandleNotificationError]; [readInfo setObject: s forKey: GSFileHandleNotificationError];
[self postReadNotification]; [self postReadNotification];
} }
@ -2007,7 +2007,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSString *s; NSString *s;
s = [NSString stringWithFormat: @"Read attempt failed - %@", s = [NSString stringWithFormat: @"Read attempt failed - %@",
[_GSPrivate error]]; [NSError _last]];
[readInfo setObject: s forKey: GSFileHandleNotificationError]; [readInfo setObject: s forKey: GSFileHandleNotificationError];
[self postReadNotification]; [self postReadNotification];
} }
@ -2047,7 +2047,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSString *s; NSString *s;
s = [NSString stringWithFormat: @"Connect attempt failed - %@", s = [NSString stringWithFormat: @"Connect attempt failed - %@",
[_GSPrivate error]]; [NSError _last]];
[info setObject: s forKey: GSFileHandleNotificationError]; [info setObject: s forKey: GSFileHandleNotificationError];
} }
else else
@ -2081,7 +2081,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
NSString *s; NSString *s;
s = [NSString stringWithFormat: s = [NSString stringWithFormat:
@"Write attempt failed - %@", [_GSPrivate error]]; @"Write attempt failed - %@", [NSError _last]];
[info setObject: s forKey: GSFileHandleNotificationError]; [info setObject: s forKey: GSFileHandleNotificationError];
[self postWriteNotification]; [self postWriteNotification];
} }
@ -2245,7 +2245,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
== SOCKET_ERROR) == SOCKET_ERROR)
{ {
NSLog(@"unable to set non-blocking mode - %@", NSLog(@"unable to set non-blocking mode - %@",
[_GSPrivate error]); [NSError _last]);
} }
else else
isNonBlocking = flag; isNonBlocking = flag;
@ -2256,7 +2256,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (ioctlsocket((SOCKET)_get_osfhandle(descriptor), FIONBIO, &dummy) if (ioctlsocket((SOCKET)_get_osfhandle(descriptor), FIONBIO, &dummy)
== SOCKET_ERROR) == SOCKET_ERROR)
{ {
NSLog(@"unable to set blocking mode - %@", [_GSPrivate error]); NSLog(@"unable to set blocking mode - %@", [NSError _last]);
} }
else else
isNonBlocking = flag; isNonBlocking = flag;
@ -2277,7 +2277,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR) if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR)
{ {
NSLog(@"unable to get socket name - %@", [_GSPrivate error]); NSLog(@"unable to get socket name - %@", [NSError _last]);
} }
else else
{ {
@ -2294,7 +2294,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR) if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR)
{ {
NSLog(@"unable to get socket name - %@", [_GSPrivate error]); NSLog(@"unable to get socket name - %@", [NSError _last]);
} }
else else
{ {

View file

@ -9,13 +9,14 @@
#include "config.h" #include "config.h"
#include "GNUstepBase/preface.h" #include "GNUstepBase/preface.h"
#include "../GSRunLoopCtxt.h"
#include "../GSRunLoopWatcher.h"
#include "../GSPrivate.h"
#include <Foundation/NSDebug.h> #include <Foundation/NSDebug.h>
#include <Foundation/NSError.h>
#include <Foundation/NSNotificationQueue.h> #include <Foundation/NSNotificationQueue.h>
#include <Foundation/NSPort.h> #include <Foundation/NSPort.h>
#include <Foundation/NSStream.h> #include <Foundation/NSStream.h>
#include "../GSRunLoopCtxt.h"
#include "../GSRunLoopWatcher.h"
#include "../GSPrivate.h"
#if GS_WITH_GC == 0 #if GS_WITH_GC == 0
static SEL wRelSel; static SEL wRelSel;
@ -434,7 +435,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
BOOL found = NO; BOOL found = NO;
NSDebugMLLog(@"NSRunLoop", @"WaitForMultipleObjects() error in " NSDebugMLLog(@"NSRunLoop", @"WaitForMultipleObjects() error in "
@"-acceptInputForMode:beforeDate: %@", [_GSPrivate error]); @"-acceptInputForMode:beforeDate: %@", [NSError _last]);
/* /*
* Check each handle in turn until either we find one which has an * Check each handle in turn until either we find one which has an
* event signalled, or we find the one which caused the original * event signalled, or we find the one which caused the original
@ -455,7 +456,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
if (found == NO) if (found == NO)
{ {
NSLog(@"WaitForMultipleObjects() error in " NSLog(@"WaitForMultipleObjects() error in "
@"-acceptInputForMode:beforeDate: %@", [_GSPrivate error]); @"-acceptInputForMode:beforeDate: %@", [NSError _last]);
abort (); abort ();
} }
} }

View file

@ -207,7 +207,7 @@ static Class messagePortClass = 0;
if ([p _setupSendPort] == NO) if ([p _setupSendPort] == NO)
{ {
NSLog(@"unable to access mailslot '%@' - %@", NSLog(@"unable to access mailslot '%@' - %@",
[p name], [_GSPrivate error]); [p name], [NSError _last]);
DESTROY(p); DESTROY(p);
} }
return p; return p;
@ -335,7 +335,7 @@ static Class messagePortClass = 0;
if (this->rHandle == INVALID_HANDLE_VALUE) if (this->rHandle == INVALID_HANDLE_VALUE)
{ {
NSLog(@"unable to create mailslot '%@' - %@", NSLog(@"unable to create mailslot '%@' - %@",
this->name, [_GSPrivate error]); this->name, [NSError _last]);
DESTROY(self); DESTROY(self);
} }
else else
@ -507,7 +507,7 @@ static Class messagePortClass = 0;
} }
else else
{ {
NSLog(@"GetOverlappedResult failed ... %@", [_GSPrivate error]); NSLog(@"GetOverlappedResult failed ... %@", [NSError _last]);
this->rState = RS_NONE; this->rState = RS_NONE;
this->rLength = 0; this->rLength = 0;
} }
@ -530,7 +530,7 @@ static Class messagePortClass = 0;
0) == 0) 0) == 0)
{ {
NSLog(@"unable to get info from mailslot '%@' - %@", NSLog(@"unable to get info from mailslot '%@' - %@",
this->name, [_GSPrivate error]); this->name, [NSError _last]);
[self invalidate]; [self invalidate];
return; return;
} }
@ -547,14 +547,14 @@ static Class messagePortClass = 0;
NULL) == 0) NULL) == 0)
{ {
NSLog(@"unable to read from mailslot '%@' - %@", NSLog(@"unable to read from mailslot '%@' - %@",
this->name, [_GSPrivate error]); this->name, [NSError _last]);
[self invalidate]; [self invalidate];
return; return;
} }
if (this->rSize != this->rWant) if (this->rSize != this->rWant)
{ {
NSLog(@"only read %d of %d bytes from mailslot '%@' - %@", NSLog(@"only read %d of %d bytes from mailslot '%@' - %@",
this->rSize, this->rWant, this->name, [_GSPrivate error]); this->rSize, this->rWant, this->name, [NSError _last]);
[self invalidate]; [self invalidate];
return; return;
} }
@ -749,7 +749,7 @@ static Class messagePortClass = 0;
else else
{ {
NSLog(@"unable to read from mailslot '%@' - %@", NSLog(@"unable to read from mailslot '%@' - %@",
this->name, [_GSPrivate error]); this->name, [NSError _last]);
[self invalidate]; [self invalidate];
} }
} }
@ -803,7 +803,7 @@ static Class messagePortClass = 0;
&this->wSize, &this->wSize,
TRUE) == 0) TRUE) == 0)
{ {
NSLog(@"GetOverlappedResult failed ... %@", [_GSPrivate error]); NSLog(@"GetOverlappedResult failed ... %@", [NSError _last]);
} }
else else
{ {
@ -856,7 +856,7 @@ again:
else if ((errno = GetLastError()) != ERROR_IO_PENDING) else if ((errno = GetLastError()) != ERROR_IO_PENDING)
{ {
NSLog(@"unable to write to mailslot '%@' - %@", NSLog(@"unable to write to mailslot '%@' - %@",
this->name, [_GSPrivate error]); this->name, [NSError _last]);
[self invalidate]; [self invalidate];
} }
else else

View file

@ -269,7 +269,7 @@ static void setNonblocking(SOCKET fd)
unsigned long dummy = 1; unsigned long dummy = 1;
if (ioctlsocket(fd, FIONBIO, &dummy) == SOCKET_ERROR) if (ioctlsocket(fd, FIONBIO, &dummy) == SOCKET_ERROR)
NSLog(@"unable to set non-blocking mode - %@", [_GSPrivate error]); NSLog(@"unable to set non-blocking mode - %@", [NSError _last]);
} }
@implementation GSFileInputStream @implementation GSFileInputStream
@ -1867,7 +1867,7 @@ static void setNonblocking(SOCKET fd)
{ {
[NSException raise: NSInternalInconsistencyException [NSException raise: NSInternalInconsistencyException
format: @"Unable to open named pipe '%@'... %@", format: @"Unable to open named pipe '%@'... %@",
path, [_GSPrivate error]]; path, [NSError _last]];
} }
// the type of the stream does not matter, since we are only using the fd // the type of the stream does not matter, since we are only using the fd