diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-07 05:37:38 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-07 05:37:38 -0600 |
commit | 89e0472b50364bed2a5a2068c0121b64b3b0321b (patch) | |
tree | 39e9003e55cc630dd4f233b15b1652a4e9f920cc /src/item.cc | |
parent | 65835a89ccbcb9c0a0297b4f7c6adbfd768dca84 (diff) | |
download | fork-ledger-89e0472b50364bed2a5a2068c0121b64b3b0321b.tar.gz fork-ledger-89e0472b50364bed2a5a2068c0121b64b3b0321b.tar.bz2 fork-ledger-89e0472b50364bed2a5a2068c0121b64b3b0321b.zip |
Another fix to metadata value parsing
Diffstat (limited to 'src/item.cc')
-rw-r--r-- | src/item.cc | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/item.cc b/src/item.cc index ef64e154..4ddbe913 100644 --- a/src/item.cc +++ b/src/item.cc @@ -189,22 +189,16 @@ void item_t::parse_tags(const char * p, tag = string(q, len - index); string_map::iterator i; - const string::size_type plen = std::strlen(p); - const char * v = p + (q - p) + (len - index) + 1; - while (*v == '\0' && v < p + plen) - ++v; - - if (v < p + plen) { - string field(v); - if (by_value) { - bind_scope_t bound_scope(scope, *this); - i = set_tag(tag, expr_t(field).calc(bound_scope), overwrite_existing); - } else { - i = set_tag(tag, string_value(field), overwrite_existing); - } - (*i).second.second = true; - break; + string field(p + len + index); + trim(field); + if (by_value) { + bind_scope_t bound_scope(scope, *this); + i = set_tag(tag, expr_t(field).calc(bound_scope), overwrite_existing); + } else { + i = set_tag(tag, string_value(field), overwrite_existing); } + (*i).second.second = true; + break; } first = false; } |