summaryrefslogtreecommitdiffstats
path: root/src/util/units.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-11-23 23:36:49 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-11-23 23:36:49 +0000
commit0969085ddf607a7a98cf7fd6d9b10da5fbebe62d (patch)
tree59b2bc9ed3412ab2de4c703ef30342dfe2401704 /src/util/units.cpp
parentrefactor from lastApplied (diff)
parentFixed a bug pointed by suv running from comand line, also removed another des... (diff)
downloadinkscape-0969085ddf607a7a98cf7fd6d9b10da5fbebe62d.tar.gz
inkscape-0969085ddf607a7a98cf7fd6d9b10da5fbebe62d.zip
fixing to trunk
(bzr r12588.1.34)
Diffstat (limited to 'src/util/units.cpp')
-rw-r--r--src/util/units.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util/units.cpp b/src/util/units.cpp
index d2053f60b..3d635e2d2 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -206,7 +206,6 @@ bool Unit::compatibleWith(Unit const *u) const
}
bool Unit::compatibleWith(Glib::ustring const &u) const
{
- static UnitTable unit_table;
return compatibleWith(unit_table.getUnit(u));
}
@@ -291,11 +290,15 @@ Quantity UnitTable::parseQuantity(Glib::ustring const &q) const
std::istringstream tmp_v(match_info.fetch(0));
tmp_v >> value;
}
+ int start_pos, end_pos;
+ match_info.fetch_pos(0, end_pos, start_pos);
+ end_pos = q.size() - start_pos;
+ Glib::ustring u = q.substr(start_pos, end_pos);
// Extract unit abbreviation
Glib::ustring abbr;
Glib::RefPtr<Glib::Regex> unit_regex = Glib::Regex::create("[A-z%]+");
- if (unit_regex->match(q, match_info)) {
+ if (unit_regex->match(u, match_info)) {
abbr = match_info.fetch(0);
}