Update to recent ObjFW changes.

This commit is contained in:
Jonathan Schleifer 2011-09-12 22:08:45 +02:00
parent 7b07a24ec4
commit 7c35be965c
5 changed files with 51 additions and 47 deletions

View file

@ -96,7 +96,7 @@
char *node;
Stringprep_rc rc;
if ((rc = stringprep_profile([username_ cString], &node,
if ((rc = stringprep_profile([username_ UTF8String], &node,
"SASLprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: self
@ -104,7 +104,7 @@
string: username_];
@try {
username = [[OFString alloc] initWithCString: node];
username = [[OFString alloc] initWithUTF8String: node];
} @finally {
free(node);
}
@ -123,7 +123,7 @@
char *res;
Stringprep_rc rc;
if ((rc = stringprep_profile([resource_ cString], &res,
if ((rc = stringprep_profile([resource_ UTF8String], &res,
"Resourceprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException
newWithClass: isa
@ -132,7 +132,7 @@
string: resource_];
@try {
resource = [[OFString alloc] initWithCString: res];
resource = [[OFString alloc] initWithUTF8String: res];
} @finally {
free(res);
}
@ -151,7 +151,7 @@
char *srv;
Idna_rc rc;
if ((rc = idna_to_ascii_8z([server_ cString],
if ((rc = idna_to_ascii_8z([server_ UTF8String],
&srv, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
@throw [XMPPIDNATranslationFailedException
newWithClass: isa
@ -160,7 +160,7 @@
string: server_];
@try {
server = [[OFString alloc] initWithCString: srv];
server = [[OFString alloc] initWithUTF8String: srv];
} @finally {
free(srv);
}
@ -179,7 +179,7 @@
char *srv;
Stringprep_rc rc;
if ((rc = stringprep_profile([domain_ cString], &srv,
if ((rc = stringprep_profile([domain_ UTF8String], &srv,
"Nameprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: self
@ -187,7 +187,7 @@
string: domain_];
@try {
domain = [[OFString alloc] initWithCString: srv];
domain = [[OFString alloc] initWithUTF8String: srv];
} @finally {
free(srv);
}
@ -206,7 +206,7 @@
char *pass;
Stringprep_rc rc;
if ((rc = stringprep_profile([password_ cString], &pass,
if ((rc = stringprep_profile([password_ UTF8String], &pass,
"SASLprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: self
@ -214,7 +214,7 @@
string: password_];
@try {
password = [[OFString alloc] initWithCString: pass];
password = [[OFString alloc] initWithUTF8String: pass];
} @finally {
free(pass);
}
@ -241,7 +241,7 @@
[sock connectToHost: server
port: port];
else {
if ((rc = idna_to_ascii_8z([domain cString], &cDomainToASCII,
if ((rc = idna_to_ascii_8z([domain UTF8String], &cDomainToASCII,
IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS)
@throw [XMPPIDNATranslationFailedException
newWithClass: isa
@ -251,7 +251,7 @@
@try {
domainToASCII = [OFString
stringWithCString: cDomainToASCII];
stringWithUTF8String: cDomainToASCII];
} @finally {
free(cDomainToASCII);
}

View file

@ -110,7 +110,7 @@
return;
}
if ((rc = stringprep_profile([node_ cString], &nodepart,
if ((rc = stringprep_profile([node_ UTF8String], &nodepart,
"Nodeprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: nil
@ -118,7 +118,7 @@
string: node_];
@try {
node = [[OFString alloc] initWithCString: nodepart];
node = [[OFString alloc] initWithUTF8String: nodepart];
} @finally {
free(nodepart);
}
@ -137,7 +137,7 @@
char *srv;
Stringprep_rc rc;
if ((rc = stringprep_profile([domain_ cString], &srv,
if ((rc = stringprep_profile([domain_ UTF8String], &srv,
"Nameprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException newWithClass: isa
connection: nil
@ -145,7 +145,7 @@
string: domain_];
@try {
domain = [[OFString alloc] initWithCString: srv];
domain = [[OFString alloc] initWithUTF8String: srv];
} @finally {
free(srv);
}
@ -170,7 +170,7 @@
return;
}
if ((rc = stringprep_profile([resource_ cString], &res,
if ((rc = stringprep_profile([resource_ UTF8String], &res,
"Resourceprep", 0)) != STRINGPREP_OK)
@throw [XMPPStringPrepFailedException
newWithClass: isa
@ -179,7 +179,7 @@
string: resource_];
@try {
resource = [[OFString alloc] initWithCString: res];
resource = [[OFString alloc] initWithUTF8String: res];
} @finally {
free(res);
}

View file

@ -56,15 +56,15 @@
[message addItem: ""];
/* authcid */
[message addNItems: [authcid cStringLength]
fromCArray: [authcid cString]];
[message addNItems: [authcid UTF8StringLength]
fromCArray: [authcid UTF8String]];
/* separator */
[message addItem: ""];
/* passwd */
[message addNItems: [password cStringLength]
fromCArray: [password cString]];
[message addNItems: [password UTF8StringLength]
fromCArray: [password UTF8String]];
return message;
}

View file

@ -168,11 +168,11 @@
authcid,
cNonce];
[ret addNItems: [GS2Header cStringLength]
fromCArray: [GS2Header cString]];
[ret addNItems: [GS2Header UTF8StringLength]
fromCArray: [GS2Header UTF8String]];
[ret addNItems: [clientFirstMessageBare cStringLength]
fromCArray: [clientFirstMessageBare cString]];
[ret addNItems: [clientFirstMessageBare UTF8StringLength]
fromCArray: [clientFirstMessageBare UTF8String]];
return ret;
}
@ -198,7 +198,7 @@
ret = [OFDataArray dataArrayWithItemSize: 1];
authMessage = [OFDataArray dataArrayWithItemSize: 1];
OFString *chal = [OFString stringWithCString: [challenge cArray]
OFString *chal = [OFString stringWithUTF8String: [challenge cArray]
length: [challenge count] *
[challenge itemSize]];
@ -232,8 +232,8 @@
// Add c=<base64(GS2Header+channelBindingData)>
tmpArray = [OFDataArray dataArrayWithItemSize: 1];
[tmpArray addNItems: [GS2Header cStringLength]
fromCArray: [GS2Header cString]];
[tmpArray addNItems: [GS2Header UTF8StringLength]
fromCArray: [GS2Header UTF8String]];
if (plusAvailable && [connection encrypted]) {
OFDataArray *channelBinding = [((SSLSocket*)[connection socket])
channelBindingDataWithType: @"tls-unique"];
@ -243,19 +243,19 @@
tmpString = [tmpArray stringByBase64Encoding];
[ret addNItems: 2
fromCArray: "c="];
[ret addNItems: [tmpString cStringLength]
fromCArray: [tmpString cString]];
[ret addNItems: [tmpString UTF8StringLength]
fromCArray: [tmpString UTF8String]];
// Add r=<nonce>
[ret addItem: ","];
[ret addNItems: 2
fromCArray: "r="];
[ret addNItems: [sNonce cStringLength]
fromCArray: [sNonce cString]];
[ret addNItems: [sNonce UTF8StringLength]
fromCArray: [sNonce UTF8String]];
tmpArray = [OFDataArray dataArrayWithItemSize: 1];
[tmpArray addNItems: [password cStringLength]
fromCArray: [password cString]];
[tmpArray addNItems: [password UTF8StringLength]
fromCArray: [password UTF8String]];
/*
* IETF RFC 5802:
@ -271,8 +271,8 @@
* server-first-message + "," +
* client-final-message-without-proof
*/
[authMessage addNItems: [clientFirstMessageBare cStringLength]
fromCArray: [clientFirstMessageBare cString]];
[authMessage addNItems: [clientFirstMessageBare UTF8StringLength]
fromCArray: [clientFirstMessageBare UTF8String]];
[authMessage addItem: ","];
[authMessage addNItems: [challenge count] * [challenge itemSize]
fromCArray: [challenge cArray]];
@ -344,8 +344,8 @@
[ret addNItems: 2
fromCArray: "p="];
tmpString = [tmpArray stringByBase64Encoding];
[ret addNItems: [tmpString cStringLength]
fromCArray: [tmpString cString]];
[ret addNItems: [tmpString UTF8StringLength]
fromCArray: [tmpString UTF8String]];
[ret retain];
[pool release];
@ -356,7 +356,7 @@
- (void)parseServerFinalMessage: (OFDataArray*)message
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFString *mess = [OFString stringWithCString: [message cArray]
OFString *mess = [OFString stringWithUTF8String: [message cArray]
length: [message count] *
[message itemSize]];
OFString *value = [mess substringWithRange:
@ -393,6 +393,7 @@
}
return [OFString stringWithCString: (char*)buf
encoding: OF_STRING_ENCODING_ASCII
length: 64];
}

View file

@ -102,7 +102,9 @@
@throw [OFInitializationFailedException
newWithClass: isa];
target = [[OFString alloc] initWithCString: buffer];
target = [[OFString alloc]
initWithCString: buffer
encoding: OF_STRING_ENCODING_NATIVE];
} @catch (id e) {
[self release];
@throw e;
@ -213,8 +215,9 @@
host: domain];
answer = [self allocMemoryWithSize: of_pagesize];
answerLen = res_nsearch(&resState, [request cString], ns_c_in,
ns_t_srv, answer, (int)of_pagesize);
answerLen = res_nsearch(&resState, [request cStringWithEncoding:
OF_STRING_ENCODING_NATIVE], ns_c_in, ns_t_srv, answer,
(int)of_pagesize);
if ((answerLen == -1) && ((h_errno == HOST_NOT_FOUND) ||
(h_errno == NO_DATA)))