Various bugfixes etc.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13479 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-04-16 13:48:14 +00:00
parent 971c00d233
commit e1274f9986
6 changed files with 58 additions and 51 deletions

View file

@ -1,3 +1,16 @@
2002-04-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPortNameServer.m: Improved warnings about launching
gdomap.
* Source/NSDistributedNotification.m: Improved warnings about
launching gdnc.
* Source/NSException.m: Log uncaught exceptions using NSLog()
* Source/GSString.m: Applied fix by Malexander Malmberg for
transmuting strings where the default encoding is not the same as
the internal 8-bit encoding.
* Source/Unicode.m: Logic fix for selecting strict conversion from
unicode by Alexander Malmberg.
2002-04-12 Richard Frith-Macdonald <rfm@gnu.org> 2002-04-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSXML.m: New method ([-nextElement]) to traverse * Source/Additions/GSXML.m: New method ([-nextElement]) to traverse

View file

@ -1665,11 +1665,15 @@ transmute(ivars self, NSString *aString)
*/ */
transmute = NO; transmute = NO;
} }
else if ([aString canBeConvertedToEncoding: intEnc] == YES) else if (intEnc == defEnc
&& [aString canBeConvertedToEncoding: intEnc] == YES)
{ {
/* /*
* The other string can be converted to the internal 8-bit encoding, * The other string can be converted to the internal 8-bit encoding,
* so we don't need to transmute, but we can *not* use its ivars. * via the cString method, so we don't need to transmute, but we
* can *not* use its ivars.
* NB. If 'intEnc != defEnc' the cString method of the other string
* will not return data in the internal encoding.
*/ */
transmute = NO; transmute = NO;
other = 0; other = 0;

View file

@ -42,16 +42,6 @@
#include "../Tools/gdnc.h" #include "../Tools/gdnc.h"
/*
* Macros to build text to start name server and to give an error
* message about it - they include installation path information.
*/
#define MAKE_GDNC_CMD [GSSystemRootDirectory() \
stringByAppendingPathComponent: @"Tools/gdnc"]
#define MAKE_GDNC_ERR [NSString stringWithFormat: \
@"check that %@/Tools/gdnc is running", \
GSSystemRootDirectory()]
/* /*
* Global variables for distributed notification center types. * Global variables for distributed notification center types.
*/ */
@ -393,32 +383,32 @@ static NSDistributedNotificationCenter *defCenter = nil;
} }
else else
{ {
static BOOL recursion = NO; static BOOL recursion = NO;
static NSString *cmd = nil;
static NSArray *args = nil;
if (recursion == NO) if (recursion == NO)
{ {
static NSString *cmd = nil;
static NSArray *args = nil;
NSLog(@"\nI couldn't contact the notification server for %@ -\n"
@"so I'm attempting to to start one - which will take a few seconds.\n"
@"It is recommended that you start the notification server (gdnc) either at\n"
@"login or (better) when your computer is started up.\n", description);
if (cmd == nil) if (cmd == nil)
{ {
#if 1
cmd = RETAIN([[NSSearchPathForDirectoriesInDomains( cmd = RETAIN([[NSSearchPathForDirectoriesInDomains(
GSToolsDirectory, NSSystemDomainMask, YES) objectAtIndex: 0] GSToolsDirectory, NSSystemDomainMask, YES) objectAtIndex: 0]
stringByAppendingPathComponent: @"gdnc"]); stringByAppendingPathComponent: @"gdnc"]);
#else }
cmd = MAKE_GDNC_CMD; }
#endif if (recursion == NO && cmd != nil)
if ([host length] > 0) {
{ NSLog(@"\nI couldn't contact the notification server for %@ -\n"
args = [[NSArray alloc] initWithObjects: @"so I'm attempting to to start one - which will take a few seconds.\n"
@"-NSHost", host, nil]; @"Trying to launch gdnc from %@ or a machine/operating-system subdirectory.\n"
} @"It is recommended that you start the notification server (gdnc) either at\n"
@"login or (better) when your computer is started up.\n", description,
[cmd stringByDeletingLastPathComponent]);
if ([host length] > 0)
{
args = [[NSArray alloc] initWithObjects:
@"-NSHost", host, nil];
} }
[NSTask launchedTaskWithLaunchPath: cmd arguments: args]; [NSTask launchedTaskWithLaunchPath: cmd arguments: args];
@ -435,8 +425,8 @@ static NSDistributedNotificationCenter *defCenter = nil;
{ {
recursion = NO; recursion = NO;
[NSException raise: NSInternalInconsistencyException [NSException raise: NSInternalInconsistencyException
format: @"unable to contact GDNC server - %@", format: @"unable to contact GDNC server -\n"
MAKE_GDNC_ERR]; @"please check that the gdnc process is running."];
} }
} }
} }

View file

@ -39,6 +39,8 @@
static void static void
_preventRecursion (NSException *exception) _preventRecursion (NSException *exception)
{ {
fprintf(stderr, "recursion encountered handling uncaught exception\n");
fflush(stderr); /* NEEDED UNDER MINGW */
} }
static void static void
@ -47,13 +49,14 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception)
BOOL a; BOOL a;
_NSUncaughtExceptionHandler = _preventRecursion; _NSUncaughtExceptionHandler = _preventRecursion;
fprintf(stderr, "Uncaught exception %s, reason: %s\n", #if 0
fprintf(stderr, "%s: Uncaught exception %s, reason: %s\n",
[[exception name] lossyCString], [[exception reason] lossyCString]); [[exception name] lossyCString], [[exception reason] lossyCString]);
fflush(stderr); /* NEEDED UNDER MINGW */ fflush(stderr); /* NEEDED UNDER MINGW */
/* FIXME: need to implement this: #else
NSLogError("Uncaught exception %@, reason: %@", NSLog("Uncaught exception %@, reason: %@",
[exception name], [exception reason]); [exception name], [exception reason]);
*/ #endif
#ifdef DEBUG #ifdef DEBUG
a = YES; // abort() by default. a = YES; // abort() by default.

