Description: fix numerous issues caught by gcc 14.
Author: Étienne Mollier <emollier@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075198
Forwarded: no
Last-Update: 2024-08-25
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- libpsortb.orig/modhmm0.92b/core_algorithms_multialpha.c
+++ libpsortb/modhmm0.92b/core_algorithms_multialpha.c
@@ -1187,14 +1187,14 @@
     
     if(hmmp->alphabet_type == DISCRETE) {
       
-      a_index = get_alphabet_index((msa_seq_infop->msa_seq_1 + (c * (hmmp->a_size+1)))->query_letter, hmmp->alphabet, hmmp->a_size);
+      a_index = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_1 + (c * (hmmp->a_size+1)))->query_letter, hmmp->alphabet, hmmp->a_size);
       if(a_index < 0) {
 	a_index = hmmp->a_size; /* if letter is wild card, use default column in subst matrix */
       }
     }
     if(hmmp->nr_alphabets > 1) {
       if(hmmp->alphabet_type_2 == DISCRETE) {
-	a_index_2 = get_alphabet_index((msa_seq_infop->msa_seq_2 + (c * (hmmp->a_size_2+1)))->query_letter,
+	a_index_2 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_2 + (c * (hmmp->a_size_2+1)))->query_letter,
 				       hmmp->alphabet_2, hmmp->a_size_2);
 	if(a_index_2 < 0) {
 	  a_index_2 = hmmp->a_size_2; /* if letter is wild card, use default column in subst matrix */
@@ -1203,7 +1203,7 @@
     }
     if(hmmp->nr_alphabets > 2) {
       if(hmmp->alphabet_type_3 == DISCRETE) {
-	a_index_3 = get_alphabet_index((msa_seq_infop->msa_seq_3 + (c * (hmmp->a_size_3+1)))->query_letter,
+	a_index_3 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_3 + (c * (hmmp->a_size_3+1)))->query_letter,
 				       hmmp->alphabet_3, hmmp->a_size_3);
 	if(a_index_3 < 0) {
 	  a_index_3 = hmmp->a_size_3; /* if letter is wild card, use default column in subst matrix */
@@ -1212,7 +1212,7 @@
     }
     if(hmmp->nr_alphabets > 3) {
       if(hmmp->alphabet_type_4 == DISCRETE) {
-	a_index_4 = get_alphabet_index((msa_seq_infop->msa_seq_4 + (c * (hmmp->a_size_4+1)))->query_letter,
+	a_index_4 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_4 + (c * (hmmp->a_size_4+1)))->query_letter,
 				       hmmp->alphabet_4, hmmp->a_size_4);
 	if(a_index_4 < 0) {
 	  a_index_4 = hmmp->a_size_4; /* if letter is wild card, use default column in subst matrix */
@@ -1414,14 +1414,14 @@
     a_index_3 = -1;
     a_index_4 = -1;
     if(hmmp->alphabet_type == DISCRETE) {
-      a_index = get_alphabet_index((msa_seq_infop->msa_seq_1 + (c * (hmmp->a_size+1)))->query_letter, hmmp->alphabet, hmmp->a_size);
+      a_index = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_1 + (c * (hmmp->a_size+1)))->query_letter, hmmp->alphabet, hmmp->a_size);
       if(a_index < 0) {
 	a_index = hmmp->a_size; /* if letter is wild card, use default column in subst matrix */
       }
     }
     if(hmmp->nr_alphabets > 1) {
       if(hmmp->alphabet_type_2 == DISCRETE) {
-	a_index_2 = get_alphabet_index((msa_seq_infop->msa_seq_2 + (c * (hmmp->a_size_2+1)))->query_letter,
+	a_index_2 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_2 + (c * (hmmp->a_size_2+1)))->query_letter,
 				       hmmp->alphabet_2, hmmp->a_size_2);
 	if(a_index_2 < 0) {
 	  a_index_2 = hmmp->a_size_2; /* if letter is wild card, use default column in subst matrix */
@@ -1430,7 +1430,7 @@
     }
     if(hmmp->nr_alphabets > 2) {
       if(hmmp->alphabet_type_3 == DISCRETE) {
-	a_index_3 = get_alphabet_index((msa_seq_infop->msa_seq_3 + (c * (hmmp->a_size_3+1)))->query_letter,
+	a_index_3 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_3 + (c * (hmmp->a_size_3+1)))->query_letter,
 				       hmmp->alphabet_3, hmmp->a_size_3);
 	if(a_index_3 < 0) {
 	  a_index_3 = hmmp->a_size_3; /* if letter is wild card, use default column in subst matrix */
@@ -1439,7 +1439,7 @@
     }
     if(hmmp->nr_alphabets > 3) {
       if(hmmp->alphabet_type_4 == DISCRETE) {
-	a_index_4 = get_alphabet_index((msa_seq_infop->msa_seq_4 + (c * (hmmp->a_size_4+1)))->query_letter,
+	a_index_4 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_4 + (c * (hmmp->a_size_4+1)))->query_letter,
 				       hmmp->alphabet_4, hmmp->a_size_4);
 	if(a_index_4 < 0) {
 	  a_index_4 = hmmp->a_size_4; /* if letter is wild card, use default column in subst matrix */
@@ -1603,14 +1603,14 @@
     a_index_3 = -1;
     a_index_4 = -1;
     if(hmmp->alphabet_type == DISCRETE) {
-      a_index = get_alphabet_index((msa_seq_infop->msa_seq_1 + (c * (hmmp->a_size+1)))->query_letter, hmmp->alphabet, hmmp->a_size);
+      a_index = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_1 + (c * (hmmp->a_size+1)))->query_letter, hmmp->alphabet, hmmp->a_size);
       if(a_index < 0) {
 	a_index = hmmp->a_size; /* if letter is wild card, use default column in subst matrix */
       }
     }
     if(hmmp->nr_alphabets > 1) {
       if(hmmp->alphabet_type_2 == DISCRETE) {
-	a_index_2 = get_alphabet_index((msa_seq_infop->msa_seq_2 + (c * (hmmp->a_size_2+1)))->query_letter,
+	a_index_2 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_2 + (c * (hmmp->a_size_2+1)))->query_letter,
 				       hmmp->alphabet_2, hmmp->a_size_2);
 	if(a_index_2 < 0) {
 	  a_index_2 = hmmp->a_size_2; /* if letter is wild card, use default column in subst matrix */
@@ -1619,7 +1619,7 @@
     }
     if(hmmp->nr_alphabets > 2) {
       if(hmmp->alphabet_type_3 == DISCRETE) {
-	a_index_3 = get_alphabet_index((msa_seq_infop->msa_seq_3 + (c * (hmmp->a_size_3+1)))->query_letter,
+	a_index_3 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_3 + (c * (hmmp->a_size_3+1)))->query_letter,
 				       hmmp->alphabet_3, hmmp->a_size_3);
 	if(a_index_3 < 0) {
 	  a_index_3 = hmmp->a_size_3; /* if letter is wild card, use default column in subst matrix */
@@ -1628,7 +1628,7 @@
     }
     if(hmmp->nr_alphabets > 3) {
       if(hmmp->alphabet_type_4 == DISCRETE) {
-	a_index_4 = get_alphabet_index((msa_seq_infop->msa_seq_4 + (c * (hmmp->a_size_4+1)))->query_letter,
+	a_index_4 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_4 + (c * (hmmp->a_size_4+1)))->query_letter,
 				       hmmp->alphabet_4, hmmp->a_size_4);
 	if(a_index_4 < 0) {
 	  a_index_4 = hmmp->a_size_4; /* if letter is wild card, use default column in subst matrix */
@@ -1887,14 +1887,14 @@
     a_index_3 = -1;
     a_index_4 = -1;
     if(hmmp->alphabet_type == DISCRETE) {
-      a_index = get_alphabet_index((msa_seq_infop->msa_seq_1 + (c * (hmmp->a_size+1)))->query_letter, hmmp->alphabet, hmmp->a_size);
+      a_index = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_1 + (c * (hmmp->a_size+1)))->query_letter, hmmp->alphabet, hmmp->a_size);
       if(a_index < 0) {
 	a_index = hmmp->a_size; /* if letter is wild card, use default column in subst matrix */
       }
     }
     if(hmmp->nr_alphabets > 1) {
       if(hmmp->alphabet_type_2 == DISCRETE) {
-	a_index_2 = get_alphabet_index((msa_seq_infop->msa_seq_2 + (c * (hmmp->a_size_2+1)))->query_letter,
+	a_index_2 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_2 + (c * (hmmp->a_size_2+1)))->query_letter,
 				       hmmp->alphabet_2, hmmp->a_size_2);
 	if(a_index_2 < 0) {
 	a_index_2 = hmmp->a_size_2; /* if letter is wild card, use default column in subst matrix */
@@ -1903,7 +1903,7 @@
     }
     if(hmmp->nr_alphabets > 2) {
       if(hmmp->alphabet_type_3 == DISCRETE) {
-	a_index_3 = get_alphabet_index((msa_seq_infop->msa_seq_3 + (c * (hmmp->a_size_3+1)))->query_letter,
+	a_index_3 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_3 + (c * (hmmp->a_size_3+1)))->query_letter,
 				       hmmp->alphabet_3, hmmp->a_size_3);
 	if(a_index_3 < 0) {
 	  a_index_3 = hmmp->a_size_3; /* if letter is wild card, use default column in subst matrix */
@@ -1912,7 +1912,7 @@
     }
     if(hmmp->nr_alphabets > 3) {
       if(hmmp->alphabet_type_4 == DISCRETE) {
-	a_index_4 = get_alphabet_index((msa_seq_infop->msa_seq_4 + (c * (hmmp->a_size_4+1)))->query_letter,
+	a_index_4 = get_alphabet_index((struct letter_s*)(msa_seq_infop->msa_seq_4 + (c * (hmmp->a_size_4+1)))->query_letter,
 				       hmmp->alphabet_4, hmmp->a_size_4);
 	if(a_index_4 < 0) {
 	  a_index_4 = hmmp->a_size_4; /* if letter is wild card, use default column in subst matrix */
--- libpsortb.orig/modhmm0.92b/hmmsearch.c
+++ libpsortb/modhmm0.92b/hmmsearch.c
@@ -532,7 +532,7 @@
      through and record their locations */
 
   if(hSites) {
-    hSites->helix = (helix_sites *) malloc(sizeof (helix_sites) * helices);
+    hSites->helix = (struct helix_site *) malloc(sizeof (helix_sites) * helices);
     helixSite = hSites->helix;
     
     hSites->helix_count = helices;
--- libpsortb.orig/modhmm0.92b/readhmm.c
+++ libpsortb/modhmm0.92b/readhmm.c
@@ -118,7 +118,7 @@
   /* nr of trans tie groups */
   if(fgets(s, MAX_LINE, file) != NULL) {
     hmmp->nr_ttg = atoi(&s[29]);
-    hmmp->trans_tie_groups = (int*)(malloc_or_die((hmmp->nr_t + hmmp->nr_ttg) * sizeof(struct transition_s)));
+    hmmp->trans_tie_groups = (struct transition_s*)(malloc_or_die((hmmp->nr_t + hmmp->nr_ttg) * sizeof(struct transition_s)));
   }
   /* nr of emission priorfiles */
   if(fgets(s, MAX_LINE, file) != NULL) {
@@ -391,7 +391,7 @@
   /* nr of trans tie groups */
   if(fgets(s, MAX_LINE, file) != NULL) {
     hmmp->nr_ttg = atoi(&s[29]);
-    hmmp->trans_tie_groups = (int*)(malloc_or_die((hmmp->nr_t + hmmp->nr_ttg) * sizeof(struct transition_s)));
+    hmmp->trans_tie_groups = (struct transition_s*)(malloc_or_die((hmmp->nr_t + hmmp->nr_ttg) * sizeof(struct transition_s)));
   }
   /* nr of emission priorfiles */
   if(fgets(s, MAX_LINE, file) != NULL) {
--- libpsortb.orig/modhmm0.92b/readseqs_multialpha.c
+++ libpsortb/modhmm0.92b/readseqs_multialpha.c
@@ -80,7 +80,7 @@
   inside_seq = NO;
 
   /* read sequence name */
-  (seq_infop->seqs + seq_nr)->name[0] = "s";
+  (seq_infop->seqs + seq_nr)->name[0] = 's';
 
   i = 0;
   while((i <= nr_letters) && (seq[i] != '\0')) {
--- libpsortb.orig/modhmm0.92b/readhmm_multialpha.c
+++ libpsortb/modhmm0.92b/readhmm_multialpha.c
@@ -270,7 +270,7 @@
   retrain_hmmp->distrib_groups = (int*)(malloc_or_die((hmmp->nr_d + hmmp->nr_v) * sizeof(int)));
   memcpy(retrain_hmmp->distrib_groups, hmmp->distrib_groups,(hmmp->nr_d + hmmp->nr_v) * sizeof(int)); 
   
-  retrain_hmmp->trans_tie_groups = (int*)(malloc_or_die((hmmp->nr_t + hmmp->nr_ttg) * sizeof(struct transition_s)));
+  retrain_hmmp->trans_tie_groups = (struct transition_s*)(malloc_or_die((hmmp->nr_t + hmmp->nr_ttg) * sizeof(struct transition_s)));
   memcpy(retrain_hmmp->trans_tie_groups, hmmp->trans_tie_groups,(hmmp->nr_t + hmmp->nr_ttg) * sizeof(struct transition_s)); 
  
   
@@ -466,7 +466,7 @@
   /* nr of trans tie groups */
   if(fgets(s, MAX_LINE, file) != NULL) {
     hmmp->nr_ttg = atoi(&s[29]);
-    hmmp->trans_tie_groups = (int*)(malloc_or_die((hmmp->nr_t + hmmp->nr_ttg) * sizeof(struct transition_s)));
+    hmmp->trans_tie_groups = (struct transition_s*)(malloc_or_die((hmmp->nr_t + hmmp->nr_ttg) * sizeof(struct transition_s)));
   }
 
   /* nr of emission priorfiles */
--- libpsortb.orig/modhmm0.92b/std_funcs.c
+++ libpsortb/modhmm0.92b/std_funcs.c
@@ -2068,7 +2068,7 @@
   
   /* get gap data (not implemented) */
   for(i = 0; i < msa_seq_infop->msa_seq_length; i++) {
-    *(reverse_msa_seq_infop->gaps + (msa_seq_infop->msa_seq_length + i)) = END;
+    *(reverse_msa_seq_infop->gaps + (msa_seq_infop->msa_seq_length + i)) = (int*)END;
   }
   for(i = 0; i < msa_seq_infop->msa_seq_length; i++) {
     *(reverse_msa_seq_infop->gaps + i) = (int*)(reverse_msa_seq_infop->gaps + (msa_seq_infop->msa_seq_length + i));
@@ -2176,7 +2176,7 @@
 
   /* get gap data (not implemented) */
   for(i = 0; i < msa_seq_infop->msa_seq_length; i++) {
-    *(reverse_msa_seq_infop->gaps + (msa_seq_infop->msa_seq_length + i)) = END;
+    *(reverse_msa_seq_infop->gaps + (msa_seq_infop->msa_seq_length + i)) = (int*)END;
   }
   for(i = 0; i < msa_seq_infop->msa_seq_length; i++) {
     *(reverse_msa_seq_infop->gaps + i) = (int*)(reverse_msa_seq_infop->gaps + (msa_seq_infop->msa_seq_length + i));
@@ -2463,7 +2463,7 @@
   if(em_di->nr_components <= 0) {
     //printf("em_di nr comps = %d\n",em_di->nr_components);
     //printf("alphabet = %d\n", alphabet);
-    return;
+    return YES;  // Initially void, so YES, but actual intention is unclear.
   }
   
   /* set a_size and msa_seq according to alphabet */
--- libpsortb.orig/modhmm0.92b/training_algorithms_multialpha.c
+++ libpsortb/modhmm0.92b/training_algorithms_multialpha.c
@@ -698,7 +698,7 @@
 	    /* loop over the alphabets */
 	    for(alphabet_nr = 1; alphabet_nr <= hmmp->nr_alphabets; alphabet_nr++) {
 	      if(alphabet_nr == 1) {
-		alphabet = hmmp->alphabet;
+		alphabet = (int)hmmp->alphabet;
 		subst_mtx = hmmp->subst_mtx;
 		a_size = hmmp->a_size;
 		E_cur = E;
@@ -707,7 +707,7 @@
 		tmp_emissions = hmmp->emissions;
 	      }
 	      else if(alphabet_nr == 2) {
-		alphabet = hmmp->alphabet_2;
+		alphabet = (int)hmmp->alphabet_2;
 		subst_mtx = hmmp->subst_mtx_2;
 		a_size = hmmp->a_size_2;
 		E_cur = E_2;
@@ -716,7 +716,7 @@
 		tmp_emissions = hmmp->emissions_2;
 	      }
 	      else if(alphabet_nr == 3) {
-		alphabet = hmmp->alphabet_3;
+		alphabet = (int)hmmp->alphabet_3;
 		subst_mtx = hmmp->subst_mtx_3;
 		a_size = hmmp->a_size_3;
 		E_cur = E_3;
@@ -725,7 +725,7 @@
 		tmp_emissions = hmmp->emissions_3;
 	      }
 	      else if(alphabet_nr == 4) {
-		alphabet = hmmp->alphabet_4;
+		alphabet = (int)hmmp->alphabet_4;
 		subst_mtx = hmmp->subst_mtx_4;
 		a_size = hmmp->a_size_4;
 		E_cur = E_4;
@@ -1636,28 +1636,28 @@
 	    /* loop over the alphabets */
 	    for(alphabet_nr = 1; alphabet_nr <= hmmp->nr_alphabets; alphabet_nr++) {
 	      if(alphabet_nr == 1) {
-		alphabet = hmmp->alphabet;
+		alphabet = (int)hmmp->alphabet;
 		subst_mtx = hmmp->subst_mtx;
 		a_size = hmmp->a_size;
 		E_cur = E_ulab;
 		msa_seq = msa_seq_infop->msa_seq_1;
 	      }
 	      else if(alphabet_nr == 2) {
-		alphabet = hmmp->alphabet_2;
+		alphabet = (int)hmmp->alphabet_2;
 		subst_mtx = hmmp->subst_mtx_2;
 		a_size = hmmp->a_size_2;
 		E_cur = E_ulab_2;
 		msa_seq = msa_seq_infop->msa_seq_2;
 	      }
 	      else if(alphabet_nr == 3) {
-		alphabet = hmmp->alphabet_3;
+		alphabet = (int)hmmp->alphabet_3;
 		subst_mtx = hmmp->subst_mtx_3;
 		a_size = hmmp->a_size_3;
 		E_cur = E_ulab_3;
 		msa_seq = msa_seq_infop->msa_seq_3;
 	      }
 	      else if(alphabet_nr == 4) {
-		alphabet = hmmp->alphabet_4;
+		alphabet = (int)hmmp->alphabet_4;
 		subst_mtx = hmmp->subst_mtx_4;
 		a_size = hmmp->a_size_4;
 		E_cur = E_ulab_4;
@@ -1781,28 +1781,28 @@
 	    /* loop over the alphabets */
 	    for(alphabet_nr = 1; alphabet_nr <= hmmp->nr_alphabets; alphabet_nr++) {
 	      if(alphabet_nr == 1) {
-		alphabet = hmmp->alphabet;
+		alphabet = (int)hmmp->alphabet;
 		subst_mtx = hmmp->subst_mtx;
 		a_size = hmmp->a_size;
 		E_cur = E_lab;
 		msa_seq = msa_seq_infop->msa_seq_1;
 	      }
 	      else if(alphabet_nr == 2) {
-		alphabet = hmmp->alphabet_2;
+		alphabet = (int)hmmp->alphabet_2;
 		subst_mtx = hmmp->subst_mtx_2;
 		a_size = hmmp->a_size_2;
 		E_cur = E_lab_2;
 		msa_seq = msa_seq_infop->msa_seq_2;
 	      }
 	      else if(alphabet_nr == 3) {
-		alphabet = hmmp->alphabet_3;
+		alphabet = (int)hmmp->alphabet_3;
 		subst_mtx = hmmp->subst_mtx_3;
 		a_size = hmmp->a_size_3;
 		E_cur = E_lab_3;
 		msa_seq = msa_seq_infop->msa_seq_3;
 	      }
 	      else if(alphabet_nr == 4) {
-		alphabet = hmmp->alphabet_4;
+		alphabet = (int)hmmp->alphabet_4;
 		subst_mtx = hmmp->subst_mtx_4;
 		a_size = hmmp->a_size_4;
 		E_cur = E_lab_4;
@@ -3586,11 +3586,11 @@
   }
   else if(scoring_method == SUBST_MTX_DOT_PRODUCT && use_nr_occ == YES) {
     add_to_E_subst_mtx_dot_product_nr_occ(E, Eka_base, msa_seq, p, k, a_size, normalize, subst_mtx,
-					  alphabet);
+					  (char*)alphabet);
   }
   else if(scoring_method == SUBST_MTX_DOT_PRODUCT_PRIOR && use_nr_occ == YES) {
     add_to_E_subst_mtx_dot_product_prior_nr_occ(E, Eka_base, msa_seq, p, k, a_size, normalize, subst_mtx,
-						alphabet);
+						(char*)alphabet);
   }
   else if(scoring_method == DOT_PRODUCT) {
     add_to_E_dot_product(E, Eka_base, msa_seq, p, k, a_size, normalize);
@@ -3615,11 +3615,11 @@
   }
   else if(scoring_method == SUBST_MTX_DOT_PRODUCT) {
     add_to_E_subst_mtx_dot_product(E, Eka_base, msa_seq, p, k, a_size, normalize, subst_mtx,
-				   alphabet);
+				   (char*)alphabet);
   }
   else if(scoring_method == SUBST_MTX_DOT_PRODUCT_PRIOR) {
     add_to_E_subst_mtx_dot_product_prior(E, Eka_base, msa_seq, p, k, a_size, normalize, subst_mtx,
-					 alphabet);
+					 (char*)alphabet);
   }
   else {
     printf("Error: Unrecognized scoring method\n");
