aboutsummaryrefslogtreecommitdiff
path: root/kmer_utils.c
diff options
context:
space:
mode:
authororbitz <orbitz@gmail.com>2014-01-18 15:31:56 +0100
committerorbitz <orbitz@gmail.com>2014-01-18 19:54:13 +0100
commit26cffc51bdd89be81938e55f3a8e9c92ba21b204 (patch)
treed30dcf7dbb8f7f201a838a405b5d4ba86b9e5a36 /kmer_utils.c
parent78b0a8db8d41d9748ea8cba41120821bf3876b9c (diff)
Fix compiler warnings
Diffstat (limited to 'kmer_utils.c')
-rw-r--r--kmer_utils.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/kmer_utils.c b/kmer_utils.c
index a2fed0e..3b38985 100644
--- a/kmer_utils.c
+++ b/kmer_utils.c
@@ -11,7 +11,7 @@
#define ERROR 5
#define SPACE 6
-#define BUFSIZ 256
+#define BUFFER_SIZE 256
const unsigned char kmer_alpha[256] =
// \n
@@ -159,12 +159,11 @@ static size_t fread_save_n_bytes(char *buffer, FILE *fh, size_t save_size, size_
}
unsigned long long *kmer_counts_from_file(FILE *fh, const unsigned int kmer) {
- char buffer[BUFSIZ] = { 0 };
+ char buffer[BUFFER_SIZE] = { 0 };
bool header = false;
bool started = false;
size_t len = 0;
- size_t position;
const unsigned long width = kmer_pow_four(kmer);
@@ -175,17 +174,17 @@ unsigned long long *kmer_counts_from_file(FILE *fh, const unsigned int kmer) {
exit(EXIT_FAILURE);
}
- size_t save_size = kmer - 1;
- while((len = fread_save_n_bytes(buffer, fh, save_size, BUFSIZ - 1, len)) != NULL) {
+ size_t save_size = kmer - 1;
+ while((len = fread_save_n_bytes(buffer, fh, save_size, BUFFER_SIZE - 1, len)) != 0) {
size_t i;
- char *ptr = buffer + save_size;
- size_t ptr_len = len;
-
- if(!started) {
- ptr_len = len + save_size;
- ptr = buffer;
- }
-
+ char *ptr = buffer + save_size;
+ size_t ptr_len = len;
+
+ if(!started) {
+ ptr_len = len + save_size;
+ ptr = buffer;
+ }
+
header = translate_nucleotides_to_numbers(ptr, ptr_len, kmer_alpha, header);
for(i = 0; i < (len - kmer + 1); i++) {