From f590ff46fe54868539ea956159612551ea550eaf Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Thu, 12 Jul 2012 05:34:20 +0200 Subject: [PATCH] Don't access isa directly. --- src/XMPPConnection.m | 28 +++++++++++++++------------- src/XMPPExceptions.m | 10 +++++----- src/XMPPIQ.m | 2 +- src/XMPPJID.m | 6 +++--- src/XMPPJSONFileStorage.m | 2 +- src/XMPPRoster.m | 3 ++- src/XMPPSCRAMAuth.m | 9 +++++---- src/XMPPSRVLookup.m | 17 ++++++++--------- src/XMPPStanza.m | 2 +- src/XMPPXMLElementBuilder.m | 4 ++-- 10 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/XMPPConnection.m b/src/XMPPConnection.m index 073cd88..b196f1e 100644 --- a/src/XMPPConnection.m +++ b/src/XMPPConnection.m @@ -110,7 +110,7 @@ if ((rc = stringprep_profile([username_ UTF8String], &node, "SASLprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: self profile: @"SASLprep" string: username_]; @@ -138,7 +138,7 @@ if ((rc = stringprep_profile([resource_ UTF8String], &res, "Resourceprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: self profile: @"Resourceprep" string: resource_]; @@ -179,7 +179,7 @@ if ((rc = stringprep_profile([domain_ UTF8String], &srv, "Nameprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: self profile: @"Nameprep" string: domain_]; @@ -209,7 +209,7 @@ if ((rc = stringprep_profile([password_ UTF8String], &pass, "SASLprep", 0)) != STRINGPREP_OK) @throw [XMPPStringPrepFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: self profile: @"SASLprep" string: password_]; @@ -695,10 +695,11 @@ elementForName: @"text" namespace: XMPP_NS_XMPP_STREAM] stringValue]; - @throw [XMPPStreamErrorException exceptionWithClass: isa - connection: self - condition: condition - reason: reason]; + @throw [XMPPStreamErrorException + exceptionWithClass: [self class] + connection: self + condition: condition + reason: reason]; return; } @@ -735,7 +736,7 @@ if ([[element name] isEqual: @"failure"]) /* TODO: Find/create an exception to throw here */ - @throw [OFException exceptionWithClass: isa]; + @throw [OFException exceptionWithClass: [self class]]; assert(0); } @@ -781,7 +782,7 @@ of_log(@"Auth failed!"); // FIXME: Do more parsing/handling @throw [XMPPAuthFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: self reason: [element XMLString]]; } @@ -848,7 +849,7 @@ if (encryptionRequired && !encrypted) /* TODO: Find/create an exception to throw here */ - @throw [OFException exceptionWithClass: isa]; + @throw [OFException exceptionWithClass: [self class]]; if ([element elementForName: @"ver" namespace: XMPP_NS_ROSTERVER] != nil) @@ -1038,7 +1039,7 @@ if ((rc = idna_to_ascii_8z([domain_ UTF8String], &cDomain, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS) @throw [XMPPIDNATranslationFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: self operation: @"ToASCII" string: domain_]; @@ -1070,7 +1071,8 @@ - (void)setDataStorage: (id )dataStorage_ { if (streamOpen) - @throw [OFInvalidArgumentException exceptionWithClass: isa]; + @throw [OFInvalidArgumentException + exceptionWithClass: [self class]]; dataStorage = dataStorage_; } diff --git a/src/XMPPExceptions.m b/src/XMPPExceptions.m index 252b2bf..37c1b69 100644 --- a/src/XMPPExceptions.m +++ b/src/XMPPExceptions.m @@ -37,7 +37,7 @@ - initWithClass: (Class)class_ { - Class c = isa; + Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; @@ -97,7 +97,7 @@ - initWithClass: (Class)class_ connection: (XMPPConnection*)conn { - Class c = isa; + Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; @@ -167,7 +167,7 @@ - initWithClass: (Class)class_ connection: (XMPPConnection*)conn { - Class c = isa; + Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; @@ -238,7 +238,7 @@ - initWithClass: (Class)class_ connection: (XMPPConnection*)conn { - Class c = isa; + Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; @@ -306,7 +306,7 @@ - initWithClass: (Class)class_ connection: (XMPPConnection*)conn { - Class c = isa; + Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; diff --git a/src/XMPPIQ.m b/src/XMPPIQ.m index 73d4555..2b347e2 100644 --- a/src/XMPPIQ.m +++ b/src/XMPPIQ.m @@ -47,7 +47,7 @@ if (![type_ isEqual: @"get"] && ![type_ isEqual: @"set"] && ![type_ isEqual: @"result"] && ![type_ isEqual: @"error"]) @throw [OFInvalidArgumentException - exceptionWithClass: isa + exceptionWithClass: [self class] selector: _cmd]; } @catch (id e) { [self release]; diff --git a/src/XMPPJID.m b/src/XMPPJID.m index 0975120..5da7f8c 100644 --- a/src/XMPPJID.m +++ b/src/XMPPJID.m @@ -116,7 +116,7 @@ "Nodeprep", 0)) != STRINGPREP_OK) || (nodepart[0] == '\0') || (strlen(nodepart) > 1023)) @throw [XMPPStringPrepFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: nil profile: @"Nodeprep" string: node_]; @@ -145,7 +145,7 @@ "Nameprep", 0)) != STRINGPREP_OK) || (srv[0] == '\0') || (strlen(srv) > 1023)) @throw [XMPPStringPrepFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: nil profile: @"Nameprep" string: domain_]; @@ -180,7 +180,7 @@ "Resourceprep", 0)) != STRINGPREP_OK) || (res[0] == '\0') || (strlen(res) > 1023)) @throw [XMPPStringPrepFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: nil profile: @"Resourceprep" string: resource_]; diff --git a/src/XMPPJSONFileStorage.m b/src/XMPPJSONFileStorage.m index a763985..8d0bcdd 100644 --- a/src/XMPPJSONFileStorage.m +++ b/src/XMPPJSONFileStorage.m @@ -37,7 +37,7 @@ @implementation XMPPJSONFileStorage - init { - Class c = isa; + Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; diff --git a/src/XMPPRoster.m b/src/XMPPRoster.m index 6341388..c0dc2fb 100644 --- a/src/XMPPRoster.m +++ b/src/XMPPRoster.m @@ -213,7 +213,8 @@ - (void)setDataStorage: (id )dataStorage_ { if (rosterRequested) - @throw [OFInvalidArgumentException exceptionWithClass: isa]; + @throw [OFInvalidArgumentException + exceptionWithClass: [self class]]; dataStorage = dataStorage_; } diff --git a/src/XMPPSCRAMAuth.m b/src/XMPPSCRAMAuth.m index c4b1bf7..bf2d614 100644 --- a/src/XMPPSCRAMAuth.m +++ b/src/XMPPSCRAMAuth.m @@ -231,7 +231,7 @@ if ([comp hasPrefix: @"r="]) { if (![entry hasPrefix: cNonce]) @throw [XMPPAuthFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: nil reason: @"Received wrong " @"nonce"]; @@ -249,7 +249,8 @@ } if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT)) - @throw [OFInvalidServerReplyException exceptionWithClass: isa]; + @throw [OFInvalidServerReplyException + exceptionWithClass: [self class]]; // Add c= tmpArray = [OFDataArray dataArray]; @@ -392,13 +393,13 @@ if ([mess hasPrefix: @"v="]) { if (![value isEqual: [serverSignature stringByBase64Encoding]]) @throw [XMPPAuthFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] connection: nil reason: @"Received wrong " @"ServerSignature"]; authenticated = YES; } else - @throw [XMPPAuthFailedException exceptionWithClass: isa + @throw [XMPPAuthFailedException exceptionWithClass: [self class] connection: nil reason: value]; diff --git a/src/XMPPSRVLookup.m b/src/XMPPSRVLookup.m index e08463f..897a70a 100644 --- a/src/XMPPSRVLookup.m +++ b/src/XMPPSRVLookup.m @@ -55,7 +55,7 @@ - init { - Class c = isa; + Class c = [self class]; [self release]; @throw [OFNotImplementedException exceptionWithClass: c selector: _cmd]; @@ -98,7 +98,7 @@ if (dn_expand(ns_msg_base(handle), ns_msg_end(handle), (uint8_t*)&rdata[3], buffer, NS_MAXDNAME) < 1) @throw [OFInitializationFailedException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; target = [[OFString alloc] initWithCString: buffer @@ -120,10 +120,9 @@ - (OFString*)description { - return [OFString stringWithFormat: @"<%@ priority: %" PRIu16 - @", weight: %" PRIu16 - @", target: %@:%" PRIu16 @">", - isa, priority, weight, target, port]; + return [OFString stringWithFormat: + @"<%@ priority: %" PRIu16 @", weight: %" PRIu16 @", target: %@:%" + PRIu16 @">", [self class], priority, weight, target, port]; } - (uint16_t)priority @@ -208,7 +207,7 @@ if (res_ninit(&resState)) @throw [OFAddressTranslationFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] socket: nil host: domain]; @@ -223,14 +222,14 @@ if (answerLen < 1 || answerLen > of_pagesize) { @throw [OFAddressTranslationFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] socket: nil host: domain]; } if (ns_initparse(answer, answerLen, &handle)) @throw [OFAddressTranslationFailedException - exceptionWithClass: isa + exceptionWithClass: [self class] socket: nil host: domain]; diff --git a/src/XMPPStanza.m b/src/XMPPStanza.m index 256c50e..7f1ea34 100644 --- a/src/XMPPStanza.m +++ b/src/XMPPStanza.m @@ -97,7 +97,7 @@ if (![name_ isEqual: @"iq"] && ![name_ isEqual: @"message"] && ![name_ isEqual: @"presence"]) @throw [OFInvalidArgumentException - exceptionWithClass: isa + exceptionWithClass: [self class] selector: _cmd]; [self setDefaultNamespace: XMPP_NS_CLIENT]; diff --git a/src/XMPPXMLElementBuilder.m b/src/XMPPXMLElementBuilder.m index 24885de..67dc33f 100644 --- a/src/XMPPXMLElementBuilder.m +++ b/src/XMPPXMLElementBuilder.m @@ -32,12 +32,12 @@ - (void)parser: (OFXMLParser*)parser foundProcessingInstructions: (OFString*)pi { - @throw [OFMalformedXMLException exceptionWithClass: isa]; + @throw [OFMalformedXMLException exceptionWithClass: [self class]]; } - (void)parser: (OFXMLParser*)parser foundComment: (OFString*)comment { - @throw [OFMalformedXMLException exceptionWithClass: isa]; + @throw [OFMalformedXMLException exceptionWithClass: [self class]]; } @end