@@ -143,10 +143,13 @@ pool = [[OFAutoreleasePool alloc] init]; dict = [OFMutableDictionary dictionaryWithKeysAndObjects: @"xml", @"http://www.w3.org/XML/1998/namespace", @"xmlns", @"http://www.w3.org/2000/xmlns/", nil]; [namespaces addObject: dict]; + + lineNumber = 1; + [pool release]; } @catch (id e) { [self release]; @throw e; } @@ -203,12 +206,24 @@ newWithClass: isa]; return; } - for (i = 0; i < size; i++) + for (i = 0; i < size; i++) { + size_t j = i; + lookup_table[state](self, selectors[state], buf, &i, &last); + + /* Ensure we don't count this character twice */ + if (i != j) + continue; + + if (buf[i] == '\r' || (buf[i] == '\n' && !lastCarriageReturn)) + lineNumber++; + + lastCarriageReturn = (buf[i] == '\r' ? YES : NO); + } /* In OF_XMLPARSER_IN_TAG, there can be only spaces */ if (size - last > 0 && state != OF_XMLPARSER_IN_TAG) [cache appendCStringWithoutUTF8Checking: buf + last length: size - last]; @@ -890,10 +905,15 @@ level--; } *last = *i + 1; } + +- (size_t)lineNumber +{ + return lineNumber; +} - (BOOL)finishedParsing { return finishedParsing; }