diff --git a/hts.c b/hts.c index caf85e64a..42be3f21f 100644 --- a/hts.c +++ b/hts.c @@ -3826,7 +3826,7 @@ void hts_itr_destroy(hts_itr_t *iter) } } -static inline long long push_digit(long long i, char c) +static inline unsigned long long push_digit(unsigned long long i, char c) { // ensure subtraction occurs first, avoiding overflow for >= MAX-48 or so int digit = c - '0'; @@ -3835,7 +3835,7 @@ static inline long long push_digit(long long i, char c) long long hts_parse_decimal(const char *str, char **strend, int flags) { - long long n = 0; + unsigned long long n = 0; int digits = 0, decimals = 0, e = 0, lost = 0; char sign = '+', esign = '+'; const char *s, *str_orig = str; diff --git a/hts_expr.c b/hts_expr.c index 5e5a132ea..0fdb3bc8b 100644 --- a/hts_expr.c +++ b/hts_expr.c @@ -527,8 +527,10 @@ static int bitand_expr(hts_filter_t *filt, void *data, hts_expr_sym_func *fn, } else if (res->is_str || val.is_str) { hts_expr_val_free(&val); return -1; + } else { + res->is_true = + (res->d = ((int64_t)res->d & (int64_t)val.d)) != 0; } - res->is_true = (res->d = ((int64_t)res->d & (int64_t)val.d)) != 0; } else { break; } @@ -560,8 +562,10 @@ static int bitxor_expr(hts_filter_t *filt, void *data, hts_expr_sym_func *fn, } else if (res->is_str || val.is_str) { hts_expr_val_free(&val); return -1; + } else { + res->is_true = + (res->d = ((int64_t)res->d ^ (int64_t)val.d)) != 0; } - res->is_true = (res->d = ((int64_t)res->d ^ (int64_t)val.d)) != 0; } else { break; } @@ -593,8 +597,10 @@ static int bitor_expr(hts_filter_t *filt, void *data, hts_expr_sym_func *fn, } else if (res->is_str || val.is_str) { hts_expr_val_free(&val); return -1; + } else { + res->is_true = + (res->d = ((int64_t)res->d | (int64_t)val.d)) != 0; } - res->is_true = (res->d = ((int64_t)res->d | (int64_t)val.d)) != 0; } else { break; } diff --git a/vcf.c b/vcf.c index 53f2b7a92..daedad34d 100644 --- a/vcf.c +++ b/vcf.c @@ -4020,7 +4020,10 @@ int vcf_format(const bcf_hdr_t *h, const bcf1_t *v, kstring_t *s) kputc_('\t', s); // INFO if (v->n_info) { - uint8_t *ptr = (uint8_t *)v->shared.s + v->unpack_size[0] + v->unpack_size[1] + v->unpack_size[2]; + uint8_t *ptr = v->shared.s + ? (uint8_t *)v->shared.s + v->unpack_size[0] + + v->unpack_size[1] + v->unpack_size[2] + : NULL; int first = 1; bcf_info_t *info = v->d.info;