As -o is still free in the mem command, use that standard option to
specify an output file (and keep -f to parallel bwase/bwape commands).
Document it in the usage and man page.
In the bwa.c and bwase.c calls, rlen is an int64_t returned from
bns_get_seq() and is the number of reference bases covered by the
alignment; l_query/len is an int and the query length of the alignment;
and the result is an int given to an int parameter of ksw_global[2]().
As even the result is int and as rlen is effectively bounded by the
maximum length of a reference sequence, we maintain the status quo in
this code and simply cast rlen to int to silence Clang's "use llabs()"
(llabs() would not be a great answer given an int64_t anyway).
The bwtsw2_pair.c call needs to remain fabs() so both divisions are
done in floating point; cast to double to prevent Clang suggesting
changing the call to integer abs().
[Based on PR #37 with the additions below.]
Don't free non-malloced items in BWTFree(). If BWTCreate() is ever
called with a non-NULL decodeTable, BWTFree() will need to not free
decodeTable -- see FIXME comment.
Close packedFile in BWTIncConstructFromPacked() in the normal case.
Ignore it in error cases, as they immediately call exit() anyway.
Similarly to the realloc(pac,...) within add1(), only bother to call
realloc() if appending the reverse complemented sequence requires more
space than is currently in the pac/m_pac buffer.
Avoids realloc(pac,0) (and a "Failed to allocate 0 bytes at bntseq.c"
message from wrap_realloc()) in the corner case of an empty reference
FASTA file. Fixes#54.
The u_int32_t type comes from <sys/types.h>, which is often included
as a byproduct of other headers on glibc platforms, but not on FreeBSD
or Alpine Linux. Use <stdint.h>'s uint32_t instead, which is used
elsewhere in bwa source code.