mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
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:
parent
6ba4584136
commit
9e7b96ab0e
87 changed files with 746 additions and 539 deletions
95
ChangeLog
95
ChangeLog
|
@ -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>
|
||||
|
||||
* Documentation/manual/DistributedObjects.texi: Update for current API
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/** 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>
|
||||
Date: May 2004
|
||||
|
@ -27,15 +27,16 @@
|
|||
#ifndef __NSError_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSError_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if OS_API_VERSION(100300,GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@class NSDictionary, NSString;
|
||||
@class NSArray, NSDictionary, NSString;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
#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).
|
||||
*/
|
||||
|
@ -61,11 +98,21 @@ GS_EXPORT NSString* const NSOSStatusErrorDomain;
|
|||
* Domain for system and system library errors.
|
||||
*/
|
||||
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>
|
||||
{
|
||||
@private
|
||||
|
@ -101,13 +148,49 @@ GS_EXPORT NSString* const NSPOSIXErrorDomain;
|
|||
code: (int)aCode
|
||||
userInfo: (NSDictionary*)aDictionary;
|
||||
|
||||
/** <override-subclass />
|
||||
/**
|
||||
* Return a human readable description for the error.<br />
|
||||
* The default implementation uses the value from the user info dictionary
|
||||
* if it is available, otherwise it generates a generic one from domain
|
||||
* 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 />
|
||||
|
@ -124,5 +207,6 @@ GS_EXPORT NSString* const NSPOSIXErrorDomain;
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* STRICT_OPENSTEP */
|
||||
#endif
|
||||
|
||||
#endif /* __NSError_h_GNUSTEP_BASE_INCLUDE*/
|
||||
|
|
|
@ -80,10 +80,9 @@
|
|||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
static NSString*
|
||||
sslError(int err, int e)
|
||||
sslError(int err)
|
||||
{
|
||||
NSString *str;
|
||||
|
||||
|
@ -107,8 +106,12 @@ sslError(int err, int e)
|
|||
str = @"Want X509 Lookup Error";
|
||||
break;
|
||||
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;
|
||||
case SSL_ERROR_SSL:
|
||||
str = @"SSL Error: really helpful";
|
||||
|
@ -224,7 +227,6 @@ sslError(int err, int e)
|
|||
}
|
||||
if (ret != 1)
|
||||
{
|
||||
int e = errno;
|
||||
NSDate *final;
|
||||
NSDate *when;
|
||||
NSTimeInterval last = 0.0;
|
||||
|
@ -253,7 +255,6 @@ sslError(int err, int e)
|
|||
ret = SSL_accept(ssl);
|
||||
if (ret != 1)
|
||||
{
|
||||
e = errno;
|
||||
err = SSL_get_error(ssl, ret);
|
||||
}
|
||||
else
|
||||
|
@ -271,7 +272,7 @@ sslError(int err, int e)
|
|||
* Some other error ... not just a timeout or disconnect
|
||||
*/
|
||||
NSLog(@"unable to accept SSL connection from %@:%@ - %@",
|
||||
address, service, sslError(err, e));
|
||||
address, service, sslError(err));
|
||||
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
|
@ -330,7 +331,6 @@ sslError(int err, int e)
|
|||
}
|
||||
if (ret != 1)
|
||||
{
|
||||
int e = errno;
|
||||
NSDate *final;
|
||||
NSDate *when;
|
||||
NSTimeInterval last = 0.0;
|
||||
|
@ -359,7 +359,6 @@ sslError(int err, int e)
|
|||
ret = SSL_connect(ssl);
|
||||
if (ret != 1)
|
||||
{
|
||||
e = errno;
|
||||
err = SSL_get_error(ssl, ret);
|
||||
}
|
||||
else
|
||||
|
@ -371,13 +370,14 @@ sslError(int err, int e)
|
|||
RELEASE(final);
|
||||
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)
|
||||
{
|
||||
/*
|
||||
* Some other error ... not just a timeout or disconnect
|
||||
*/
|
||||
NSLog(@"unable to make SSL connection to %@:%@ - %@",
|
||||
address, service, sslError(err, e));
|
||||
address, service, sslError(err));
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
RELEASE(self);
|
||||
|
@ -439,7 +439,7 @@ sslError(int err, int e)
|
|||
if (ret != 1)
|
||||
{
|
||||
NSLog(@"Failed to set certificate file to %@ - %@",
|
||||
certFile, sslError(ERR_get_error(), errno));
|
||||
certFile, sslError(ERR_get_error()));
|
||||
}
|
||||
}
|
||||
if ([privateKey length] > 0)
|
||||
|
@ -449,7 +449,7 @@ sslError(int err, int e)
|
|||
if (ret != 1)
|
||||
{
|
||||
NSLog(@"Failed to set private key file to %@ - %@",
|
||||
privateKey, sslError(ERR_get_error(), errno));
|
||||
privateKey, sslError(ERR_get_error()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ Additions_OBJC_FILES =\
|
|||
GSMime.m \
|
||||
GSXML.m \
|
||||
GSFunctions.m \
|
||||
GSPrivate.m \
|
||||
behavior.m
|
||||
|
||||
ifneq ($(OBJC_RUNTIME_LIB), gnu)
|
||||
|
|
|
@ -900,6 +900,80 @@ static void MD5Transform (uint32_t buf[4], uint32_t const in[16])
|
|||
}
|
||||
@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.
|
||||
*/
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to create socket - %@", [NSError _last]);
|
||||
RELEASE(self);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -276,7 +276,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
|
||||
if (listen(net, 5) < 0)
|
||||
{
|
||||
NSLog(@"unable to listen on port - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to listen on port - %@", [NSError _last]);
|
||||
(void) close(net);
|
||||
RELEASE(self);
|
||||
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)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to get socket name - %@", [NSError _last]);
|
||||
(void) close(net);
|
||||
RELEASE(self);
|
||||
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)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to get socket name - %@", [NSError _last]);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSBundle.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSError.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSLock.h>
|
||||
|
@ -331,7 +332,8 @@ static void GSSetupEncodingTable(void)
|
|||
}
|
||||
}
|
||||
|
||||
static BOOL isEncodingSupported(NSStringEncoding enc)
|
||||
BOOL
|
||||
GSPrivateIsEncodingSupported(NSStringEncoding enc)
|
||||
{
|
||||
GSSetupEncodingTable();
|
||||
|
||||
|
@ -1160,7 +1162,7 @@ tables:
|
|||
const char *estr = 0;
|
||||
BOOL done = NO;
|
||||
|
||||
if (isEncodingSupported(enc) == YES)
|
||||
if (GSPrivateIsEncodingSupported(enc) == YES)
|
||||
{
|
||||
estr = encodingTable[enc]->iconv;
|
||||
}
|
||||
|
@ -1181,7 +1183,7 @@ tables:
|
|||
if (cd == (iconv_t)-1)
|
||||
{
|
||||
NSLog(@"No iconv for encoding %@ tried to use %s",
|
||||
[_GSPrivate encodingName: enc], estr);
|
||||
GSPrivateEncodingName(enc), estr);
|
||||
result = NO;
|
||||
goto done;
|
||||
}
|
||||
|
@ -1853,7 +1855,7 @@ iconv_start:
|
|||
const char *estr = 0;
|
||||
BOOL done = NO;
|
||||
|
||||
if (isEncodingSupported(enc) == YES)
|
||||
if (GSPrivateIsEncodingSupported(enc) == YES)
|
||||
{
|
||||
if (strict == NO)
|
||||
{
|
||||
|
@ -1886,7 +1888,7 @@ iconv_start:
|
|||
if (cd == (iconv_t)-1)
|
||||
{
|
||||
NSLog(@"No iconv for encoding %@ tried to use %s",
|
||||
[_GSPrivate encodingName: enc], estr);
|
||||
GSPrivateEncodingName(enc), estr);
|
||||
result = NO;
|
||||
goto done;
|
||||
}
|
||||
|
@ -2043,9 +2045,10 @@ iconv_start:
|
|||
|
||||
#undef GROW
|
||||
|
||||
@implementation GSPrivate (Unicode)
|
||||
|
||||
- (NSStringEncoding*) availableEncodings
|
||||
|
||||
NSStringEncoding*
|
||||
GSPrivateAvailableEncodings()
|
||||
{
|
||||
if (_availableEncodings == 0)
|
||||
{
|
||||
|
@ -2068,7 +2071,7 @@ iconv_start:
|
|||
pos = 0;
|
||||
for (i = 0; i < encTableSize+1; i++)
|
||||
{
|
||||
if (isEncodingSupported(i) == YES)
|
||||
if (GSPrivateIsEncodingSupported(i) == YES)
|
||||
{
|
||||
encodings[pos++] = i;
|
||||
}
|
||||
|
@ -2081,7 +2084,8 @@ iconv_start:
|
|||
return _availableEncodings;
|
||||
}
|
||||
|
||||
- (NSStringEncoding) defaultCStringEncoding
|
||||
NSStringEncoding
|
||||
GSPrivateDefaultCStringEncoding()
|
||||
{
|
||||
if (defEnc == GSUndefinedEncoding)
|
||||
{
|
||||
|
@ -2233,7 +2237,7 @@ iconv_start:
|
|||
#endif
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
}
|
||||
else if (isEncodingSupported(defEnc) == NO)
|
||||
else if (GSPrivateIsEncodingSupported(defEnc) == NO)
|
||||
{
|
||||
fprintf(stderr, "WARNING: %s - encoding not implemented as "
|
||||
"default c string encoding.\n", encoding);
|
||||
|
@ -2246,28 +2250,24 @@ iconv_start:
|
|||
return defEnc;
|
||||
}
|
||||
|
||||
- (NSString*) encodingName: (NSStringEncoding)encoding
|
||||
NSString*
|
||||
GSPrivateEncodingName(NSStringEncoding encoding)
|
||||
{
|
||||
if (isEncodingSupported(encoding) == NO)
|
||||
if (GSPrivateIsEncodingSupported(encoding) == NO)
|
||||
{
|
||||
return @"Unknown encoding";
|
||||
}
|
||||
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 encodingTable[encoding]->eightBit;
|
||||
}
|
||||
|
||||
- (BOOL) isEncodingSupported: (NSStringEncoding)encoding
|
||||
{
|
||||
return isEncodingSupported(encoding);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -979,7 +979,7 @@ static NSLock *urlLock = nil;
|
|||
*/
|
||||
[self backgroundLoadDidFailWithReason: [NSString stringWithFormat:
|
||||
@"Unable to connect to %@:%@ ... %@",
|
||||
host, port, [_GSPrivate error]]];
|
||||
host, port, [NSError _last]]];
|
||||
return;
|
||||
}
|
||||
cHandle = [[GSTelnetHandle alloc] initWithHandle: sock isConnected: NO];
|
||||
|
|
|
@ -798,7 +798,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
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);
|
||||
return nil;
|
||||
}
|
||||
|
@ -813,7 +813,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (bind(net, (struct sockaddr *)&lsin, sizeof(lsin)) == -1)
|
||||
{
|
||||
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);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -833,7 +833,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
NSLog(@"unable to make connection to %s:%d - %@",
|
||||
inet_ntoa(sin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]);
|
||||
GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
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);
|
||||
return nil;
|
||||
}
|
||||
|
@ -915,7 +915,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) == -1)
|
||||
{
|
||||
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);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -923,7 +923,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (listen(net, 256) == -1)
|
||||
{
|
||||
NSLog(@"unable to listen on port - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to listen on port - %@", [NSError _last]);
|
||||
(void) close(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -931,7 +931,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
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);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -1097,7 +1097,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (fstat(desc, &sbuf) < 0)
|
||||
{
|
||||
NSLog(@"unable to get status of descriptor %d - %@",
|
||||
desc, [_GSPrivate error]);
|
||||
desc, [NSError _last]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1319,7 +1319,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
@ -1344,7 +1344,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
@ -1370,7 +1370,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
[d setLength: got];
|
||||
}
|
||||
|
@ -1393,7 +1393,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
}
|
||||
while (len > 0 && got > 0);
|
||||
|
@ -1439,7 +1439,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to write to descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1545,7 +1545,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
return (unsigned long long)result;
|
||||
}
|
||||
|
@ -1569,7 +1569,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
return (unsigned long long)result;
|
||||
}
|
||||
|
@ -1593,7 +1593,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1929,7 +1929,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Accept attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
[readInfo setObject: s forKey: GSFileHandleNotificationError];
|
||||
}
|
||||
else
|
||||
|
@ -1997,7 +1997,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Read attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
[readInfo setObject: s forKey: GSFileHandleNotificationError];
|
||||
[self postReadNotification];
|
||||
}
|
||||
|
@ -2033,7 +2033,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Connect attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
[info setObject: s forKey: GSFileHandleNotificationError];
|
||||
}
|
||||
else
|
||||
|
@ -2066,7 +2066,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat:
|
||||
@"Write attempt failed - %@", [_GSPrivate error]];
|
||||
@"Write attempt failed - %@", [NSError _last]];
|
||||
[info setObject: s forKey: GSFileHandleNotificationError];
|
||||
[self postWriteNotification];
|
||||
}
|
||||
|
@ -2143,7 +2143,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (fcntl(descriptor, F_SETFL, e) < 0)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode for %d - %@",
|
||||
descriptor, [_GSPrivate error]);
|
||||
descriptor, [NSError _last]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2153,7 +2153,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to get socket name - %@", [NSError _last]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2188,7 +2188,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
@ -73,7 +73,8 @@
|
|||
#include "Foundation/NSZone.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
#include "GNUstepBase/GSLocale.h"
|
||||
#include "GSFormat.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#include <string.h> // for strstr()
|
||||
#include <sys/stat.h>
|
||||
|
@ -802,7 +803,7 @@ static unichar *group_number (unichar *, unichar *, const char *, NSString *);
|
|||
|
||||
/* The function itself. */
|
||||
void
|
||||
GSFormat (GSStr s, const unichar *format, va_list ap,
|
||||
GSPrivateFormat (GSStr s, const unichar *format, va_list ap,
|
||||
NSDictionary *locale)
|
||||
{
|
||||
/* The character used as thousands separator. */
|
||||
|
@ -1694,7 +1695,8 @@ NSDictionary *locale)
|
|||
|
||||
LABEL (form_strerror):
|
||||
/* Print description of error ERRNO. */
|
||||
string = (unichar *)[[_GSPrivate error: save_errno]
|
||||
errno = save_errno;
|
||||
string = (unichar *)[[[NSError _last] localizedDescription]
|
||||
cStringUsingEncoding: NSUnicodeStringEncoding];
|
||||
is_long = 1; /* This is a unicode string. */
|
||||
goto LABEL (print_string);
|
||||
|
@ -1762,7 +1764,7 @@ NSDictionary *locale)
|
|||
if (enc == GSUndefinedEncoding)
|
||||
{
|
||||
enc = [NSString defaultCStringEncoding];
|
||||
byteEncoding = [_GSPrivate isByteEncoding: enc];
|
||||
byteEncoding = GSPrivateIsByteEncoding(enc);
|
||||
}
|
||||
|
||||
len = strlen(str); // Number of bytes to convert.
|
||||
|
|
|
@ -25,22 +25,22 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "Foundation/NSArray.h"
|
||||
#include "Foundation/NSString.h"
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSValue.h"
|
||||
#include "Foundation/NSByteOrder.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/NSURLHandle.h"
|
||||
#include "Foundation/NSNotification.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 "Foundation/NSValue.h"
|
||||
#include "GNUstepBase/GSMime.h"
|
||||
#include "GNUstepBase/GSLock.h"
|
||||
#include "NSCallBacks.h"
|
||||
|
@ -1269,7 +1269,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
*/
|
||||
[self backgroundLoadDidFailWithReason:
|
||||
[NSString stringWithFormat: @"Unable to connect to %@:%@ ... %@",
|
||||
host, port, [_GSPrivate error]]];
|
||||
host, port, [NSError _last]]];
|
||||
return;
|
||||
}
|
||||
RETAIN(sock);
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#ifndef _GSPrivate_h_
|
||||
#define _GSPrivate_h_
|
||||
|
||||
#include "Foundation/NSError.h"
|
||||
|
||||
@class NSNotification;
|
||||
|
||||
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
|
||||
|
@ -218,6 +220,72 @@ typedef enum {
|
|||
- (const char*) type;
|
||||
@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
|
||||
* queued notifications and task completion events.
|
||||
|
@ -227,74 +295,6 @@ void GSPrivateNotifyASAP(void) GS_ATTRIB_PRIVATE;
|
|||
void GSPrivateNotifyIdle(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_ */
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSError.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include <Foundation/NSHost.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
|
@ -365,7 +364,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
theError = [NSError errorWithDomain: NSPOSIXErrorDomain
|
||||
code: errno
|
||||
userInfo: nil];
|
||||
NSLog(@"%@ error(%d): - %@", self, errno, [_GSPrivate error]);
|
||||
NSLog(@"%@ error(%d): - %@", self, errno, [NSError _last]);
|
||||
ASSIGN(_lastError, theError);
|
||||
_currentStatus = NSStreamStatusError;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "Foundation/NSDebug.h"
|
||||
#include "Foundation/NSObjCRuntime.h"
|
||||
#include "GNUstepBase/GSObjCRuntime.h"
|
||||
#include "GSFormat.h"
|
||||
#include <limits.h>
|
||||
|
||||
#include "GSPrivate.h"
|
||||
|
@ -58,7 +57,7 @@
|
|||
|
||||
static BOOL isByteEncoding(NSStringEncoding enc)
|
||||
{
|
||||
return [_GSPrivate isByteEncoding: enc];
|
||||
return GSPrivateIsByteEncoding(enc);
|
||||
}
|
||||
|
||||
#ifdef NeXT_RUNTIME
|
||||
|
@ -258,7 +257,7 @@ setup(void)
|
|||
* Cache the default string encoding, and set the internal encoding
|
||||
* used by 8-bit character strings to match if possible.
|
||||
*/
|
||||
externalEncoding = [_GSPrivate defaultCStringEncoding];
|
||||
externalEncoding = GSPrivateDefaultCStringEncoding();
|
||||
if (isByteEncoding(externalEncoding) == YES)
|
||||
{
|
||||
internalEncoding = externalEncoding;
|
||||
|
@ -451,7 +450,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
|
|||
void *chars = 0;
|
||||
BOOL flag = NO;
|
||||
|
||||
if ([_GSPrivate isEncodingSupported: encoding] == NO)
|
||||
if (GSPrivateIsEncodingSupported(encoding) == NO)
|
||||
{
|
||||
return nil; // Invalid encoding
|
||||
}
|
||||
|
@ -494,7 +493,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
|
|||
BOOL isLatin1 = NO;
|
||||
GSStr me;
|
||||
|
||||
if ([_GSPrivate isEncodingSupported: encoding] == NO)
|
||||
if (GSPrivateIsEncodingSupported(encoding) == NO)
|
||||
{
|
||||
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
|
||||
* 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._zone = NSDefaultMallocZone();
|
||||
|
@ -713,7 +712,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
|
|||
f._count = 0;
|
||||
f._flags.wide = 0;
|
||||
f._flags.free = 0;
|
||||
GSFormat(&f, fmt, argList, locale);
|
||||
GSPrivateFormat(&f, fmt, argList, locale);
|
||||
if (fmt != fbuf)
|
||||
{
|
||||
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
|
||||
* unichars for passing to GSFormat. Use on-stack memory for performance
|
||||
* unless the size of the format string is really big (a rare occurrence).
|
||||
* unichars for passing to GSPrivateFormat. Use on-stack memory for
|
||||
* performance unless the size of the format string is really big
|
||||
* (a rare occurrence).
|
||||
*/
|
||||
len = [format length];
|
||||
if (len >= 1024)
|
||||
|
@ -3458,7 +3458,7 @@ agree, create a new GSUnicodeInlineString otherwise.
|
|||
_zone = GSObjCZone(self);
|
||||
#endif
|
||||
}
|
||||
GSFormat((GSStr)self, fmt, ap, nil);
|
||||
GSPrivateFormat((GSStr)self, fmt, ap, nil);
|
||||
_flags.hash = 0; // Invalidate the hash for this string.
|
||||
if (fmt != buf)
|
||||
{
|
||||
|
@ -3950,7 +3950,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException);
|
|||
[format getCharacters: fmt];
|
||||
fmt[len] = '\0';
|
||||
|
||||
GSFormat((GSStr)self, fmt, argList, locale);
|
||||
GSPrivateFormat((GSStr)self, fmt, argList, locale);
|
||||
if (fmt != fbuf)
|
||||
{
|
||||
objc_free(fmt);
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "Foundation/NSAutoreleasePool.h"
|
||||
#include "Foundation/NSData.h"
|
||||
#include "Foundation/NSDictionary.h"
|
||||
#include "Foundation/NSError.h"
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSHTTPCookie.h"
|
||||
#include "Foundation/NSHTTPCookieStorage.h"
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
|
@ -55,9 +55,9 @@
|
|||
static BOOL GSMacOSXCompatiblePropertyLists(void)
|
||||
{
|
||||
#if defined(HAVE_LIBXML)
|
||||
if ([_GSPrivate userDefaultsFlag: NSWriteOldStylePropertyLists] == YES)
|
||||
if (GSPrivateDefaultsFlag(NSWriteOldStylePropertyLists) == YES)
|
||||
return NO;
|
||||
return [_GSPrivate userDefaultsFlag: GSMacOSXCompatible];
|
||||
return GSPrivateDefaultsFlag(GSMacOSXCompatible);
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSAssertionHandler class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
|
||||
<title>NSBundle class reference</title>
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
<title>NSCallBacks class reference</title>
|
||||
$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 *******************************************************/
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSClassDescription class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
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.
|
||||
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
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSCopyObject class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSCountedSet class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -164,7 +164,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
if (c != 0)
|
||||
{
|
||||
NSWarnFLog(@"Seek to end of file (%@) failed - %@", path,
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
fileLength = ftell(theFile);
|
||||
if (fileLength == -1)
|
||||
{
|
||||
NSWarnFLog(@"Ftell on %@ failed - %@", path, [_GSPrivate error]);
|
||||
NSWarnFLog(@"Ftell on %@ failed - %@", path, [NSError _last]);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
if (c != 0)
|
||||
{
|
||||
NSWarnFLog(@"Fseek to start of file (%@) failed - %@", path,
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
if (tmp == 0)
|
||||
{
|
||||
NSLog(@"Malloc failed for file (%@) of length %d - %@", path,
|
||||
fileLength + c, [_GSPrivate error]);
|
||||
fileLength + c, [NSError _last]);
|
||||
goto failure;
|
||||
}
|
||||
memcpy(tmp + fileLength, buf, c);
|
||||
|
@ -237,7 +237,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
if (tmp == 0)
|
||||
{
|
||||
NSLog(@"Malloc failed for file (%@) of length %d - %@", path,
|
||||
fileLength, [_GSPrivate error]);
|
||||
fileLength, [NSError _last]);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
if (c != (int)fileLength)
|
||||
{
|
||||
NSWarnFLog(@"read of file (%@) contents failed - %@", path,
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
@ -851,7 +851,7 @@ failure:
|
|||
strcat(thePath, "XXXXXX");
|
||||
if ((desc = mkstemp(thePath)) < 0)
|
||||
{
|
||||
NSWarnMLog(@"mkstemp (%s) failed - %@", thePath, [_GSPrivate error]);
|
||||
NSWarnMLog(@"mkstemp (%s) failed - %@", thePath, [NSError _last]);
|
||||
goto failure;
|
||||
}
|
||||
mask = umask(0);
|
||||
|
@ -880,7 +880,7 @@ failure:
|
|||
{
|
||||
NSWarnMLog(@"mktemp (%@) failed - %@",
|
||||
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
goto failure;
|
||||
}
|
||||
#else
|
||||
|
@ -888,7 +888,7 @@ failure:
|
|||
strcat(thePath, "XXXXXX");
|
||||
if (mktemp(thePath) == 0)
|
||||
{
|
||||
NSWarnMLog(@"mktemp (%s) failed - %@", thePath, [_GSPrivate error]);
|
||||
NSWarnMLog(@"mktemp (%s) failed - %@", thePath, [NSError _last]);
|
||||
goto failure;
|
||||
}
|
||||
#endif
|
||||
|
@ -917,9 +917,9 @@ failure:
|
|||
#if defined(__MINGW32__)
|
||||
NSWarnMLog(@"Open (%@) failed - %@",
|
||||
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
#else
|
||||
NSWarnMLog(@"Open (%s) failed - %@", thePath, [_GSPrivate error]);
|
||||
NSWarnMLog(@"Open (%s) failed - %@", thePath, [NSError _last]);
|
||||
#endif
|
||||
goto failure;
|
||||
}
|
||||
|
@ -935,9 +935,9 @@ failure:
|
|||
#if defined(__MINGW32__)
|
||||
NSWarnMLog(@"Fwrite (%@) failed - %@",
|
||||
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
#else
|
||||
NSWarnMLog(@"Fwrite (%s) failed - %@", thePath, [_GSPrivate error]);
|
||||
NSWarnMLog(@"Fwrite (%s) failed - %@", thePath, [NSError _last]);
|
||||
#endif
|
||||
goto failure;
|
||||
}
|
||||
|
@ -952,9 +952,9 @@ failure:
|
|||
#if defined(__MINGW32__)
|
||||
NSWarnMLog(@"Fclose (%@) failed - %@",
|
||||
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
#else
|
||||
NSWarnMLog(@"Fclose (%s) failed - %@", thePath, [_GSPrivate error]);
|
||||
NSWarnMLog(@"Fclose (%s) failed - %@", thePath, [NSError _last]);
|
||||
#endif
|
||||
goto failure;
|
||||
}
|
||||
|
@ -1040,10 +1040,10 @@ failure:
|
|||
length: wcslen(wthePath)],
|
||||
[NSString stringWithCharacters: wtheRealPath
|
||||
length: wcslen(wtheRealPath)],
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
#else
|
||||
NSWarnMLog(@"Rename ('%s' to '%s') failed - %@",
|
||||
thePath, theRealPath, [_GSPrivate error]);
|
||||
thePath, theRealPath, [NSError _last]);
|
||||
#endif
|
||||
goto failure;
|
||||
}
|
||||
|
@ -2916,7 +2916,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
#endif
|
||||
if (fd < 0)
|
||||
{
|
||||
NSWarnMLog(@"unable to open %@ - %@", path, [_GSPrivate error]);
|
||||
NSWarnMLog(@"unable to open %@ - %@", path, [NSError _last]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -2924,7 +2924,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
length = lseek(fd, 0, SEEK_END);
|
||||
if (length < 0)
|
||||
{
|
||||
NSWarnMLog(@"unable to seek to eof %@ - %@", path, [_GSPrivate error]);
|
||||
NSWarnMLog(@"unable to seek to eof %@ - %@", path, [NSError _last]);
|
||||
close(fd);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -2932,7 +2932,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
/* Position at start of file. */
|
||||
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);
|
||||
RELEASE(self);
|
||||
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);
|
||||
if (bytes == MAP_FAILED)
|
||||
{
|
||||
NSWarnMLog(@"mapping failed for %s - %@", path, [_GSPrivate error]);
|
||||
NSWarnMLog(@"mapping failed for %s - %@", path, [NSError _last]);
|
||||
close(fd);
|
||||
RELEASE(self);
|
||||
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)
|
||||
NSLog(@"[NSDataShared -dealloc] shared memory control failed - %@",
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
else if (buf.shm_nattch == 1)
|
||||
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
|
||||
NSLog(@"[NSDataShared -dealloc] shared memory delete failed - %@",
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
if (shmdt(bytes) < 0)
|
||||
NSLog(@"[NSDataShared -dealloc] shared memory detach failed - %@",
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
bytes = 0;
|
||||
length = 0;
|
||||
shmid = -1;
|
||||
|
@ -2992,7 +2992,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
if (shmid == -1) /* Created memory? */
|
||||
{
|
||||
NSLog(@"[-initWithBytes:length:] shared mem get failed for %u - %@",
|
||||
bufferSize, [_GSPrivate error]);
|
||||
bufferSize, [NSError _last]);
|
||||
RELEASE(self);
|
||||
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
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)
|
||||
{
|
||||
NSLog(@"[-initWithBytes:length:] shared mem attach failed for %u - %@",
|
||||
bufferSize, [_GSPrivate error]);
|
||||
bufferSize, [NSError _last]);
|
||||
bytes = 0;
|
||||
RELEASE(self);
|
||||
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)
|
||||
{
|
||||
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory "
|
||||
@"control failed - %@", [_GSPrivate error]);
|
||||
@"control failed - %@", [NSError _last]);
|
||||
RELEASE(self); /* Unable to access memory. */
|
||||
return nil;
|
||||
}
|
||||
|
@ -3036,7 +3036,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
if (bytes == (void*)-1)
|
||||
{
|
||||
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory "
|
||||
@"attach failed - %s", [_GSPrivate error]);
|
||||
@"attach failed - %s", [NSError _last]);
|
||||
bytes = 0;
|
||||
RELEASE(self); /* Unable to attach to memory. */
|
||||
return nil;
|
||||
|
@ -3162,7 +3162,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
if (bytes == 0)
|
||||
{
|
||||
NSLog(@"[NSMutableDataMalloc -initWithCapacity:] out of memory "
|
||||
@"for %u bytes - %@", size, [_GSPrivate error]);
|
||||
@"for %u bytes - %@", size, [NSError _last]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -3658,20 +3658,20 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
if (shmctl(shmid, IPC_STAT, &buf) < 0)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory "
|
||||
@"control failed - %@", [_GSPrivate error]);
|
||||
@"control failed - %@", [NSError _last]);
|
||||
}
|
||||
else if (buf.shm_nattch == 1)
|
||||
{
|
||||
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory "
|
||||
@"delete failed - %@", [_GSPrivate error]);
|
||||
@"delete failed - %@", [NSError _last]);
|
||||
}
|
||||
}
|
||||
if (shmdt(bytes) < 0)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory "
|
||||
@"detach failed - %@", [_GSPrivate error]);
|
||||
@"detach failed - %@", [NSError _last]);
|
||||
}
|
||||
bytes = 0;
|
||||
length = 0;
|
||||
|
@ -3699,7 +3699,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
if (shmid == -1) /* Created memory? */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
|
||||
@"get failed for %u - %@", bufferSize, [_GSPrivate error]);
|
||||
@"get failed for %u - %@", bufferSize, [NSError _last]);
|
||||
RELEASE(self);
|
||||
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
return [self initWithCapacity: bufferSize];
|
||||
|
@ -3709,7 +3709,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
if (bytes == (void*)-1)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
|
||||
@"attach failed for %u - %@", bufferSize, [_GSPrivate error]);
|
||||
@"attach failed for %u - %@", bufferSize, [NSError _last]);
|
||||
bytes = 0;
|
||||
RELEASE(self);
|
||||
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)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory "
|
||||
@"control failed - %@", [_GSPrivate error]);
|
||||
@"control failed - %@", [NSError _last]);
|
||||
RELEASE(self); /* Unable to access memory. */
|
||||
return nil;
|
||||
}
|
||||
|
@ -3744,7 +3744,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
if (bytes == (void*)-1)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithShmID:length:] shared memory "
|
||||
@"attach failed - %@", [_GSPrivate error]);
|
||||
@"attach failed - %@", [NSError _last]);
|
||||
bytes = 0;
|
||||
RELEASE(self); /* Unable to attach to memory. */
|
||||
return nil;
|
||||
|
@ -3767,7 +3767,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
{
|
||||
[NSException raise: NSMallocException
|
||||
format: @"Unable to create shared memory segment (size:%u) - %@.",
|
||||
size, [_GSPrivate error]];
|
||||
size, [NSError _last]];
|
||||
}
|
||||
tmp = shmat(newid, 0, 0);
|
||||
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)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
|
||||
@"control failed - %@", [_GSPrivate error]);
|
||||
@"control failed - %@", [NSError _last]);
|
||||
}
|
||||
else if (buf.shm_nattch == 1)
|
||||
{
|
||||
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
|
||||
@"delete failed - %@", [_GSPrivate error]);
|
||||
@"delete failed - %@", [NSError _last]);
|
||||
}
|
||||
}
|
||||
if (shmdt(bytes) < 0) /* Detach memory. */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
|
||||
@"detach failed - %@", [_GSPrivate error]);
|
||||
@"detach failed - %@", [NSError _last]);
|
||||
}
|
||||
}
|
||||
bytes = tmp;
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSDebug utilities reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -49,9 +49,9 @@
|
|||
static BOOL GSMacOSXCompatiblePropertyLists(void)
|
||||
{
|
||||
#if defined(HAVE_LIBXML)
|
||||
if ([_GSPrivate userDefaultsFlag: NSWriteOldStylePropertyLists] == YES)
|
||||
if (GSPrivateDefaultsFlag(NSWriteOldStylePropertyLists) == YES)
|
||||
return NO;
|
||||
return [_GSPrivate userDefaultsFlag: GSMacOSXCompatible];
|
||||
return GSPrivateDefaultsFlag(GSMacOSXCompatible);
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSDistantObject class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -78,7 +78,7 @@ static NSFileManager *mgr = nil;
|
|||
|
||||
if ([mgr removeFileAtPath: _lockPath handler: nil] == NO)
|
||||
{
|
||||
NSString *err = [_GSPrivate error];
|
||||
NSString *err = [[NSError _last] localizedDescription];
|
||||
|
||||
attributes = [mgr fileAttributesAtPath: _lockPath traverseLink: YES];
|
||||
if ([modDate isEqual: [attributes fileModificationDate]] == YES)
|
||||
|
@ -204,7 +204,7 @@ static NSFileManager *mgr = nil;
|
|||
if (locked == NO)
|
||||
{
|
||||
NSLog(@"Failed to create lock directory '%@' - %@",
|
||||
_lockPath, [_GSPrivate error]);
|
||||
_lockPath, [NSError _last]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ static NSFileManager *mgr = nil;
|
|||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Failed to remove lock directory '%@' - %@",
|
||||
_lockPath, [_GSPrivate error]];
|
||||
_lockPath, [NSError _last]];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSEnumerator class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSDictionary.h>
|
||||
|
@ -26,11 +27,25 @@
|
|||
#include <Foundation/NSError.h>
|
||||
#include <Foundation/NSCoder.h>
|
||||
|
||||
NSString* const NSFilePathErrorKey = @"NSFilePathErrorKey";
|
||||
NSString* const NSLocalizedDescriptionKey = @"NSLocalizedDescriptionKey";
|
||||
NSString* const NSStringEncodingErrorKey = @"NSStringEncodingErrorKey";
|
||||
NSString* const NSURLErrorKey = @"NSURLErrorKey";
|
||||
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 NSOSStatusErrorDomain = @"NSOSStatusErrorDomain";
|
||||
NSString* const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain";
|
||||
NSString* const NSCocoaErrorDomain = @"NSCocoaErrorDomain";
|
||||
|
||||
@implementation NSError
|
||||
|
||||
|
@ -64,6 +79,11 @@ NSString* const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain";
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString*) description
|
||||
{
|
||||
return [self localizedDescription];
|
||||
}
|
||||
|
||||
- (NSString*) domain
|
||||
{
|
||||
return _domain;
|
||||
|
@ -131,7 +151,7 @@ NSString* const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain";
|
|||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)localizedDescription
|
||||
- (NSString *) localizedDescription
|
||||
{
|
||||
NSString *desc = [_userInfo objectForKey: NSLocalizedDescriptionKey];
|
||||
|
||||
|
@ -142,6 +162,26 @@ NSString* const NSPOSIXErrorDomain = @"NSPOSIXErrorDomain";
|
|||
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
|
||||
{
|
||||
return _userInfo;
|
||||
|
|
|
@ -585,8 +585,7 @@ static void _terminate()
|
|||
#else
|
||||
shouldAbort = NO; // exit() by default.
|
||||
#endif
|
||||
shouldAbort = [_GSPrivate environmentFlag: "CRASH_ON_ABORT"
|
||||
defaultValue: shouldAbort];
|
||||
shouldAbort = GSPrivateEnvironmentFlag("CRASH_ON_ABORT", shouldAbort);
|
||||
if (shouldAbort == YES)
|
||||
{
|
||||
abort();
|
||||
|
@ -601,7 +600,7 @@ static void
|
|||
_NSFoundationUncaughtExceptionHandler (NSException *exception)
|
||||
{
|
||||
fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n",
|
||||
[_GSPrivate argZero],
|
||||
GSPrivateArgZero(),
|
||||
[[exception name] lossyCString], [[exception reason] lossyCString]);
|
||||
fflush(stderr); /* NEEDED UNDER MINGW */
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSFileHandle class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSFileManager class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
@ -402,7 +403,7 @@ static NSStringEncoding defaultEncoding;
|
|||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFileOwnerAccountID to '%u' - %@",
|
||||
num, [_GSPrivate error]];
|
||||
num, [NSError _last]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -426,7 +427,7 @@ static NSStringEncoding defaultEncoding;
|
|||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFileOwnerAccountName to '%@' - %@",
|
||||
str, [_GSPrivate error]];
|
||||
str, [NSError _last]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -440,7 +441,7 @@ static NSStringEncoding defaultEncoding;
|
|||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFileGroupOwnerAccountID to '%u' - %@",
|
||||
num, [_GSPrivate error]];
|
||||
num, [NSError _last]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -462,7 +463,7 @@ static NSStringEncoding defaultEncoding;
|
|||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFileGroupOwnerAccountName to '%@' - %@",
|
||||
str, [_GSPrivate error]];
|
||||
str, [NSError _last]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -476,7 +477,7 @@ static NSStringEncoding defaultEncoding;
|
|||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFilePosixPermissions to '%o' - %@",
|
||||
num, [_GSPrivate error]];
|
||||
num, [NSError _last]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -520,7 +521,7 @@ static NSStringEncoding defaultEncoding;
|
|||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFileModificationDate to '%@' - %@",
|
||||
date, [_GSPrivate error]];
|
||||
date, [NSError _last]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -748,7 +749,7 @@ static NSStringEncoding defaultEncoding;
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Could not create '%s' - '%@'",
|
||||
dirpath, [_GSPrivate error]];
|
||||
dirpath, [NSError _last]];
|
||||
ASSIGN(_lastError, s);
|
||||
return NO;
|
||||
}
|
||||
|
@ -1277,8 +1278,10 @@ static NSStringEncoding defaultEncoding;
|
|||
if (unlink(lpath) < 0)
|
||||
#endif
|
||||
{
|
||||
NSString *message = [[NSError _last] localizedDescription];
|
||||
|
||||
return [self _proceedAccordingToHandler: handler
|
||||
forError: [_GSPrivate error]
|
||||
forError: message
|
||||
inPath: path];
|
||||
}
|
||||
else
|
||||
|
@ -1311,8 +1314,10 @@ static NSStringEncoding defaultEncoding;
|
|||
|
||||
if (_RMDIR([self fileSystemRepresentationWithPath: path]) < 0)
|
||||
{
|
||||
NSString *message = [[NSError _last] localizedDescription];
|
||||
|
||||
return [self _proceedAccordingToHandler: handler
|
||||
forError: [_GSPrivate error]
|
||||
forError: message
|
||||
inPath: path];
|
||||
}
|
||||
else
|
||||
|
@ -2032,7 +2037,7 @@ inline void gsedRelease(GSEnumeratedDirectory X)
|
|||
else
|
||||
{
|
||||
NSLog(@"Failed to recurse into directory '%@' - %@", path,
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -2199,7 +2204,7 @@ inline void gsedRelease(GSEnumeratedDirectory X)
|
|||
else
|
||||
{
|
||||
NSLog(@"Failed to recurse into directory '%@' - %@",
|
||||
_currentFilePath, [_GSPrivate error]);
|
||||
_currentFilePath, [NSError _last]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSFormatter class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -73,9 +73,9 @@ setupCache(void)
|
|||
|
||||
static BOOL GSMacOSXCompatibleGeometry(void)
|
||||
{
|
||||
if ([_GSPrivate userDefaultsFlag: GSOldStyleGeometry] == YES)
|
||||
if (GSPrivateDefaultsFlag(GSOldStyleGeometry) == YES)
|
||||
return NO;
|
||||
return [_GSPrivate userDefaultsFlag: GSMacOSXCompatible];
|
||||
return GSPrivateDefaultsFlag(GSMacOSXCompatible);
|
||||
}
|
||||
|
||||
/**** Function Implementations ***********************************************/
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
*
|
||||
* 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.
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02111 USA.
|
||||
*
|
||||
* <title>NSHashTable class reference</title>
|
||||
* $Date$ $Revision$
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSHost class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
*/
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
*/
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSLock class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSLog reference</title>
|
||||
$Date$ $Revision$
|
||||
|
@ -144,7 +145,7 @@ _NSLog_standard_printf_handler (NSString* message)
|
|||
|
||||
OutputDebugStringW(null_terminated_buf);
|
||||
|
||||
if (([_GSPrivate userDefaultsFlag: GSLogSyslog] == YES
|
||||
if ((GSPrivateDefaultsFlag(GSLogSyslog) == YES
|
||||
|| write(_NSLogDescriptor, buf, len) != (int)len) && !IsDebuggerPresent())
|
||||
{
|
||||
static HANDLE eventloghandle = 0;
|
||||
|
@ -170,7 +171,7 @@ _NSLog_standard_printf_handler (NSString* message)
|
|||
#else
|
||||
|
||||
#if defined(HAVE_SYSLOG)
|
||||
if ([_GSPrivate userDefaultsFlag: GSLogSyslog] == YES
|
||||
if (GSPrivateDefaultsFlag(GSLogSyslog) == YES
|
||||
|| write(_NSLogDescriptor, buf, len) != (int)len)
|
||||
{
|
||||
null_terminated_buf = objc_malloc (sizeof (char) * (len + 1));
|
||||
|
@ -302,9 +303,9 @@ NSLogv (NSString* format, va_list args)
|
|||
}
|
||||
|
||||
#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] ",
|
||||
GSCurrentThread()];
|
||||
|
@ -317,7 +318,7 @@ NSLogv (NSString* format, va_list args)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
if ([_GSPrivate userDefaultsFlag: GSLogThread] == YES)
|
||||
if (GSPrivateDefaultsFlag(GSLogThread) == YES)
|
||||
{
|
||||
prefix = [NSString
|
||||
stringWithFormat: @"%@ %@[%d,%x] ",
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -304,14 +304,14 @@ static Class runLoopClass;
|
|||
if (fcntl(d, F_SETFL, e) < 0)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode on %d - %@",
|
||||
d, [_GSPrivate error]);
|
||||
d, [NSError _last]);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"unable to get non-blocking mode on %d - %@",
|
||||
d, [_GSPrivate error]);
|
||||
d, [NSError _last]);
|
||||
return nil;
|
||||
}
|
||||
handle = (GSMessageHandle*)NSAllocateObject(self, 0, NSDefaultMallocZone());
|
||||
|
@ -381,7 +381,7 @@ static Class runLoopClass;
|
|||
if (errno != EINPROGRESS)
|
||||
{
|
||||
NSLog(@"unable to make connection to %s - %@",
|
||||
sockAddr.sun_path, [_GSPrivate error]);
|
||||
sockAddr.sun_path, [NSError _last]);
|
||||
M_UNLOCK(myLock);
|
||||
return NO;
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ static Class runLoopClass;
|
|||
else if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort",
|
||||
@"read failed - %@ on 0x%p", [_GSPrivate error], self);
|
||||
@"read failed - %@ on 0x%p", [NSError _last], self);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
|
@ -906,7 +906,7 @@ static Class runLoopClass;
|
|||
&& res != 0)
|
||||
{
|
||||
state = GS_H_UNCON;
|
||||
NSLog(@"connect attempt failed - %@", [_GSPrivate error]);
|
||||
NSLog(@"connect attempt failed - %@", [NSError _last]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -923,7 +923,7 @@ static Class runLoopClass;
|
|||
{
|
||||
state = GS_H_UNCON;
|
||||
NSLog(@"connect write attempt failed - %@",
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
}
|
||||
RELEASE(d);
|
||||
}
|
||||
|
@ -957,7 +957,7 @@ static Class runLoopClass;
|
|||
{
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
NSLog(@"write attempt failed - %@", [_GSPrivate error]);
|
||||
NSLog(@"write attempt failed - %@", [NSError _last]);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
|
@ -1249,7 +1249,7 @@ typedef struct {
|
|||
sizeof(sockAddr.sun_path));
|
||||
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;
|
||||
}
|
||||
else if (bind(desc, (struct sockaddr *)&sockAddr,
|
||||
|
@ -1264,14 +1264,14 @@ typedef struct {
|
|||
if ((desc = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0)
|
||||
{
|
||||
NSLog(@"unable to create socket - %@",
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
desc = -1;
|
||||
}
|
||||
else if (bind(desc, (struct sockaddr *)&sockAddr,
|
||||
SUN_LEN(&sockAddr)) < 0)
|
||||
{
|
||||
NSLog(@"unable to bind to %s - %@",
|
||||
sockAddr.sun_path, [_GSPrivate error]);
|
||||
sockAddr.sun_path, [NSError _last]);
|
||||
(void) close(desc);
|
||||
desc = -1;
|
||||
}
|
||||
|
@ -1279,7 +1279,7 @@ typedef struct {
|
|||
else
|
||||
{
|
||||
NSLog(@"unable to bind to %s - %@",
|
||||
sockAddr.sun_path, [_GSPrivate error]);
|
||||
sockAddr.sun_path, [NSError _last]);
|
||||
(void) close(desc);
|
||||
desc = -1;
|
||||
}
|
||||
|
@ -1291,13 +1291,13 @@ typedef struct {
|
|||
}
|
||||
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);
|
||||
DESTROY(port);
|
||||
}
|
||||
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);
|
||||
DESTROY(port);
|
||||
}
|
||||
|
@ -1492,7 +1492,7 @@ typedef struct {
|
|||
sock = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC);
|
||||
if (sock < 0)
|
||||
{
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to create socket - %@", [NSError _last]);
|
||||
}
|
||||
#ifndef BROKEN_SO_REUSEADDR
|
||||
/*
|
||||
|
@ -1505,13 +1505,13 @@ typedef struct {
|
|||
sizeof(opt)) < 0)
|
||||
{
|
||||
(void)close(sock);
|
||||
NSLog(@"unable to set reuse on socket - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to set reuse on socket - %@", [NSError _last]);
|
||||
}
|
||||
#endif
|
||||
else if ((handle = [GSMessageHandle handleWithDescriptor: sock]) == nil)
|
||||
{
|
||||
(void)close(sock);
|
||||
NSLog(@"unable to create GSMessageHandle - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to create GSMessageHandle - %@", [NSError _last]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSMessagePortNameServer class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSMethodSignature class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSNotificationCenter class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSNull class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSNumberFormatter class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -161,7 +161,7 @@ static void GSLogZombie(id o, SEL sel)
|
|||
NSLog(@"Deallocated %@ (0x%x) sent %@",
|
||||
NSStringFromClass(c), o, NSStringFromSelector(sel));
|
||||
}
|
||||
if ([_GSPrivate environmentFlag: "CRASH_ON_ZOMBIE" defaultValue: NO] == YES)
|
||||
if (GSPrivateEnvironmentFlag("CRASH_ON_ZOMBIE", NO) == YES)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
@ -882,8 +882,6 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
}
|
||||
#endif
|
||||
|
||||
GSPrivate *_GSPrivate = nil;
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -895,10 +893,6 @@ GSPrivate *_GSPrivate = nil;
|
|||
{
|
||||
if (self == [NSObject class])
|
||||
{
|
||||
extern void GSBuildStrings(void); // See externs.m
|
||||
|
||||
_GSPrivate = [GSPrivate new];
|
||||
|
||||
#ifdef __MINGW32__
|
||||
// See libgnustep-base-entry.m
|
||||
extern void gnustep_base_socket_init(void);
|
||||
|
@ -972,10 +966,8 @@ GSPrivate *_GSPrivate = nil;
|
|||
zombieMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
zombieClass = [NSZombie class];
|
||||
NSZombieEnabled = [_GSPrivate environmentFlag: "NSZombieEnabled"
|
||||
defaultValue: NO];
|
||||
NSDeallocateZombies = [_GSPrivate environmentFlag: "NSDeallocateZombies"
|
||||
defaultValue: NO];
|
||||
NSZombieEnabled = GSPrivateEnvironmentFlag("NSZombieEnabled", NO);
|
||||
NSDeallocateZombies = GSPrivateEnvironmentFlag("NSDeallocateZombies", NO);
|
||||
|
||||
autorelease_class = [NSAutoreleasePool class];
|
||||
autorelease_sel = @selector(addObject:);
|
||||
|
@ -987,7 +979,7 @@ GSPrivate *_GSPrivate = nil;
|
|||
#endif
|
||||
#endif
|
||||
NSConstantStringClass = [NSString constantStringClass];
|
||||
GSBuildStrings();
|
||||
GSPrivateBuildStrings();
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_becomeMultiThreaded:)
|
||||
|
@ -1301,7 +1293,7 @@ GSPrivate *_GSPrivate = nil;
|
|||
{
|
||||
if (aSelector == 0)
|
||||
{
|
||||
if ([_GSPrivate userDefaultsFlag: GSMacOSXCompatible])
|
||||
if (GSPrivateDefaultsFlag(GSMacOSXCompatible))
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given",
|
||||
|
@ -1874,7 +1866,7 @@ GSPrivate *_GSPrivate = nil;
|
|||
{
|
||||
if (aSelector == 0)
|
||||
{
|
||||
if ([_GSPrivate userDefaultsFlag: GSMacOSXCompatible])
|
||||
if (GSPrivateDefaultsFlag(GSMacOSXCompatible))
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given",
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Failed to create pipe ... %@", [_GSPrivate error]);
|
||||
NSLog(@"Failed to create pipe ... %@", [NSError _last]);
|
||||
DESTROY(self);
|
||||
}
|
||||
#else
|
||||
|
@ -99,7 +99,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Failed to create pipe ... %@", [_GSPrivate error]);
|
||||
NSLog(@"Failed to create pipe ... %@", [NSError _last]);
|
||||
DESTROY(self);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSPortNameServer class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -317,7 +317,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
NSMutableSet *mySet;
|
||||
id obj_argv[argc];
|
||||
int added = 1;
|
||||
NSStringEncoding enc = [_GSPrivate defaultCStringEncoding];
|
||||
NSStringEncoding enc = GSPrivateDefaultCStringEncoding();
|
||||
|
||||
mySet = [NSMutableSet new];
|
||||
|
||||
|
@ -346,7 +346,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
{
|
||||
NSMutableArray *keys = [NSMutableArray new];
|
||||
NSMutableArray *values = [NSMutableArray new];
|
||||
NSStringEncoding enc = [_GSPrivate defaultCStringEncoding];
|
||||
NSStringEncoding enc = GSPrivateDefaultCStringEncoding();
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
if (fallbackInitialisation == NO)
|
||||
|
@ -1234,8 +1234,8 @@ BOOL GSDebugSet(NSString *level)
|
|||
return YES;
|
||||
}
|
||||
|
||||
@implementation GSPrivate (ProcessInfo)
|
||||
- (BOOL) environmentFlag: (const char *)name defaultValue: (BOOL)def
|
||||
BOOL
|
||||
GSPrivateEnvironmentFlag(const char *name, BOOL def)
|
||||
{
|
||||
const char *c = getenv(name);
|
||||
BOOL a = def;
|
||||
|
@ -1262,7 +1262,8 @@ BOOL GSDebugSet(NSString *level)
|
|||
return a;
|
||||
}
|
||||
|
||||
- (const char*) argZero
|
||||
const char*
|
||||
GSPrivateArgZero()
|
||||
{
|
||||
if (_gnu_arg_zero == 0)
|
||||
return "";
|
||||
|
@ -1270,5 +1271,3 @@ BOOL GSDebugSet(NSString *level)
|
|||
return _gnu_arg_zero;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -2170,7 +2170,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
{
|
||||
style = NSPropertyListXMLFormat_v1_0;
|
||||
}
|
||||
else if ([_GSPrivate userDefaultsFlag: NSWriteOldStylePropertyLists] == YES)
|
||||
else if (GSPrivateDefaultsFlag(NSWriteOldStylePropertyLists) == YES)
|
||||
{
|
||||
style = NSPropertyListOpenStepFormat;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSProtocolChecker class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSProxy class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
*
|
||||
* 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.
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02111 USA.
|
||||
|
||||
<title>NSRange class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -141,7 +141,7 @@ typedef struct {
|
|||
NSConstantStringClass = [NSString constantStringClass];
|
||||
_holder = (id)NSAllocateObject(GSPlaceholderStringClass, 0, 0);
|
||||
externalEncoding = [NSString defaultCStringEncoding];
|
||||
if ([_GSPrivate isByteEncoding: externalEncoding] == YES)
|
||||
if (GSPrivateIsByteEncoding(externalEncoding) == YES)
|
||||
{
|
||||
internalEncoding = externalEncoding;
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSSerializer class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -391,7 +391,7 @@ static Class runLoopClass;
|
|||
if (ioctlsocket(d, FIONBIO, &dummy) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode on %d - %@",
|
||||
d, [_GSPrivate error]);
|
||||
d, [NSError _last]);
|
||||
return nil;
|
||||
}
|
||||
#else /* !__MINGW32__ */
|
||||
|
@ -401,14 +401,14 @@ static Class runLoopClass;
|
|||
if (fcntl(d, F_SETFL, e) < 0)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode on %d - %@",
|
||||
d, [_GSPrivate error]);
|
||||
d, [NSError _last]);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"unable to get non-blocking mode on %d - %@",
|
||||
d, [_GSPrivate error]);
|
||||
d, [NSError _last]);
|
||||
return nil;
|
||||
}
|
||||
#endif
|
||||
|
@ -547,7 +547,7 @@ static Class runLoopClass;
|
|||
{
|
||||
NSLog(@"unable to make connection to %s:%d - %@",
|
||||
inet_ntoa(sockAddr.sin_addr),
|
||||
GSSwapBigI16ToHost(sockAddr.sin_port), [_GSPrivate error]);
|
||||
GSSwapBigI16ToHost(sockAddr.sin_port), [NSError _last]);
|
||||
if (addrNum < [addrs count])
|
||||
{
|
||||
BOOL result;
|
||||
|
@ -817,7 +817,7 @@ static Class runLoopClass;
|
|||
#endif /* !__MINGW32__ */
|
||||
{
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"read failed - %@ on 0x%p", [_GSPrivate error], self);
|
||||
@"read failed - %@ on 0x%p", [NSError _last], self);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
|
@ -1108,7 +1108,7 @@ static Class runLoopClass;
|
|||
&& res != 0)
|
||||
{
|
||||
state = GS_H_UNCON;
|
||||
NSLog(@"connect attempt failed - %@", [_GSPrivate error]);
|
||||
NSLog(@"connect attempt failed - %@", [NSError _last]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1128,7 +1128,7 @@ static Class runLoopClass;
|
|||
{
|
||||
state = GS_H_UNCON;
|
||||
NSLog(@"connect write attempt failed - %@",
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
}
|
||||
RELEASE(d);
|
||||
}
|
||||
|
@ -1166,7 +1166,7 @@ static Class runLoopClass;
|
|||
if (errno != EINTR && errno != EAGAIN)
|
||||
#endif /* !__MINGW32__ */
|
||||
{
|
||||
NSLog(@"write attempt failed - %@", [_GSPrivate error]);
|
||||
NSLog(@"write attempt failed - %@", [NSError _last]);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
|
@ -1635,7 +1635,7 @@ static Class tcpPortClass;
|
|||
else if ((desc = socket(AF_INET, SOCK_STREAM, PF_UNSPEC))
|
||||
== INVALID_SOCKET)
|
||||
{
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to create socket - %@", [NSError _last]);
|
||||
DESTROY(port);
|
||||
}
|
||||
#ifndef BROKEN_SO_REUSEADDR
|
||||
|
@ -1650,7 +1650,7 @@ static Class tcpPortClass;
|
|||
{
|
||||
(void) close(desc);
|
||||
NSLog(@"unable to set reuse on socket - %@",
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
DESTROY(port);
|
||||
}
|
||||
#endif
|
||||
|
@ -1658,20 +1658,20 @@ static Class tcpPortClass;
|
|||
sizeof(sockaddr)) == SOCKET_ERROR)
|
||||
{
|
||||
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);
|
||||
DESTROY(port);
|
||||
}
|
||||
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);
|
||||
DESTROY(port);
|
||||
}
|
||||
else if (getsockname(desc, (struct sockaddr*)&sockaddr, &i)
|
||||
== SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to get socket name - %@", [NSError _last]);
|
||||
(void) close(desc);
|
||||
DESTROY(port);
|
||||
}
|
||||
|
@ -1971,7 +1971,7 @@ static Class tcpPortClass;
|
|||
handle = nil;
|
||||
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
|
||||
/*
|
||||
|
@ -1984,13 +1984,13 @@ static Class tcpPortClass;
|
|||
sizeof(opt)) < 0)
|
||||
{
|
||||
(void)close(sock);
|
||||
NSLog(@"unable to set reuse on socket - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to set reuse on socket - %@", [NSError _last]);
|
||||
}
|
||||
#endif
|
||||
else if ((handle = [GSTcpHandle handleWithDescriptor: sock]) == nil)
|
||||
{
|
||||
(void)close(sock);
|
||||
NSLog(@"unable to create GSTcpHandle - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to create GSTcpHandle - %@", [NSError _last]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
|
|
|
@ -77,7 +77,6 @@
|
|||
#include "Foundation/NSKeyedArchiver.h"
|
||||
#include "GNUstepBase/GSMime.h"
|
||||
#include "GSPrivate.h"
|
||||
#include "GSFormat.h"
|
||||
#include <limits.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -565,8 +564,8 @@ handle_printf_atsign (FILE *stream,
|
|||
gcrSel = @selector(getCharacters:range:);
|
||||
ranSel = @selector(rangeOfComposedCharacterSequenceAtIndex:);
|
||||
|
||||
_DefaultStringEncoding = [_GSPrivate defaultCStringEncoding];
|
||||
_ByteEncodingOk = [_GSPrivate isByteEncoding: _DefaultStringEncoding];
|
||||
_DefaultStringEncoding = GSPrivateDefaultCStringEncoding();
|
||||
_ByteEncodingOk = GSPrivateIsByteEncoding(_DefaultStringEncoding);
|
||||
|
||||
NSStringClass = self;
|
||||
[self setVersion: 1];
|
||||
|
@ -1078,7 +1077,7 @@ handle_printf_atsign (FILE *stream,
|
|||
|
||||
/*
|
||||
* 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._zone = NSDefaultMallocZone();
|
||||
|
@ -1087,7 +1086,7 @@ handle_printf_atsign (FILE *stream,
|
|||
f._count = 0;
|
||||
f._flags.wide = 0;
|
||||
f._flags.free = 0;
|
||||
GSFormat(&f, fmt, argList, locale);
|
||||
GSPrivateFormat(&f, fmt, argList, locale);
|
||||
GSStrExternalize(&f);
|
||||
if (fmt != fbuf)
|
||||
{
|
||||
|
@ -2683,7 +2682,7 @@ handle_printf_atsign (FILE *stream,
|
|||
*/
|
||||
+ (NSStringEncoding*) availableStringEncodings
|
||||
{
|
||||
return [_GSPrivate availableEncodings];
|
||||
return GSPrivateAvailableEncodings();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2701,7 +2700,7 @@ handle_printf_atsign (FILE *stream,
|
|||
*/
|
||||
ourbundle = [NSBundle bundleForLibrary: @"gnustep-base"];
|
||||
|
||||
ourname = [_GSPrivate encodingName: encoding];
|
||||
ourname = GSPrivateEncodingName(encoding);
|
||||
return [ourbundle localizedStringForKey: ourname
|
||||
value: ourname
|
||||
table: nil];
|
||||
|
|
|
@ -1563,7 +1563,7 @@ GSPrivateCheckTasks()
|
|||
if (result < 0)
|
||||
{
|
||||
NSLog(@"waitpid %d, result %d, error %@",
|
||||
_taskId, result, [_GSPrivate error]);
|
||||
_taskId, result, [NSError _last]);
|
||||
[self _terminatedChild: -1];
|
||||
}
|
||||
else if (result == _taskId || (result > 0 && errno == 0))
|
||||
|
@ -1596,7 +1596,7 @@ GSPrivateCheckTasks()
|
|||
else
|
||||
{
|
||||
NSLog(@"waitpid %d, result %d, error %@",
|
||||
_taskId, result, [_GSPrivate error]);
|
||||
_taskId, result, [NSError _last]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -890,12 +890,12 @@ static NSDate *theFuture;
|
|||
#if defined(__MINGW32__)
|
||||
if (SetEvent(event) == 0)
|
||||
{
|
||||
NSLog(@"Set event failed - %@", [_GSPrivate error]);
|
||||
NSLog(@"Set event failed - %@", [NSError _last]);
|
||||
}
|
||||
#else
|
||||
if (write(outputFd, "0", 1) != 1)
|
||||
{
|
||||
NSLog(@"Write to pipe failed - %@", [_GSPrivate error]);
|
||||
NSLog(@"Write to pipe failed - %@", [NSError _last]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -919,12 +919,12 @@ static NSDate *theFuture;
|
|||
#if defined(__MINGW32__)
|
||||
if (ResetEvent(event) == 0)
|
||||
{
|
||||
NSLog(@"Reset event failed - %@", [_GSPrivate error]);
|
||||
NSLog(@"Reset event failed - %@", [NSError _last]);
|
||||
}
|
||||
#else
|
||||
if (read(inputFd, &c, 1) != 1)
|
||||
{
|
||||
NSLog(@"Read pipe failed - %@", [_GSPrivate error]);
|
||||
NSLog(@"Read pipe failed - %@", [NSError _last]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
|
||||
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.
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSTimeZone class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSUndoManager class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -1955,9 +1955,8 @@ static BOOL isLocked = NO;
|
|||
}
|
||||
@end
|
||||
|
||||
@implementation GSPrivate (UserDefaults)
|
||||
|
||||
- (BOOL) userDefaultsFlag: (GSUserDefaultFlagType)type
|
||||
BOOL
|
||||
GSPrivateDefaultsFlag(GSUserDefaultFlagType type)
|
||||
{
|
||||
if (sharedDefaults == nil)
|
||||
{
|
||||
|
@ -1965,7 +1964,6 @@ static BOOL isLocked = NO;
|
|||
}
|
||||
return flags[type];
|
||||
}
|
||||
@end
|
||||
|
||||
/* FIXME ... Slightly faster than
|
||||
* [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
|
||||
|
@ -1975,6 +1973,10 @@ NSDictionary *GSPrivateDefaultLocale()
|
|||
{
|
||||
NSDictionary *locale;
|
||||
|
||||
if (classLock == nil)
|
||||
{
|
||||
[NSUserDefaults standardUserDefaults];
|
||||
}
|
||||
[classLock lock];
|
||||
if (sharedDefaults == nil)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSValue class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
*/
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
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.
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSZone class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "config.h"
|
||||
#include "Foundation/NSString.h"
|
||||
|
||||
|
||||
#include "Foundation/NSArray.h"
|
||||
#include "Foundation/NSException.h"
|
||||
|
||||
|
@ -231,7 +230,7 @@ NSString *NSClassDescriptionNeededForClassNotification = @"NSClassDescriptionNee
|
|||
*/
|
||||
|
||||
void
|
||||
GSBuildStrings()
|
||||
GSPrivateBuildStrings()
|
||||
{
|
||||
static Class NSStringClass = 0;
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
/* These functions can be used for dissecting and making method calls
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
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.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "GNUstepBase/preface.h"
|
||||
#include "../GSRunLoopCtxt.h"
|
||||
#include "../GSRunLoopWatcher.h"
|
||||
#include "../GSPrivate.h"
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSError.h>
|
||||
#include <Foundation/NSNotificationQueue.h>
|
||||
#include <Foundation/NSPort.h>
|
||||
#include <Foundation/NSStream.h>
|
||||
#include "../GSRunLoopCtxt.h"
|
||||
#include "../GSRunLoopWatcher.h"
|
||||
#include "../GSPrivate.h"
|
||||
|
||||
#ifdef HAVE_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
|
||||
aborting here. */
|
||||
NSLog (@"poll() error in -acceptInputForMode:beforeDate: '%@'",
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
@ -799,7 +800,7 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
/* xxx We can do something with exception_fds, instead of
|
||||
aborting here. */
|
||||
NSLog (@"select() error in -acceptInputForMode:beforeDate: '%@'",
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -793,7 +793,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
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);
|
||||
return nil;
|
||||
}
|
||||
|
@ -808,7 +808,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (bind(net, (struct sockaddr *)&lsin, sizeof(lsin)) == SOCKET_ERROR)
|
||||
{
|
||||
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);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -828,7 +828,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
NSLog(@"unable to make connection to %s:%d - %@",
|
||||
inet_ntoa(sin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]);
|
||||
GSSwapBigI16ToHost(sin.sin_port), [NSError _last]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -892,7 +892,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
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);
|
||||
return nil;
|
||||
}
|
||||
|
@ -910,7 +910,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) == SOCKET_ERROR)
|
||||
{
|
||||
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);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -918,7 +918,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
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);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -926,7 +926,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
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);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -1094,7 +1094,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (_fstat(desc, &sbuf) != 0)
|
||||
{
|
||||
NSLog(@"unable to get status of descriptor %d - %@",
|
||||
desc, [_GSPrivate error]);
|
||||
desc, [NSError _last]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1295,7 +1295,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
@ -1320,7 +1320,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
@ -1346,7 +1346,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
[d setLength: got];
|
||||
}
|
||||
|
@ -1369,7 +1369,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
}
|
||||
while (len > 0 && got > 0);
|
||||
|
@ -1416,7 +1416,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to write to descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1522,7 +1522,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
return (unsigned long long)result;
|
||||
}
|
||||
|
@ -1546,7 +1546,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
return (unsigned long long)result;
|
||||
}
|
||||
|
@ -1570,7 +1570,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1929,7 +1929,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Accept attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
[readInfo setObject: s forKey: GSFileHandleNotificationError];
|
||||
}
|
||||
else
|
||||
|
@ -1998,7 +1998,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Read attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
[readInfo setObject: s forKey: GSFileHandleNotificationError];
|
||||
[self postReadNotification];
|
||||
}
|
||||
|
@ -2007,7 +2007,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Read attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
[readInfo setObject: s forKey: GSFileHandleNotificationError];
|
||||
[self postReadNotification];
|
||||
}
|
||||
|
@ -2047,7 +2047,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Connect attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[NSError _last]];
|
||||
[info setObject: s forKey: GSFileHandleNotificationError];
|
||||
}
|
||||
else
|
||||
|
@ -2081,7 +2081,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat:
|
||||
@"Write attempt failed - %@", [_GSPrivate error]];
|
||||
@"Write attempt failed - %@", [NSError _last]];
|
||||
[info setObject: s forKey: GSFileHandleNotificationError];
|
||||
[self postWriteNotification];
|
||||
}
|
||||
|
@ -2245,7 +2245,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
== SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode - %@",
|
||||
[_GSPrivate error]);
|
||||
[NSError _last]);
|
||||
}
|
||||
else
|
||||
isNonBlocking = flag;
|
||||
|
@ -2256,7 +2256,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (ioctlsocket((SOCKET)_get_osfhandle(descriptor), FIONBIO, &dummy)
|
||||
== SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to set blocking mode - %@", [_GSPrivate error]);
|
||||
NSLog(@"unable to set blocking mode - %@", [NSError _last]);
|
||||
}
|
||||
else
|
||||
isNonBlocking = flag;
|
||||
|
@ -2277,7 +2277,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
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
|
||||
{
|
||||
|
@ -2294,7 +2294,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
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
|
||||
{
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "GNUstepBase/preface.h"
|
||||
#include "../GSRunLoopCtxt.h"
|
||||
#include "../GSRunLoopWatcher.h"
|
||||
#include "../GSPrivate.h"
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSError.h>
|
||||
#include <Foundation/NSNotificationQueue.h>
|
||||
#include <Foundation/NSPort.h>
|
||||
#include <Foundation/NSStream.h>
|
||||
#include "../GSRunLoopCtxt.h"
|
||||
#include "../GSRunLoopWatcher.h"
|
||||
#include "../GSPrivate.h"
|
||||
|
||||
#if GS_WITH_GC == 0
|
||||
static SEL wRelSel;
|
||||
|
@ -434,7 +435,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
BOOL found = NO;
|
||||
|
||||
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
|
||||
* event signalled, or we find the one which caused the original
|
||||
|
@ -455,7 +456,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
if (found == NO)
|
||||
{
|
||||
NSLog(@"WaitForMultipleObjects() error in "
|
||||
@"-acceptInputForMode:beforeDate: %@", [_GSPrivate error]);
|
||||
@"-acceptInputForMode:beforeDate: %@", [NSError _last]);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ static Class messagePortClass = 0;
|
|||
if ([p _setupSendPort] == NO)
|
||||
{
|
||||
NSLog(@"unable to access mailslot '%@' - %@",
|
||||
[p name], [_GSPrivate error]);
|
||||
[p name], [NSError _last]);
|
||||
DESTROY(p);
|
||||
}
|
||||
return p;
|
||||
|
@ -335,7 +335,7 @@ static Class messagePortClass = 0;
|
|||
if (this->rHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
NSLog(@"unable to create mailslot '%@' - %@",
|
||||
this->name, [_GSPrivate error]);
|
||||
this->name, [NSError _last]);
|
||||
DESTROY(self);
|
||||
}
|
||||
else
|
||||
|
@ -507,7 +507,7 @@ static Class messagePortClass = 0;
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"GetOverlappedResult failed ... %@", [_GSPrivate error]);
|
||||
NSLog(@"GetOverlappedResult failed ... %@", [NSError _last]);
|
||||
this->rState = RS_NONE;
|
||||
this->rLength = 0;
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ static Class messagePortClass = 0;
|
|||
0) == 0)
|
||||
{
|
||||
NSLog(@"unable to get info from mailslot '%@' - %@",
|
||||
this->name, [_GSPrivate error]);
|
||||
this->name, [NSError _last]);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
|
@ -547,14 +547,14 @@ static Class messagePortClass = 0;
|
|||
NULL) == 0)
|
||||
{
|
||||
NSLog(@"unable to read from mailslot '%@' - %@",
|
||||
this->name, [_GSPrivate error]);
|
||||
this->name, [NSError _last]);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
if (this->rSize != this->rWant)
|
||||
{
|
||||
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];
|
||||
return;
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ static Class messagePortClass = 0;
|
|||
else
|
||||
{
|
||||
NSLog(@"unable to read from mailslot '%@' - %@",
|
||||
this->name, [_GSPrivate error]);
|
||||
this->name, [NSError _last]);
|
||||
[self invalidate];
|
||||
}
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ static Class messagePortClass = 0;
|
|||
&this->wSize,
|
||||
TRUE) == 0)
|
||||
{
|
||||
NSLog(@"GetOverlappedResult failed ... %@", [_GSPrivate error]);
|
||||
NSLog(@"GetOverlappedResult failed ... %@", [NSError _last]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -856,7 +856,7 @@ again:
|
|||
else if ((errno = GetLastError()) != ERROR_IO_PENDING)
|
||||
{
|
||||
NSLog(@"unable to write to mailslot '%@' - %@",
|
||||
this->name, [_GSPrivate error]);
|
||||
this->name, [NSError _last]);
|
||||
[self invalidate];
|
||||
}
|
||||
else
|
||||
|
|
|
@ -269,7 +269,7 @@ static void setNonblocking(SOCKET fd)
|
|||
unsigned long dummy = 1;
|
||||
|
||||
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
|
||||
|
@ -1867,7 +1867,7 @@ static void setNonblocking(SOCKET fd)
|
|||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue