Changeset 265


Ignore:
Timestamp:
May 1, 2007, 2:27:59 PM (16 years ago)
Author:
Peter Johansson
Message:

fixes #170

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Parser.cc

    r262 r265  
    4040  {
    4141    std::ifstream is(path.c_str());
     42    assert(is.good());
    4243    std::vector<std::pair<std::string, std::string> > codon;
    4344    if (match_end(path.rbegin(), path.rend(), ".ac") ||
     
    116117          }
    117118        }
    118         if (!mode && match_begin(iter,str.end(), codon[mode-1].second)){
     119        assert(mode==0 || mode-1<codon.size());
     120        if (mode && match_begin(iter,str.end(), codon[mode-1].second)){
    119121          mode=0;
    120122          continue;
    121123        }
    122 
    123124        // A line of code or comment must contain at least one
    124125        // alphanumerical character.
    125126        if (isalnum(*iter)) {
    126           if (!mode)
     127          if (!mode) {
    127128            lt=code;
    128           else if (mode!=code)
     129          }
     130          else if (lt!=code) {
    129131            lt=comment;
     132          }
    130133        }
    131134      }
    132       if (!mode && codon[mode-1].second==std::string("\n"))
     135      if (mode && codon[mode-1].second==std::string("\n"))
    133136        mode=0;
    134 
    135137      type_.push_back(lt);
    136138    }
  • trunk/lib/Stats.cc

    r244 r265  
    9292
    9393    std::vector<u_int>* total = &(total_[user]);
     94    assert(total);
    9495    if (total->size() < rev+1){
    9596      total->reserve(revision_ + 1);
     
    101102
    102103    std::vector<u_int>* code = &(code_[user]);
     104    assert(code);
    103105    if (code->size() < rev+1){
    104106      code->reserve(revision_ + 1);
     
    113115
    114116    std::vector<u_int>* comments = &(comments_[user]);
     117    assert(comments);
    115118    if (comments->size() < rev+1){
    116119      comments->reserve(revision_ + 1);
     
    125128
    126129    std::vector<u_int>* empty = &(empty_[user]);
     130    assert(empty);
    127131    if (empty->size() < rev+1){
    128132      empty->reserve(revision_ + 1);
     
    145149    SVNblame svn_blame(path);
    146150    while (const SVNblame::blame_information * bi=svn_blame.next()) {
     151      assert(bi);
    147152      // to handle symbolic links
    148153      if (count==parser.type().end())
    149154        add(bi->author, bi->revision, Parser::empty);
    150       else
     155      else {
    151156        add(bi->author, bi->revision, *count);
    152       ++count;
     157        ++count;
     158      }
    153159    }
    154160   
Note: See TracChangeset for help on using the changeset viewer.