make -description more informative

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28578 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-08-31 07:08:39 +00:00
parent 019f6b1da6
commit 8f97c8ffc9
3 changed files with 19 additions and 14 deletions

View file

@ -1,7 +1,14 @@
2009-08-31 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSMessagePort.m:
* Source/NSSocketPort.m:
Improve -description to include the registered names (if any) of ports.
2009-08-30 David Chisnall <csdavec@swan.ac.uk>
* Headers/Foundation/NSObject.h: Added NSDicardableContent protocol from
Snow Leopard.
2009-08-27 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSCategories.m:

View file

@ -1335,9 +1335,12 @@ typedef struct {
- (NSString*) description
{
NSString *desc;
NSArray *names;
desc = [NSString stringWithFormat: @"<NSMessagePort %p with name %s>",
self, [name bytes]];
names = [[NSMessagePortNameServer sharedInstance] namesForPort: self];
desc = [NSString stringWithFormat:
@"NSMessagePort %p %@ with file name %s",
self, ([names count] == 0) ? (id)@"<un-named>" : (id)names, [name bytes]];
return desc;
}

View file

@ -1802,19 +1802,14 @@ static Class tcpPortClass;
- (NSString*) description
{
NSMutableString *desc;
NSString *desc;
NSArray *names;
desc = [NSMutableString stringWithFormat: @"NSPort on host with details -\n"
@"%@\n", host];
if (address == nil)
{
[desc appendFormat: @" IP address - any\n"];
}
else
{
[desc appendFormat: @" IP address - %@\n", address];
}
[desc appendFormat: @" TCP port - %d\n", portNum];
names = [[NSSocketPortNameServer sharedInstance] namesForPort: self];
desc = [NSString stringWithFormat:
@"NSSocketPort %p %@ on IP address: %@, port: %d",
self, (([names count] == 0) ? (id)@"<un-named>" : (id)names), host,
((address == nil) ? (id)@"any" : (id)address), portNum];
return desc;
}