@@ -76,30 +76,30 @@ else { void *pool = objc_autoreleasePoolPush(); OFString *tmp = [OFString stringWithCString: string encoding: encoding length: length]; - [buffer addItems: [tmp UTF8String] - count: [tmp UTF8StringLength]]; + [buffer addItems: tmp.UTF8String + count: tmp.UTF8StringLength]; objc_autoreleasePoolPop(pool); } } static OFString * transformString(OFXMLParser *parser, OFMutableData *buffer, size_t cut, bool unescape) { - char *items = [buffer items]; - size_t length = [buffer count] - cut; + char *items = buffer.mutableItems; + size_t length = buffer.count - cut; bool hasEntities = false; OFString *ret; for (size_t i = 0; i < length; i++) { if (items[i] == '\r') { if (i + 1 < length && items[i + 1] == '\n') { [buffer removeItemAtIndex: i]; - items = [buffer items]; + items = buffer.mutableItems; i--; length--; } else items[i] = '\n'; @@ -123,12 +123,12 @@ } static OFString * namespaceForPrefix(OFString *prefix, OFArray *namespaces) { - OFDictionary *const *objects = [namespaces objects]; - size_t count = [namespaces count]; + OFDictionary *const *objects = namespaces.objects; + size_t count = namespaces.count; if (prefix == nil) prefix = @""; while (count > 0) { @@ -280,21 +280,21 @@ length - _last); } - (void)parseString: (OFString *)string { - [self parseBuffer: [string UTF8String] - length: [string UTF8StringLength]]; + [self parseBuffer: string.UTF8String + length: string.UTF8StringLength]; } - (void)parseStream: (OFStream *)stream { size_t pageSize = [OFSystemInfo pageSize]; char *buffer = [self allocMemoryWithSize: pageSize]; @try { - while (![stream isAtEndOfStream]) { + while (!stream.atEndOfStream) { size_t length = [stream readIntoBuffer: buffer length: pageSize]; [self parseBuffer: buffer length: length]; @@ -344,11 +344,11 @@ /* Not in a tag */ - (void)of_outsideTagState { size_t length; - if ((_finishedParsing || [_previous count] < 1) && _data[_i] != ' ' && + if ((_finishedParsing || _previous.count < 1) && _data[_i] != ' ' && _data[_i] != '\t' && _data[_i] != '\n' && _data[_i] != '\r' && _data[_i] != '<') @throw [OFMalformedXMLException exceptionWithParser: self]; if (_data[_i] != '<') @@ -355,11 +355,11 @@ return; if ((length = _i - _last) > 0) appendToBuffer(_buffer, _data + _last, _encoding, length); - if ([_buffer count] > 0) { + if (_buffer.count > 0) { void *pool = objc_autoreleasePoolPush(); OFString *characters = transformString(self, _buffer, 0, true); if ([_delegate respondsToSelector: @selector(parser:foundCharacters:)]) @@ -396,11 +396,11 @@ _last = _i + 1; _state = OF_XMLPARSER_IN_EXCLAMATIONMARK; _acceptProlog = false; break; default: - if (_depthLimit > 0 && [_previous count] >= _depthLimit) + if (_depthLimit > 0 && _previous.count >= _depthLimit) @throw [OFOutOfRangeException exception]; _state = OF_XMLPARSER_IN_TAG_NAME; _acceptProlog = false; _i--; @@ -422,15 +422,15 @@ if (!_acceptProlog) return false; _acceptProlog = false; - pi = [pi substringWithRange: of_range(3, [pi length] - 3)]; - pi = [pi stringByDeletingEnclosingWhitespaces]; + pi = [pi substringWithRange: of_range(3, pi.length - 3)]; + pi = pi.stringByDeletingEnclosingWhitespaces; - cString = [pi UTF8String]; - length = [pi UTF8StringLength]; + cString = pi.UTF8String; + length = pi.UTF8StringLength; last = 0; for (size_t i = 0; i < length; i++) { switch (PIState) { case 0: @@ -545,12 +545,12 @@ if ((length = _i - _last) > 0) appendToBuffer(_buffer, _data + _last, _encoding, length); pool = objc_autoreleasePoolPush(); - bufferCString = [_buffer items]; - bufferLength = [_buffer count]; + bufferCString = _buffer.items; + bufferLength = _buffer.count; bufferString = [OFString stringWithUTF8String: bufferCString length: bufferLength]; if ((tmp = memchr(bufferCString, ':', bufferLength)) != NULL) { _name = [[OFString alloc] @@ -589,11 +589,11 @@ [_delegate parser: self didEndElement: _name prefix: _prefix namespace: namespace]; - if ([_previous count] == 0) + if (_previous.count == 0) _finishedParsing = true; } else [_previous addObject: bufferString]; [_name release]; @@ -630,12 +630,12 @@ if ((length = _i - _last) > 0) appendToBuffer(_buffer, _data + _last, _encoding, length); pool = objc_autoreleasePoolPush(); - bufferCString = [_buffer items]; - bufferLength = [_buffer count]; + bufferCString = _buffer.items; + bufferLength = _buffer.count; bufferString = [OFString stringWithUTF8String: bufferCString length: bufferLength]; if ((tmp = memchr(bufferCString, ':', bufferLength)) != NULL) { _name = [[OFString alloc] @@ -648,11 +648,11 @@ } else { _name = [bufferString copy]; _prefix = nil; } - if (![[_previous lastObject] isEqual: bufferString]) + if (![_previous.lastObject isEqual: bufferString]) @throw [OFMalformedXMLException exceptionWithParser: self]; [_previous removeLastObject]; [_buffer removeAllItems]; @@ -679,11 +679,11 @@ _last = _i + 1; _state = (_data[_i] == '>' ? OF_XMLPARSER_OUTSIDE_TAG : OF_XMLPARSER_EXPECT_SPACE_OR_TAG_CLOSE); - if ([_previous count] == 0) + if (_previous.count == 0) _finishedParsing = true; } /* Inside a tag, name found */ - (void)of_inTagState @@ -702,12 +702,12 @@ } return; } - attributesObjects = [_attributes objects]; - attributesCount = [_attributes count]; + attributesObjects = _attributes.objects; + attributesCount = _attributes.count; namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) @throw [OFUnboundPrefixException exceptionWithPrefix: _prefix @@ -733,11 +733,11 @@ [_delegate parser: self didEndElement: _name prefix: _prefix namespace: namespace]; - if ([_previous count] == 0) + if (_previous.count == 0) _finishedParsing = true; [_namespaces removeLastObject]; } else if (_prefix != nil) { OFString *str = [OFString stringWithFormat: @"%@:%@", @@ -774,15 +774,15 @@ if ((length = _i - _last) > 0) appendToBuffer(_buffer, _data + _last, _encoding, length); pool = objc_autoreleasePoolPush(); - bufferString = [OFString stringWithUTF8String: [_buffer items] - length: [_buffer count]]; + bufferString = [OFString stringWithUTF8String: _buffer.items + length: _buffer.count]; - bufferCString = [bufferString UTF8String]; - bufferLength = [bufferString UTF8StringLength]; + bufferCString = bufferString.UTF8String; + bufferLength = bufferString.UTF8StringLength; if ((tmp = memchr(bufferCString, ':', bufferLength)) != NULL) { _attributeName = [[OFString alloc] initWithUTF8String: tmp + 1 length: bufferLength - @@ -851,15 +851,15 @@ pool = objc_autoreleasePoolPush(); attributeValue = transformString(self, _buffer, 0, true); if (_attributePrefix == nil && [_attributeName isEqual: @"xmlns"]) - [[_namespaces lastObject] setObject: attributeValue - forKey: @""]; + [_namespaces.lastObject setObject: attributeValue + forKey: @""]; if ([_attributePrefix isEqual: @"xmlns"]) - [[_namespaces lastObject] setObject: attributeValue - forKey: _attributeName]; + [_namespaces.lastObject setObject: attributeValue + forKey: _attributeName]; attribute = [OFXMLAttribute attributeWithName: _attributeName namespace: _attributePrefix stringValue: attributeValue]; attribute->_useDoubleQuotes = (_delimiter == '"');