[Pkg-isocodes-devel] r1244 - in trunk/isoquery: . src
toddy-guest at alioth.debian.org
toddy-guest at alioth.debian.org
Thu Dec 27 17:30:48 UTC 2007
Author: toddy-guest
Date: 2007-12-27 17:30:48 +0000 (Thu, 27 Dec 2007)
New Revision: 1244
Modified:
trunk/isoquery/ChangeLog
trunk/isoquery/src/xmldata.cpp
trunk/isoquery/src/xmldata.h
Log:
Bug fix:
The codes in ISO 639 were shown twice if 2B and 2T code are
identical. Examples are vie, swa.
Modified: trunk/isoquery/ChangeLog
===================================================================
--- trunk/isoquery/ChangeLog 2007-12-27 17:13:53 UTC (rev 1243)
+++ trunk/isoquery/ChangeLog 2007-12-27 17:30:48 UTC (rev 1244)
@@ -2,6 +2,9 @@
=============
UNRELEASED
+* Bug fix:
+ The codes in ISO 639 were shown twice if 2B and 2T code are
+ identical. Examples are vie, swa.
* Setup testing framework to catch regression bugs
Modified: trunk/isoquery/src/xmldata.cpp
===================================================================
--- trunk/isoquery/src/xmldata.cpp 2007-12-27 17:13:53 UTC (rev 1243)
+++ trunk/isoquery/src/xmldata.cpp 2007-12-27 17:30:48 UTC (rev 1244)
@@ -107,11 +107,16 @@
* Return the next xpath depending on command line options
*/
Glib::ustring
-XMLData::get_next_xpath(Glib::ustring code)
+XMLData::get_next_xpath(Glib::ustring code, bool initialize)
{
Glib::ustring xpath = "";
- static int xpath_index = 0;
- static bool last_xpath = false;
+ static int xpath_index;
+ static bool last_xpath;
+
+ if (initialize) {
+ xpath_index = 0;
+ last_xpath = false;
+ }
// No more xpaths available, so return an empty xpath
if (last_xpath) {
@@ -199,7 +204,7 @@
const xmlpp::Element *current_node;
bool found = false;
- xpath = get_next_xpath(code);
+ xpath = get_next_xpath(code, true);
while (!xpath.empty()) {
nodeset = parser.get_document()->get_root_node()->find(xpath);
for (iter = nodeset.begin(); iter != nodeset.end(); iter++) {
@@ -207,7 +212,11 @@
print_node(current_node);
found = true;
}
- xpath = get_next_xpath(code);
+ if (!found) {
+ xpath = get_next_xpath(code, false);
+ } else {
+ xpath = "";
+ }
}
// Show a warning if the code was not found
if (!found) {
Modified: trunk/isoquery/src/xmldata.h
===================================================================
--- trunk/isoquery/src/xmldata.h 2007-12-27 17:13:53 UTC (rev 1243)
+++ trunk/isoquery/src/xmldata.h 2007-12-27 17:30:48 UTC (rev 1244)
@@ -47,7 +47,7 @@
void check(Glib::ustring iso_standard);
void set_output_locale(Glib::ustring output_locale);
void set_attribute_name(Glib::ustring attr_name);
- Glib::ustring get_next_xpath(Glib::ustring code);
+ Glib::ustring get_next_xpath(Glib::ustring code, bool initialize);
void show(Glib::ustring code);
};
More information about the Pkg-isocodes-devel
mailing list