Skip to content

Commit

Permalink
Error about blank chars in partition file (reported by David Maddison)
Browse files Browse the repository at this point in the history
  • Loading branch information
bqminh committed Jun 25, 2018
1 parent 87f2dd6 commit c047513
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions alignment/alignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2944,6 +2944,8 @@ void convert_range(const char *str, int &lower, int &upper, int &step_size, char
//int d_save = d;
upper = d;
step_size = 1;
// skip blank chars
for (; *endptr == ' '; endptr++) {}
if (*endptr != '-') return;

// parse the upper bound of the range
Expand All @@ -2958,6 +2960,9 @@ void convert_range(const char *str, int &lower, int &upper, int &step_size, char

//lower = d_save;
upper = d;
// skip blank chars
for (; *endptr == ' '; endptr++) {}

if (*endptr != '\\') return;

// parse the step size of the range
Expand Down
7 changes: 6 additions & 1 deletion nclextra/msetsblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ void MSetsBlock::Read(NxsToken &token)
myset->aln_file = myset->position_spec.substr(0, pos);
myset->position_spec = myset->position_spec.substr(pos+1);
}
trimString(myset->position_spec);
if ((pos=myset->position_spec.find(',')) != string::npos && isalpha(myset->position_spec[0])) {
myset->sequence_type = myset->position_spec.substr(0, pos);
myset->position_spec = myset->position_spec.substr(pos+1);
Expand All @@ -174,7 +175,11 @@ void MSetsBlock::Read(NxsToken &token)
errormsg += " instead";
throw NxsException(errormsg, token.GetFilePosition(), token.GetFileLine(), token.GetFileColumn());
}

trimString(myset->aln_file);
trimString(myset->char_partition);
trimString(myset->model_name);
trimString(myset->position_spec);
trimString(myset->sequence_type);
} // if (token.Equals("CHARSET"))
else if (token.Equals("CHARPARTITION"))
{
Expand Down

0 comments on commit c047513

Please sign in to comment.