From 592e0945fcfb94d641c16f2cf02add0c0430b226 Mon Sep 17 00:00:00 2001
From: Calvin Morrison <mutantturkey@gmail.com>
Date: Tue, 4 Mar 2014 14:19:46 -0500
Subject: fix all warnings and that weird bug

---
 src/c/kmer_utils.c        |  4 ++--
 src/c/multifasta_to_otu.c | 10 +++++-----
 src/c/quikr.c             |  2 +-
 src/c/quikr_functions.c   |  1 -
 src/c/test.c              |  4 +---
 5 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/c/kmer_utils.c b/src/c/kmer_utils.c
index ca33156..0980a69 100644
--- a/src/c/kmer_utils.c
+++ b/src/c/kmer_utils.c
@@ -28,7 +28,7 @@ unsigned long num_to_index(const char *str, const int kmer, const long error_pos
 
   for(i = kmer - 1; i >= 0; i--){
 
-		if(str[i] >> 2) { 
+		if(str[i] == 5) { 
 			// position += i;
 			return error_pos;
 		}
@@ -117,7 +117,7 @@ unsigned long long * get_kmer_counts_from_file(const char *fn, const unsigned in
 
 		// strip out all other newlines to handle multiline sequences
 		str = strnstrip(start, str, '\n',start_len);
-		size_t seq_length = strlen(str);
+		ssize_t seq_length = strlen(str);
 		if(seq_length < kmer)
 			continue;
 
diff --git a/src/c/multifasta_to_otu.c b/src/c/multifasta_to_otu.c
index 7513b11..fcb0822 100644
--- a/src/c/multifasta_to_otu.c
+++ b/src/c/multifasta_to_otu.c
@@ -38,7 +38,7 @@ char **get_fasta_files(char *directory) {
     exit(EXIT_FAILURE);
   } 
 
-	while(e = readdir(dh)) 
+	while((e = readdir(dh))) 
 		count++; 
 	
 	e = NULL;
@@ -226,11 +226,11 @@ int main(int argc, char **argv) {
 
   struct matrix *sensing_matrix = load_sensing_matrix(sensing_matrix_filename, kmer);
 	double *sensing_matrix_ptr = sensing_matrix->matrix;
-	unsigned long long sequences = sensing_matrix->matrix;
+	unsigned long long sequences = sensing_matrix->sequences;
 
   if(verbose) {
     printf("directory count: %llu\n", dir_count);
-    printf("width: %llu\nsequences %llu\n", width, sensing_matrix->sequences);
+    printf("width: %llu\nsequences %llu\n", width, sequences);
 	}
 
   unsigned long long *solutions = malloc(dir_count * sequences * sizeof(unsigned long long));
@@ -244,7 +244,7 @@ int main(int argc, char **argv) {
 	#endif
   printf("Beginning to process samples\n"); 
   #pragma omp parallel for shared(solutions, sensing_matrix_ptr, width, done, sequences)
-  for(long i = 0; i < dir_count; i++ ) {
+  for(size_t i = 0; i < dir_count; i++ ) {
 
 		unsigned long long x = 0;
 		unsigned long long y = 0;
@@ -343,7 +343,7 @@ int main(int argc, char **argv) {
 		double *solution = nnls(sensing_matrix_rare, count_matrix_rare, sequences, rare_width);
 
 		// add the current solution to the solutions array
-		for(int z = 0; z < sequences; z++ )  {
+		for(unsigned long long z = 0; z < sequences; z++ )  {
 			solutions[sensing_matrix->sequences*i + z] = (unsigned long long)round(solution[z] * file_sequence_count);
 		}
 
diff --git a/src/c/quikr.c b/src/c/quikr.c
index bbe6a31..180a548 100644
--- a/src/c/quikr.c
+++ b/src/c/quikr.c
@@ -116,7 +116,7 @@ int main(int argc, char **argv) {
 	}
 
   if(verbose) {
-    printf("rare width:%ld\n", rare_width);
+    printf("rare width:%llu\n", rare_width);
     printf("kmer: %u\n", kmer);
     printf("lambda: %llu\n", lambda);
     printf("fasta: %s\n", input_fasta_filename);
diff --git a/src/c/quikr_functions.c b/src/c/quikr_functions.c
index 178c1d1..89f0698 100644
--- a/src/c/quikr_functions.c
+++ b/src/c/quikr_functions.c
@@ -21,7 +21,6 @@ void check_malloc(void *ptr, char *error) {
 	}
 }
 
-
 void debug_arrays(double *count_matrix, struct matrix *sensing_matrix) {
 	FILE *count_fh = fopen("count.mat", "w");
 	FILE *sensing_fh = fopen("sensing.mat", "w");
diff --git a/src/c/test.c b/src/c/test.c
index fa905af..0122dc3 100644
--- a/src/c/test.c
+++ b/src/c/test.c
@@ -60,7 +60,6 @@ void test_normalize_matrix() {
 	int test_number = 1;
 	int fail_flag = 0;
 	char *test_name = "test_normailze_matrix";
-	char *type = "%lf";
 
 	double sum = 0;
 	int i = 0;
@@ -106,8 +105,7 @@ void test_normalize_matrix() {
 		
 }
 
-int main(int argc, char **argv) {
-	int test_number = 1;
+int main() {
 
 	header("count_sequences");
 	test_count_sequences();
-- 
cgit v1.2.3