mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 12:16:40 +00:00
Updates to reduce global namespace pollution. Plenty more remaining.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23795 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4874117588
commit
31342aef09
85 changed files with 1090 additions and 1277 deletions
86
ChangeLog
86
ChangeLog
|
@ -1,3 +1,89 @@
|
|||
2006-10-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Additions/GNUstepBase/unicode:
|
||||
Moved to Source/Additions/unicode
|
||||
* Source/NSSocketPortNameServer.m:
|
||||
* Source/GSLocale.m:
|
||||
* Source/NSTimeZone.m:
|
||||
* Source/GSCompatibility.m:
|
||||
* Source/NSCalendarDate.m:
|
||||
* Source/NSBundle.m:
|
||||
* Source/NSPropertyList.m:
|
||||
* Source/NSPathUtilities.m:
|
||||
* Source/NSScanner.m:
|
||||
* Source/NSProcessInfo.m:
|
||||
* Source/GNUmakefile:
|
||||
* Source/NSSocketPort.m:
|
||||
* Source/NSUserDefaults.m:
|
||||
* Source/GSFFCallInvocation.m:
|
||||
* Source/NSArray.m:
|
||||
* Source/GSStream.m:
|
||||
* Source/NSKeyedArchiver.m:
|
||||
* Source/NSDebug.m:
|
||||
* Source/unix/GSRunLoopCtxt.m:
|
||||
* Source/NSDistributedLock.m:
|
||||
* Source/GSHTTPURLHandle.m:
|
||||
* Source/NSMessagePort.m:
|
||||
* Source/GSPrivate.h:
|
||||
* Source/win32/NSMessagePortNameServerWin32.m:
|
||||
* Source/win32/GSFileHandleWin32.m:
|
||||
* Source/win32/NSUserDefaultsWin32.m:
|
||||
* Source/win32/GSRunLoopCtxt.m:
|
||||
* Source/win32/NSMessagePortWin32.m:
|
||||
* Source/win32/NSStreamWin32.m:
|
||||
* Source/NSInvocation.m:
|
||||
* Source/NSFileManager.m:
|
||||
* Source/objc-load.m:
|
||||
* Source/NSException.m:
|
||||
* Source/NSString.m:
|
||||
* Source/NSObject.m:
|
||||
* Source/NSDecimalNumber.m:
|
||||
* Source/Additions/Unicode.m:
|
||||
* Source/Additions/GSXML.m:
|
||||
* Source/Additions/GSFunctions.m:
|
||||
* Source/Additions/GSCompatibility.m:
|
||||
* Source/Additions/GSCategories.m:
|
||||
* Source/NSDecimal.m:
|
||||
* Source/GSString.m:
|
||||
* Source/NSDateFormatter.m:
|
||||
* Source/NSThread.m:
|
||||
* Source/NSData.m:
|
||||
* Source/NSHost.m:
|
||||
* Source/NSDate.m:
|
||||
* Source/NSObjCRuntime.m:
|
||||
* Source/NSPipe.m:
|
||||
* Source/NSDictionary.m:
|
||||
* Source/NSLog.m:
|
||||
* Source/GSFormat.m:
|
||||
* Source/GSFileHandle.m:
|
||||
* Source/NSTask.m:
|
||||
* Source/NSArchiver.m:
|
||||
* Source/GSFTPURLHandle.m:
|
||||
* SSL/GSSSLHandle.m:
|
||||
* Headers/Foundation/NSException.h:
|
||||
* Headers/Additions/GNUstepBase/GSFunctions.h:
|
||||
* Headers/Additions/GNUstepBase/GSObjCRuntime.h:
|
||||
* Headers/Additions/GNUstepBase/Unicode.h:
|
||||
* Tools/xmlparse.m:
|
||||
* Tools/defaults.m:
|
||||
* Tools/locale_alias.m:
|
||||
* Tools/Makefile.preamble:
|
||||
* Tools/AGSParser.m:
|
||||
* Tools/make_strings/make_strings.m:
|
||||
* Tools/pl.m:
|
||||
* Testing/tcpport-server.m:
|
||||
* Testing/exported-strings.m:
|
||||
* Testing/call.m:
|
||||
* Testing/nsconnection_server.m:
|
||||
* Testing/benchmark.m:
|
||||
* Testing/tcpport-client.m:
|
||||
Continuing effort to reduce global namespace pollution ... made many
|
||||
external variables static (particuarly unicode tables). Changed
|
||||
several global functions to be methods of a private internal class.
|
||||
Also updated several usages of deprecated cString methods to use
|
||||
either UTF8 methods or cString...encoding methods as seemed most
|
||||
appropriate and/or simplest.
|
||||
|
||||
2006-10-06 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/Additions/GSMime.m(GSMimeDocument +initialize): Corrected
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include "GNUstepBase/GSObjCRuntime.h"
|
||||
#include "GNUstepBase/GNUstep.h"
|
||||
|
||||
#warning "deprecated header ... will be removed in a later release"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -673,11 +673,6 @@ GSAutoreleasedBuffer(unsigned size);
|
|||
GS_EXPORT void
|
||||
GSAllocateMutexAt(objc_mutex_t *request);
|
||||
|
||||
/** Returns a system error message on a variety of systems
|
||||
*/
|
||||
GS_EXPORT const char *
|
||||
GSLastErrorStr(long error_id);
|
||||
|
||||
/**
|
||||
* <p>Prints a message to fptr using the format string provided and any
|
||||
* additional arguments. The format string is interpreted as by
|
||||
|
@ -699,6 +694,9 @@ GSPrintf (FILE *fptr, NSString *format, ...);
|
|||
|
||||
#ifndef NO_DEPRECATED
|
||||
|
||||
GS_EXPORT const char *
|
||||
GSLastErrorStr(long error_id) GS_ATTRIB_DEPRECATED;
|
||||
|
||||
GS_EXPORT BOOL
|
||||
GSFindInstanceVariable(id obj, const char *name,
|
||||
const char **type,
|
||||
|
|
|
@ -44,19 +44,17 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
GS_EXPORT NSStringEncoding *GetAvailableEncodings(void);
|
||||
GS_EXPORT NSStringEncoding GetDefEncoding(void);
|
||||
#if GS_API_VERSION(GS_API_NONE,011500)
|
||||
/* Deprecated functions */
|
||||
GS_EXPORT NSStringEncoding GSEncodingFromLocale(const char *clocale);
|
||||
GS_EXPORT NSStringEncoding GSEncodingForRegistry(NSString *registry,
|
||||
NSString *encoding);
|
||||
GS_EXPORT NSString* GSEncodingName(NSStringEncoding encoding);
|
||||
|
||||
GS_EXPORT unichar uni_tolower(unichar ch);
|
||||
GS_EXPORT unichar uni_toupper(unichar ch);
|
||||
GS_EXPORT unsigned char uni_cop(unichar u);
|
||||
GS_EXPORT BOOL uni_isnonsp(unichar u);
|
||||
GS_EXPORT unichar *uni_is_decomp(unichar u);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -77,22 +75,6 @@ GS_EXPORT BOOL GSToUnicode(unichar **dst, unsigned int *size,
|
|||
const unsigned char *src, unsigned int slen, NSStringEncoding enc,
|
||||
NSZone *zone, unsigned int options);
|
||||
|
||||
/*
|
||||
* The next functions are deprecated and will be removed in a future
|
||||
* release. Use GSFromUnicode() and GSToUnicode() instead.
|
||||
*/
|
||||
GS_EXPORT NSString* GetEncodingName(NSStringEncoding encoding);
|
||||
GS_EXPORT unichar chartouni(unsigned char c);
|
||||
GS_EXPORT unsigned char unitochar(unichar u);
|
||||
GS_EXPORT unichar encode_chartouni(unsigned char c, NSStringEncoding enc);
|
||||
GS_EXPORT unsigned char encode_unitochar(unichar u, NSStringEncoding enc);
|
||||
GS_EXPORT unsigned encode_unitochar_strict(unichar u, NSStringEncoding enc);
|
||||
GS_EXPORT int encode_ustrtocstr(char *dst, int dl, const unichar *src, int sl,
|
||||
NSStringEncoding enc, BOOL strict);
|
||||
GS_EXPORT int encode_cstrtoustr(unichar *dst, int dl, const char *src, int sl,
|
||||
NSStringEncoding enc);
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -335,7 +335,7 @@ GS_EXPORT void _NSRemoveHandler( NSHandler *handler );
|
|||
[[NSAssertionHandler currentHandler] \
|
||||
handleFailureInMethod: _cmd \
|
||||
object: self \
|
||||
file: [NSString stringWithCString: __FILE__] \
|
||||
file: [NSString stringWithUTF8String: __FILE__] \
|
||||
lineNumber: __LINE__ \
|
||||
description: (desc) , ## args]; \
|
||||
} \
|
||||
|
@ -345,8 +345,8 @@ GS_EXPORT void _NSRemoveHandler( NSHandler *handler );
|
|||
do { \
|
||||
if (!(condition)) { \
|
||||
[[NSAssertionHandler currentHandler] \
|
||||
handleFailureInFunction: [NSString stringWithCString: __PRETTY_FUNCTION__] \
|
||||
file: [NSString stringWithCString: __FILE__] \
|
||||
handleFailureInFunction: [NSString stringWithUTF8String: __PRETTY_FUNCTION__] \
|
||||
file: [NSString stringWithUTF8String: __FILE__] \
|
||||
lineNumber: __LINE__ \
|
||||
description: (desc) , ## args]; \
|
||||
} \
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -53,6 +54,7 @@
|
|||
#include <Foundation/Foundation.h>
|
||||
|
||||
#include <GNUstepBase/GSFileHandle.h>
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#include <winsock2.h>
|
||||
|
@ -105,8 +107,8 @@ sslError(int err, int e)
|
|||
str = @"Want X509 Lookup Error";
|
||||
break;
|
||||
case SSL_ERROR_SYSCALL:
|
||||
str = [NSString stringWithFormat: @"Syscall error %d - %s",
|
||||
e, GSLastErrorStr(e)];
|
||||
str = [NSString stringWithFormat: @"Syscall error %d - %@",
|
||||
e, [_GSPrivate error: e]];
|
||||
break;
|
||||
case SSL_ERROR_SSL:
|
||||
str = @"SSL Error: really helpful";
|
||||
|
|
|
@ -27,10 +27,57 @@
|
|||
#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, nuymber, 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
|
||||
|
||||
@implementation NSArray (GSCategories)
|
||||
|
||||
- (unsigned) insertionPosition: (id)item
|
||||
|
|
|
@ -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"
|
||||
|
@ -260,7 +261,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 - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -277,8 +278,8 @@ 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 - %s", inet_ntoa(sin.sin_addr),
|
||||
NSSwapBigShortToHost(sin.sin_port), GSLastErrorStr(errno));
|
||||
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
|
||||
NSSwapBigShortToHost(sin.sin_port), [_GSPrivate error]);
|
||||
(void) close(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -286,7 +287,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
|
||||
if (listen(net, 5) < 0)
|
||||
{
|
||||
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to listen on port - %@", [_GSPrivate error]);
|
||||
(void) close(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -294,7 +295,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 - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
(void) close(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -323,7 +324,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 - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ GSFindNamedFile(NSArray *paths, NSString *aName, NSString *anExtension)
|
|||
NSCParameterAssert(aName != nil);
|
||||
NSCParameterAssert(paths != nil);
|
||||
|
||||
GSOnceFLog(@"deprecated ... trivial to code directly");
|
||||
|
||||
/* make up the name with extension if given */
|
||||
if (anExtension != nil)
|
||||
{
|
||||
|
|
|
@ -122,14 +122,12 @@ UTF8Str(const unsigned char *bytes)
|
|||
inline static NSString*
|
||||
UTF8StrLen(const unsigned char *bytes, unsigned length)
|
||||
{
|
||||
unsigned char *buf = NSZoneMalloc(NSDefaultMallocZone(), length+1);
|
||||
NSString *str;
|
||||
|
||||
memcpy(buf, bytes, length);
|
||||
buf[length] = '\0';
|
||||
str = UTF8Str(buf);
|
||||
NSZoneFree(NSDefaultMallocZone(), buf);
|
||||
return str;
|
||||
str = [[NSString_class alloc] initWithBytes: bytes
|
||||
length: length
|
||||
encoding: NSUTF8StringEncoding];
|
||||
return AUTORELEASE(str);
|
||||
}
|
||||
|
||||
static BOOL cacheDone = NO;
|
||||
|
|
|
@ -24,7 +24,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"
|
||||
|
@ -42,6 +43,7 @@
|
|||
#include "GNUstepBase/GSLock.h"
|
||||
#include "GNUstepBase/GSCategories.h"
|
||||
#include "GNUstepBase/Unicode.h"
|
||||
#include "../GSPrivate.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -52,15 +54,15 @@
|
|||
|
||||
typedef struct {unichar from; unsigned char to;} _ucc_;
|
||||
|
||||
#include "GNUstepBase/unicode/cyrillic.h"
|
||||
#include "GNUstepBase/unicode/latin2.h"
|
||||
#include "GNUstepBase/unicode/latin9.h"
|
||||
#include "GNUstepBase/unicode/nextstep.h"
|
||||
#include "GNUstepBase/unicode/caseconv.h"
|
||||
#include "GNUstepBase/unicode/cop.h"
|
||||
#include "GNUstepBase/unicode/decomp.h"
|
||||
#include "GNUstepBase/unicode/gsm0338.h"
|
||||
#include "GNUstepBase/unicode/thai.h"
|
||||
#include "unicode/cyrillic.h"
|
||||
#include "unicode/latin2.h"
|
||||
#include "unicode/latin9.h"
|
||||
#include "unicode/nextstep.h"
|
||||
#include "unicode/caseconv.h"
|
||||
#include "unicode/cop.h"
|
||||
#include "unicode/decomp.h"
|
||||
#include "unicode/gsm0338.h"
|
||||
#include "unicode/thai.h"
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#ifdef HAVE_GICONV_H
|
||||
|
@ -329,7 +331,7 @@ static void GSSetupEncodingTable(void)
|
|||
}
|
||||
}
|
||||
|
||||
BOOL GSEncodingSupported(NSStringEncoding enc)
|
||||
static BOOL isEncodingSupported(NSStringEncoding enc)
|
||||
{
|
||||
GSSetupEncodingTable();
|
||||
|
||||
|
@ -385,9 +387,6 @@ BOOL GSEncodingSupported(NSStringEncoding enc)
|
|||
return NO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a nul terminated array of the available string encodings.
|
||||
*/
|
||||
NSStringEncoding *
|
||||
GetAvailableEncodings()
|
||||
{
|
||||
|
@ -412,7 +411,7 @@ GetAvailableEncodings()
|
|||
pos = 0;
|
||||
for (i = 0; i < encTableSize+1; i++)
|
||||
{
|
||||
if (GSEncodingSupported(i) == YES)
|
||||
if (isEncodingSupported(i) == YES)
|
||||
{
|
||||
encodings[pos++] = i;
|
||||
}
|
||||
|
@ -532,7 +531,7 @@ GSEncodingForRegistry (NSString *registry, NSString *encoding)
|
|||
* deduced from the clocale string itself. If clocale isn't set or
|
||||
* no match can be found, returns GSUndefinedEncoding.
|
||||
*/
|
||||
/* It would be really nice if this could be used in GetDefEncoding, but
|
||||
/* It would be really nice if this could be used in +defaultCStringEncoding, but
|
||||
* there are too many dependancies on other parts of the library to
|
||||
* make this practical (even if everything possible was written in C,
|
||||
* we'd still need some way to find the Locale.encodings file).
|
||||
|
@ -559,7 +558,7 @@ GSEncodingFromLocale(const char *clocale)
|
|||
char *s;
|
||||
|
||||
s = strchr (clocale, '.');
|
||||
registry = [[NSString stringWithCString: s+1] lowercaseString];
|
||||
registry = [[NSString stringWithUTF8String: s+1] lowercaseString];
|
||||
array = [registry componentsSeparatedByString: @"-"];
|
||||
registry = [array objectAtIndex: 0];
|
||||
if ([array count] > 1)
|
||||
|
@ -594,7 +593,7 @@ GSEncodingFromLocale(const char *clocale)
|
|||
|
||||
dict = [NSDictionary dictionaryWithContentsOfFile: table];
|
||||
encodstr = [dict objectForKey:
|
||||
[NSString stringWithCString: clocale]];
|
||||
[NSString stringWithUTF8String: clocale]];
|
||||
if (encodstr == nil)
|
||||
return GSUndefinedEncoding;
|
||||
|
||||
|
@ -620,299 +619,6 @@ GSEncodingFromLocale(const char *clocale)
|
|||
return encoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default encoding
|
||||
*/
|
||||
NSStringEncoding
|
||||
GetDefEncoding(void)
|
||||
{
|
||||
if (defEnc == GSUndefinedEncoding)
|
||||
{
|
||||
char *encoding;
|
||||
unsigned int count;
|
||||
|
||||
GSSetupEncodingTable();
|
||||
|
||||
[GS_INITIALIZED_LOCK(local_lock, GSLazyLock) lock];
|
||||
if (defEnc != GSUndefinedEncoding)
|
||||
{
|
||||
[local_lock unlock];
|
||||
return defEnc;
|
||||
}
|
||||
|
||||
encoding = getenv("GNUSTEP_STRING_ENCODING");
|
||||
if (encoding != 0)
|
||||
{
|
||||
count = 0;
|
||||
while (str_encoding_table[count].enc
|
||||
&& strcasecmp(str_encoding_table[count].ename, encoding)
|
||||
&& strcasecmp(str_encoding_table[count].iconv, encoding))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
if (str_encoding_table[count].enc)
|
||||
{
|
||||
defEnc = str_encoding_table[count].enc;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"WARNING: %s - encoding not supported.\n", encoding);
|
||||
fprintf(stderr,
|
||||
" NSISOLatin1StringEncoding set as default.\n");
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
}
|
||||
}
|
||||
if (defEnc == GSUndefinedEncoding)
|
||||
{
|
||||
/* Encoding not set */
|
||||
#if HAVE_LANGINFO_CODESET
|
||||
/* Take it from the system locale information. */
|
||||
encoding = nl_langinfo(CODESET);
|
||||
/*
|
||||
* First handle the fallback response from nl_langinfo() ...
|
||||
* if we are getting the default value we can't assume that
|
||||
* the user has set anything up at all, so we must use the
|
||||
* OpenStep/GNUstep default encopding ... latin1, even though
|
||||
* the nl_langinfo() stuff would say default is ascii.
|
||||
*/
|
||||
if (strcmp(encoding, "ANSI_X3.4-1968") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO_646.IRV:1983") == 0 /* glibc */
|
||||
|| strcmp(encoding, "646") == 0 /* Solaris NetBSD */)
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
else if (strcmp(encoding, "EUC-JP") == 0 /* glibc */
|
||||
/* HP-UX IRIX OSF/1 Solaris NetBSD */
|
||||
|| strcmp(encoding, "eucJP") == 0
|
||||
|| strcmp(encoding, "IBM-eucJP") == 0 /* AIX */)
|
||||
defEnc = NSJapaneseEUCStringEncoding;
|
||||
else if (strcmp(encoding, "UTF-8") == 0 /* glibc AIX OSF/1 Solaris */
|
||||
|| strcmp(encoding, "utf8") == 0 /* HP-UX */)
|
||||
defEnc = NSUTF8StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-1") == 0 /* glibc */
|
||||
/* AIX IRIX OSF/1 Solaris NetBSD */
|
||||
|| strcmp(encoding, "ISO8859-1") == 0
|
||||
|| strcmp(encoding, "iso88591") == 0 /* HP-UX */)
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
else if (strcmp(encoding, "IBM-932") == 0 /* AIX */
|
||||
|| strcmp(encoding, "SJIS") == 0 /* HP-UX OSF/1 NetBSD */
|
||||
|| strcmp(encoding, "PCK") == 0 /* Solaris */)
|
||||
defEnc = NSShiftJISStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-2") == 0 /* glibc */
|
||||
/* AIX IRIX OSF/1 Solaris NetBSD */
|
||||
|| strcmp(encoding, "ISO8859-2") == 0
|
||||
|| strcmp(encoding, "iso88592") == 0 /* HP-UX */)
|
||||
defEnc = NSISOLatin2StringEncoding;
|
||||
else if (strcmp(encoding, "CP1251") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ansi-1251") == 0 /* Solaris */)
|
||||
defEnc = NSWindowsCP1251StringEncoding;
|
||||
else if (strcmp(encoding, "CP1252") == 0 /* */
|
||||
|| strcmp(encoding, "IBM-1252") == 0 /* AIX */)
|
||||
defEnc = NSWindowsCP1252StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-5") == 0 /* glibc */
|
||||
/* AIX IRIX OSF/1 Solaris NetBSD */
|
||||
|| strcmp(encoding, "ISO8859-5") == 0
|
||||
|| strcmp(encoding, "iso88595") == 0 /* HP-UX */)
|
||||
defEnc = NSISOCyrillicStringEncoding;
|
||||
else if (strcmp(encoding, "KOI8-R") == 0 /* glibc */
|
||||
|| strcmp(encoding, "koi8-r") == 0 /* Solaris */)
|
||||
defEnc = NSKOI8RStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-3") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-3") == 0 /* Solaris */)
|
||||
defEnc = NSISOLatin3StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-4") == 0 /* */
|
||||
|| strcmp(encoding, "ISO8859-4") == 0 /* OSF/1 Solaris NetBSD */)
|
||||
defEnc = NSISOLatin4StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-6") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-6") == 0 /* AIX Solaris */
|
||||
|| strcmp(encoding, "iso88596") == 0 /* HP-UX */)
|
||||
defEnc = NSISOArabicStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-7") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-7") == 0 /* AIX IRIX OSF/1 Solaris */
|
||||
|| strcmp(encoding, "iso88597") == 0 /* HP-UX */)
|
||||
defEnc = NSISOGreekStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-8") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-8") == 0 /* AIX OSF/1 Solaris */
|
||||
|| strcmp(encoding, "iso88598") == 0 /* HP-UX */)
|
||||
defEnc = NSISOHebrewStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-9") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-9") == 0 /* AIX IRIX OSF/1 Solaris */
|
||||
|| strcmp(encoding, "iso88599") == 0 /* HP-UX */)
|
||||
defEnc = NSISOLatin5StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-10") == 0 /* */
|
||||
|| strcmp(encoding, "ISO8859-10") == 0 /* */)
|
||||
defEnc = NSISOLatin6StringEncoding;
|
||||
else if (strcmp(encoding, "TIS-620") == 0 /* glibc AIX */
|
||||
|| strcmp(encoding, "tis620") == 0 /* HP-UX */
|
||||
|| strcmp(encoding, "TIS620.2533") == 0 /* Solaris */
|
||||
|| strcmp(encoding, "TACTIS") == 0 /* OSF/1 */)
|
||||
defEnc = NSISOThaiStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-13") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-13") == 0 /* */
|
||||
|| strcmp(encoding, "IBM-921") == 0 /* AIX */)
|
||||
defEnc = NSISOLatin7StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-14") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-14") == 0 /* */)
|
||||
defEnc = NSISOLatin8StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-15") == 0 /* glibc */
|
||||
/* AIX OSF/1 Solaris NetBSD */
|
||||
|| strcmp(encoding, "ISO8859-15") == 0
|
||||
|| strcmp(encoding, "iso885915") == 0 /* HP-UX */)
|
||||
defEnc = NSISOLatin9StringEncoding;
|
||||
else if (strcmp(encoding, "GB2312") == 0 /* glibc */
|
||||
|| strcmp(encoding, "gb2312") == 0 /* Solaris */
|
||||
|| strcmp(encoding, "eucCN") == 0 /* IRIX NetBSD */
|
||||
|| strcmp(encoding, "IBM-eucCN") == 0 /* AIX */
|
||||
|| strcmp(encoding, "hp15CN") == 0 /* HP-UX */)
|
||||
defEnc = NSGB2312StringEncoding;
|
||||
else if (strcmp(encoding, "BIG5") == 0 /* glibc Solaris NetBSD */
|
||||
|| strcmp(encoding, "big5") == 0 /* AIX HP-UX OSF/1 */)
|
||||
defEnc = NSBIG5StringEncoding;
|
||||
else if (strcmp(encoding, "EUC-KR") == 0 /* glibc */
|
||||
|| strcmp(encoding, "eucKR") == 0 /* HP-UX IRIX OSF/1 NetBSD */
|
||||
|| strcmp(encoding, "IBM-eucKR") == 0 /* AIX */
|
||||
|| strcmp(encoding, "5601") == 0 /* Solaris */)
|
||||
defEnc = NSKoreanEUCStringEncoding;
|
||||
else
|
||||
#endif
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
}
|
||||
else if (GSEncodingSupported(defEnc) == NO)
|
||||
{
|
||||
fprintf(stderr, "WARNING: %s - encoding not implemented as "
|
||||
"default c string encoding.\n", encoding);
|
||||
fprintf(stderr,
|
||||
" NSISOLatin1StringEncoding set as default.\n");
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
}
|
||||
[local_lock unlock];
|
||||
}
|
||||
return defEnc;
|
||||
}
|
||||
|
||||
BOOL
|
||||
GSIsByteEncoding(NSStringEncoding encoding)
|
||||
{
|
||||
if (GSEncodingSupported(encoding) == NO)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
return encodingTable[encoding]->eightBit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the standard name for the specified encoding.
|
||||
*/
|
||||
#ifndef NeXT_Foundation_LIBRARY
|
||||
NSString*
|
||||
GSEncodingName(NSStringEncoding encoding)
|
||||
{
|
||||
if (GSEncodingSupported(encoding) == NO)
|
||||
{
|
||||
return @"Unknown encoding";
|
||||
}
|
||||
return [NSString stringWithCString: encodingTable[encoding]->ename];
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* <strong>deprecated</strong> Use GSEncodingName()
|
||||
*/
|
||||
#ifndef NeXT_Foundation_LIBRARY
|
||||
NSString*
|
||||
GetEncodingName(NSStringEncoding encoding)
|
||||
{
|
||||
return GSEncodingName(encoding);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* <strong>deprecated</strong>
|
||||
* See GSToUnicode() and GSFromUnicode()
|
||||
*/
|
||||
unichar
|
||||
encode_chartouni(unsigned char c, NSStringEncoding enc)
|
||||
{
|
||||
BOOL result;
|
||||
unsigned int size = 1;
|
||||
unichar u = 0;
|
||||
unichar *dst = &u;
|
||||
|
||||
result = GSToUnicode(&dst, &size, &c, 1, enc, 0, 0);
|
||||
if (result == NO)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
||||
/**
|
||||
* <strong>deprecated</strong>
|
||||
* See GSToUnicode() and GSFromUnicode()
|
||||
*/
|
||||
unsigned char
|
||||
encode_unitochar(unichar u, NSStringEncoding enc)
|
||||
{
|
||||
BOOL result;
|
||||
unsigned int size = 1;
|
||||
unsigned char c = 0;
|
||||
unsigned char *dst = &c;
|
||||
|
||||
result = GSFromUnicode(&dst, &size, &u, 1, enc, 0, 0);
|
||||
if (result == NO)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* <strong>deprecated</strong>
|
||||
* See GSToUnicode() and GSFromUnicode()
|
||||
*/
|
||||
unsigned
|
||||
encode_unitochar_strict(unichar u, NSStringEncoding enc)
|
||||
{
|
||||
BOOL result;
|
||||
unsigned int size = 1;
|
||||
unsigned char c = 0;
|
||||
unsigned char *dst = &c;
|
||||
|
||||
result = GSFromUnicode(&dst, &size, &u, 1, enc, 0, GSUniStrict);
|
||||
if (result == NO)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* <strong>deprecated</strong>
|
||||
* See GSToUnicode() and GSFromUnicode()
|
||||
*/
|
||||
unichar
|
||||
chartouni(unsigned char c)
|
||||
{
|
||||
if (defEnc == GSUndefinedEncoding)
|
||||
{
|
||||
defEnc = GetDefEncoding();
|
||||
}
|
||||
return encode_chartouni(c, defEnc);
|
||||
}
|
||||
|
||||
/**
|
||||
* <strong>deprecated</strong>
|
||||
* See GSToUnicode() and GSFromUnicode()
|
||||
*/
|
||||
unsigned char
|
||||
unitochar(unichar u)
|
||||
{
|
||||
if (defEnc == GSUndefinedEncoding)
|
||||
{
|
||||
defEnc = GetDefEncoding();
|
||||
}
|
||||
return encode_unitochar(u, defEnc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses direct access into a two-level table to map cases.<br />
|
||||
* The two-level table method is less space efficient (but still not bad) than
|
||||
|
@ -1050,46 +756,6 @@ uni_is_decomp(unichar u)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <strong>deprecated</strong>
|
||||
* See GSToUnicode() and GSFromUnicode()
|
||||
*/
|
||||
int encode_ustrtocstr(char *dst, int dl, const unichar *src, int sl,
|
||||
NSStringEncoding enc, BOOL strict)
|
||||
{
|
||||
BOOL result;
|
||||
unsigned int options = (strict == YES) ? GSUniStrict : 0;
|
||||
unsigned int old = dl;
|
||||
|
||||
result = GSFromUnicode((unsigned char**)&dst, (unsigned int*)&dl,
|
||||
src, sl, enc, 0, options);
|
||||
if (result == NO)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return old - dl; // Number of characters.
|
||||
}
|
||||
|
||||
/**
|
||||
* <strong>deprecated</strong>
|
||||
* See GSToUnicode() and GSFromUnicode()
|
||||
*/
|
||||
int encode_cstrtoustr(unichar *dst, int dl, const char *src, int sl,
|
||||
NSStringEncoding enc)
|
||||
{
|
||||
BOOL result;
|
||||
unsigned int old = dl;
|
||||
|
||||
result = GSToUnicode(&dst, (unsigned int*)&dl, (unsigned char*)src,
|
||||
sl, enc, 0, 0);
|
||||
if (result == NO)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return old - dl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to check a block of data for validity as a unicode string and
|
||||
* say whether it contains solely ASCII or solely Latin1 data.<br />
|
||||
|
@ -1531,7 +1197,7 @@ tables:
|
|||
const char *estr = 0;
|
||||
BOOL done = NO;
|
||||
|
||||
if (GSEncodingSupported(enc) == YES)
|
||||
if (isEncodingSupported(enc) == YES)
|
||||
{
|
||||
estr = encodingTable[enc]->iconv;
|
||||
}
|
||||
|
@ -1552,7 +1218,7 @@ tables:
|
|||
if (cd == (iconv_t)-1)
|
||||
{
|
||||
NSLog(@"No iconv for encoding %@ tried to use %s",
|
||||
GetEncodingName(enc), estr);
|
||||
[_GSPrivate encodingName: enc], estr);
|
||||
result = NO;
|
||||
goto done;
|
||||
}
|
||||
|
@ -2224,7 +1890,7 @@ iconv_start:
|
|||
const char *estr = 0;
|
||||
BOOL done = NO;
|
||||
|
||||
if (GSEncodingSupported(enc) == YES)
|
||||
if (isEncodingSupported(enc) == YES)
|
||||
{
|
||||
if (strict == NO)
|
||||
{
|
||||
|
@ -2257,7 +1923,7 @@ iconv_start:
|
|||
if (cd == (iconv_t)-1)
|
||||
{
|
||||
NSLog(@"No iconv for encoding %@ tried to use %s",
|
||||
GetEncodingName(enc), estr);
|
||||
[_GSPrivate encodingName: enc], estr);
|
||||
result = NO;
|
||||
goto done;
|
||||
}
|
||||
|
@ -2414,3 +2080,231 @@ iconv_start:
|
|||
|
||||
#undef GROW
|
||||
|
||||
@implementation _GSPrivate (Unicode)
|
||||
|
||||
+ (NSStringEncoding*) availableEncodings
|
||||
{
|
||||
if (_availableEncodings == 0)
|
||||
{
|
||||
GSSetupEncodingTable();
|
||||
[GS_INITIALIZED_LOCK(local_lock, GSLazyLock) lock];
|
||||
if (_availableEncodings == 0)
|
||||
{
|
||||
NSStringEncoding *encodings;
|
||||
unsigned pos;
|
||||
unsigned i;
|
||||
|
||||
/*
|
||||
* Now build up a list of supported encodings ... in the
|
||||
* format needed to support [NSString+availableStringEncodings]
|
||||
* Check to see what iconv support we have as we go along.
|
||||
* This is also the place where we determine the name we use
|
||||
* for iconv to support unicode.
|
||||
*/
|
||||
encodings = objc_malloc(sizeof(NSStringEncoding) * (encTableSize+1));
|
||||
pos = 0;
|
||||
for (i = 0; i < encTableSize+1; i++)
|
||||
{
|
||||
if (isEncodingSupported(i) == YES)
|
||||
{
|
||||
encodings[pos++] = i;
|
||||
}
|
||||
}
|
||||
encodings[pos] = 0;
|
||||
_availableEncodings = encodings;
|
||||
}
|
||||
[local_lock unlock];
|
||||
}
|
||||
return _availableEncodings;
|
||||
}
|
||||
|
||||
+ (NSStringEncoding) defaultCStringEncoding
|
||||
{
|
||||
if (defEnc == GSUndefinedEncoding)
|
||||
{
|
||||
char *encoding;
|
||||
unsigned int count;
|
||||
|
||||
GSSetupEncodingTable();
|
||||
|
||||
[GS_INITIALIZED_LOCK(local_lock, GSLazyLock) lock];
|
||||
if (defEnc != GSUndefinedEncoding)
|
||||
{
|
||||
[local_lock unlock];
|
||||
return defEnc;
|
||||
}
|
||||
|
||||
encoding = getenv("GNUSTEP_STRING_ENCODING");
|
||||
if (encoding != 0)
|
||||
{
|
||||
count = 0;
|
||||
while (str_encoding_table[count].enc
|
||||
&& strcasecmp(str_encoding_table[count].ename, encoding)
|
||||
&& strcasecmp(str_encoding_table[count].iconv, encoding))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
if (str_encoding_table[count].enc)
|
||||
{
|
||||
defEnc = str_encoding_table[count].enc;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,
|
||||
"WARNING: %s - encoding not supported.\n", encoding);
|
||||
fprintf(stderr,
|
||||
" NSISOLatin1StringEncoding set as default.\n");
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
}
|
||||
}
|
||||
if (defEnc == GSUndefinedEncoding)
|
||||
{
|
||||
/* Encoding not set */
|
||||
#if HAVE_LANGINFO_CODESET
|
||||
/* Take it from the system locale information. */
|
||||
encoding = nl_langinfo(CODESET);
|
||||
/*
|
||||
* First handle the fallback response from nl_langinfo() ...
|
||||
* if we are getting the default value we can't assume that
|
||||
* the user has set anything up at all, so we must use the
|
||||
* OpenStep/GNUstep default encopding ... latin1, even though
|
||||
* the nl_langinfo() stuff would say default is ascii.
|
||||
*/
|
||||
if (strcmp(encoding, "ANSI_X3.4-1968") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO_646.IRV:1983") == 0 /* glibc */
|
||||
|| strcmp(encoding, "646") == 0 /* Solaris NetBSD */)
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
else if (strcmp(encoding, "EUC-JP") == 0 /* glibc */
|
||||
/* HP-UX IRIX OSF/1 Solaris NetBSD */
|
||||
|| strcmp(encoding, "eucJP") == 0
|
||||
|| strcmp(encoding, "IBM-eucJP") == 0 /* AIX */)
|
||||
defEnc = NSJapaneseEUCStringEncoding;
|
||||
else if (strcmp(encoding, "UTF-8") == 0 /* glibc AIX OSF/1 Solaris */
|
||||
|| strcmp(encoding, "utf8") == 0 /* HP-UX */)
|
||||
defEnc = NSUTF8StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-1") == 0 /* glibc */
|
||||
/* AIX IRIX OSF/1 Solaris NetBSD */
|
||||
|| strcmp(encoding, "ISO8859-1") == 0
|
||||
|| strcmp(encoding, "iso88591") == 0 /* HP-UX */)
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
else if (strcmp(encoding, "IBM-932") == 0 /* AIX */
|
||||
|| strcmp(encoding, "SJIS") == 0 /* HP-UX OSF/1 NetBSD */
|
||||
|| strcmp(encoding, "PCK") == 0 /* Solaris */)
|
||||
defEnc = NSShiftJISStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-2") == 0 /* glibc */
|
||||
/* AIX IRIX OSF/1 Solaris NetBSD */
|
||||
|| strcmp(encoding, "ISO8859-2") == 0
|
||||
|| strcmp(encoding, "iso88592") == 0 /* HP-UX */)
|
||||
defEnc = NSISOLatin2StringEncoding;
|
||||
else if (strcmp(encoding, "CP1251") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ansi-1251") == 0 /* Solaris */)
|
||||
defEnc = NSWindowsCP1251StringEncoding;
|
||||
else if (strcmp(encoding, "CP1252") == 0 /* */
|
||||
|| strcmp(encoding, "IBM-1252") == 0 /* AIX */)
|
||||
defEnc = NSWindowsCP1252StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-5") == 0 /* glibc */
|
||||
/* AIX IRIX OSF/1 Solaris NetBSD */
|
||||
|| strcmp(encoding, "ISO8859-5") == 0
|
||||
|| strcmp(encoding, "iso88595") == 0 /* HP-UX */)
|
||||
defEnc = NSISOCyrillicStringEncoding;
|
||||
else if (strcmp(encoding, "KOI8-R") == 0 /* glibc */
|
||||
|| strcmp(encoding, "koi8-r") == 0 /* Solaris */)
|
||||
defEnc = NSKOI8RStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-3") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-3") == 0 /* Solaris */)
|
||||
defEnc = NSISOLatin3StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-4") == 0 /* */
|
||||
|| strcmp(encoding, "ISO8859-4") == 0 /* OSF/1 Solaris NetBSD */)
|
||||
defEnc = NSISOLatin4StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-6") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-6") == 0 /* AIX Solaris */
|
||||
|| strcmp(encoding, "iso88596") == 0 /* HP-UX */)
|
||||
defEnc = NSISOArabicStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-7") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-7") == 0 /* AIX IRIX OSF/1 Solaris */
|
||||
|| strcmp(encoding, "iso88597") == 0 /* HP-UX */)
|
||||
defEnc = NSISOGreekStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-8") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-8") == 0 /* AIX OSF/1 Solaris */
|
||||
|| strcmp(encoding, "iso88598") == 0 /* HP-UX */)
|
||||
defEnc = NSISOHebrewStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-9") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-9") == 0 /* AIX IRIX OSF/1 Solaris */
|
||||
|| strcmp(encoding, "iso88599") == 0 /* HP-UX */)
|
||||
defEnc = NSISOLatin5StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-10") == 0 /* */
|
||||
|| strcmp(encoding, "ISO8859-10") == 0 /* */)
|
||||
defEnc = NSISOLatin6StringEncoding;
|
||||
else if (strcmp(encoding, "TIS-620") == 0 /* glibc AIX */
|
||||
|| strcmp(encoding, "tis620") == 0 /* HP-UX */
|
||||
|| strcmp(encoding, "TIS620.2533") == 0 /* Solaris */
|
||||
|| strcmp(encoding, "TACTIS") == 0 /* OSF/1 */)
|
||||
defEnc = NSISOThaiStringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-13") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-13") == 0 /* */
|
||||
|| strcmp(encoding, "IBM-921") == 0 /* AIX */)
|
||||
defEnc = NSISOLatin7StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-14") == 0 /* glibc */
|
||||
|| strcmp(encoding, "ISO8859-14") == 0 /* */)
|
||||
defEnc = NSISOLatin8StringEncoding;
|
||||
else if (strcmp(encoding, "ISO-8859-15") == 0 /* glibc */
|
||||
/* AIX OSF/1 Solaris NetBSD */
|
||||
|| strcmp(encoding, "ISO8859-15") == 0
|
||||
|| strcmp(encoding, "iso885915") == 0 /* HP-UX */)
|
||||
defEnc = NSISOLatin9StringEncoding;
|
||||
else if (strcmp(encoding, "GB2312") == 0 /* glibc */
|
||||
|| strcmp(encoding, "gb2312") == 0 /* Solaris */
|
||||
|| strcmp(encoding, "eucCN") == 0 /* IRIX NetBSD */
|
||||
|| strcmp(encoding, "IBM-eucCN") == 0 /* AIX */
|
||||
|| strcmp(encoding, "hp15CN") == 0 /* HP-UX */)
|
||||
defEnc = NSGB2312StringEncoding;
|
||||
else if (strcmp(encoding, "BIG5") == 0 /* glibc Solaris NetBSD */
|
||||
|| strcmp(encoding, "big5") == 0 /* AIX HP-UX OSF/1 */)
|
||||
defEnc = NSBIG5StringEncoding;
|
||||
else if (strcmp(encoding, "EUC-KR") == 0 /* glibc */
|
||||
|| strcmp(encoding, "eucKR") == 0 /* HP-UX IRIX OSF/1 NetBSD */
|
||||
|| strcmp(encoding, "IBM-eucKR") == 0 /* AIX */
|
||||
|| strcmp(encoding, "5601") == 0 /* Solaris */)
|
||||
defEnc = NSKoreanEUCStringEncoding;
|
||||
else
|
||||
#endif
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
}
|
||||
else if (isEncodingSupported(defEnc) == NO)
|
||||
{
|
||||
fprintf(stderr, "WARNING: %s - encoding not implemented as "
|
||||
"default c string encoding.\n", encoding);
|
||||
fprintf(stderr,
|
||||
" NSISOLatin1StringEncoding set as default.\n");
|
||||
defEnc = NSISOLatin1StringEncoding;
|
||||
}
|
||||
[local_lock unlock];
|
||||
}
|
||||
return defEnc;
|
||||
}
|
||||
|
||||
+ (NSString*) encodingName: (NSStringEncoding)encoding
|
||||
{
|
||||
if (isEncodingSupported(encoding) == NO)
|
||||
{
|
||||
return @"Unknown encoding";
|
||||
}
|
||||
return [NSString stringWithUTF8String: encodingTable[encoding]->ename];
|
||||
}
|
||||
|
||||
+ (BOOL) isByteEncoding: (NSStringEncoding)encoding
|
||||
{
|
||||
if (isEncodingSupported(encoding) == NO)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
return encodingTable[encoding]->eightBit;
|
||||
}
|
||||
|
||||
+ (BOOL) isEncodingSupported: (NSStringEncoding)encoding
|
||||
{
|
||||
return isEncodingSupported(encoding);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved.
|
||||
*/
|
||||
unichar gs_casemap_empty_table[] = {
|
||||
static unichar gs_casemap_empty_table[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -267,7 +267,7 @@ unichar gs_casemap_empty_table[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
unichar gs_tolower_map_table_0[] = {
|
||||
static unichar gs_tolower_map_table_0[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -525,7 +525,8 @@ unichar gs_tolower_map_table_0[] = {
|
|||
0x0,
|
||||
0x0,
|
||||
};
|
||||
unichar gs_tolower_map_table_1[] = {
|
||||
|
||||
static unichar gs_tolower_map_table_1[] = {
|
||||
0x101, /* 0 */
|
||||
0x0,
|
||||
0x103, /* 2 */
|
||||
|
@ -783,7 +784,8 @@ unichar gs_tolower_map_table_1[] = {
|
|||
0x1ff, /* fe */
|
||||
0x0,
|
||||
};
|
||||
unichar gs_tolower_map_table_2[] = {
|
||||
|
||||
static unichar gs_tolower_map_table_2[] = {
|
||||
0x201, /* 0 */
|
||||
0x0,
|
||||
0x203, /* 2 */
|
||||
|
@ -1041,7 +1043,8 @@ unichar gs_tolower_map_table_2[] = {
|
|||
0x0,
|
||||
0x0,
|
||||
};
|
||||
unichar gs_tolower_map_table_3[] = {
|
||||
|
||||
static unichar gs_tolower_map_table_3[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -1299,7 +1302,8 @@ unichar gs_tolower_map_table_3[] = {
|
|||
0x0,
|
||||
0x0,
|
||||
};
|
||||
unichar gs_tolower_map_table_4[] = {
|
||||
|
||||
static unichar gs_tolower_map_table_4[] = {
|
||||
0x450, /* 0 */
|
||||
0x451, /* 1 */
|
||||
0x452, /* 2 */
|
||||
|
@ -1557,7 +1561,8 @@ unichar gs_tolower_map_table_4[] = {
|
|||
0x0,
|
||||
0x0,
|
||||
};
|
||||
unichar gs_tolower_map_table_5[] = {
|
||||
|
||||
static unichar gs_tolower_map_table_5[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -1815,7 +1820,8 @@ unichar gs_tolower_map_table_5[] = {
|
|||
0x0,
|
||||
0x0,
|
||||
};
|
||||
unichar gs_tolower_map_table_1e[] = {
|
||||
|
||||
static unichar gs_tolower_map_table_1e[] = {
|
||||
0x1e01, /* 0 */
|
||||
0x0,
|
||||
0x1e03, /* 2 */
|
||||
|
@ -2073,7 +2079,8 @@ unichar gs_tolower_map_table_1e[] = {
|
|||
0x0,
|
||||
0x0,
|
||||
};
|
||||
unichar gs_tolower_map_table_1f[] = {
|
||||
|
||||
static unichar gs_tolower_map_table_1f[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -2331,7 +2338,8 @@ unichar gs_tolower_map_table_1f[] = {
|
|||
0x0,
|
||||
0x0,
|
||||
};
|
||||
unichar gs_tolower_map_table_21[] = {
|
||||
|
||||
static unichar gs_tolower_map_table_21[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -2589,7 +2597,8 @@ unichar gs_tolower_map_table_21[] = {
|
|||
0x0,
|
||||
0x0,
|
||||
};
|
||||
unichar gs_tolower_map_table_24[] = {
|
||||
|
||||
static unichar gs_tolower_map_table_24[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -2847,7 +2856,8 @@ unichar gs_tolower_map_table_24[] = {
|
|||
0x0,
|
||||
0x0,
|
||||
};
|
||||
unichar gs_tolower_map_table_ff[] = {
|
||||
|
||||
static unichar gs_tolower_map_table_ff[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -3106,7 +3116,7 @@ unichar gs_tolower_map_table_ff[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
unichar *gs_tolower_map[] = {
|
||||
static unichar *gs_tolower_map[] = {
|
||||
gs_tolower_map_table_0,
|
||||
gs_tolower_map_table_1,
|
||||
gs_tolower_map_table_2,
|
||||
|
@ -3365,7 +3375,7 @@ unichar *gs_tolower_map[] = {
|
|||
gs_tolower_map_table_ff,
|
||||
};
|
||||
|
||||
unichar gs_toupper_map_table_0[] = {
|
||||
static unichar gs_toupper_map_table_0[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -3624,7 +3634,7 @@ unichar gs_toupper_map_table_0[] = {
|
|||
0x178, /* ff */
|
||||
};
|
||||
|
||||
unichar gs_toupper_map_table_1[] = {
|
||||
static unichar gs_toupper_map_table_1[] = {
|
||||
0x0,
|
||||
0x100, /* 1 */
|
||||
0x0,
|
||||
|
@ -3883,7 +3893,7 @@ unichar gs_toupper_map_table_1[] = {
|
|||
0x1fe, /* ff */
|
||||
};
|
||||
|
||||
unichar gs_toupper_map_table_2[] = {
|
||||
static unichar gs_toupper_map_table_2[] = {
|
||||
0x0,
|
||||
0x200, /* 1 */
|
||||
0x0,
|
||||
|
@ -4142,7 +4152,7 @@ unichar gs_toupper_map_table_2[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
unichar gs_toupper_map_table_3[] = {
|
||||
static unichar gs_toupper_map_table_3[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -4401,7 +4411,7 @@ unichar gs_toupper_map_table_3[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
unichar gs_toupper_map_table_4[] = {
|
||||
static unichar gs_toupper_map_table_4[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -4660,7 +4670,7 @@ unichar gs_toupper_map_table_4[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
unichar gs_toupper_map_table_5[] = {
|
||||
static unichar gs_toupper_map_table_5[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -4919,31 +4929,7 @@ unichar gs_toupper_map_table_5[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
unichar gs_toupper_map_table_1e[] = {
|
||||
static unichar gs_toupper_map_table_1e[] = {
|
||||
0x0,
|
||||
0x1e00, /* 1 */
|
||||
0x0,
|
||||
|
@ -5202,7 +5188,7 @@ unichar gs_toupper_map_table_1e[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
unichar gs_toupper_map_table_1f[] = {
|
||||
static unichar gs_toupper_map_table_1f[] = {
|
||||
0x1f08, /* 0 */
|
||||
0x1f09, /* 1 */
|
||||
0x1f0a, /* 2 */
|
||||
|
@ -5461,8 +5447,7 @@ unichar gs_toupper_map_table_1f[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
|
||||
unichar gs_toupper_map_table_21[] = {
|
||||
static unichar gs_toupper_map_table_21[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -5721,9 +5706,7 @@ unichar gs_toupper_map_table_21[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
|
||||
|
||||
unichar gs_toupper_map_table_24[] = {
|
||||
static unichar gs_toupper_map_table_24[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -5982,225 +5965,7 @@ unichar gs_toupper_map_table_24[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
unichar gs_toupper_map_table_ff[] = {
|
||||
static unichar gs_toupper_map_table_ff[] = {
|
||||
0x0,
|
||||
0x0,
|
||||
0x0,
|
||||
|
@ -6459,8 +6224,7 @@ unichar gs_toupper_map_table_ff[] = {
|
|||
0x0,
|
||||
};
|
||||
|
||||
|
||||
unichar *gs_toupper_map[] = {
|
||||
static unichar *gs_toupper_map[] = {
|
||||
gs_toupper_map_table_0,
|
||||
gs_toupper_map_table_1,
|
||||
gs_toupper_map_table_2,
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
|
||||
struct _cop_ {unichar code; unsigned char cop;};
|
||||
const unsigned int uni_cop_table_size = 355;
|
||||
|
||||
struct _cop_ uni_cop_table[]=
|
||||
static const unsigned int uni_cop_table_size = 355;
|
||||
static struct _cop_ uni_cop_table[]=
|
||||
{
|
||||
{0x0300,230},
|
||||
{0x0301,230},
|
|
@ -8,9 +8,8 @@
|
|||
*/
|
||||
|
||||
|
||||
const unsigned int Cyrillic_conv_base = 0x80;
|
||||
|
||||
unichar Cyrillic_char_to_uni_table[] =
|
||||
static const unsigned int Cyrillic_conv_base = 0x80;
|
||||
static unichar Cyrillic_char_to_uni_table[] =
|
||||
{
|
||||
0x0080,
|
||||
0x0081,
|
||||
|
@ -144,9 +143,8 @@ unichar Cyrillic_char_to_uni_table[] =
|
|||
|
||||
// Unicode to ISO_8859-5,1988 maping
|
||||
|
||||
const unsigned int Cyrillic_uni_to_char_table_size = 128;
|
||||
|
||||
_ucc_ Cyrillic_uni_to_char_table[]=
|
||||
static const unsigned int Cyrillic_uni_to_char_table_size = 128;
|
||||
static _ucc_ Cyrillic_uni_to_char_table[]=
|
||||
{
|
||||
{0x0080,0x80},
|
||||
{0x0081,0x81},
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
|
||||
struct _dec_ {unichar code; unichar decomp[5];};
|
||||
const unsigned int uni_dec_table_size = 1052;
|
||||
|
||||
struct _dec_ uni_dec_table[]=
|
||||
static const unsigned int uni_dec_table_size = 1052;
|
||||
static struct _dec_ uni_dec_table[]=
|
||||
{
|
||||
{0x00C0, {0x0041, 0x0300, 0}},
|
||||
{0x00C1, {0x0041, 0x0301, 0}},
|
|
@ -10,9 +10,8 @@
|
|||
|
||||
// GSM0338 to Unicode maping
|
||||
|
||||
const unsigned int GSM0338_conv_base = 0x00;
|
||||
|
||||
unichar GSM0338_char_to_uni_table[] =
|
||||
static const unsigned int GSM0338_conv_base = 0x00;
|
||||
static unichar GSM0338_char_to_uni_table[] =
|
||||
{
|
||||
0x0040,
|
||||
0x00A3,
|
||||
|
@ -144,7 +143,7 @@ unichar GSM0338_char_to_uni_table[] =
|
|||
0x00E0
|
||||
};
|
||||
|
||||
_ucc_ GSM0338_uni_to_char_table[] =
|
||||
static _ucc_ GSM0338_uni_to_char_table[] =
|
||||
{
|
||||
{0x000A,0x0A,},
|
||||
{0x000D,0x0D,},
|
||||
|
@ -277,7 +276,7 @@ _ucc_ GSM0338_uni_to_char_table[] =
|
|||
};
|
||||
#define GSM0338_tsize (sizeof(GSM0338_uni_to_char_table)/sizeof(_ucc_))
|
||||
|
||||
_ucc_ GSM0338_escapes[] =
|
||||
static _ucc_ GSM0338_escapes[] =
|
||||
{
|
||||
{0x000C,0x0A}, /* Form feed */
|
||||
{0x005B,0x3C}, /* '[' */
|
||||
|
@ -300,7 +299,7 @@ _ucc_ GSM0338_escapes[] =
|
|||
* a cut down version suitable for use when delivering data to phones
|
||||
* which don't support escape sequences.
|
||||
*/
|
||||
_ucc_ GSM0338_lossy[] =
|
||||
static _ucc_ GSM0338_lossy[] =
|
||||
{
|
||||
{0x005B,0x3C}, /* '[' => '<' */
|
||||
{0x005C,0x2F}, /* '\\' => '/' */
|
|
@ -10,9 +10,8 @@
|
|||
|
||||
// ISO_8859-2 to Unicode maping
|
||||
|
||||
const unsigned int Latin2_conv_base = 0x80;
|
||||
|
||||
unichar Latin2_char_to_uni_table[] =
|
||||
static const unsigned int Latin2_conv_base = 0x80;
|
||||
static unichar Latin2_char_to_uni_table[] =
|
||||
{
|
||||
0x0080,
|
||||
0x0081,
|
||||
|
@ -146,9 +145,8 @@ unichar Latin2_char_to_uni_table[] =
|
|||
|
||||
// Unicode to ISO_8859-2 maping
|
||||
|
||||
const unsigned int Latin2_uni_to_char_table_size = 128;
|
||||
|
||||
_ucc_ Latin2_uni_to_char_table[]=
|
||||
static const unsigned int Latin2_uni_to_char_table_size = 128;
|
||||
static _ucc_ Latin2_uni_to_char_table[]=
|
||||
{
|
||||
{0x0080,0x80},
|
||||
{0x0081,0x81},
|
|
@ -10,9 +10,8 @@
|
|||
|
||||
// ISO_8859-15 to Unicode maping
|
||||
|
||||
const unsigned int Latin9_conv_base = 0x80;
|
||||
|
||||
unichar Latin9_char_to_uni_table[] =
|
||||
static const unsigned int Latin9_conv_base = 0x80;
|
||||
static unichar Latin9_char_to_uni_table[] =
|
||||
{
|
||||
0x0080,
|
||||
0x0081,
|
||||
|
@ -146,9 +145,8 @@ unichar Latin9_char_to_uni_table[] =
|
|||
|
||||
// Unicode to ISO_8859-15 maping
|
||||
|
||||
const unsigned int Latin9_uni_to_char_table_size = 128;
|
||||
|
||||
_ucc_ Latin9_uni_to_char_table[]=
|
||||
static const unsigned int Latin9_uni_to_char_table_size = 128;
|
||||
static _ucc_ Latin9_uni_to_char_table[]=
|
||||
{
|
||||
{0x0080, 0x80},
|
||||
{0x0081, 0x81},
|
|
@ -7,8 +7,8 @@
|
|||
notice and this notice are preserved.
|
||||
*/
|
||||
|
||||
const unsigned int Next_conv_base = 0x80;
|
||||
unichar Next_char_to_uni_table[] =
|
||||
static const unsigned int Next_conv_base = 0x80;
|
||||
static unichar Next_char_to_uni_table[] =
|
||||
{
|
||||
0x00A0,
|
||||
0x00C0,
|
||||
|
@ -135,9 +135,8 @@ unichar Next_char_to_uni_table[] =
|
|||
|
||||
// Unicode to NextStep maping
|
||||
|
||||
const unsigned int Next_uni_to_char_table_size = 128;
|
||||
|
||||
_ucc_ Next_uni_to_char_table[]=
|
||||
static const unsigned int Next_uni_to_char_table_size = 128;
|
||||
static _ucc_ Next_uni_to_char_table[]=
|
||||
{
|
||||
{0x00A0,0x80},
|
||||
{0x00A1,0xA1},
|
|
@ -8,9 +8,8 @@
|
|||
*/
|
||||
|
||||
|
||||
const unsigned int Thai_conv_base = 0xA0;
|
||||
|
||||
unichar Thai_char_to_uni_table[] =
|
||||
static const unsigned int Thai_conv_base = 0xA0;
|
||||
static unichar Thai_char_to_uni_table[] =
|
||||
{
|
||||
0x00A0,
|
||||
0x0E01,
|
||||
|
@ -112,9 +111,8 @@ unichar Thai_char_to_uni_table[] =
|
|||
|
||||
/* Unicode to ISO_8859-11 maping */
|
||||
|
||||
const unsigned int Thai_uni_to_char_table_size = 88;
|
||||
|
||||
_ucc_ Thai_uni_to_char_table[]=
|
||||
static const unsigned int Thai_uni_to_char_table_size = 88;
|
||||
static _ucc_ Thai_uni_to_char_table[]=
|
||||
{
|
||||
{0x00A0,0xA0},
|
||||
{0x0E01,0xA1},
|
|
@ -370,17 +370,8 @@ NSValue.h \
|
|||
NSXMLParser.h \
|
||||
NSZone.h
|
||||
|
||||
UNICODE_HEADERS = \
|
||||
unicode/caseconv.h \
|
||||
unicode/cop.h \
|
||||
unicode/cyrillic.h \
|
||||
unicode/latin2.h \
|
||||
unicode/decomp.h \
|
||||
unicode/nextstep.h
|
||||
|
||||
HEADERS_INSTALL = $(GNU_HEADERS) \
|
||||
$(FOUNDATION_HEADERS) \
|
||||
$(UNICODE_HEADERS)
|
||||
$(FOUNDATION_HEADERS)
|
||||
|
||||
GENERATED_HFILES = \
|
||||
dynamic-load.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"
|
||||
|
@ -43,17 +44,17 @@ static double rint(double a)
|
|||
|
||||
BOOL GSMacOSXCompatibleGeometry(void)
|
||||
{
|
||||
if (GSUserDefaultsFlag(GSOldStyleGeometry) == YES)
|
||||
if ([_GSPrivate userDefaultsFlag: GSOldStyleGeometry] == YES)
|
||||
return NO;
|
||||
return GSUserDefaultsFlag(GSMacOSXCompatible);
|
||||
return [_GSPrivate userDefaultsFlag: GSMacOSXCompatible];
|
||||
}
|
||||
|
||||
BOOL GSMacOSXCompatiblePropertyLists(void)
|
||||
{
|
||||
#if defined(HAVE_LIBXML)
|
||||
if (GSUserDefaultsFlag(NSWriteOldStylePropertyLists) == YES)
|
||||
if ([_GSPrivate userDefaultsFlag: NSWriteOldStylePropertyLists] == YES)
|
||||
return NO;
|
||||
return GSUserDefaultsFlag(GSMacOSXCompatible);
|
||||
return [_GSPrivate userDefaultsFlag: GSMacOSXCompatible];
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
|
|
|
@ -168,7 +168,7 @@ gs_offset(const char *type, int index)
|
|||
/* Determines if the structure type can be returned entirely in registers.
|
||||
See the avcall or vacall man pages for more info. FIXME: I'm betting
|
||||
this won't work if a structure contains another structure */
|
||||
int
|
||||
static int
|
||||
gs_splittable (const char *type)
|
||||
{
|
||||
int i, numtypes;
|
||||
|
@ -297,7 +297,7 @@ gs_find_by_receiver_best_typed_sel (id receiver, SEL sel)
|
|||
Only passes the first part. Is used for determining
|
||||
the return type for the vacall macros.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
gs_sel_type_to_callback_type (const char *sel_type,
|
||||
vacallReturnTypeInfo *vatype)
|
||||
{
|
||||
|
|
|
@ -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"
|
||||
|
@ -36,6 +37,7 @@
|
|||
#include "Foundation/NSFileHandle.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
#include "GNUstepBase/GSMime.h"
|
||||
#include "GSPrivate.h"
|
||||
|
||||
GS_EXPORT NSString * const GSTelnetNotification;
|
||||
GS_EXPORT NSString * const GSTelnetErrorKey;
|
||||
|
@ -972,14 +974,12 @@ static NSLock *urlLock = nil;
|
|||
protocol: @"tcp"];
|
||||
if (sock == nil)
|
||||
{
|
||||
extern int errno;
|
||||
|
||||
/*
|
||||
* Tell superclass that the load failed - let it do housekeeping.
|
||||
*/
|
||||
[self backgroundLoadDidFailWithReason: [NSString stringWithFormat:
|
||||
@"Unable to connect to %@:%@ ... %s",
|
||||
host, port, GSLastErrorStr(errno)]];
|
||||
@"Unable to connect to %@:%@ ... %@",
|
||||
host, port, [_GSPrivate error]]];
|
||||
return;
|
||||
}
|
||||
cHandle = [[GSTelnetHandle alloc] initWithHandle: sock isConnected: NO];
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "Foundation/NSProcessInfo.h"
|
||||
#include "Foundation/NSUserDefaults.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#include "../Tools/gdomap.h"
|
||||
|
||||
|
@ -797,7 +798,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1)
|
||||
{
|
||||
NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error: errno]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -811,8 +812,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
if (bind(net, (struct sockaddr *)&lsin, sizeof(lsin)) == -1)
|
||||
{
|
||||
NSLog(@"unable to bind to port %s:%d - %s", inet_ntoa(lsin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
|
||||
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(lsin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error: errno]);
|
||||
(void) close(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -830,9 +831,9 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
if (errno != EINPROGRESS)
|
||||
{
|
||||
NSLog(@"unable to make connection to %s:%d - %s",
|
||||
NSLog(@"unable to make connection to %s:%d - %@",
|
||||
inet_ntoa(sin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
|
||||
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -896,7 +897,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == -1)
|
||||
{
|
||||
NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -913,8 +914,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) == -1)
|
||||
{
|
||||
NSLog(@"unable to bind to port %s:%d - %s", inet_ntoa(sin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
|
||||
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]);
|
||||
(void) close(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -922,7 +923,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (listen(net, 256) == -1)
|
||||
{
|
||||
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to listen on port - %@", [_GSPrivate error]);
|
||||
(void) close(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -930,7 +931,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (getsockname(net, (struct sockaddr*)&sin, &size) == -1)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
(void) close(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -1095,8 +1096,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (fstat(desc, &sbuf) < 0)
|
||||
{
|
||||
NSLog(@"unable to get status of descriptor %d - %s",
|
||||
desc, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get status of descriptor %d - %@",
|
||||
desc, [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1317,8 +1318,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (len < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
@ -1342,8 +1343,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (len < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
@ -1368,8 +1369,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (got < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
[d setLength: got];
|
||||
}
|
||||
|
@ -1391,8 +1392,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
else if (got < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
}
|
||||
while (len > 0 && got > 0);
|
||||
|
@ -1437,8 +1438,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (rval < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to write to descriptor - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"unable to write to descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1543,8 +1544,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (result < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
return (unsigned long long)result;
|
||||
}
|
||||
|
@ -1567,8 +1568,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (result < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
return (unsigned long long)result;
|
||||
}
|
||||
|
@ -1591,8 +1592,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (result < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1927,8 +1928,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Accept attempt failed - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
s = [NSString stringWithFormat: @"Accept attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[readInfo setObject: s forKey: GSFileHandleNotificationError];
|
||||
}
|
||||
else
|
||||
|
@ -1995,8 +1996,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Read attempt failed - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
s = [NSString stringWithFormat: @"Read attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[readInfo setObject: s forKey: GSFileHandleNotificationError];
|
||||
[self postReadNotification];
|
||||
}
|
||||
|
@ -2031,8 +2032,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Connect attempt failed - %s",
|
||||
GSLastErrorStr(result)];
|
||||
s = [NSString stringWithFormat: @"Connect attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[info setObject: s forKey: GSFileHandleNotificationError];
|
||||
}
|
||||
else
|
||||
|
@ -2065,7 +2066,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat:
|
||||
@"Write attempt failed - %s", GSLastErrorStr(errno)];
|
||||
@"Write attempt failed - %@", [_GSPrivate error]];
|
||||
[info setObject: s forKey: GSFileHandleNotificationError];
|
||||
[self postWriteNotification];
|
||||
}
|
||||
|
@ -2141,8 +2142,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
if (fcntl(descriptor, F_SETFL, e) < 0)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode for %d - %s",
|
||||
descriptor, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to set non-blocking mode for %d - %@",
|
||||
descriptor, [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2151,8 +2152,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"unable to get non-blocking mode for %d - %s",
|
||||
descriptor, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get non-blocking mode for %d - %@",
|
||||
descriptor, [_GSPrivate error]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2170,11 +2171,11 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == -1)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = [NSString stringWithCString: (char*)inet_ntoa(sin.sin_addr)];
|
||||
str = [NSString stringWithUTF8String: (char*)inet_ntoa(sin.sin_addr)];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
@ -2187,7 +2188,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == -1)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -758,6 +758,10 @@ parse_one_spec (const unichar *format, size_t posn, struct printf_spec *spec,
|
|||
return nargs;
|
||||
}
|
||||
|
||||
static inline void GSStrAppendUnichar(GSStr s, unichar u)
|
||||
{
|
||||
GSStrAppendUnichars(s, &u, 1);
|
||||
}
|
||||
|
||||
#define outchar(Ch) GSStrAppendUnichar(s, Ch)
|
||||
#define outstring(String, Len) GSStrAppendUnichars(s, String, Len)
|
||||
|
@ -1690,9 +1694,9 @@ NSDictionary *locale)
|
|||
|
||||
LABEL (form_strerror):
|
||||
/* Print description of error ERRNO. */
|
||||
string =
|
||||
(unichar *) GSLastErrorStr(save_errno);
|
||||
is_long = 0; /* This is no wide-char string. */
|
||||
string = (unichar *)[[_GSPrivate error: save_errno]
|
||||
cStringUsingEncoding: NSUnicodeStringEncoding];
|
||||
is_long = 1; /* This is a unicode string. */
|
||||
goto LABEL (print_string);
|
||||
LABEL (form_character):
|
||||
/* Character. */
|
||||
|
@ -1757,8 +1761,8 @@ NSDictionary *locale)
|
|||
|
||||
if (enc == GSUndefinedEncoding)
|
||||
{
|
||||
enc = GetDefEncoding();
|
||||
byteEncoding = GSIsByteEncoding(enc);
|
||||
enc = [NSString defaultCStringEncoding];
|
||||
byteEncoding = [_GSPrivate isByteEncoding: enc];
|
||||
}
|
||||
|
||||
len = strlen(str); // Number of bytes to convert.
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "GNUstepBase/GSLock.h"
|
||||
#include "NSCallBacks.h"
|
||||
#include "GSURLPrivate.h"
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -1267,8 +1268,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
|||
* Tell superclass that the load failed - let it do housekeeping.
|
||||
*/
|
||||
[self backgroundLoadDidFailWithReason:
|
||||
[NSString stringWithFormat: @"Unable to connect to %@:%@ ... %s",
|
||||
host, port, GSLastErrorStr(errno)]];
|
||||
[NSString stringWithFormat: @"Unable to connect to %@:%@ ... %@",
|
||||
host, port, [_GSPrivate error]]];
|
||||
return;
|
||||
}
|
||||
RETAIN(sock);
|
||||
|
|
|
@ -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"
|
||||
#include "GNUstepBase/GSLocale.h"
|
||||
|
@ -75,12 +76,12 @@ GSSetLocale(int category, NSString *locale)
|
|||
locale = nil;
|
||||
if (clocale != 0)
|
||||
{
|
||||
locale = [NSString stringWithCString: clocale];
|
||||
locale = [NSString stringWithUTF8String: clocale];
|
||||
}
|
||||
return locale;
|
||||
}
|
||||
|
||||
#define GSLanginfo(value) [NSString stringWithCString: nl_langinfo (value)]
|
||||
#define GSLanginfo(value) [NSString stringWithUTF8String: nl_langinfo (value)]
|
||||
|
||||
/* Creates a locale dictionary from information provided by i18n functions.
|
||||
Many, but not all, of the keys are filled in or inferred from the
|
||||
|
@ -154,33 +155,33 @@ GSDomainFromDefaultLocale(void)
|
|||
/* Currency Information */
|
||||
if (lconv->currency_symbol)
|
||||
{
|
||||
[dict setObject: [NSString stringWithCString: lconv->currency_symbol]
|
||||
[dict setObject: [NSString stringWithUTF8String: lconv->currency_symbol]
|
||||
forKey: NSCurrencySymbol];
|
||||
}
|
||||
if (lconv->int_curr_symbol)
|
||||
{
|
||||
[dict setObject: [NSString stringWithCString: lconv->int_curr_symbol]
|
||||
[dict setObject: [NSString stringWithUTF8String: lconv->int_curr_symbol]
|
||||
forKey: NSInternationalCurrencyString];
|
||||
}
|
||||
if (lconv->mon_decimal_point)
|
||||
{
|
||||
[dict setObject: [NSString stringWithCString: lconv->mon_decimal_point]
|
||||
[dict setObject: [NSString stringWithUTF8String: lconv->mon_decimal_point]
|
||||
forKey: NSInternationalCurrencyString];
|
||||
}
|
||||
if (lconv->mon_thousands_sep)
|
||||
{
|
||||
[dict setObject: [NSString stringWithCString: lconv->mon_thousands_sep]
|
||||
[dict setObject: [NSString stringWithUTF8String: lconv->mon_thousands_sep]
|
||||
forKey: NSInternationalCurrencyString];
|
||||
}
|
||||
|
||||
if (lconv->decimal_point)
|
||||
{
|
||||
[dict setObject: [NSString stringWithCString: lconv->decimal_point]
|
||||
[dict setObject: [NSString stringWithUTF8String: lconv->decimal_point]
|
||||
forKey: NSDecimalSeparator];
|
||||
}
|
||||
if (lconv->thousands_sep)
|
||||
{
|
||||
[dict setObject: [NSString stringWithCString: lconv->thousands_sep]
|
||||
[dict setObject: [NSString stringWithUTF8String: lconv->thousands_sep]
|
||||
forKey: NSThousandsSeparator];
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
|
||||
#include "GNUstepBase/GSObjCRuntime.h"
|
||||
#include "Foundation/NSString.h"
|
||||
|
||||
/**
|
||||
* Macro to manage memory for chunks of code that need to work with
|
||||
|
@ -100,17 +101,6 @@
|
|||
because NXConstantString returns a pointer
|
||||
to it's internal pointer. */
|
||||
|
||||
/*
|
||||
* Function to get the name of a string encoding as an NSString.
|
||||
*/
|
||||
GS_EXPORT NSString *GSEncodingName(NSStringEncoding encoding);
|
||||
|
||||
/*
|
||||
* Function to determine whether data in a particular encoding can
|
||||
* generally be represented as 8-bit characters including ascii.
|
||||
*/
|
||||
GS_EXPORT BOOL GSIsByteEncoding(NSStringEncoding encoding);
|
||||
|
||||
/*
|
||||
* Type to hold either UTF-16 (unichar) or 8-bit encodings,
|
||||
* while satisfying alignment constraints.
|
||||
|
@ -173,10 +163,15 @@ typedef struct {
|
|||
typedef GSStr_t *GSStr;
|
||||
|
||||
/*
|
||||
* Functions to append to GSStr
|
||||
* Function to append to GSStr
|
||||
*/
|
||||
extern void GSStrAppendUnichar(GSStr s, unichar);
|
||||
extern void GSStrAppendUnichars(GSStr s, const unichar *u, unsigned l);
|
||||
/*
|
||||
* Make the content of this string into unicode if it is not in
|
||||
* the external defaults C string encoding.
|
||||
*/
|
||||
void GSStrExternalize(GSStr s);
|
||||
|
||||
|
||||
/*
|
||||
* Enumeration for MacOS-X compatibility user defaults settings.
|
||||
|
@ -192,21 +187,6 @@ typedef enum {
|
|||
GSUserDefaultMaxFlag // End marker.
|
||||
} GSUserDefaultFlagType;
|
||||
|
||||
/*
|
||||
* Get the dictionary representation.
|
||||
*/
|
||||
NSDictionary *GSUserDefaultsDictionaryRepresentation(void);
|
||||
|
||||
/*
|
||||
* Get one of several potentially useful flags.
|
||||
*/
|
||||
BOOL GSUserDefaultsFlag(GSUserDefaultFlagType type);
|
||||
|
||||
/**
|
||||
* Get a flag from an environment variable - return def if not defined.
|
||||
*/
|
||||
BOOL GSEnvironmentFlag(const char *name, BOOL def);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -238,5 +218,68 @@ extern void GSNotifyASAP(void);
|
|||
extern void GSNotifyIdle(void);
|
||||
extern BOOL GSNotifyMore(void);
|
||||
|
||||
/* 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/GSCategories.h), 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
|
||||
|
||||
@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 the dictionary representation.
|
||||
*/
|
||||
+ (NSDictionary*) userDefaultsDictionaryRepresentation;
|
||||
|
||||
/*
|
||||
* Get one of several potentially useful flags.
|
||||
*/
|
||||
+ (BOOL) userDefaultsFlag: (GSUserDefaultFlagType)type;
|
||||
@end
|
||||
|
||||
#endif /* __GSPrivate_h_ */
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <Foundation/NSDebug.h>
|
||||
|
||||
#include "GSStream.h"
|
||||
#include "GSPrivate.h"
|
||||
|
||||
NSString * const NSStreamDataWrittenToMemoryStreamKey
|
||||
= @"NSStreamDataWrittenToMemoryStreamKey";
|
||||
|
@ -364,7 +365,7 @@ static RunLoopEventType typeForStream(NSStream *aStream)
|
|||
theError = [NSError errorWithDomain: NSPOSIXErrorDomain
|
||||
code: errno
|
||||
userInfo: nil];
|
||||
NSLog(@"%@ error(%d): - %s", self, errno, GSLastErrorStr(errno));
|
||||
NSLog(@"%@ error(%d): - %@", self, errno, [_GSPrivate error]);
|
||||
ASSIGN(_lastError, theError);
|
||||
_currentStatus = NSStreamStatusError;
|
||||
}
|
||||
|
|
|
@ -52,12 +52,15 @@
|
|||
|
||||
#include "GSPrivate.h"
|
||||
|
||||
extern BOOL GSEncodingSupported(NSStringEncoding enc);
|
||||
|
||||
/* memcpy(), strlen(), strcmp() are gcc builtin's */
|
||||
|
||||
#include "GNUstepBase/Unicode.h"
|
||||
|
||||
static BOOL isByteEncoding(NSStringEncoding enc)
|
||||
{
|
||||
return [_GSPrivate isByteEncoding: enc];
|
||||
}
|
||||
|
||||
#ifdef NeXT_RUNTIME
|
||||
/* Used by the Darwin/NeXT ObjC Runtime
|
||||
until Apple Radar 2870817 is fixed. */
|
||||
|
@ -249,10 +252,18 @@ setup(void)
|
|||
|
||||
if (beenHere == NO)
|
||||
{
|
||||
extern NSStringEncoding GetDefEncoding(void);
|
||||
|
||||
beenHere = YES;
|
||||
|
||||
/*
|
||||
* Cache the default string encoding, and set the internal encoding
|
||||
* used by 8-bit character strings to match if possible.
|
||||
*/
|
||||
externalEncoding = [_GSPrivate defaultCStringEncoding];
|
||||
if (isByteEncoding(externalEncoding) == YES)
|
||||
{
|
||||
internalEncoding = externalEncoding;
|
||||
}
|
||||
|
||||
/*
|
||||
* Cache pointers to classes to work round misfeature in
|
||||
* GNU compiler/runtime system where class lookup is very slow.
|
||||
|
@ -290,16 +301,6 @@ setup(void)
|
|||
caiSel = @selector(characterAtIndex:);
|
||||
gcrSel = @selector(getCharacters:range:);
|
||||
ranSel = @selector(rangeOfComposedCharacterSequenceAtIndex:);
|
||||
|
||||
/*
|
||||
* Cache the default string encoding, and set the internal encoding
|
||||
* used by 8-bit character strings to match if possible.
|
||||
*/
|
||||
externalEncoding = GetDefEncoding();
|
||||
if (GSIsByteEncoding(externalEncoding) == YES)
|
||||
{
|
||||
internalEncoding = externalEncoding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,7 +451,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
|
|||
void *chars = 0;
|
||||
BOOL flag = NO;
|
||||
|
||||
if (GSEncodingSupported(encoding) == NO)
|
||||
if ([_GSPrivate isEncodingSupported: encoding] == NO)
|
||||
{
|
||||
return nil; // Invalid encoding
|
||||
}
|
||||
|
@ -493,7 +494,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
|
|||
BOOL isLatin1 = NO;
|
||||
GSStr me;
|
||||
|
||||
if (GSEncodingSupported(encoding) == NO)
|
||||
if ([_GSPrivate isEncodingSupported: encoding] == NO)
|
||||
{
|
||||
if (flag == YES && bytes != 0)
|
||||
{
|
||||
|
@ -535,7 +536,7 @@ fixBOM(unsigned char **bytes, unsigned *length, BOOL *shouldFree,
|
|||
encoding = internalEncoding;
|
||||
}
|
||||
}
|
||||
else if (encoding != internalEncoding && GSIsByteEncoding(encoding) == YES)
|
||||
else if (encoding != internalEncoding && isByteEncoding(encoding) == YES)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -1025,7 +1026,7 @@ canBeConvertedToEncoding_c(GSStr self, NSStringEncoding enc)
|
|||
&& enc != internalEncoding
|
||||
&& enc != NSUTF8StringEncoding
|
||||
&& enc != NSUnicodeStringEncoding
|
||||
&& ((internalEncoding != NSASCIIStringEncoding) || !GSIsByteEncoding(enc)))
|
||||
&& ((internalEncoding != NSASCIIStringEncoding) || !isByteEncoding(enc)))
|
||||
{
|
||||
unsigned l = 0;
|
||||
unichar *r = 0;
|
||||
|
@ -1403,7 +1404,7 @@ dataUsingEncoding_c(GSStr self, NSStringEncoding encoding, BOOL lossy)
|
|||
|
||||
if ((encoding == internalEncoding)
|
||||
|| ((internalEncoding == NSASCIIStringEncoding)
|
||||
&& (encoding == NSUTF8StringEncoding || GSIsByteEncoding(encoding))))
|
||||
&& (encoding == NSUTF8StringEncoding || isByteEncoding(encoding))))
|
||||
{
|
||||
unsigned char *buff;
|
||||
|
||||
|
@ -1787,7 +1788,7 @@ getCStringE_c(GSStr self, char *buffer, unsigned int maxLength,
|
|||
}
|
||||
|
||||
if (enc == NSUTF8StringEncoding
|
||||
&& GSIsByteEncoding(internalEncoding))
|
||||
&& isByteEncoding(internalEncoding))
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -1822,7 +1823,7 @@ getCStringE_c(GSStr self, char *buffer, unsigned int maxLength,
|
|||
}
|
||||
|
||||
if (enc == NSASCIIStringEncoding
|
||||
&& GSIsByteEncoding(internalEncoding))
|
||||
&& isByteEncoding(internalEncoding))
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -3759,7 +3760,7 @@ NSAssert(_flags.free == 1 && _zone != 0, NSInternalInconsistencyException);
|
|||
encoding = internalEncoding;
|
||||
}
|
||||
}
|
||||
else if (encoding != internalEncoding && GSIsByteEncoding(encoding) == YES)
|
||||
else if (encoding != internalEncoding && isByteEncoding(encoding) == YES)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -5078,44 +5079,7 @@ void GSStrAppendUnichars(GSStr s, const unichar *u, unsigned l)
|
|||
}
|
||||
}
|
||||
|
||||
void GSStrAppendUnichar(GSStr s, unichar u)
|
||||
{
|
||||
/*
|
||||
* Make the string wide if necessary.
|
||||
*/
|
||||
if (s->_flags.wide == 0)
|
||||
{
|
||||
if (u > 255 || (u > 127 && internalEncoding != NSISOLatin1StringEncoding))
|
||||
{
|
||||
GSStrWiden(s);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Make room for the characters we are appending.
|
||||
*/
|
||||
if (s->_count + 2 >= s->_capacity)
|
||||
{
|
||||
GSStrMakeSpace(s, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the characters into place.
|
||||
*/
|
||||
if (s->_flags.wide == 1)
|
||||
{
|
||||
s->_contents.u[s->_count++] = u;
|
||||
}
|
||||
else
|
||||
{
|
||||
s->_contents.c[s->_count++] = u;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Make the content of this string into unicode if it is not in
|
||||
* the external defaults C string encoding.
|
||||
*/
|
||||
void GSStrExternalize(GSStr s)
|
||||
{
|
||||
if (s->_flags.wide == 0 && internalEncoding != externalEncoding)
|
||||
|
|
|
@ -858,7 +858,7 @@ static Class NSMutableDataMallocClass;
|
|||
if (node)
|
||||
{
|
||||
c = (Class)node->value.ptr;
|
||||
return [NSString stringWithCString: GSNameFromClass(c)];
|
||||
return [NSString stringWithUTF8String: GSNameFromClass(c)];
|
||||
}
|
||||
}
|
||||
return trueName;
|
||||
|
|
|
@ -1202,7 +1202,7 @@ compare(id elem1, id elem2, void* context)
|
|||
*/
|
||||
- (BOOL) writeToFile: (NSString *)path atomically: (BOOL)useAuxiliaryFile
|
||||
{
|
||||
NSDictionary *loc = GSUserDefaultsDictionaryRepresentation();
|
||||
NSDictionary *loc = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
NSString *desc = nil;
|
||||
NSData *data;
|
||||
|
||||
|
@ -1228,7 +1228,7 @@ compare(id elem1, id elem2, void* context)
|
|||
*/
|
||||
- (BOOL) writeToURL: (NSURL *)url atomically: (BOOL)useAuxiliaryFile
|
||||
{
|
||||
NSDictionary *loc = GSUserDefaultsDictionaryRepresentation();
|
||||
NSDictionary *loc = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
NSString *desc = nil;
|
||||
NSData *data;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "Foundation/NSPathUtilities.h"
|
||||
#include "Foundation/NSData.h"
|
||||
#include "Foundation/NSValue.h"
|
||||
#include "GNUstepBase/GSFunctions.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -226,7 +226,7 @@ static NSString *ExecutablePath()
|
|||
#ifdef PROCFS_EXE_LINK
|
||||
executablePath = [[NSFileManager defaultManager]
|
||||
pathContentOfSymbolicLinkAtPath:
|
||||
[NSString stringWithCString: PROCFS_EXE_LINK]];
|
||||
[NSString stringWithUTF8String: PROCFS_EXE_LINK]];
|
||||
|
||||
/*
|
||||
On some systems, the link is of the form "[device]:inode", which
|
||||
|
@ -378,10 +378,28 @@ static inline NSString *
|
|||
_find_framework(NSString *name)
|
||||
{
|
||||
NSArray *paths;
|
||||
NSFileManager *file_mgr = [NSFileManager defaultManager];
|
||||
NSString *file_name;
|
||||
NSString *file_path;
|
||||
NSString *path;
|
||||
NSEnumerator *enumerator;
|
||||
|
||||
NSCParameterAssert(name != nil);
|
||||
|
||||
paths = NSSearchPathForDirectoriesInDomains(GSFrameworksDirectory,
|
||||
NSAllDomainsMask,YES);
|
||||
return GSFindNamedFile(paths, name, @"framework");
|
||||
|
||||
enumerator = [paths objectEnumerator];
|
||||
while ((path = [enumerator nextObject]))
|
||||
{
|
||||
file_path = [path stringByAppendingPathComponent: file_name];
|
||||
|
||||
if ([file_mgr fileExistsAtPath: file_path] == YES)
|
||||
{
|
||||
return file_path; // Found it!
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@interface NSBundle (Private)
|
||||
|
@ -464,8 +482,9 @@ _find_framework(NSString *name)
|
|||
&& !strncmp ("NSFramework_", frameworkClass->name, 12))
|
||||
{
|
||||
/* The name of the framework. */
|
||||
NSString *name = [NSString stringWithCString: &frameworkClass->name[12]];
|
||||
NSString *name;
|
||||
|
||||
name = [NSString stringWithUTF8String: &frameworkClass->name[12]];
|
||||
/* Important - gnustep-make mangles framework names to encode
|
||||
* them as ObjC class names. Here we need to demangle them. We
|
||||
* apply the reverse transformations in the reverse order.
|
||||
|
|
|
@ -653,7 +653,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
sourceLen = strlen(source);
|
||||
if (locale == nil)
|
||||
{
|
||||
locale = GSUserDefaultsDictionaryRepresentation();
|
||||
locale = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
}
|
||||
if (fmt == nil)
|
||||
{
|
||||
|
@ -1064,7 +1064,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
NSString *currAMPM;
|
||||
NSArray *amPMNames;
|
||||
|
||||
currAMPM = [NSString stringWithCString: tmpStr];
|
||||
currAMPM = [NSString stringWithUTF8String: tmpStr];
|
||||
amPMNames = [locale objectForKey: NSAMPMDesignation];
|
||||
|
||||
/*
|
||||
|
@ -1170,7 +1170,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
tmpStr[tmpIdx - sourceIdx] = '\0';
|
||||
sourceIdx += tmpIdx - sourceIdx;
|
||||
{
|
||||
NSString *z = [NSString stringWithCString: tmpStr];
|
||||
NSString *z = [NSString stringWithUTF8String: tmpStr];
|
||||
|
||||
/* Abbreviations aren't one-to-one with time zone names
|
||||
so just look for the zone named after the abbreviation,
|
||||
|
@ -2191,7 +2191,7 @@ static void Grow(DescriptionInfo *info, unsigned size)
|
|||
DescriptionInfo info;
|
||||
|
||||
if (locale == nil)
|
||||
locale = GSUserDefaultsDictionaryRepresentation();
|
||||
locale = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
if (format == nil)
|
||||
format = [locale objectForKey: NSTimeDateFormatString];
|
||||
|
||||
|
|
143
Source/NSData.m
143
Source/NSData.m
|
@ -80,6 +80,7 @@
|
|||
#include "Foundation/NSRange.h"
|
||||
#include "Foundation/NSURL.h"
|
||||
#include "Foundation/NSZone.h"
|
||||
#include "GSPrivate.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h> /* for memset() */
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -163,8 +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 - %s", path,
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnFLog(@"Open (%@) attempt failed - %@", path, [_GSPrivate error]);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
@ -174,8 +174,8 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
c = fseek(theFile, 0L, SEEK_END);
|
||||
if (c != 0)
|
||||
{
|
||||
NSWarnFLog(@"Seek to end of file (%@) failed - %s", path,
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnFLog(@"Seek to end of file (%@) failed - %@", path,
|
||||
[_GSPrivate error]);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
@ -186,8 +186,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
fileLength = ftell(theFile);
|
||||
if (fileLength == -1)
|
||||
{
|
||||
NSWarnFLog(@"Ftell on %@ failed - %s", path,
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnFLog(@"Ftell on %@ failed - %@", path, [_GSPrivate error]);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
@ -198,8 +197,8 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
c = fseek(theFile, 0L, SEEK_SET);
|
||||
if (c != 0)
|
||||
{
|
||||
NSWarnFLog(@"Fseek to start of file (%@) failed - %s", path,
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnFLog(@"Fseek to start of file (%@) failed - %@", path,
|
||||
[_GSPrivate error]);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
@ -224,8 +223,8 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
}
|
||||
if (tmp == 0)
|
||||
{
|
||||
NSLog(@"Malloc failed for file (%@) of length %d - %s", path,
|
||||
fileLength + c, GSLastErrorStr(errno));
|
||||
NSLog(@"Malloc failed for file (%@) of length %d - %@", path,
|
||||
fileLength + c, [_GSPrivate error]);
|
||||
goto failure;
|
||||
}
|
||||
memcpy(tmp + fileLength, buf, c);
|
||||
|
@ -237,16 +236,16 @@ readContentsOfFile(NSString* path, void** buf, unsigned int* len, NSZone* zone)
|
|||
tmp = NSZoneMalloc(zone, fileLength);
|
||||
if (tmp == 0)
|
||||
{
|
||||
NSLog(@"Malloc failed for file (%@) of length %d - %s", path,
|
||||
fileLength, GSLastErrorStr(errno));
|
||||
NSLog(@"Malloc failed for file (%@) of length %d - %@", path,
|
||||
fileLength, [_GSPrivate error]);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
c = fread(tmp, 1, fileLength, theFile);
|
||||
if (c != (int)fileLength)
|
||||
{
|
||||
NSWarnFLog(@"read of file (%@) contents failed - %s", path,
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnFLog(@"read of file (%@) contents failed - %@", path,
|
||||
[_GSPrivate error]);
|
||||
goto failure;
|
||||
}
|
||||
}
|
||||
|
@ -852,8 +851,7 @@ failure:
|
|||
strcat(thePath, "XXXXXX");
|
||||
if ((desc = mkstemp(thePath)) < 0)
|
||||
{
|
||||
NSWarnMLog(@"mkstemp (%s) failed - %s", thePath,
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"mkstemp (%s) failed - %@", thePath, [_GSPrivate error]);
|
||||
goto failure;
|
||||
}
|
||||
mask = umask(0);
|
||||
|
@ -880,9 +878,9 @@ failure:
|
|||
wcscat(wthePath, L"XXXXXX");
|
||||
if (_wmktemp(wthePath) == 0)
|
||||
{
|
||||
NSWarnMLog(@"mktemp (%@) failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"mktemp (%@) failed - %@",
|
||||
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
|
||||
[_GSPrivate error]);
|
||||
goto failure;
|
||||
}
|
||||
#else
|
||||
|
@ -890,8 +888,7 @@ failure:
|
|||
strcat(thePath, "XXXXXX");
|
||||
if (mktemp(thePath) == 0)
|
||||
{
|
||||
NSWarnMLog(@"mktemp (%s) failed - %s", thePath,
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"mktemp (%s) failed - %@", thePath, [_GSPrivate error]);
|
||||
goto failure;
|
||||
}
|
||||
#endif
|
||||
|
@ -918,11 +915,11 @@ failure:
|
|||
/* Something went wrong; we weren't
|
||||
* even able to open the file. */
|
||||
#if defined(__MINGW32__)
|
||||
NSWarnMLog(@"Open (%@) failed - %s",
|
||||
NSWarnMLog(@"Open (%@) failed - %@",
|
||||
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
|
||||
GSLastErrorStr(errno));
|
||||
[_GSPrivate error]);
|
||||
#else
|
||||
NSWarnMLog(@"Open (%s) failed - %s", thePath, GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"Open (%s) failed - %@", thePath, [_GSPrivate error]);
|
||||
#endif
|
||||
goto failure;
|
||||
}
|
||||
|
@ -936,11 +933,11 @@ failure:
|
|||
* some reason. */
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
NSWarnMLog(@"Fwrite (%@) failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"Fwrite (%@) failed - %@",
|
||||
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
|
||||
[_GSPrivate error]);
|
||||
#else
|
||||
NSWarnMLog(@"Fwrite (%s) failed - %s", thePath, GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"Fwrite (%s) failed - %@", thePath, [_GSPrivate error]);
|
||||
#endif
|
||||
goto failure;
|
||||
}
|
||||
|
@ -953,11 +950,11 @@ failure:
|
|||
* so we need to deal with it. */
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
NSWarnMLog(@"Fclose (%@) failed - %s",
|
||||
[NSString stringWithCharacters:wthePath length:wcslen(wthePath)],
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"Fclose (%@) failed - %@",
|
||||
[NSString stringWithCharacters: wthePath length: wcslen(wthePath)],
|
||||
[_GSPrivate error]);
|
||||
#else
|
||||
NSWarnMLog(@"Fclose (%s) failed - %s", thePath, GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"Fclose (%s) failed - %@", thePath, [_GSPrivate error]);
|
||||
#endif
|
||||
goto failure;
|
||||
}
|
||||
|
@ -1038,14 +1035,15 @@ failure:
|
|||
if (c != 0) /* Many things could go wrong, I guess. */
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
NSWarnMLog(@"Rename ('%@' to '%@') failed - %s",
|
||||
[NSString stringWithCharacters: wthePath length:wcslen(wthePath)],
|
||||
[NSString stringWithCharacters:
|
||||
wtheRealPath length:wcslen(wtheRealPath)],
|
||||
GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"Rename ('%@' to '%@') failed - %@",
|
||||
[NSString stringWithCharacters: wthePath
|
||||
length: wcslen(wthePath)],
|
||||
[NSString stringWithCharacters: wtheRealPath
|
||||
length: wcslen(wtheRealPath)],
|
||||
[_GSPrivate error]);
|
||||
#else
|
||||
NSWarnMLog(@"Rename ('%s' to '%s') failed - %s",
|
||||
thePath, theRealPath, GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"Rename ('%s' to '%s') failed - %@",
|
||||
thePath, theRealPath, [_GSPrivate error]);
|
||||
#endif
|
||||
goto failure;
|
||||
}
|
||||
|
@ -2918,7 +2916,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
#endif
|
||||
if (fd < 0)
|
||||
{
|
||||
NSWarnMLog(@"unable to open %@ - %s", path, GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"unable to open %@ - %@", path, [_GSPrivate error]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -2926,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 %@ - %s", path, GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"unable to seek to eof %@ - %@", path, [_GSPrivate error]);
|
||||
close(fd);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -2934,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 %@ - %s", path, GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"unable to seek to sof %@ - %@", path, [_GSPrivate error]);
|
||||
close(fd);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -2942,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 - %s", path, GSLastErrorStr(errno));
|
||||
NSWarnMLog(@"mapping failed for %s - %@", path, [_GSPrivate error]);
|
||||
close(fd);
|
||||
RELEASE(self);
|
||||
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
|
@ -2969,15 +2967,15 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
struct shmid_ds buf;
|
||||
|
||||
if (shmctl(shmid, IPC_STAT, &buf) < 0)
|
||||
NSLog(@"[NSDataShared -dealloc] shared memory control failed - %s",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"[NSDataShared -dealloc] shared memory control failed - %@",
|
||||
[_GSPrivate error]);
|
||||
else if (buf.shm_nattch == 1)
|
||||
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
|
||||
NSLog(@"[NSDataShared -dealloc] shared memory delete failed - %s",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"[NSDataShared -dealloc] shared memory delete failed - %@",
|
||||
[_GSPrivate error]);
|
||||
if (shmdt(bytes) < 0)
|
||||
NSLog(@"[NSDataShared -dealloc] shared memory detach failed - %s",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"[NSDataShared -dealloc] shared memory detach failed - %@",
|
||||
[_GSPrivate error]);
|
||||
bytes = 0;
|
||||
length = 0;
|
||||
shmid = -1;
|
||||
|
@ -2993,8 +2991,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
shmid = shmget(IPC_PRIVATE, bufferSize, IPC_CREAT|VM_RDONLY);
|
||||
if (shmid == -1) /* Created memory? */
|
||||
{
|
||||
NSLog(@"[-initWithBytes:length:] shared mem get failed for %u - %s",
|
||||
bufferSize, GSLastErrorStr(errno));
|
||||
NSLog(@"[-initWithBytes:length:] shared mem get failed for %u - %@",
|
||||
bufferSize, [_GSPrivate error]);
|
||||
RELEASE(self);
|
||||
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
return [self initWithBytes: aBuffer length: bufferSize];
|
||||
|
@ -3003,8 +3001,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
bytes = shmat(shmid, 0, 0);
|
||||
if (bytes == (void*)-1)
|
||||
{
|
||||
NSLog(@"[-initWithBytes:length:] shared mem attach failed for %u - %s",
|
||||
bufferSize, GSLastErrorStr(errno));
|
||||
NSLog(@"[-initWithBytes:length:] shared mem attach failed for %u - %@",
|
||||
bufferSize, [_GSPrivate error]);
|
||||
bytes = 0;
|
||||
RELEASE(self);
|
||||
self = [dataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
|
@ -3022,21 +3020,23 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
shmid = anId;
|
||||
if (shmctl(shmid, IPC_STAT, &buf) < 0)
|
||||
{
|
||||
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory control failed - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory "
|
||||
@"control failed - %@", [_GSPrivate error]);
|
||||
RELEASE(self); /* Unable to access memory. */
|
||||
return nil;
|
||||
}
|
||||
if (buf.shm_segsz < bufferSize)
|
||||
{
|
||||
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory segment too small");
|
||||
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory "
|
||||
@"segment too small");
|
||||
RELEASE(self); /* Memory segment too small. */
|
||||
return nil;
|
||||
}
|
||||
bytes = shmat(shmid, 0, 0);
|
||||
if (bytes == (void*)-1)
|
||||
{
|
||||
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory attach failed - %s",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"[NSDataShared -initWithShmID:length:] shared memory "
|
||||
@"attach failed - %s", [_GSPrivate error]);
|
||||
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 - %s", size, GSLastErrorStr(errno));
|
||||
@"for %u bytes - %@", size, [_GSPrivate error]);
|
||||
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 - %s", GSLastErrorStr(errno));
|
||||
@"control failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
else if (buf.shm_nattch == 1)
|
||||
{
|
||||
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory "
|
||||
@"delete failed - %s", GSLastErrorStr(errno));
|
||||
@"delete failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
}
|
||||
if (shmdt(bytes) < 0)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -dealloc] shared memory "
|
||||
@"detach failed - %s", GSLastErrorStr(errno));
|
||||
@"detach failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
bytes = 0;
|
||||
length = 0;
|
||||
|
@ -3695,24 +3695,21 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
|
||||
- (id) initWithCapacity: (unsigned int)bufferSize
|
||||
{
|
||||
int e;
|
||||
|
||||
shmid = shmget(IPC_PRIVATE, bufferSize, IPC_CREAT|VM_ACCESS);
|
||||
if (shmid == -1) /* Created memory? */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
|
||||
@"get failed for %u - %s", bufferSize, GSLastErrorStr(errno));
|
||||
@"get failed for %u - %@", bufferSize, [_GSPrivate error]);
|
||||
RELEASE(self);
|
||||
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
return [self initWithCapacity: bufferSize];
|
||||
}
|
||||
|
||||
bytes = shmat(shmid, 0, 0);
|
||||
e = errno;
|
||||
if (bytes == (void*)-1)
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -initWithCapacity:] shared memory "
|
||||
@"attach failed for %u - %s", bufferSize, GSLastErrorStr(e));
|
||||
@"attach failed for %u - %@", bufferSize, [_GSPrivate error]);
|
||||
bytes = 0;
|
||||
RELEASE(self);
|
||||
self = [mutableDataMalloc allocWithZone: NSDefaultMallocZone()];
|
||||
|
@ -3732,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 - %s", GSLastErrorStr(errno));
|
||||
@"control failed - %@", [_GSPrivate error]);
|
||||
RELEASE(self); /* Unable to access memory. */
|
||||
return nil;
|
||||
}
|
||||
|
@ -3747,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 - %s", GSLastErrorStr(errno));
|
||||
@"attach failed - %@", [_GSPrivate error]);
|
||||
bytes = 0;
|
||||
RELEASE(self); /* Unable to attach to memory. */
|
||||
return nil;
|
||||
|
@ -3769,8 +3766,8 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
if (newid == -1) /* Created memory? */
|
||||
{
|
||||
[NSException raise: NSMallocException
|
||||
format: @"Unable to create shared memory segment (size:%u) - %s.",
|
||||
size, GSLastErrorStr(errno)];
|
||||
format: @"Unable to create shared memory segment (size:%u) - %@.",
|
||||
size, [_GSPrivate error]];
|
||||
}
|
||||
tmp = shmat(newid, 0, 0);
|
||||
if ((intptr_t)tmp == -1) /* Attached memory? */
|
||||
|
@ -3786,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 - %s", GSLastErrorStr(errno));
|
||||
@"control failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
else if (buf.shm_nattch == 1)
|
||||
{
|
||||
if (shmctl(shmid, IPC_RMID, &buf) < 0) /* Mark for deletion. */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
|
||||
@"delete failed - %s", GSLastErrorStr(errno));
|
||||
@"delete failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
}
|
||||
if (shmdt(bytes) < 0) /* Detach memory. */
|
||||
{
|
||||
NSLog(@"[NSMutableDataShared -setCapacity:] shared memory "
|
||||
@"detach failed - %s", GSLastErrorStr(errno));
|
||||
@"detach failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
}
|
||||
bytes = tmp;
|
||||
|
|
|
@ -264,7 +264,7 @@ otherTime(NSDate* other)
|
|||
|
||||
if (locale == nil)
|
||||
{
|
||||
locale = GSUserDefaultsDictionaryRepresentation();
|
||||
locale = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
}
|
||||
ws = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
digits = [NSCharacterSet decimalDigitCharacterSet];
|
||||
|
|
|
@ -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>NSDateFormatter class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -957,6 +957,7 @@ const char *_NSPrintForDebugger(id object)
|
|||
|
||||
NSString *_NSNewStringFromCString(const char *cstring)
|
||||
{
|
||||
return [NSString stringWithCString: cstring];
|
||||
return [NSString stringWithCString: cstring
|
||||
encoding: [NSString defaultCStringEncoding]];
|
||||
}
|
||||
|
||||
|
|
|
@ -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>NSDecimal class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -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>NSDecimalNumber class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
@ -260,7 +261,7 @@ static NSDecimalNumber *one;
|
|||
- (id) initWithString: (NSString*)numberValue
|
||||
{
|
||||
return [self initWithString: numberValue
|
||||
locale: GSUserDefaultsDictionaryRepresentation()];
|
||||
locale: [_GSPrivate userDefaultsDictionaryRepresentation]];
|
||||
}
|
||||
|
||||
- (id) initWithString: (NSString*)numberValue
|
||||
|
|
|
@ -929,7 +929,7 @@ compareIt(id o1, id o2, void* context)
|
|||
*/
|
||||
- (BOOL) writeToFile: (NSString *)path atomically: (BOOL)useAuxiliaryFile
|
||||
{
|
||||
NSDictionary *loc = GSUserDefaultsDictionaryRepresentation();
|
||||
NSDictionary *loc = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
NSString *desc = nil;
|
||||
NSData *data;
|
||||
|
||||
|
@ -954,7 +954,7 @@ compareIt(id o1, id o2, void* context)
|
|||
*/
|
||||
- (BOOL) writeToURL: (NSURL *)url atomically: (BOOL)useAuxiliaryFile
|
||||
{
|
||||
NSDictionary *loc = GSUserDefaultsDictionaryRepresentation();
|
||||
NSDictionary *loc = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
NSString *desc = nil;
|
||||
NSData *data;
|
||||
|
||||
|
|
|
@ -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>NSDistributedLock class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
@ -31,6 +32,7 @@
|
|||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSValue.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
|
@ -76,13 +78,13 @@ static NSFileManager *mgr = nil;
|
|||
|
||||
if ([mgr removeFileAtPath: _lockPath handler: nil] == NO)
|
||||
{
|
||||
const char *err = GSLastErrorStr(errno);
|
||||
NSString *err = [_GSPrivate error];
|
||||
|
||||
attributes = [mgr fileAttributesAtPath: _lockPath traverseLink: YES];
|
||||
if ([modDate isEqual: [attributes fileModificationDate]] == YES)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Failed to remove lock directory '%@' - %s",
|
||||
format: @"Failed to remove lock directory '%@' - %@",
|
||||
_lockPath, err];
|
||||
}
|
||||
}
|
||||
|
@ -201,8 +203,8 @@ static NSFileManager *mgr = nil;
|
|||
attributes: attributesToSet];
|
||||
if (locked == NO)
|
||||
{
|
||||
NSLog(@"Failed to create lock directory '%@' - %s",
|
||||
_lockPath, GSLastErrorStr(errno));
|
||||
NSLog(@"Failed to create lock directory '%@' - %@",
|
||||
_lockPath, [_GSPrivate error]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,8 +259,8 @@ static NSFileManager *mgr = nil;
|
|||
if ([mgr removeFileAtPath: _lockPath handler: nil] == NO)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Failed to remove lock directory '%@' - %s",
|
||||
_lockPath, GSLastErrorStr(errno)];
|
||||
format: @"Failed to remove lock directory '%@' - %@",
|
||||
_lockPath, [_GSPrivate error]];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -353,8 +353,9 @@ static void find_address (bfd *abfd, asection *section,
|
|||
fi = [GSFunctionInfo alloc];
|
||||
fi = [fi initWithModule: info->module
|
||||
address: info->theAddress
|
||||
file: [NSString stringWithCString: fileName]
|
||||
function: [NSString stringWithCString: functionName]
|
||||
file: [NSString stringWithCString: fileName
|
||||
encoding: [NSString defaultCStringEncoding]]
|
||||
function: [NSString stringWithUTF8String: functionName]
|
||||
line: line];
|
||||
[fi autorelease];
|
||||
info->theInfo = fi;
|
||||
|
@ -584,7 +585,8 @@ static void _terminate()
|
|||
#else
|
||||
shouldAbort = NO; // exit() by default.
|
||||
#endif
|
||||
shouldAbort = GSEnvironmentFlag("CRASH_ON_ABORT", shouldAbort);
|
||||
shouldAbort = [_GSPrivate environmentFlag: "CRASH_ON_ABORT"
|
||||
defaultValue: shouldAbort];
|
||||
if (shouldAbort == YES)
|
||||
{
|
||||
abort();
|
||||
|
@ -598,9 +600,8 @@ static void _terminate()
|
|||
static void
|
||||
_NSFoundationUncaughtExceptionHandler (NSException *exception)
|
||||
{
|
||||
extern const char* GSArgZero(void);
|
||||
|
||||
fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n", GSArgZero(),
|
||||
fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n",
|
||||
[_GSPrivate argZero],
|
||||
[[exception name] lossyCString], [[exception reason] lossyCString]);
|
||||
fflush(stderr); /* NEEDED UNDER MINGW */
|
||||
|
||||
|
|
|
@ -401,8 +401,8 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFileOwnerAccountID to '%u' - %s",
|
||||
num, GSLastErrorStr(errno)];
|
||||
@"Unable to change NSFileOwnerAccountID to '%u' - %@",
|
||||
num, [_GSPrivate error]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -425,8 +425,8 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFileOwnerAccountName to '%@' - %s",
|
||||
str, GSLastErrorStr(errno)];
|
||||
@"Unable to change NSFileOwnerAccountName to '%@' - %@",
|
||||
str, [_GSPrivate error]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -439,8 +439,8 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFileGroupOwnerAccountID to '%u' - %s",
|
||||
num, GSLastErrorStr(errno)];
|
||||
@"Unable to change NSFileGroupOwnerAccountID to '%u' - %@",
|
||||
num, [_GSPrivate error]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -461,8 +461,8 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFileGroupOwnerAccountName to '%@' - %s",
|
||||
str, GSLastErrorStr(errno)];
|
||||
@"Unable to change NSFileGroupOwnerAccountName to '%@' - %@",
|
||||
str, [_GSPrivate error]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -475,8 +475,8 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFilePosixPermissions to '%o' - %s",
|
||||
num, GSLastErrorStr(errno)];
|
||||
@"Unable to change NSFilePosixPermissions to '%o' - %@",
|
||||
num, [_GSPrivate error]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -519,8 +519,8 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
allOk = NO;
|
||||
str = [NSString stringWithFormat:
|
||||
@"Unable to change NSFileModificationDate to '%@' - %s",
|
||||
date, GSLastErrorStr(errno)];
|
||||
@"Unable to change NSFileModificationDate to '%@' - %@",
|
||||
date, [_GSPrivate error]];
|
||||
ASSIGN(_lastError, str);
|
||||
}
|
||||
}
|
||||
|
@ -747,8 +747,8 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Could not create '%s' - '%s'",
|
||||
dirpath, GSLastErrorStr(errno)];
|
||||
s = [NSString stringWithFormat: @"Could not create '%s' - '%@'",
|
||||
dirpath, [_GSPrivate error]];
|
||||
ASSIGN(_lastError, s);
|
||||
return NO;
|
||||
}
|
||||
|
@ -1278,7 +1278,7 @@ static NSStringEncoding defaultEncoding;
|
|||
#endif
|
||||
{
|
||||
return [self _proceedAccordingToHandler: handler
|
||||
forError: [NSString stringWithCString: GSLastErrorStr (errno)]
|
||||
forError: [_GSPrivate error]
|
||||
inPath: path];
|
||||
}
|
||||
else
|
||||
|
@ -1312,7 +1312,7 @@ static NSStringEncoding defaultEncoding;
|
|||
if (_RMDIR([self fileSystemRepresentationWithPath: path]) < 0)
|
||||
{
|
||||
return [self _proceedAccordingToHandler: handler
|
||||
forError: [NSString stringWithCString: GSLastErrorStr (errno)]
|
||||
forError: [_GSPrivate error]
|
||||
inPath: path];
|
||||
}
|
||||
else
|
||||
|
@ -2031,8 +2031,8 @@ inline void gsedRelease(GSEnumeratedDirectory X)
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Failed to recurse into directory '%@' - %s", path,
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"Failed to recurse into directory '%@' - %@", path,
|
||||
[_GSPrivate error]);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -2198,8 +2198,8 @@ inline void gsedRelease(GSEnumeratedDirectory X)
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Failed to recurse into directory '%@' - %s",
|
||||
_currentFilePath, GSLastErrorStr(errno));
|
||||
NSLog(@"Failed to recurse into directory '%@' - %@",
|
||||
_currentFilePath, [_GSPrivate error]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2940,7 +2940,8 @@ static NSSet *fileKeys = nil;
|
|||
gp = getgrgid(statbuf.st_gid);
|
||||
if (gp != 0)
|
||||
{
|
||||
group = [NSString stringWithCString: gp->gr_name];
|
||||
group = [NSString stringWithCString: gp->gr_name
|
||||
encoding: defaultEncoding];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -3081,7 +3082,8 @@ static NSSet *fileKeys = nil;
|
|||
|
||||
if (pw != 0)
|
||||
{
|
||||
owner = [NSString stringWithCString: pw->pw_name];
|
||||
owner = [NSString stringWithCString: pw->pw_name
|
||||
encoding: defaultEncoding];
|
||||
}
|
||||
#endif /* HAVE_PWD_H */
|
||||
#endif
|
||||
|
|
|
@ -204,7 +204,7 @@ static NSMutableDictionary *_hostCache = nil;
|
|||
break;
|
||||
}
|
||||
|
||||
h_name = [NSString stringWithCString: entry->h_name];
|
||||
h_name = [NSString stringWithUTF8String: entry->h_name];
|
||||
[names addObject: h_name];
|
||||
|
||||
if (entry->h_aliases != 0)
|
||||
|
@ -212,7 +212,7 @@ static NSMutableDictionary *_hostCache = nil;
|
|||
i = 0;
|
||||
while ((ptr = entry->h_aliases[i++]) != 0)
|
||||
{
|
||||
[names addObject: [NSString stringWithCString: ptr]];
|
||||
[names addObject: [NSString stringWithUTF8String: ptr]];
|
||||
}
|
||||
}
|
||||
if (entry->h_addr_list != 0)
|
||||
|
@ -223,7 +223,7 @@ static NSMutableDictionary *_hostCache = nil;
|
|||
NSString *addr;
|
||||
|
||||
memcpy((void*)&in.s_addr, (const void*)ptr, entry->h_length);
|
||||
addr = [NSString stringWithCString: (char*)inet_ntoa(in)];
|
||||
addr = [NSString stringWithUTF8String: (char*)inet_ntoa(in)];
|
||||
[addresses addObject: addr];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -654,7 +654,7 @@ _arg_addr(NSInvocation *inv, int index)
|
|||
_target ? GSNameFromClass([_target class]) : "nil" \
|
||||
);
|
||||
|
||||
return [NSString stringWithCString: buffer];
|
||||
return [NSString stringWithUTF8String: buffer];
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
|
|
|
@ -669,7 +669,7 @@ static NSDictionary *makeReference(unsigned ref)
|
|||
* Bizzarely MacOS-X seems to encode char* values by creating
|
||||
* string objects and encoding those objects!
|
||||
*/
|
||||
o = [NSString stringWithCString: (char*)address];
|
||||
o = [NSString stringWithUTF8String: (char*)address];
|
||||
[self encodeObject: o];
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -144,7 +144,7 @@ _NSLog_standard_printf_handler (NSString* message)
|
|||
|
||||
OutputDebugStringW(null_terminated_buf);
|
||||
|
||||
if ((GSUserDefaultsFlag(GSLogSyslog) == YES
|
||||
if (([_GSPrivate userDefaultsFlag: GSLogSyslog] == YES
|
||||
|| write(_NSLogDescriptor, buf, len) != (int)len) && !IsDebuggerPresent())
|
||||
{
|
||||
static HANDLE eventloghandle = 0;
|
||||
|
@ -170,7 +170,7 @@ _NSLog_standard_printf_handler (NSString* message)
|
|||
#else
|
||||
|
||||
#if defined(HAVE_SYSLOG)
|
||||
if (GSUserDefaultsFlag(GSLogSyslog) == YES
|
||||
if ([_GSPrivate userDefaultsFlag: GSLogSyslog] == YES
|
||||
|| write(_NSLogDescriptor, buf, len) != (int)len)
|
||||
{
|
||||
null_terminated_buf = objc_malloc (sizeof (char) * (len + 1));
|
||||
|
@ -302,9 +302,9 @@ NSLogv (NSString* format, va_list args)
|
|||
}
|
||||
|
||||
#ifdef HAVE_SYSLOG
|
||||
if (GSUserDefaultsFlag(GSLogSyslog) == YES)
|
||||
if ([_GSPrivate userDefaultsFlag: GSLogSyslog] == YES)
|
||||
{
|
||||
if (GSUserDefaultsFlag(GSLogThread) == YES)
|
||||
if ([_GSPrivate userDefaultsFlag: GSLogThread] == YES)
|
||||
{
|
||||
prefix = [NSString stringWithFormat: @"[thread:%x] ",
|
||||
GSCurrentThread()];
|
||||
|
@ -317,7 +317,7 @@ NSLogv (NSString* format, va_list args)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
if (GSUserDefaultsFlag(GSLogThread) == YES)
|
||||
if ([_GSPrivate userDefaultsFlag: GSLogThread] == YES)
|
||||
{
|
||||
prefix = [NSString
|
||||
stringWithFormat: @"%@ %@[%d,%x] ",
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "Foundation/NSFileManager.h"
|
||||
#include "Foundation/NSProcessInfo.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
#include "GSPortPrivate.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -302,15 +303,15 @@ static Class runLoopClass;
|
|||
e |= NBLK_OPT;
|
||||
if (fcntl(d, F_SETFL, e) < 0)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode on %d - %s",
|
||||
d, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to set non-blocking mode on %d - %@",
|
||||
d, [_GSPrivate error]);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"unable to get non-blocking mode on %d - %s",
|
||||
d, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get non-blocking mode on %d - %@",
|
||||
d, [_GSPrivate error]);
|
||||
return nil;
|
||||
}
|
||||
handle = (GSMessageHandle*)NSAllocateObject(self, 0, NSDefaultMallocZone());
|
||||
|
@ -379,9 +380,8 @@ static Class runLoopClass;
|
|||
{
|
||||
if (errno != EINPROGRESS)
|
||||
{
|
||||
NSLog(@"unable to make connection to %s - %s",
|
||||
sockAddr.sun_path,
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"unable to make connection to %s - %@",
|
||||
sockAddr.sun_path, [_GSPrivate error]);
|
||||
M_UNLOCK(myLock);
|
||||
return NO;
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ static Class runLoopClass;
|
|||
else if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
NSDebugMLLog(@"NSMessagePort",
|
||||
@"read failed - %s on 0x%x", GSLastErrorStr(errno), self);
|
||||
@"read failed - %@ on 0x%p", [_GSPrivate error], self);
|
||||
M_UNLOCK(myLock);
|
||||
[self invalidate];
|
||||
return;
|
||||
|
@ -906,7 +906,7 @@ static Class runLoopClass;
|
|||
&& res != 0)
|
||||
{
|
||||
state = GS_H_UNCON;
|
||||
NSLog(@"connect attempt failed - %s", GSLastErrorStr(res));
|
||||
NSLog(@"connect attempt failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -922,8 +922,8 @@ static Class runLoopClass;
|
|||
else
|
||||
{
|
||||
state = GS_H_UNCON;
|
||||
NSLog(@"connect write attempt failed - %s",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"connect write attempt failed - %@",
|
||||
[_GSPrivate error]);
|
||||
}
|
||||
RELEASE(d);
|
||||
}
|
||||
|
@ -957,7 +957,7 @@ static Class runLoopClass;
|
|||
{
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
NSLog(@"write attempt failed - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"write attempt failed - %@", [_GSPrivate error]);
|
||||
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 - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
desc = -1;
|
||||
}
|
||||
else if (bind(desc, (struct sockaddr *)&sockAddr,
|
||||
|
@ -1263,23 +1263,23 @@ typedef struct {
|
|||
close(desc);
|
||||
if ((desc = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0)
|
||||
{
|
||||
NSLog(@"unable to create socket - %s",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create socket - %@",
|
||||
[_GSPrivate error]);
|
||||
desc = -1;
|
||||
}
|
||||
else if (bind(desc, (struct sockaddr *)&sockAddr,
|
||||
SUN_LEN(&sockAddr)) < 0)
|
||||
{
|
||||
NSLog(@"unable to bind to %s - %s",
|
||||
sockAddr.sun_path, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to bind to %s - %@",
|
||||
sockAddr.sun_path, [_GSPrivate error]);
|
||||
(void) close(desc);
|
||||
desc = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"unable to bind to %s - %s",
|
||||
sockAddr.sun_path, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to bind to %s - %@",
|
||||
sockAddr.sun_path, [_GSPrivate error]);
|
||||
(void) close(desc);
|
||||
desc = -1;
|
||||
}
|
||||
|
@ -1291,13 +1291,13 @@ typedef struct {
|
|||
}
|
||||
else if (listen(desc, 128) < 0)
|
||||
{
|
||||
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to listen on port - %@", [_GSPrivate error]);
|
||||
(void) close(desc);
|
||||
DESTROY(port);
|
||||
}
|
||||
else if (getsockname(desc, (struct sockaddr*)&sockAddr, &i) < 0)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
(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 - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
}
|
||||
#ifndef BROKEN_SO_REUSEADDR
|
||||
/*
|
||||
|
@ -1505,13 +1505,13 @@ typedef struct {
|
|||
sizeof(opt)) < 0)
|
||||
{
|
||||
(void)close(sock);
|
||||
NSLog(@"unable to set reuse on socket - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to set reuse on socket - %@", [_GSPrivate error]);
|
||||
}
|
||||
#endif
|
||||
else if ((handle = [GSMessageHandle handleWithDescriptor: sock]) == nil)
|
||||
{
|
||||
(void)close(sock);
|
||||
NSLog(@"unable to create GSMessageHandle - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create GSMessageHandle - %@", [_GSPrivate error]);
|
||||
}
|
||||
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>NSObjCRuntime class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
@ -40,7 +41,7 @@ NSString *
|
|||
NSStringFromSelector(SEL aSelector)
|
||||
{
|
||||
if (aSelector != (SEL)0)
|
||||
return [NSString stringWithCString: GSNameFromSelector(aSelector)];
|
||||
return [NSString stringWithUTF8String: GSNameFromSelector(aSelector)];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -92,7 +93,7 @@ NSString *
|
|||
NSStringFromClass(Class aClass)
|
||||
{
|
||||
if (aClass != (Class)0)
|
||||
return [NSString stringWithCString: (char*)GSNameFromClass(aClass)];
|
||||
return [NSString stringWithUTF8String: (char*)GSNameFromClass(aClass)];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ static void GSLogZombie(id o, SEL sel)
|
|||
NSLog(@"Deallocated %@ (0x%x) sent %@",
|
||||
NSStringFromClass(c), o, NSStringFromSelector(sel));
|
||||
}
|
||||
if (GSEnvironmentFlag("CRASH_ON_ZOMBIE", NO) == YES)
|
||||
if ([_GSPrivate environmentFlag: "CRASH_ON_ZOMBIE" defaultValue: NO] == YES)
|
||||
{
|
||||
abort();
|
||||
}
|
||||
|
@ -968,8 +968,10 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
zombieMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
zombieClass = [NSZombie class];
|
||||
NSZombieEnabled = GSEnvironmentFlag("NSZombieEnabled", NO);
|
||||
NSDeallocateZombies = GSEnvironmentFlag("NSDeallocateZombies", NO);
|
||||
NSZombieEnabled = [_GSPrivate environmentFlag: "NSZombieEnabled"
|
||||
defaultValue: NO];
|
||||
NSDeallocateZombies = [_GSPrivate environmentFlag: "NSDeallocateZombies"
|
||||
defaultValue: NO];
|
||||
|
||||
autorelease_class = [NSAutoreleasePool class];
|
||||
autorelease_sel = @selector(addObject:);
|
||||
|
@ -1295,7 +1297,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
{
|
||||
if (aSelector == 0)
|
||||
{
|
||||
if (GSUserDefaultsFlag(GSMacOSXCompatible))
|
||||
if ([_GSPrivate userDefaultsFlag: GSMacOSXCompatible])
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given",
|
||||
|
@ -1868,7 +1870,7 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
{
|
||||
if (aSelector == 0)
|
||||
{
|
||||
if (GSUserDefaultsFlag(GSMacOSXCompatible))
|
||||
if ([_GSPrivate userDefaultsFlag: GSMacOSXCompatible])
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given",
|
||||
|
|
|
@ -1082,7 +1082,7 @@ NSHomeDirectoryForUser(NSString *loginName)
|
|||
pw = getpwnam ([loginName cString]);
|
||||
if (pw != 0 && pw->pw_dir != NULL)
|
||||
{
|
||||
s = [NSString stringWithCString: pw->pw_dir];
|
||||
s = [NSString stringWithUTF8String: pw->pw_dir];
|
||||
}
|
||||
[gnustep_global_lock unlock];
|
||||
#else
|
||||
|
@ -1152,7 +1152,7 @@ NSFullUserName(void)
|
|||
struct passwd *pw;
|
||||
|
||||
pw = getpwnam([NSUserName() cString]);
|
||||
userName = [NSString stringWithCString: pw->pw_gecos];
|
||||
userName = [NSString stringWithUTF8String: pw->pw_gecos];
|
||||
#else
|
||||
NSLog(@"Warning: NSFullUserName not implemented\n");
|
||||
userName = NSUserName();
|
||||
|
|
|
@ -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.
|
||||
|
||||
$Date$ $Revision$
|
||||
*/
|
||||
|
@ -28,6 +29,7 @@
|
|||
#include "Foundation/NSObject.h"
|
||||
#include "Foundation/NSFileHandle.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
#include "GSPrivate.h"
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -77,7 +79,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Failed to create pipe ... %s", GSLastErrorStr(errno));
|
||||
NSLog(@"Failed to create pipe ... %@", [_GSPrivate error]);
|
||||
DESTROY(self);
|
||||
}
|
||||
#else
|
||||
|
@ -95,6 +97,11 @@
|
|||
writeHandle = [[NSFileHandle alloc] initWithNativeHandle: writeh
|
||||
closeOnDealloc: YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Failed to create pipe ... %@", [_GSPrivate error]);
|
||||
DESTROY(self);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return self;
|
||||
|
|
|
@ -262,7 +262,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
objc_free(buffer);
|
||||
}
|
||||
}
|
||||
tmp = [arg0 UTF8String];
|
||||
tmp = [arg0 cStringUsingEncoding: [NSString defaultCStringEncoding]];
|
||||
_gnu_arg_zero = (char*)objc_malloc(strlen(tmp) + 1);
|
||||
strcpy(_gnu_arg_zero, tmp);
|
||||
#else
|
||||
|
@ -317,6 +317,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
NSMutableSet *mySet;
|
||||
id obj_argv[argc];
|
||||
int added = 1;
|
||||
NSStringEncoding enc = [_GSPrivate defaultCStringEncoding];
|
||||
|
||||
mySet = [NSMutableSet new];
|
||||
|
||||
|
@ -325,7 +326,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
str = [NSString stringWithCString: argv[i]];
|
||||
str = [NSString stringWithCString: argv[i] encoding: enc];
|
||||
|
||||
if ([str hasPrefix: @"--GNU-Debug="])
|
||||
[mySet addObject: [str substringFromIndex: 12]];
|
||||
|
@ -345,6 +346,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
{
|
||||
NSMutableArray *keys = [NSMutableArray new];
|
||||
NSMutableArray *values = [NSMutableArray new];
|
||||
NSStringEncoding enc = [_GSPrivate defaultCStringEncoding];
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
if (fallbackInitialisation == NO)
|
||||
|
@ -408,8 +410,10 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
strcpy(buf, env[i]);
|
||||
cp = &buf[cp - env[i]];
|
||||
*cp++ = '\0';
|
||||
[keys addObject: [NSString stringWithCString: buf]];
|
||||
[values addObject: [NSString stringWithCString: cp]];
|
||||
[keys addObject:
|
||||
[NSString stringWithCString: buf encoding: enc]];
|
||||
[values addObject:
|
||||
[NSString stringWithCString: cp encoding: enc]];
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@ -1230,11 +1234,8 @@ BOOL GSDebugSet(NSString *level)
|
|||
return YES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function for GNUstep base library
|
||||
*/
|
||||
BOOL
|
||||
GSEnvironmentFlag(const char *name, BOOL def)
|
||||
@implementation _GSPrivate (ProcessInfo)
|
||||
+ (BOOL) environmentFlag: (const char *)name defaultValue: (BOOL)def
|
||||
{
|
||||
const char *c = getenv(name);
|
||||
BOOL a = def;
|
||||
|
@ -1261,13 +1262,7 @@ GSEnvironmentFlag(const char *name, BOOL def)
|
|||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function for GNUstep base library.
|
||||
* Used by NSException uncaught exception handler - must not call any
|
||||
* methods/functions which might cause a recursive exception.
|
||||
*/
|
||||
const char*
|
||||
GSArgZero(void)
|
||||
+ (const char*) argZero
|
||||
{
|
||||
if (_gnu_arg_zero == 0)
|
||||
return "";
|
||||
|
@ -1275,4 +1270,5 @@ GSArgZero(void)
|
|||
return _gnu_arg_zero;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -2168,7 +2168,7 @@ GSPropertyListMake(id obj, NSDictionary *loc, BOOL xml,
|
|||
{
|
||||
style = NSPropertyListXMLFormat_v1_0;
|
||||
}
|
||||
else if (GSUserDefaultsFlag(NSWriteOldStylePropertyLists))
|
||||
else if ([_GSPrivate userDefaultsFlag: NSWriteOldStylePropertyLists] == YES)
|
||||
{
|
||||
style = NSPropertyListOpenStepFormat;
|
||||
}
|
||||
|
|
|
@ -140,8 +140,8 @@ typedef struct {
|
|||
GSPlaceholderStringClass = [GSPlaceholderString class];
|
||||
NSConstantStringClass = [NSString constantStringClass];
|
||||
_holder = (id)NSAllocateObject(GSPlaceholderStringClass, 0, 0);
|
||||
externalEncoding = GetDefEncoding();
|
||||
if (GSIsByteEncoding(externalEncoding) == YES)
|
||||
externalEncoding = [NSString defaultCStringEncoding];
|
||||
if ([_GSPrivate isByteEncoding: externalEncoding] == YES)
|
||||
{
|
||||
internalEncoding = externalEncoding;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ typedef struct {
|
|||
|
||||
if (scanner != nil)
|
||||
{
|
||||
[scanner setLocale: GSUserDefaultsDictionaryRepresentation()];
|
||||
[scanner setLocale: [_GSPrivate userDefaultsDictionaryRepresentation]];
|
||||
}
|
||||
return scanner;
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ decodePort(NSData *data, NSString *defaultAddress)
|
|||
pi->addr, pnum);
|
||||
return nil;
|
||||
}
|
||||
addr = [NSString stringWithCString: pi->addr];
|
||||
addr = [NSString stringWithUTF8String: pi->addr];
|
||||
|
||||
NSDebugFLLog(@"NSPort", @"Decoded port as '%@:%d'", addr, pnum);
|
||||
|
||||
|
@ -390,8 +390,8 @@ static Class runLoopClass;
|
|||
dummy = 1;
|
||||
if (ioctlsocket(d, FIONBIO, &dummy) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode on %d - %s",
|
||||
d, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to set non-blocking mode on %d - %@",
|
||||
d, [_GSPrivate error]);
|
||||
return nil;
|
||||
}
|
||||
#else /* !__MINGW32__ */
|
||||
|
@ -400,15 +400,15 @@ static Class runLoopClass;
|
|||
e |= NBLK_OPT;
|
||||
if (fcntl(d, F_SETFL, e) < 0)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode on %d - %s",
|
||||
d, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to set non-blocking mode on %d - %@",
|
||||
d, [_GSPrivate error]);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"unable to get non-blocking mode on %d - %s",
|
||||
d, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get non-blocking mode on %d - %@",
|
||||
d, [_GSPrivate error]);
|
||||
return nil;
|
||||
}
|
||||
#endif
|
||||
|
@ -545,9 +545,9 @@ static Class runLoopClass;
|
|||
if (errno != EINPROGRESS)
|
||||
#endif
|
||||
{
|
||||
NSLog(@"unable to make connection to %s:%d - %s",
|
||||
NSLog(@"unable to make connection to %s:%d - %@",
|
||||
inet_ntoa(sockAddr.sin_addr),
|
||||
GSSwapBigI16ToHost(sockAddr.sin_port), GSLastErrorStr(errno));
|
||||
GSSwapBigI16ToHost(sockAddr.sin_port), [_GSPrivate error]);
|
||||
if (addrNum < [addrs count])
|
||||
{
|
||||
BOOL result;
|
||||
|
@ -817,7 +817,7 @@ static Class runLoopClass;
|
|||
#endif /* !__MINGW32__ */
|
||||
{
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"read failed - %s on 0x%x", GSLastErrorStr(errno), self);
|
||||
@"read failed - %@ on 0x%p", [_GSPrivate error], self);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
|
@ -1108,7 +1108,7 @@ static Class runLoopClass;
|
|||
&& res != 0)
|
||||
{
|
||||
state = GS_H_UNCON;
|
||||
NSLog(@"connect attempt failed - %s", GSLastErrorStr(res));
|
||||
NSLog(@"connect attempt failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1118,7 +1118,7 @@ static Class runLoopClass;
|
|||
if (len == (int)[d length])
|
||||
{
|
||||
RELEASE(defaultAddress);
|
||||
defaultAddress = RETAIN([NSString stringWithCString:
|
||||
defaultAddress = RETAIN([NSString stringWithUTF8String:
|
||||
inet_ntoa(sockAddr.sin_addr)]);
|
||||
NSDebugMLLog(@"GSTcpHandle",
|
||||
@"wrote %d bytes on 0x%x", len, self);
|
||||
|
@ -1127,8 +1127,8 @@ static Class runLoopClass;
|
|||
else
|
||||
{
|
||||
state = GS_H_UNCON;
|
||||
NSLog(@"connect write attempt failed - %s",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"connect write attempt failed - %@",
|
||||
[_GSPrivate error]);
|
||||
}
|
||||
RELEASE(d);
|
||||
}
|
||||
|
@ -1166,7 +1166,7 @@ static Class runLoopClass;
|
|||
if (errno != EINTR && errno != EAGAIN)
|
||||
#endif /* !__MINGW32__ */
|
||||
{
|
||||
NSLog(@"write attempt failed - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"write attempt failed - %@", [_GSPrivate error]);
|
||||
[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 - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
DESTROY(port);
|
||||
}
|
||||
#ifndef BROKEN_SO_REUSEADDR
|
||||
|
@ -1649,29 +1649,29 @@ static Class tcpPortClass;
|
|||
sizeof(reuse)) < 0)
|
||||
{
|
||||
(void) close(desc);
|
||||
NSLog(@"unable to set reuse on socket - %s",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"unable to set reuse on socket - %@",
|
||||
[_GSPrivate error]);
|
||||
DESTROY(port);
|
||||
}
|
||||
#endif
|
||||
else if (bind(desc, (struct sockaddr *)&sockaddr,
|
||||
sizeof(sockaddr)) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to bind to port %s:%d - %s",
|
||||
inet_ntoa(sockaddr.sin_addr), number, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to bind to port %s:%d - %@",
|
||||
inet_ntoa(sockaddr.sin_addr), number, [_GSPrivate error]);
|
||||
(void) close(desc);
|
||||
DESTROY(port);
|
||||
}
|
||||
else if (listen(desc, 128) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to listen on port - %@", [_GSPrivate error]);
|
||||
(void) close(desc);
|
||||
DESTROY(port);
|
||||
}
|
||||
else if (getsockname(desc, (struct sockaddr*)&sockaddr, &i)
|
||||
== SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
(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 - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
}
|
||||
#ifndef BROKEN_SO_REUSEADDR
|
||||
/*
|
||||
|
@ -1984,13 +1984,13 @@ static Class tcpPortClass;
|
|||
sizeof(opt)) < 0)
|
||||
{
|
||||
(void)close(sock);
|
||||
NSLog(@"unable to set reuse on socket - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to set reuse on socket - %@", [_GSPrivate error]);
|
||||
}
|
||||
#endif
|
||||
else if ((handle = [GSTcpHandle handleWithDescriptor: sock]) == nil)
|
||||
{
|
||||
(void)close(sock);
|
||||
NSLog(@"unable to create GSTcpHandle - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create GSTcpHandle - %@", [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2179,7 +2179,7 @@ static Class tcpPortClass;
|
|||
*/
|
||||
handle = [GSTcpHandle handleWithDescriptor: desc];
|
||||
memcpy(&handle->sockAddr, &sockAddr, sizeof(sockAddr));
|
||||
handle->defaultAddress = RETAIN([NSString stringWithCString:
|
||||
handle->defaultAddress = RETAIN([NSString stringWithUTF8String:
|
||||
inet_ntoa(sockAddr.sin_addr)]);
|
||||
|
||||
[handle setState: GS_H_ACCEPT];
|
||||
|
|
|
@ -554,7 +554,7 @@ typedef enum {
|
|||
serverLock = [NSRecursiveLock new];
|
||||
modes = [[NSArray alloc] initWithObjects: &mode count: 1];
|
||||
#ifdef GDOMAP_PORT_OVERRIDE
|
||||
serverPort = RETAIN([NSString stringWithCString:
|
||||
serverPort = RETAIN([NSString stringWithUTF8String:
|
||||
make_gdomap_port(GDOMAP_PORT_OVERRIDE)]);
|
||||
#endif
|
||||
portClass = [NSSocketPort class];
|
||||
|
@ -738,7 +738,7 @@ typedef enum {
|
|||
[array addObject: com];
|
||||
RELEASE(com);
|
||||
[com setAddr: svrs[count]];
|
||||
addr = [NSString stringWithCString:
|
||||
addr = [NSString stringWithUTF8String:
|
||||
(char*)inet_ntoa(svrs[count])];
|
||||
[com startPortLookup: name onHost: addr];
|
||||
count++;
|
||||
|
@ -802,7 +802,7 @@ typedef enum {
|
|||
|
||||
if (*port)
|
||||
{
|
||||
*addr = [NSString stringWithCString: inet_ntoa(singleServer)];
|
||||
*addr = [NSString stringWithUTF8String: inet_ntoa(singleServer)];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -566,8 +566,8 @@ handle_printf_atsign (FILE *stream,
|
|||
gcrSel = @selector(getCharacters:range:);
|
||||
ranSel = @selector(rangeOfComposedCharacterSequenceAtIndex:);
|
||||
|
||||
_DefaultStringEncoding = GetDefEncoding();
|
||||
_ByteEncodingOk = GSIsByteEncoding(_DefaultStringEncoding);
|
||||
_DefaultStringEncoding = [_GSPrivate defaultCStringEncoding];
|
||||
_ByteEncodingOk = [_GSPrivate isByteEncoding: _DefaultStringEncoding];
|
||||
|
||||
NSStringClass = self;
|
||||
[self setVersion: 1];
|
||||
|
@ -1057,7 +1057,6 @@ handle_printf_atsign (FILE *stream,
|
|||
locale: (NSDictionary*)locale
|
||||
arguments: (va_list)argList
|
||||
{
|
||||
extern void GSStrExternalize();
|
||||
unsigned char buf[2048];
|
||||
GSStr_t f;
|
||||
unichar fbuf[1024];
|
||||
|
@ -2685,7 +2684,7 @@ handle_printf_atsign (FILE *stream,
|
|||
*/
|
||||
+ (NSStringEncoding*) availableStringEncodings
|
||||
{
|
||||
return GetAvailableEncodings();
|
||||
return [_GSPrivate availableEncodings];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2703,7 +2702,7 @@ handle_printf_atsign (FILE *stream,
|
|||
*/
|
||||
ourbundle = [NSBundle bundleForLibrary: @"gnustep-base"];
|
||||
|
||||
ourname = GetEncodingName(encoding);
|
||||
ourname = [_GSPrivate encodingName: encoding];
|
||||
return [ourbundle localizedStringForKey: ourname
|
||||
value: ourname
|
||||
table: nil];
|
||||
|
@ -4151,7 +4150,7 @@ static NSFileManager *fm = nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
dict = GSUserDefaultsDictionaryRepresentation();
|
||||
dict = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
ret = AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithFormat: format locale: dict arguments: ap]);
|
||||
}
|
||||
|
@ -4203,7 +4202,7 @@ static NSFileManager *fm = nil;
|
|||
*/
|
||||
- (NSComparisonResult) localizedCompare: (NSString *)string
|
||||
{
|
||||
NSDictionary *dict = GSUserDefaultsDictionaryRepresentation();
|
||||
NSDictionary *dict = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
|
||||
return [self compare: string
|
||||
options: 0
|
||||
|
@ -4217,7 +4216,7 @@ static NSFileManager *fm = nil;
|
|||
*/
|
||||
- (NSComparisonResult) localizedCaseInsensitiveCompare: (NSString *)string
|
||||
{
|
||||
NSDictionary *dict = GSUserDefaultsDictionaryRepresentation();
|
||||
NSDictionary *dict = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
|
||||
return [self compare: string
|
||||
options: NSCaseInsensitiveSearch
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "Foundation/NSTimer.h"
|
||||
#include "Foundation/NSLock.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -1561,8 +1562,8 @@ GSCheckTasks()
|
|||
result = waitpid(_taskId, &_terminationStatus, WNOHANG);
|
||||
if (result < 0)
|
||||
{
|
||||
NSLog(@"waitpid %d, result %d, error %s",
|
||||
_taskId, result, GSLastErrorStr(errno));
|
||||
NSLog(@"waitpid %d, result %d, error %@",
|
||||
_taskId, result, [_GSPrivate error]);
|
||||
[self _terminatedChild: -1];
|
||||
}
|
||||
else if (result == _taskId || (result > 0 && errno == 0))
|
||||
|
@ -1594,8 +1595,8 @@ GSCheckTasks()
|
|||
#ifdef WAITDEBUG
|
||||
else
|
||||
{
|
||||
NSLog(@"waitpid %d, result %d, error %s",
|
||||
_taskId, result, GSLastErrorStr(errno));
|
||||
NSLog(@"waitpid %d, result %d, error %@",
|
||||
_taskId, result, [_GSPrivate error]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "Foundation/NSConnection.h"
|
||||
#include "Foundation/NSInvocation.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
#include "GSRunLoopCtxt.h"
|
||||
|
||||
@interface NSAutoreleasePool (NSThread)
|
||||
|
@ -889,12 +890,12 @@ static NSDate *theFuture;
|
|||
#if defined(__MINGW32__)
|
||||
if (SetEvent(event) == 0)
|
||||
{
|
||||
NSLog(@"Set event failed - %@", GSLastErrorStr(errno));
|
||||
NSLog(@"Set event failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
#else
|
||||
if (write(outputFd, "0", 1) != 1)
|
||||
{
|
||||
NSLog(@"Write to pipe failed - %@", GSLastErrorStr(errno));
|
||||
NSLog(@"Write to pipe failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -918,12 +919,12 @@ static NSDate *theFuture;
|
|||
#if defined(__MINGW32__)
|
||||
if (ResetEvent(event) == 0)
|
||||
{
|
||||
NSLog(@"Reset event failed - %@", GSLastErrorStr(errno));
|
||||
NSLog(@"Reset event failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
#else
|
||||
if (read(inputFd, &c, 1) != 1)
|
||||
{
|
||||
NSLog(@"Read pipe failed - %@", GSLastErrorStr(errno));
|
||||
NSLog(@"Read pipe failed - %@", [_GSPrivate error]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1487,7 +1487,7 @@ static NSMapTable *absolutes = 0;
|
|||
bufsize--;
|
||||
}
|
||||
localZoneString
|
||||
= [NSString stringWithCString: buf length: bufsize];
|
||||
= [NSString stringWithUTF8String: buf length: bufsize];
|
||||
}
|
||||
RegCloseKey(regkey);
|
||||
}
|
||||
|
|
|
@ -1955,8 +1955,9 @@ static BOOL isLocked = NO;
|
|||
}
|
||||
@end
|
||||
|
||||
NSDictionary*
|
||||
GSUserDefaultsDictionaryRepresentation()
|
||||
@implementation _GSPrivate (UserDefaults)
|
||||
|
||||
+ (NSDictionary*) userDefaultsDictionaryRepresentation
|
||||
{
|
||||
NSDictionary *defs;
|
||||
|
||||
|
@ -1970,11 +1971,7 @@ GSUserDefaultsDictionaryRepresentation()
|
|||
return defs;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get one of several potentially useful flags.
|
||||
*/
|
||||
BOOL
|
||||
GSUserDefaultsFlag(GSUserDefaultFlagType type)
|
||||
+ (BOOL) userDefaultsFlag: (GSUserDefaultFlagType)type
|
||||
{
|
||||
if (sharedDefaults == nil)
|
||||
{
|
||||
|
@ -1982,4 +1979,5 @@ GSUserDefaultsFlag(GSUserDefaultFlagType type)
|
|||
}
|
||||
return flags[type];
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ objc_get_symbol_path(Class theClass, Category *theCategory)
|
|||
|
||||
if (ret)
|
||||
{
|
||||
return [NSString stringWithCString: ret];
|
||||
return [NSString stringWithUTF8String: ret];
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
|
|
@ -419,8 +419,8 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
/* Some exceptional condition happened. */
|
||||
/* xxx We can do something with exception_fds, instead of
|
||||
aborting here. */
|
||||
NSLog (@"poll() error in -acceptInputForMode:beforeDate: '%s'",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog (@"poll() error in -acceptInputForMode:beforeDate: '%@'",
|
||||
[_GSPrivate error]);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
@ -800,8 +800,8 @@ static void setPollfd(int fd, int event, GSRunLoopCtxt *ctxt)
|
|||
/* Some exceptional condition happened. */
|
||||
/* xxx We can do something with exception_fds, instead of
|
||||
aborting here. */
|
||||
NSLog (@"select() error in -acceptInputForMode:beforeDate: '%s'",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog (@"select() error in -acceptInputForMode:beforeDate: '%@'",
|
||||
[_GSPrivate error]);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
@ -792,7 +793,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET)
|
||||
{
|
||||
NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -806,8 +807,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
if (bind(net, (struct sockaddr *)&lsin, sizeof(lsin)) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to bind to port %s:%d - %s", inet_ntoa(lsin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
|
||||
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(lsin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]);
|
||||
(void) closesocket(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -825,9 +826,9 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
if (WSAGetLastError() != WSAEWOULDBLOCK)
|
||||
{
|
||||
NSLog(@"unable to make connection to %s:%d - %s",
|
||||
NSLog(@"unable to make connection to %s:%d - %@",
|
||||
inet_ntoa(sin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
|
||||
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -891,7 +892,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if ((net = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) == INVALID_SOCKET)
|
||||
{
|
||||
NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create socket - %@", [_GSPrivate error]);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
@ -908,8 +909,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (bind(net, (struct sockaddr *)&sin, sizeof(sin)) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to bind to port %s:%d - %s", inet_ntoa(sin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), GSLastErrorStr(errno));
|
||||
NSLog(@"unable to bind to port %s:%d - %@", inet_ntoa(sin.sin_addr),
|
||||
GSSwapBigI16ToHost(sin.sin_port), [_GSPrivate error]);
|
||||
(void) closesocket(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -917,7 +918,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (listen(net, 256) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to listen on port - %@", [_GSPrivate error]);
|
||||
(void) closesocket(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -925,7 +926,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (getsockname(net, (struct sockaddr*)&sin, &size) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
(void) closesocket(net);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
|
@ -1092,8 +1093,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (_fstat(desc, &sbuf) != 0)
|
||||
{
|
||||
NSLog(@"unable to get status of descriptor %d - %s",
|
||||
desc, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get status of descriptor %d - %@",
|
||||
desc, [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1293,8 +1294,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (len < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
@ -1318,8 +1319,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (len < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
@ -1344,8 +1345,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (got < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
[d setLength: got];
|
||||
}
|
||||
|
@ -1367,8 +1368,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
else if (got < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to read from descriptor - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"unable to read from descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
}
|
||||
while (len > 0 && got > 0);
|
||||
|
@ -1414,8 +1415,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (rval < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"unable to write to descriptor - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"unable to write to descriptor - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1520,8 +1521,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (result < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
return (unsigned long long)result;
|
||||
}
|
||||
|
@ -1544,8 +1545,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (result < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
return (unsigned long long)result;
|
||||
}
|
||||
|
@ -1568,8 +1569,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (result < 0)
|
||||
{
|
||||
[NSException raise: NSFileHandleOperationException
|
||||
format: @"failed to move to offset in file - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
format: @"failed to move to offset in file - %@",
|
||||
[_GSPrivate error]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1927,8 +1928,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Accept attempt failed - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
s = [NSString stringWithFormat: @"Accept attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[readInfo setObject: s forKey: GSFileHandleNotificationError];
|
||||
}
|
||||
else
|
||||
|
@ -1996,8 +1997,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Read attempt failed - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
s = [NSString stringWithFormat: @"Read attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[readInfo setObject: s forKey: GSFileHandleNotificationError];
|
||||
[self postReadNotification];
|
||||
}
|
||||
|
@ -2005,8 +2006,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Read attempt failed - %s",
|
||||
GSLastErrorStr(errno)];
|
||||
s = [NSString stringWithFormat: @"Read attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[readInfo setObject: s forKey: GSFileHandleNotificationError];
|
||||
[self postReadNotification];
|
||||
}
|
||||
|
@ -2045,8 +2046,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
{
|
||||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat: @"Connect attempt failed - %s",
|
||||
GSLastErrorStr(result)];
|
||||
s = [NSString stringWithFormat: @"Connect attempt failed - %@",
|
||||
[_GSPrivate error]];
|
||||
[info setObject: s forKey: GSFileHandleNotificationError];
|
||||
}
|
||||
else
|
||||
|
@ -2080,7 +2081,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
NSString *s;
|
||||
|
||||
s = [NSString stringWithFormat:
|
||||
@"Write attempt failed - %s", GSLastErrorStr(errno)];
|
||||
@"Write attempt failed - %@", [_GSPrivate error]];
|
||||
[info setObject: s forKey: GSFileHandleNotificationError];
|
||||
[self postWriteNotification];
|
||||
}
|
||||
|
@ -2193,7 +2194,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
- (void) setAddr: (struct sockaddr_in *)sin
|
||||
{
|
||||
address = [[NSString alloc] initWithCString: (char*)inet_ntoa(sin->sin_addr)];
|
||||
address = [[NSString alloc] initWithUTF8String:
|
||||
(char*)inet_ntoa(sin->sin_addr)];
|
||||
service = [[NSString alloc] initWithFormat: @"%d",
|
||||
(int)GSSwapBigI16ToHost(sin->sin_port)];
|
||||
protocol = @"tcp";
|
||||
|
@ -2239,8 +2241,8 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (ioctlsocket((SOCKET)_get_osfhandle(descriptor), FIONBIO, &dummy)
|
||||
== SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to set non-blocking mode - %s",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"unable to set non-blocking mode - %@",
|
||||
[_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
isNonBlocking = flag;
|
||||
|
@ -2251,8 +2253,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
if (ioctlsocket((SOCKET)_get_osfhandle(descriptor), FIONBIO, &dummy)
|
||||
== SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to set blocking mode - %s",
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"unable to set blocking mode - %@", [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
isNonBlocking = flag;
|
||||
|
@ -2273,11 +2274,11 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = [NSString stringWithCString: (char*)inet_ntoa(sin.sin_addr)];
|
||||
str = [NSString stringWithUTF8String: (char*)inet_ntoa(sin.sin_addr)];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
@ -2290,7 +2291,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
|||
|
||||
if (getsockname(descriptor, (struct sockaddr*)&sin, &size) == SOCKET_ERROR)
|
||||
{
|
||||
NSLog(@"unable to get socket name - %s", GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get socket name - %@", [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -436,8 +436,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
BOOL found = NO;
|
||||
|
||||
NSDebugMLLog(@"NSRunLoop", @"WaitForMultipleObjects() error in "
|
||||
@"-acceptInputForMode:beforeDate: %s",
|
||||
GSLastErrorStr(GetLastError()));
|
||||
@"-acceptInputForMode:beforeDate: %@", [_GSPrivate error]);
|
||||
/*
|
||||
* Check each handle in turn until either we find one which has an
|
||||
* event signalled, or we find the one which caused the original
|
||||
|
@ -458,8 +457,7 @@ static const NSMapTableValueCallBacks WatcherMapValueCallBacks =
|
|||
if (found == NO)
|
||||
{
|
||||
NSLog(@"WaitForMultipleObjects() error in "
|
||||
@"-acceptInputForMode:beforeDate: %s",
|
||||
GSLastErrorStr(GetLastError()));
|
||||
@"-acceptInputForMode:beforeDate: %@", [_GSPrivate error]);
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -311,8 +311,8 @@ OutputDebugStringW(L"");
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Failed to insert HKEY_CURRENT_USER\\%@\\%@ (%x) %s",
|
||||
registry, n, rc, GSLastErrorStr(rc));
|
||||
NSLog(@"Failed to insert HKEY_CURRENT_USER\\%@\\%@ (%x) %@",
|
||||
registry, n, rc, [_GSPrivate error: rc]);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
|
@ -206,8 +206,8 @@ static Class messagePortClass = 0;
|
|||
M_UNLOCK(messagePortLock);
|
||||
if ([p _setupSendPort] == NO)
|
||||
{
|
||||
NSLog(@"unable to access mailslot '%@' - %s",
|
||||
[p name], GSLastErrorStr(errno));
|
||||
NSLog(@"unable to access mailslot '%@' - %@",
|
||||
[p name], [_GSPrivate error]);
|
||||
DESTROY(p);
|
||||
}
|
||||
return p;
|
||||
|
@ -334,8 +334,8 @@ static Class messagePortClass = 0;
|
|||
|
||||
if (this->rHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
NSLog(@"unable to create mailslot '%@' - %s",
|
||||
this->name, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to create mailslot '%@' - %@",
|
||||
this->name, [_GSPrivate error]);
|
||||
DESTROY(self);
|
||||
}
|
||||
else
|
||||
|
@ -507,14 +507,14 @@ static Class messagePortClass = 0;
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"GetOverlappedResult failed ...%s", GSLastErrorStr(errno));
|
||||
NSLog(@"GetOverlappedResult failed ... %@", [_GSPrivate error]);
|
||||
this->rState = RS_NONE;
|
||||
this->rLength = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"GetOverlappedResult success ...%u", this->rSize);
|
||||
NSLog(@"GetOverlappedResult success ... %u", this->rSize);
|
||||
this->rState = RS_NONE;
|
||||
this->rLength = 0;
|
||||
}
|
||||
|
@ -529,8 +529,8 @@ static Class messagePortClass = 0;
|
|||
0,
|
||||
0) == 0)
|
||||
{
|
||||
NSLog(@"unable to get info from mailslot '%@' - %s",
|
||||
this->name, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to get info from mailslot '%@' - %@",
|
||||
this->name, [_GSPrivate error]);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
|
@ -546,16 +546,15 @@ static Class messagePortClass = 0;
|
|||
&this->rSize,
|
||||
NULL) == 0)
|
||||
{
|
||||
NSLog(@"unable to read from mailslot '%@' - %s",
|
||||
this->name, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to read from mailslot '%@' - %@",
|
||||
this->name, [_GSPrivate error]);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
if (this->rSize != this->rWant)
|
||||
{
|
||||
NSLog(@"only read %d of %d bytes from mailslot '%@' - %s",
|
||||
this->rSize, this->rWant, this->name,
|
||||
GSLastErrorStr(errno));
|
||||
NSLog(@"only read %d of %d bytes from mailslot '%@' - %@",
|
||||
this->rSize, this->rWant, this->name, [_GSPrivate error]);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
|
@ -749,8 +748,8 @@ static Class messagePortClass = 0;
|
|||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"unable to read from mailslot '%@' - %s",
|
||||
this->name, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to read from mailslot '%@' - %@",
|
||||
this->name, [_GSPrivate error]);
|
||||
[self invalidate];
|
||||
}
|
||||
}
|
||||
|
@ -804,7 +803,7 @@ static Class messagePortClass = 0;
|
|||
&this->wSize,
|
||||
TRUE) == 0)
|
||||
{
|
||||
NSLog(@"GetOverlappedResult failed ...%s", GSLastErrorStr(errno));
|
||||
NSLog(@"GetOverlappedResult failed ... %@", [_GSPrivate error]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -856,8 +855,8 @@ again:
|
|||
}
|
||||
else if ((errno = GetLastError()) != ERROR_IO_PENDING)
|
||||
{
|
||||
NSLog(@"unable to write to mailslot '%@' - %s",
|
||||
this->name, GSLastErrorStr(errno));
|
||||
NSLog(@"unable to write to mailslot '%@' - %@",
|
||||
this->name, [_GSPrivate error]);
|
||||
[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 - %s",GSLastErrorStr(errno));
|
||||
NSLog(@"unable to set non-blocking mode - %@", [_GSPrivate error]);
|
||||
}
|
||||
|
||||
@implementation GSFileInputStream
|
||||
|
@ -1866,8 +1866,8 @@ static void setNonblocking(SOCKET fd)
|
|||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Unable to open named pipe '%@'... %s",
|
||||
path, GSLastErrorStr(GetLastError())];
|
||||
format: @"Unable to open named pipe '%@'... %@",
|
||||
path, [_GSPrivate error]];
|
||||
}
|
||||
|
||||
// the type of the stream does not matter, since we are only using the fd
|
||||
|
|
|
@ -228,16 +228,20 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
id v;
|
||||
NSString *k;
|
||||
|
||||
switch (type) {
|
||||
case REG_SZ: {
|
||||
switch (type)
|
||||
{
|
||||
case REG_SZ:
|
||||
{
|
||||
int datacharlen = datalen / 2;
|
||||
if (datacharlen > 0 && data[datacharlen-1] == 0)
|
||||
datacharlen--;
|
||||
|
||||
v = [NSString stringWithCharacters:data length:datacharlen];
|
||||
v = [NSString stringWithCharacters: data
|
||||
length: datacharlen];
|
||||
}
|
||||
break;
|
||||
case REG_BINARY: {
|
||||
case REG_BINARY:
|
||||
{
|
||||
v = [NSString stringWithCString: (char*)data
|
||||
encoding: NSASCIIStringEncoding];
|
||||
}
|
||||
|
@ -249,7 +253,8 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
v = [v propertyList];
|
||||
if (v)
|
||||
{
|
||||
k = [NSString stringWithCharacters: name length: namelen];
|
||||
k = [NSString stringWithCharacters: name
|
||||
length: namelen];
|
||||
[domainDict setObject: v forKey: k];
|
||||
}
|
||||
}
|
||||
|
@ -319,16 +324,20 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
id v;
|
||||
NSString *k;
|
||||
|
||||
switch (type) {
|
||||
case REG_SZ: {
|
||||
switch (type)
|
||||
{
|
||||
case REG_SZ:
|
||||
{
|
||||
int datacharlen = datalen / 2;
|
||||
if (datacharlen > 0 && data[datacharlen-1] == 0)
|
||||
datacharlen--;
|
||||
|
||||
v = [NSString stringWithCharacters:data length:datacharlen];
|
||||
v = [NSString stringWithCharacters: data
|
||||
length: datacharlen];
|
||||
}
|
||||
break;
|
||||
case REG_BINARY: {
|
||||
case REG_BINARY:
|
||||
{
|
||||
v = [NSString stringWithCString: (char*)data
|
||||
encoding: NSASCIIStringEncoding];
|
||||
}
|
||||
|
@ -340,7 +349,8 @@ struct NSUserDefaultsWin32_DomainInfo
|
|||
v = [v propertyList];
|
||||
if (v)
|
||||
{
|
||||
k = [NSString stringWithCharacters: name length: namelen];
|
||||
k = [NSString stringWithCharacters: name
|
||||
length: namelen];
|
||||
[domainDict setObject: v forKey: k];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ bench_array()
|
|||
{
|
||||
char buf1[100];
|
||||
sprintf(buf1, "str%0d", i);
|
||||
strings[i] = [stringClass stringWithCString: buf1];
|
||||
strings[i] = [stringClass stringWithUTF8String: buf1];
|
||||
}
|
||||
printf("NSArray\n");
|
||||
array = [NSMutableArray arrayWithCapacity: 16];
|
||||
|
@ -316,8 +316,8 @@ bench_dict()
|
|||
char buf1[100], buf2[100];
|
||||
sprintf(buf1, "key%0d", i);
|
||||
sprintf(buf2, "val%0d", i);
|
||||
keys[i] = [stringClass stringWithCString: buf1];
|
||||
vals[i] = [stringClass stringWithCString: buf2];
|
||||
keys[i] = [stringClass stringWithUTF8String: buf1];
|
||||
vals[i] = [stringClass stringWithUTF8String: buf2];
|
||||
}
|
||||
printf("NSDictionary\n");
|
||||
dict = [NSMutableDictionary dictionaryWithCapacity: 16];
|
||||
|
@ -487,7 +487,7 @@ bench_str()
|
|||
START_TIMER;
|
||||
for (i = 0; i < MAX_COUNT; i++)
|
||||
{
|
||||
str = [stringClass stringWithCString: "hello world"];
|
||||
str = [stringClass stringWithUTF8String: "hello world"];
|
||||
}
|
||||
END_TIMER;
|
||||
PRINT_TIMER("NSString (1 cstring:) \t\t");
|
||||
|
|
|
@ -72,11 +72,11 @@ GS_EXPORT NSString * const GSTelnetTextKey;
|
|||
|
||||
if (i > 0 && ptr[i-1] == '\r')
|
||||
{
|
||||
s = [NSString stringWithCString: ptr length: i-1];
|
||||
s = [NSString stringWithUTF8String: ptr length: i-1];
|
||||
}
|
||||
else
|
||||
{
|
||||
s = [NSString stringWithCString: ptr length: i];
|
||||
s = [NSString stringWithUTF8String: ptr length: i];
|
||||
}
|
||||
len -= (i + 1);
|
||||
if (len > 0)
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#define MyAssert2(IDENT) do { \
|
||||
NSCAssert2([IDENT isEqual: \
|
||||
[NSString stringWithCString: #IDENT]], \
|
||||
[NSString stringWithUTF8String: #IDENT]], \
|
||||
@"Invalid value: %@ for: %s", \
|
||||
IDENT, #IDENT); \
|
||||
NSCAssert2([cache[i++] isEqual: IDENT], \
|
||||
|
|
|
@ -522,7 +522,7 @@ int main(int argc, char *argv[], char **env)
|
|||
[c setRootObject: l];
|
||||
|
||||
if (optind < argc)
|
||||
[c registerName: [NSString stringWithCString: argv[optind]]];
|
||||
[c registerName: [NSString stringWithUTF8String: argv[optind]]];
|
||||
else
|
||||
[c registerName: @"test2server"];
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ int main (int argc, char *argv[])
|
|||
|
||||
if (argc > 1)
|
||||
out_port = [TcpOutPort newForSendingToRegisteredName:
|
||||
[NSString stringWithCString: argv[1]]
|
||||
[NSString stringWithUTF8String: argv[1]]
|
||||
onHost: @"localhost"];
|
||||
else
|
||||
out_port = [TcpOutPort newForSendingToRegisteredName: @"tcpport-test"
|
||||
|
|
|
@ -72,7 +72,7 @@ int main (int argc, char *argv[])
|
|||
{
|
||||
if (argc > 1)
|
||||
port = [TcpInPort newForReceivingFromRegisteredName:
|
||||
[NSString stringWithCString: argv[1]]];
|
||||
[NSString stringWithUTF8String: argv[1]]];
|
||||
else
|
||||
port = [TcpInPort newForReceivingFromRegisteredName: @"tcpport-test"];
|
||||
|
||||
|
|
|
@ -2333,11 +2333,11 @@ fail:
|
|||
method = [[NSMutableDictionary alloc] initWithCapacity: 4];
|
||||
if (buffer[pos++] == '-')
|
||||
{
|
||||
mname = [NSMutableString stringWithCString: "-"];
|
||||
mname = [NSMutableString stringWithUTF8String: "-"];
|
||||
}
|
||||
else
|
||||
{
|
||||
mname = [NSMutableString stringWithCString: "+"];
|
||||
mname = [NSMutableString stringWithUTF8String: "+"];
|
||||
}
|
||||
[method setObject: sels forKey: @"Sels"]; // Parts of selector.
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
#
|
||||
# You should have received a copy of the GNU 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.
|
||||
#
|
||||
|
||||
#
|
||||
|
|
|
@ -62,7 +62,7 @@ static NSString *input(char **ptr)
|
|||
{
|
||||
tmp[-1] = '\0';
|
||||
*ptr = tmp;
|
||||
result = [NSString stringWithCString: start];
|
||||
result = [NSString stringWithUTF8String: start];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ static NSString *input(char **ptr)
|
|||
}
|
||||
*tmp++ = '\0';
|
||||
*ptr = tmp;
|
||||
result = [NSString stringWithCString: start];
|
||||
result = [NSString stringWithUTF8String: start];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -64,12 +64,12 @@ loc_read_file(const char *dir, const char *file)
|
|||
if (strlen(country) > 0 && strcmp(country, language) != 0)
|
||||
{
|
||||
strcat(country, language);
|
||||
[dict setObject: [NSString stringWithCString: country]
|
||||
forKey: [NSString stringWithCString: locale]];
|
||||
[dict setObject: [NSString stringWithUTF8String: country]
|
||||
forKey: [NSString stringWithUTF8String: locale]];
|
||||
}
|
||||
locale[2] = '\0';
|
||||
[dict setObject: [NSString stringWithCString: language]
|
||||
forKey: [NSString stringWithCString: locale]];
|
||||
[dict setObject: [NSString stringWithUTF8String: language]
|
||||
forKey: [NSString stringWithUTF8String: locale]];
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -135,13 +135,14 @@ static int ParseFile(const char *filename,NSMutableDictionary *tables)
|
|||
}
|
||||
|
||||
|
||||
filenamestr=[NSString stringWithCString: filename];
|
||||
filenamestr = [NSString stringWithCString: filename
|
||||
encoding: [NSString defaultCStringEncoding]];
|
||||
if (verbose)
|
||||
printf("Parsing '%s'.\n", [filenamestr cString]);
|
||||
printf("Parsing '%s'.\n", filename);
|
||||
f=fopen(filename,"rt");
|
||||
if (!f)
|
||||
{
|
||||
NSLog(@"Unable to open '%s': %m\n",filename);
|
||||
NSLog(@"Unable to open '%@': %m\n",filenamestr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ id process_plist(NSData *inputData)
|
|||
NSString *string = nil;
|
||||
|
||||
// Initialize a string with the contents of the file.
|
||||
string = [NSString stringWithCString: (char *)[inputData bytes]];
|
||||
string = [NSString stringWithUTF8String: (char *)[inputData bytes]];
|
||||
|
||||
// Convert the string into a property list. If there is a parsing error
|
||||
// the property list interpreter will throw an exception.
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
{
|
||||
buf[--len] = '\0';
|
||||
}
|
||||
str = [NSString stringWithCString: buf];
|
||||
str = [NSString stringWithUTF8String: buf];
|
||||
return str;
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue