Adjust to recent ObjFW changes.

FossilOrigin-Name: 88eea97f3d869fb6bfd245c629c1871a30695be78d65754ce1679819a3b178fa
This commit is contained in:
Jonathan Schleifer 2011-09-12 23:17:00 +00:00
parent 140c06fd5e
commit dad2fc10b8
2 changed files with 10 additions and 10 deletions

View file

@ -31,6 +31,6 @@
@property (copy, readonly) OFString *nickname, *username, *hostname; @property (copy, readonly) OFString *nickname, *username, *hostname;
+ IRCUserWithString: (OFString*)str; + IRCUserWithString: (OFString*)string;
- initWithString: (OFString*)str; - initWithString: (OFString*)string;
@end @end

View file

@ -32,12 +32,12 @@
@implementation IRCUser @implementation IRCUser
@synthesize username, nickname, hostname; @synthesize username, nickname, hostname;
+ IRCUserWithString: (OFString*)str + IRCUserWithString: (OFString*)string
{ {
return [[[self alloc] initWithString: str] autorelease]; return [[[self alloc] initWithString: string] autorelease];
} }
- initWithString: (OFString*)str - initWithString: (OFString*)string
{ {
char *tmp2 = NULL; char *tmp2 = NULL;
@ -46,24 +46,24 @@
@try { @try {
char *tmp; char *tmp;
if ((tmp2 = strdup(str.cString)) == NULL) if ((tmp2 = strdup([string UTF8String])) == NULL)
@throw [OFOutOfMemoryException @throw [OFOutOfMemoryException
newWithClass: isa newWithClass: isa
requestedSize: str.cStringLength]; requestedSize: [string UTF8StringLength]];
if ((tmp = strchr(tmp2, '@')) == NULL) if ((tmp = strchr(tmp2, '@')) == NULL)
@throw [OFInvalidFormatException newWithClass: isa]; @throw [OFInvalidFormatException newWithClass: isa];
*tmp = '\0'; *tmp = '\0';
hostname = [[OFString alloc] initWithCString: tmp + 1]; hostname = [[OFString alloc] initWithUTF8String: tmp + 1];
if ((tmp = strchr(tmp2, '!')) == NULL) if ((tmp = strchr(tmp2, '!')) == NULL)
@throw [OFInvalidFormatException newWithClass: isa]; @throw [OFInvalidFormatException newWithClass: isa];
*tmp = '\0'; *tmp = '\0';
username = [[OFString alloc] initWithCString: tmp + 1]; username = [[OFString alloc] initWithUTF8String: tmp + 1];
nickname = [[OFString alloc] initWithCString: tmp2]; nickname = [[OFString alloc] initWithUTF8String: tmp2];
} @catch (id e) { } @catch (id e) {
[self release]; [self release];
@throw e; @throw e;