@@ -40,11 +40,11 @@ typedef void (*state_function)(id, SEL); static SEL selectors[OF_XMLPARSER_NUM_STATES]; static state_function lookupTable[OF_XMLPARSER_NUM_STATES]; static OF_INLINE void -buffer_append(OFDataArray *buffer, const char *string, +appendToBuffer(OFDataArray *buffer, const char *string, of_string_encoding_t encoding, size_t length) { if (OF_LIKELY(encoding == OF_STRING_ENCODING_UTF_8)) [buffer addItems: string count: length]; @@ -58,11 +58,11 @@ objc_autoreleasePoolPop(pool); } } static OFString* -transform_string(OFDataArray *buffer, size_t cut, bool unescape, +transformString(OFDataArray *buffer, size_t cut, bool unescape, id delegate) { char *items; size_t i, length; bool hasEntities = false; @@ -93,11 +93,11 @@ return ret; } static OFString* -namespace_for_prefix(OFString *prefix, OFArray *namespaces) +namespaceForPrefix(OFString *prefix, OFArray *namespaces) { OFDictionary **objects = [namespaces objects]; ssize_t i; if (prefix == nil) @@ -112,20 +112,20 @@ return nil; } static OF_INLINE void -resolve_attribute_namespace(OFXMLAttribute *attribute, OFArray *namespaces, +resolveAttributeNamespace(OFXMLAttribute *attribute, OFArray *namespaces, OFXMLParser *self) { OFString *attributeNS; OFString *attributePrefix = attribute->_namespace; if (attributePrefix == nil) return; - attributeNS = namespace_for_prefix(attributePrefix, namespaces); + attributeNS = namespaceForPrefix(attributePrefix, namespaces); if ((attributePrefix != nil && attributeNS == nil)) @throw [OFUnboundPrefixException exceptionWithPrefix: attributePrefix parser: self]; @@ -266,11 +266,11 @@ _lastCarriageReturn = (_data[_i] == '\r'); } /* In OF_XMLPARSER_IN_TAG, there can be only spaces */ if (length - _last > 0 && _state != OF_XMLPARSER_IN_TAG) - buffer_append(_buffer, _data + _last, _encoding, + appendToBuffer(_buffer, _data + _last, _encoding, length - _last); } - (void)parseString: (OFString*)string { @@ -344,15 +344,15 @@ if (_data[_i] != '<') return; if ((length = _i - _last) > 0) - buffer_append(_buffer, _data + _last, _encoding, length); + appendToBuffer(_buffer, _data + _last, _encoding, length); if ([_buffer count] > 0) { void *pool = objc_autoreleasePoolPush(); - OFString *characters = transform_string(_buffer, 0, true, self); + OFString *characters = transformString(_buffer, 0, true, self); if ([_delegate respondsToSelector: @selector(parser:foundCharacters:)]) [_delegate parser: self foundCharacters: characters]; @@ -509,12 +509,12 @@ _level = 1; else if (_level == 1 && _data[_i] == '>') { void *pool = objc_autoreleasePoolPush(); OFString *PI; - buffer_append(_buffer, _data + _last, _encoding, _i - _last); - PI = transform_string(_buffer, 1, false, nil); + appendToBuffer(_buffer, _data + _last, _encoding, _i - _last); + PI = transformString(_buffer, 1, false, nil); if ([PI isEqual: @"xml"] || [PI hasPrefix: @"xml "] || [PI hasPrefix: @"xml\t"] || [PI hasPrefix: @"xml\r"] || [PI hasPrefix: @"xml\n"]) if (![self OF_parseXMLProcessingInstructions: PI]) @@ -547,11 +547,11 @@ if (_data[_i] != ' ' && _data[_i] != '\t' && _data[_i] != '\n' && _data[_i] != '\r' && _data[_i] != '>' && _data[_i] != '/') return; if ((length = _i - _last) > 0) - buffer_append(_buffer, _data + _last, _encoding, length); + appendToBuffer(_buffer, _data + _last, _encoding, length); pool = objc_autoreleasePoolPush(); bufferCString = [_buffer items]; bufferLength = [_buffer count]; @@ -572,11 +572,11 @@ } if (_data[_i] == '>' || _data[_i] == '/') { OFString *namespace; - namespace = namespace_for_prefix(_prefix, _namespaces); + namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) @throw [OFUnboundPrefixException exceptionWithPrefix: _prefix parser: self]; @@ -632,11 +632,11 @@ if (_data[_i] != ' ' && _data[_i] != '\t' && _data[_i] != '\n' && _data[_i] != '\r' && _data[_i] != '>') return; if ((length = _i - _last) > 0) - buffer_append(_buffer, _data + _last, _encoding, length); + appendToBuffer(_buffer, _data + _last, _encoding, length); pool = objc_autoreleasePoolPush(); bufferCString = [_buffer items]; bufferLength = [_buffer count]; @@ -661,11 +661,11 @@ [_previous removeLastObject]; [_buffer removeAllItems]; - namespace = namespace_for_prefix(_prefix, _namespaces); + namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) @throw [OFUnboundPrefixException exceptionWithPrefix: _prefix parser: self]; if ([_delegate respondsToSelector: @@ -711,18 +711,18 @@ } attributesObjects = [_attributes objects]; attributesCount = [_attributes count]; - namespace = namespace_for_prefix(_prefix, _namespaces); + namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) @throw [OFUnboundPrefixException exceptionWithPrefix: _prefix parser: self]; for (j = 0; j < attributesCount; j++) - resolve_attribute_namespace(attributesObjects[j], _namespaces, + resolveAttributeNamespace(attributesObjects[j], _namespaces, self); pool = objc_autoreleasePoolPush(); if ([_delegate respondsToSelector: @@ -776,11 +776,11 @@ if (_data[_i] != '=' && _data[_i] != ' ' && _data[_i] != '\t' && _data[_i] != '\n' && _data[_i] != '\r') return; if ((length = _i - _last) > 0) - buffer_append(_buffer, _data + _last, _encoding, length); + appendToBuffer(_buffer, _data + _last, _encoding, length); pool = objc_autoreleasePoolPush(); bufferString = [OFString stringWithUTF8String: [_buffer items] length: [_buffer count]]; @@ -850,14 +850,14 @@ if (_data[_i] != _delimiter) return; if ((length = _i - _last) > 0) - buffer_append(_buffer, _data + _last, _encoding, length); + appendToBuffer(_buffer, _data + _last, _encoding, length); pool = objc_autoreleasePoolPush(); - attributeValue = transform_string(_buffer, 0, true, self); + attributeValue = transformString(_buffer, 0, true, self); if (_attributePrefix == nil && [_attributeName isEqual: @"xmlns"]) [[_namespaces lastObject] setObject: attributeValue forKey: @""]; if ([_attributePrefix isEqual: @"xmlns"]) @@ -942,12 +942,12 @@ _level++; else if (_data[_i] == '>' && _level >= 2) { void *pool = objc_autoreleasePoolPush(); OFString *CDATA; - buffer_append(_buffer, _data + _last, _encoding, _i - _last); - CDATA = transform_string(_buffer, 2, false, nil); + appendToBuffer(_buffer, _data + _last, _encoding, _i - _last); + CDATA = transformString(_buffer, 2, false, nil); if ([_delegate respondsToSelector: @selector(parser:foundCDATA:)]) [_delegate parser: self foundCDATA: CDATA]; @@ -992,12 +992,12 @@ if (_data[_i] != '>') @throw [OFMalformedXMLException exceptionWithParser: self]; pool = objc_autoreleasePoolPush(); - buffer_append(_buffer, _data + _last, _encoding, _i - _last); - comment = transform_string(_buffer, 2, false, nil); + appendToBuffer(_buffer, _data + _last, _encoding, _i - _last); + comment = transformString(_buffer, 2, false, nil); if ([_delegate respondsToSelector: @selector(parser:foundComment:)]) [_delegate parser: self foundComment: comment];