bgzf: Added ad-hoc checks to all hfile calls to keep compiler happy
Properly ignore hclose() in bgzf_[d]open functions

Introducing an otherwise-unused variable merely trades one compiler
warning for another ("variable 'ret' set but not used").

Because here we're unwinding after an error from bgzf_read_init(),
it's correct to just discard errors from hclose().  I had hoped that
"(void) hclose(fpr)" would suffice, but (1) that defeats -Wunused-value
but not -Wunused-result, and (2) we should preserve errno.

Also fix the bgzf_close() change to set BGZF_ERR_IO on hwrite() failure.

Note that this is not about keeping the compiler happy.  These compiler
warnings indicate places in the code where we need to be careful to
propagate I/O failures to the user correctly.  Suppressing the warnings
without carefully considering the error handling is not an improvement
in general.  Recall that the diagnostics can be temporarily suppressed
locally with -Wno-unused-result (but please don't commit that).
bcf_index_build: Check return status of helper calls
Merge branch 'develop' of github.com:samtools/htslib into develop
Enable warnings only if -Wno-unused-result works

While __attribute__((warn_unused_result)) was introduced in GCC 3.4,
the ability to ignore it with -Wno-unused-result was only introduced
in GCC 4.5 (and clang 3.0).  So activate these warnings for hclose() etc
only if we have the ability to temporarily ignore them conveniently.

(In particular, there was no way to shut it up with the system compiler
on Mac OS X Lion, llvm-gcc 4.2.1.)
synced_reader: Added support for alleles in targets files to select best matching line out of possibly duplicate VCF records.
vcf: Added bcf_get_variant_type[s]() call to avoid the need for explicit call of bcf_set_variant_types(); The mpileup's X allele is not a SNP; Get rid of htfile warnings
Merge branch 'cram' into develop

The CRAM code is not C++ compatible (mostly due to void* -> struct*
conversions without explicit casts), so causes a lot of warnings
with -Wc++-compat.  It remains to be seen whether to stop using that
flag or whether the number of casts to be sprinkled through the code
will be acceptable.
Proper initialization in hts_readlines
bcf_index_build: Check if the BCF is compressed
Remove -Wc++-compat for the sake of the CRAM code

The CRAM code is not currently C++ compatible, mainly due to void* to
other* conversions (mostly from malloc()/realloc()) without explicit
casts, so -Wc++-compat causes lots of warning noise.

We probably use -Wc++-compat so that Windows users have a chance to
compile samtools via MSVC's compile-as-C++ workaround for C99-style
variable declarations, etc.  That's now broken with CRAM code as is;
we'll do some testing on Windows to see if the MSVC situation has
improved or whether the best answer may be to suggest MinGW instead,
perhaps also providing a MinGW-built binary.
Fixed a rather surprising bug in CSI index access via hts_itr_next, before it was not possible to obtain BCF record at chr:pos-pos. The fix may have unexpected consequences in other situations and file formats, beware!
Add bam_endpos(const bam1_t *)

This is used similarly to bam_cigar2rlen(), but checks that the record is
mapped according to both flags and cigar length before calculating rlen.

More tests of more exotic cigar strings should be added to fieldarith.sam.
vcf.c: Proper freeing of memory taken by dirty info/fmt tags when update routine called multiple times
New feature in bcf_synced_reader: negate the sample selection in bcf_sr_set_samples by exclamation mark
vcf.h: Add out of range check into bcf_idinfo_exists() as it always has to be checked elsewhere.
vcf.h: New API call: bcf_get_genotypes()
Disentangle CRAM header loopiness [minor]
vcf.c: Call bcf_unpack() on user's behalf in all bcf1_get/update routines
synced_reader: Fixed an off by one error in bcf_sr_next_line() to properly match target alleles