Index: src/XMPPSRVLookup.m ================================================================== --- src/XMPPSRVLookup.m +++ src/XMPPSRVLookup.m @@ -1,7 +1,8 @@ /* - * Copyright (c) 2011, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2014, 2015 + * Jonathan Schleifer * Copyright (c) 2011, Florian Zeitz * * https://webkeks.org/git/?p=objxmpp.git * * Permission to use, copy, modify, and/or distribute this software for any @@ -33,10 +34,12 @@ #include #include #include #import "XMPPSRVLookup.h" + +#import @implementation XMPPSRVEntry + (instancetype)entryWithPriority: (uint16_t)priority weight: (uint16_t)weight port: (uint16_t)port @@ -106,11 +109,11 @@ @throw [OFInitializationFailedException exceptionWithClass: [self class]]; _target = [[OFString alloc] initWithCString: buffer - encoding: [OFString nativeOSEncoding]]; + encoding: [OFSystemInfo native8BitEncoding]]; } @catch (id e) { [self release]; @throw e; } @@ -215,12 +218,12 @@ if (res_ninit(&_resState)) @throw [OFAddressTranslationFailedException exceptionWithHost: _domain]; answer = [self allocMemoryWithSize: pageSize]; - answerLen = res_nsearch(&_resState, - [request cStringWithEncoding: [OFString nativeOSEncoding]], + answerLen = res_nsearch(&_resState, [request + cStringWithEncoding: [OFSystemInfo native8BitEncoding]], ns_c_in, ns_t_srv, answer, (int)pageSize); if ((answerLen == -1) && ((h_errno == HOST_NOT_FOUND) || (h_errno == NO_DATA))) return; @@ -262,11 +265,13 @@ OFList *subList; of_list_object_t *iter; /* Look if there already is a list with the priority */ for (iter = [_list firstListObject]; iter != NULL; iter = iter->next) { - if ([[iter->object firstObject] priority] == [entry priority]) { + XMPPSRVEntry *first = [iter->object firstObject]; + + if ([first priority] == [entry priority]) { /* * RFC 2782 says those with weight 0 should be at the * beginning of the list. */ if ([entry weight] > 0) @@ -276,11 +281,11 @@ return; } /* We can't have one if the priority is already bigger */ - if ([[iter->object firstObject] priority] > [entry priority]) + if ([first priority] > [entry priority]) break; } pool = [[OFAutoreleasePool alloc] init];