Improve error logging.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19055 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-04-06 19:14:33 +00:00
parent 15840d8386
commit 23bee88d89
2 changed files with 12 additions and 6 deletions

View file

@ -5,6 +5,8 @@
defaults and command line settings should still work.
* Source/GSDictionary.m: fix for keyed archioving reported by
Marc Ordinas i Llopis
* Source/Additions/GSXML.m: Improve error logging ... add line number
and column number to message, also avoid possible buffer overflow.
2004-04-02 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -3000,18 +3000,18 @@ warningFunction(void *ctx, const unsigned char *msg, ...)
static void
errorFunction(void *ctx, const unsigned char *msg, ...)
{
unsigned char allMsg[2048];
va_list args;
int lineNumber = -1;
int colNumber = -1;
NSString *estr;
va_list args;
int lineNumber = -1;
int colNumber = -1;
va_start(args, msg);
vsprintf(allMsg, msg, args);
estr = [[NSString alloc] initWithFormat: UTF8Str(msg) arguments: args];
va_end(args);
NSCAssert(ctx,@"No Context");
lineNumber = getLineNumber(ctx);
colNumber = getColumnNumber(ctx);
[HANDLER error: UTF8Str(allMsg)
[HANDLER error: estr
colNumber: colNumber
lineNumber: lineNumber];
}
@ -3291,6 +3291,8 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
colNumber: (int)colNumber
lineNumber: (int)lineNumber
{
e = [NSString stringWithFormat: @"at line: %d column: %d ... %@",
lineNumber, colNumber, e];
[self error: e];
}
@ -3301,6 +3303,8 @@ fatalErrorFunction(void *ctx, const unsigned char *msg, ...)
colNumber: (int)colNumber
lineNumber: (int)lineNumber
{
e = [NSString stringWithFormat: @"at line: %d column: %d ... %@",
lineNumber, colNumber, e];
[self fatalError: e];
}