From dfe6a0b65357b1ce4e3e6a88a3d1026611951ad5 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Mon, 5 Jan 2015 22:50:58 +0100 Subject: [PATCH] Adjust to ObjFW changes --- src/XMPPSRVLookup.m | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/XMPPSRVLookup.m b/src/XMPPSRVLookup.m index 59bdd0d..41d9c36 100644 --- a/src/XMPPSRVLookup.m +++ b/src/XMPPSRVLookup.m @@ -1,5 +1,6 @@ /* - * 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 @@ -36,6 +37,8 @@ #import "XMPPSRVLookup.h" +#import + @implementation XMPPSRVEntry + (instancetype)entryWithPriority: (uint16_t)priority weight: (uint16_t)weight @@ -108,7 +111,7 @@ _target = [[OFString alloc] initWithCString: buffer - encoding: [OFString nativeOSEncoding]]; + encoding: [OFSystemInfo native8BitEncoding]]; } @catch (id e) { [self release]; @throw e; @@ -217,8 +220,8 @@ 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) || @@ -264,7 +267,9 @@ /* 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. @@ -278,7 +283,7 @@ } /* We can't have one if the priority is already bigger */ - if ([[iter->object firstObject] priority] > [entry priority]) + if ([first priority] > [entry priority]) break; }