Skip to content

Commit

Permalink
fixed issue with phylip parsing when header (seqs length) ends with CRLF
Browse files Browse the repository at this point in the history
  • Loading branch information
xflouris committed Jul 11, 2017
1 parent cc43117 commit 295169d
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/phylip.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,14 @@ static int args_getint(const char * arg, int * len)
return temp;
}

static int whitechar(char c)
static int whitespace(char c)
{
if (c == ' ' || c == '\t') return 1;

if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
return 1;
return 0;
}


static int parse_header(const char * line,
int * seq_count,
int * seq_len,
Expand Down Expand Up @@ -210,7 +211,7 @@ static int parse_header(const char * line,
line += len;

/* go through all white spaces */
while (*line && whitechar(*line)) ++line;
while (*line && whitespace(*line)) ++line;

/* if end of line then return successfully */
if (!*line)
Expand All @@ -224,7 +225,7 @@ static int parse_header(const char * line,
return 0;

/* go through all white spaces */
while (*line && whitechar(*line)) ++line;
while (*line && whitespace(*line)) ++line;

/* if end of line then return successfully */
if (!*line)
Expand All @@ -233,13 +234,6 @@ static int parse_header(const char * line,
return 0;
}

static int whitespace(char c)
{
if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
return 1;
return 0;
}

static char * parse_oneline_sequence(pll_phylip_t * fd,
pll_msa_t * msa,
char * p,
Expand Down

0 comments on commit 295169d

Please sign in to comment.