Skip to content

Commit

Permalink
Fixes compilation warnings from esl_sqio_ncbi on recent OS/X.
Browse files Browse the repository at this point in the history
esl_sqio_ncbi code manipulates both text-mode and digital-mode
sequences with the same <ptr> variable. Because it can assign
eslDSQ_SENTINEL (255) to *ptr, ptr needs to be declared unsigned char.
  • Loading branch information
cryptogenomicon committed Feb 1, 2018
1 parent 41d7e9f commit 2dffa62
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions esl_sqio_ncbi.c
Expand Up @@ -1665,7 +1665,7 @@ read_dna(ESL_SQFILE *sqfp, ESL_SQ *sq)
int ssize;
int n;

char *ptr;
unsigned char *ptr;
void *t;

unsigned char c;
Expand Down Expand Up @@ -1695,10 +1695,10 @@ read_dna(ESL_SQFILE *sqfp, ESL_SQ *sq)
/* figure out if the sequence is in digital mode or not */
if (sq->dsq != NULL) {
text = FALSE;
ptr = (char *)sq->dsq + 1;
ptr = (unsigned char *) sq->dsq + 1;
} else {
text = TRUE;
ptr = sq->seq;
ptr = (unsigned char *) sq->seq;
}

for (inx = 0; inx < ssize; ++inx) {
Expand Down Expand Up @@ -1742,7 +1742,7 @@ read_dna(ESL_SQFILE *sqfp, ESL_SQ *sq)

/* skip past the count and start processing the abmiguity table */
ssize = ncbi->seq_apos - sq->doff + 4;
ptr = (text) ? sq->seq : (char *)sq->dsq + 1;
ptr = (text) ? (unsigned char *)sq->seq : (unsigned char *)sq->dsq + 1;

while (ssize < size) {
/* get the ambiguity character */
Expand Down Expand Up @@ -1810,8 +1810,7 @@ read_nres_amino(ESL_SQFILE *sqfp, ESL_SQ *sq, int len, uint64_t *nres)
int off;
int size;

char *ptr;

unsigned char *ptr;
ESL_SQNCBI_DATA *ncbi = &sqfp->data.ncbi;

if (ncbi->index >= ncbi->num_seq) return eslEOF;
Expand All @@ -1827,7 +1826,7 @@ read_nres_amino(ESL_SQFILE *sqfp, ESL_SQ *sq, int len, uint64_t *nres)
}

/* figure out if the sequence is in digital mode or not */
ptr = (sq->dsq != NULL) ? (char *)sq->dsq + 1 : sq->seq;
ptr = (sq->dsq != NULL) ? (unsigned char *)sq->dsq + 1 : (unsigned char *) sq->seq;
ptr += sq->n;

/* calculate where to start reading from */
Expand Down Expand Up @@ -1981,7 +1980,7 @@ read_nres_dna(ESL_SQFILE *sqfp, ESL_SQ *sq, int len, uint64_t *nres)
int ssize;
int n;

char *ptr;
unsigned char *ptr;
void *t;

unsigned char c;
Expand Down Expand Up @@ -2035,10 +2034,10 @@ read_nres_dna(ESL_SQFILE *sqfp, ESL_SQ *sq, int len, uint64_t *nres)
/* figure out if the sequence is in digital mode or not */
if (sq->dsq != NULL) {
text = FALSE;
ptr = (char *)sq->dsq + 1;
ptr = (unsigned char *)sq->dsq + 1;
} else {
text = TRUE;
ptr = sq->seq;
ptr = (unsigned char *)sq->seq;
}
ptr += sq->n;

Expand Down

0 comments on commit 2dffa62

Please sign in to comment.