7ec42d4b6eb8a815b95b7af131150b7e4a5569cd
galt
  Fri Jan 10 01:02:32 2025 -0800
Reapply "fixing compiler warnings for htslib compiling Rocky 9 hgwdev-new."

This reverts commit fda94da6315d3cbcd541a8580870dad45697b2bc.

diff --git src/htslib/sam.c src/htslib/sam.c
index 6ec84ab..0743c8b 100644
--- src/htslib/sam.c
+++ src/htslib/sam.c
@@ -214,34 +214,34 @@
  invalid:
     if (hts_verbose >= 1) {
         fprintf(stderr, "[E::%s] invalid BAM binary header\n", __func__);
     }
 
  clean:
     if (h != NULL) {
         h->n_targets = num_names; // ensure we free only allocated target_names
         bam_hdr_destroy(h);
     }
     return NULL;
 }
 
 int bam_hdr_write(BGZF *fp, const bam_hdr_t *h)
 {
-    char buf[4];
+    char buf[4+1];
     int32_t i, name_len, x;
     // write "BAM1"
-    strncpy(buf, "BAM\1", 4);
+    strncpy(buf, "BAM\1", 4+1);
     bgzf_write(fp, buf, 4);
     // write plain text and the number of reference sequences
     if (fp->is_be) {
         x = ed_swap_4(h->l_text);
         bgzf_write(fp, &x, 4);
         if (h->l_text) bgzf_write(fp, h->text, h->l_text);
         x = ed_swap_4(h->n_targets);
         bgzf_write(fp, &x, 4);
     } else {
         bgzf_write(fp, &h->l_text, 4);
         if (h->l_text) bgzf_write(fp, h->text, h->l_text);
         bgzf_write(fp, &h->n_targets, 4);
     }
     // write sequence names and lengths
     for (i = 0; i != h->n_targets; ++i) {
@@ -1590,31 +1590,31 @@
     }
     return 1;
 }
 
 /***********************
  *** Pileup iterator ***
  ***********************/
 
 // Dictionary of overlapping reads
 KHASH_MAP_INIT_STR(olap_hash, lbnode_t *)
 typedef khash_t(olap_hash) olap_hash_t;
 
 struct __bam_plp_t {
     mempool_t *mp;
     lbnode_t *head, *tail, *dummy;
-    int32_t tid, pos, max_tid, max_pos;
+    uint32_t tid, pos, max_tid, max_pos;
     int is_eof, max_plp, error, maxcnt;
     uint64_t id;
     bam_pileup1_t *plp;
     // for the "auto" interface only
     bam1_t *b;
     bam_plp_auto_f func;
     void *data;
     olap_hash_t *overlaps;
 };
 
 bam_plp_t bam_plp_init(bam_plp_auto_f func, void *data)
 {
     bam_plp_t iter;
     iter = (bam_plp_t)calloc(1, sizeof(struct __bam_plp_t));
     iter->mp = mp_init();