Changeset 3836


Ignore:
Timestamp:
Aug 8, 2019, 4:11:37 AM (4 years ago)
Author:
Peter
Message:

fixes #928

Location:
branches/0.16-stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/0.16-stable/NEWS

    r3835 r3836  
    88  - utility::Aligner::Cigar::begin(void) and ::end(void) are now
    99    implemented (see bug #929)
     10 - Fixed bug in GFF2 parser when attribute field had space after a
     11   semicolon (bug #928)
    1012
    1113  A complete list of closed tickets can be found here [[br]]
  • branches/0.16-stable/test/Makefile.am

    r3834 r3836  
    123123
    124124# tests not passing through yet
    125 XFAIL_TESTS = test/gff.test
     125XFAIL_TESTS =
    126126
    127127DISTRIBUTED_TESTS = \
  • branches/0.16-stable/yat/omic/GFF2.cc

    r2919 r3836  
    2424#include "GFF2.h"
    2525
     26#include <cassert>
    2627#include <string>
    2728#include <map>
     
    3435                           const std::string& str) const
    3536  {
    36     size_t i = str.find(' ');
    37     std::string key = str.substr(0,i);
    38     ++i;
     37    size_t offset = str.find_first_not_of(' ');
     38    size_t i = str.find_first_of(' ', offset);
     39    assert(i >= offset);
     40    std::string key = str.substr(offset, i-offset);
     41    // trim spaces
     42    i = str.find_first_not_of(' ', i+1);
    3943    // trim off embracing '"'
    4044    if (str[i]=='"')
    4145      ++i;
    42     size_t n = str.size() - i;
    43     if (str[str.size()-1]=='"')
     46    // skip trailing spaces
     47    size_t n = str.find_last_not_of(' ');
     48    // skip training '"'
     49    if (str[n] == '"')
    4450      --n;
    45     m[key] = str.substr(i,n);
     51    // str[n] now points to last char we want to include
     52    m[key] = str.substr(i,n-i+1);
    4653  }
    4754
Note: See TracChangeset for help on using the changeset viewer.