Ticket #72: omega-fieldnames.patch

File omega-fieldnames.patch, 1.0 KB (added by Olly Betts, 19 years ago)

Proposed fix

  • query.cc

     
    20142014    // Parse document data.
    20152015    field.clear();
    20162016    string::size_type i = 0;
    2017     map<string, string>::const_iterator opt = option.lower_bound("fieldnames");
    2018     if (opt != option.end() && !opt->second.empty()) {
     2017    string fieldnames = option["fieldnames"];
     2018    if (!fieldnames.empty()) {
    20192019        // Each line is a field, with fieldnames taken from corresponding
    20202020        // entries in the tab-separated list specified by $opt{fieldnames}.
    2021         const string & list = opt->second;
    20222021        string::size_type n = 0, n2;
    20232022        while (true) {
    2024             n2 = list.find('\t', n);
     2023            n2 = fieldnames.find('\t', n);
    20252024            string::size_type old_i = i;
    20262025            i = text.find('\n', i);
    2027             field[list.substr(n, n2 - n)] = text.substr(old_i, i - old_i);
     2026            field[fieldnames.substr(n, n2 - n)] = text.substr(old_i, i - old_i);
    20282027            if (n2 == string::npos || i == string::npos) break;
    20292028            ++i;
    20302029            n = n2 + 1;