The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

End of tag name in XML parser

These changes was commited to the Birdfont repository Tue, 26 May 2015 08:07:33 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Tue, 26 May 2015 08:07:33 +0000 (10:07 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Tue, 26 May 2015 08:07:33 +0000 (10:07 +0200)
commit cb334f705cb391e0b2e736a594877c807292eff5
tree d75b43e5d1b93f4f6fc5ff710254bc9eb496825b
parent 84ed66a8f49e923b3e489d1e7ab446658898de83
End of tag name in XML parser

libbirdxml/Tag.vala
--- a/libbirdxml/Tag.vala +++ b/libbirdxml/Tag.vala @@ -288,7 +288,7 @@ slash_index = index; entire_file.get_next_ascii_char (ref slash_index, out slash); - if (slash == '/' && entire_file.substring (slash_index).has_prefix (name.to_string ())) { + if (slash == '/' && is_tag (entire_file, name, slash_index)) { if (start_count == 1) { return previous_index; } else { @@ -297,7 +297,7 @@ return previous_index; } } - } else if (entire_file.substring (index).has_prefix (name.to_string ())) { + } else if (is_tag (entire_file, name, slash_index)) { start_count++; } } @@ -309,21 +309,21 @@ return -1; } - bool is_tag (XmlString name, int start) { + bool is_tag (XmlString tag, XmlString name, int start) { int index = 0; int data_index = start; unichar c; unichar c_data; while (name.get_next_ascii_char (ref index, out c)) { - if (data.get_next_ascii_char (ref data_index, out c_data)) { + if (tag.get_next_ascii_char (ref data_index, out c_data)) { if (c_data != c) { return false; } } } - if (data.get_next_ascii_char (ref data_index, out c_data)) { + if (tag.get_next_ascii_char (ref data_index, out c_data)) { return c_data == '>' || c_data == ' ' || c_data == '\t' || c_data == '\n' || c_data == '\r' || c_data == '/'; }