View file

@ -56,16 +56,6 @@
*/ */
#include "../Tools/gdomap.h" #include "../Tools/gdomap.h"
/*
* Macros to build text to start name server and to give an error
* message about it - they include installation path information.
*/
#define MAKE_GDOMAP_CMD [[GSSystemRootDirectory() \
stringByAppendingPathComponent: @"Tools"] \
stringByAppendingPathComponent: @"gdomap"]
#define MAKE_GDOMAP_ERR [NSString stringWithFormat: \
@"check that %@/Tools/gdomap is running", GSSystemRootDirectory()]
#define stringify_it(X) #X #define stringify_it(X) #X
#define make_gdomap_port(X) stringify_it(X) #define make_gdomap_port(X) stringify_it(X)
@ -187,15 +177,23 @@ typedef enum {
* Remove our file handle, then either retry or fail. * Remove our file handle, then either retry or fail.
*/ */
[self close]; [self close];
if (state == GSPC_LOPEN) if (launchCmd == nil)
{
launchCmd = RETAIN([[NSSearchPathForDirectoriesInDomains(
GSToolsDirectory, NSSystemDomainMask, YES) objectAtIndex: 0]
stringByAppendingPathComponent: @"gdomap"]);
}
if (state == GSPC_LOPEN && launchCmd != nil)
{ {
NSRunLoop *loop = [NSRunLoop currentRunLoop]; NSRunLoop *loop = [NSRunLoop currentRunLoop];
NSTimer *timer; NSTimer *timer;
NSLog(@"NSPortNameServer attempting to start gdomap on local host\n" NSLog(@"NSPortNameServer attempting to start gdomap on local host\n"
@"This will take a few seconds.\n" @"This will take a few seconds.\n"
@"Trying to launch gdomap from %@ or a machine/operating-system subdirectory.\n"
@"It is recommended that you start up gdomap at login time or (better) when\n" @"It is recommended that you start up gdomap at login time or (better) when\n"
@"your computer is started instead."); @"your computer is started instead.",
[launchCmd stringByDeletingLastPathComponent]);
[NSTask launchedTaskWithLaunchPath: launchCmd arguments: nil]; [NSTask launchedTaskWithLaunchPath: launchCmd arguments: nil];
timer = [NSTimer timerWithTimeInterval: 5.0 timer = [NSTimer timerWithTimeInterval: 5.0
invocation: nil invocation: nil
@ -548,7 +546,6 @@ typedef enum {
serverPort = RETAIN([NSString stringWithCString: serverPort = RETAIN([NSString stringWithCString:
make_gdomap_port(GDOMAP_PORT_OVERRIDE)]); make_gdomap_port(GDOMAP_PORT_OVERRIDE)]);
#endif #endif
launchCmd = RETAIN(MAKE_GDOMAP_CMD);
portClass = [GSTcpPort class]; portClass = [GSTcpPort class];
} }
} }

View file

@ -1963,7 +1963,7 @@ bases:
#endif #endif
tables: tables:
if (strict == YES) if (strict == NO)
{ {
while (spos < slen) while (spos < slen)
{ {