diff --git a/bgzf.c b/bgzf.c index 9833414..da1a107 100644 --- a/bgzf.c +++ b/bgzf.c @@ -547,7 +547,7 @@ int bgzf_getline(BGZF *fp, int delim, kstring_t *str) fp->block_address = _bgzf_tell((_bgzf_file_t)fp->fp); fp->block_offset = 0; fp->block_length = 0; - } + } } while (state == 0); if (str->l == 0 && state < 0) return state; str->s[str->l] = 0; diff --git a/bgzf.h b/bgzf.h index 29fe0e5..65a36b7 100644 --- a/bgzf.h +++ b/bgzf.h @@ -163,7 +163,7 @@ extern "C" { void bgzf_set_cache_size(BGZF *fp, int size); /** - * Flush the file if the remaining buffer size is smaller than _size_ + * Flush the file if the remaining buffer size is smaller than _size_ */ int bgzf_flush_try(BGZF *fp, ssize_t size); diff --git a/khmm.c b/khmm.c index 711ade5..c64e133 100644 --- a/khmm.c +++ b/khmm.c @@ -85,7 +85,7 @@ FLOAT hmm_Viterbi(const hmm_par_t *hp, hmm_data_t *hd) FLOAT **la, **le, *preV, *curV, max; int **Vmax, max_l; // backtrace matrix int k, l, b, u; - + if (hd->v) free(hd->v); hd->v = (int*)calloc(hd->L+1, sizeof(int)); la = (FLOAT**)calloc2(hp->n, hp->n, sizeof(FLOAT)); @@ -151,7 +151,7 @@ void hmm_forward(const hmm_par_t *hp, hmm_data_t *hd) // allocate memory for hd->f and hd->s n = hp->n; m = hp->m; L = hd->L; if (hd->s) free(hd->s); - if (hd->f) { + if (hd->f) { for (k = 0; k <= hd->L; ++k) free(hd->f[k]); free(hd->f); } @@ -216,7 +216,7 @@ void hmm_backward(const hmm_par_t *hp, hmm_data_t *hd) assert(hd->status & HMM_FORWARD); // allocate memory for hd->b m = hp->m; n = hp->n; L = hd->L; - if (hd->b) { + if (hd->b) { for (k = 0; k <= hd->L; ++k) free(hd->b[k]); free(hd->b); } @@ -413,7 +413,7 @@ char *hmm_simulate(const hmm_par_t *hp, int L) for (b = 0, y = 0.0; b != hp->m; ++b) { y += el[b]; if (y >= x) break; - } + } seq[i] = b; k = l; } diff --git a/kmath.c b/kmath.c index 9807b00..4e5d5e5 100644 --- a/kmath.c +++ b/kmath.c @@ -7,7 +7,7 @@ *** Pseudo-random number generator *** **************************************/ -/* +/* 64-bit Mersenne Twister pseudorandom number generator. Adapted from: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/C-LANG/mt19937-64.c @@ -29,7 +29,7 @@ struct _krand_t { static void kr_srand0(krint64_t seed, krand_t *kr) { kr->mt[0] = seed; - for (kr->mti = 1; kr->mti < KR_NN; ++kr->mti) + for (kr->mti = 1; kr->mti < KR_NN; ++kr->mti) kr->mt[kr->mti] = 6364136223846793005ULL * (kr->mt[kr->mti - 1] ^ (kr->mt[kr->mti - 1] >> 62)) + kr->mti; } @@ -87,14 +87,14 @@ int main(int argc, char *argv[]) ******************************/ /* Hooke-Jeeves algorithm for nonlinear minimization - + Based on the pseudocodes by Bell and Pike (CACM 9(9):684-685), and the revision by Tomlin and Smith (CACM 12(11):637-638). Both of the papers are comments on Kaupe's Algorithm 178 "Direct Search" (ACM 6(6):313-314). The original algorithm was designed by Hooke and Jeeves (ACM 8:212-229). This program is further revised according to Johnson's implementation at Netlib (opt/hooke.c). - + Hooke-Jeeves algorithm is very simple and it works quite well on a few examples. However, it might fail to converge due to its heuristic nature. A possible improvement, as is suggested by Johnson, may be to diff --git a/knetfile.c b/knetfile.c index 158add9..e598b34 100644 --- a/knetfile.c +++ b/knetfile.c @@ -392,7 +392,7 @@ knetFile *khttp_parse_url(const char *fn, const char *mode) } else { fp->host = (strstr(proxy, "http://") == proxy)? strdup(proxy + 7) : strdup(proxy); for (q = fp->host; *q && *q != ':'; ++q); - if (*q == ':') *q++ = 0; + if (*q == ':') *q++ = 0; fp->port = strdup(*q? q : "80"); fp->path = strdup(fn); } @@ -473,7 +473,7 @@ knetFile *knet_open(const char *fn, const char *mode) * be undefined on some systems, although it is defined on my * Mac and the Linux I have tested on. */ int fd = open(fn, O_RDONLY | O_BINARY); -#else +#else int fd = open(fn, O_RDONLY); #endif if (fd == -1) { diff --git a/knetfile.h b/knetfile.h index 0a0e66f..d7b0af2 100644 --- a/knetfile.h +++ b/knetfile.h @@ -50,7 +50,7 @@ extern "C" { knetFile *knet_open(const char *fn, const char *mode); - /* + /* This only works with local files. */ knetFile *knet_dopen(int fd, const char *mode); diff --git a/kopen.c b/kopen.c index f72735c..c998318 100644 --- a/kopen.c +++ b/kopen.c @@ -78,7 +78,7 @@ static int http_open(const char *fn) } else { host = (strstr(proxy, "http://") == proxy)? strdup(proxy + 7) : strdup(proxy); for (q = host; *q && *q != ':'; ++q); - if (*q == ':') *q++ = 0; + if (*q == ':') *q++ = 0; port = strdup(*q? q : "80"); path = strdup(fn); } @@ -152,7 +152,7 @@ static int ftp_open(const char *fn) char host2[80], port2[10]; int v[6], l, fd = -1, ret, pasv_port, pasv_ip[4]; ftpaux_t aux; - + /* parse URL */ if (strstr(fn, "ftp://") != fn) return 0; for (p = (char*)fn + 6; *p && *p != '/'; ++p); @@ -163,7 +163,7 @@ static int ftp_open(const char *fn) strncpy(host, fn + 6, l); retr = calloc(strlen(p) + 8, 1); sprintf(retr, "RETR %s\r\n", p); - + /* connect to ctrl */ memset(&aux, 0, sizeof(ftpaux_t)); aux.ctrl_fd = socket_connect(host, port); diff --git a/ksa.c b/ksa.c index 18f686d..9bbe701 100644 --- a/ksa.c +++ b/ksa.c @@ -150,7 +150,7 @@ int SAIS_CORE(const unsigned char *T, saint_t *SA, saint_t fs, saint_t n, saint_ } induceSA(T, SA, C, B, n, k, cs); if (fs < k) free(C); - /* pack all the sorted LMS into the first m items of SA + /* pack all the sorted LMS into the first m items of SA 2*m must be not larger than n (see Nong et al. for the proof) */ for (i = 0, m = 0; i < n; ++i) { saint_t p = SA[i]; diff --git a/kstring.c b/kstring.c index f029317..2b00a23 100644 --- a/kstring.c +++ b/kstring.c @@ -66,7 +66,7 @@ int ksplit_core(char *s, int delimiter, int *_max, int **_offsets) int i, n, max, last_char, last_start, *offsets, l; n = 0; max = *_max; offsets = *_offsets; l = strlen(s); - + #define __ksplit_aux do { \ if (_offsets) { \ s[i] = 0; \ diff --git a/kstring.h b/kstring.h index 0e654cb..6222cc7 100644 --- a/kstring.h +++ b/kstring.h @@ -1,6 +1,6 @@ /* The MIT License - Copyright (c) by Attractive Chaos + Copyright (c) by Attractive Chaos Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/ksw.c b/ksw.c index 742fec9..378087b 100644 --- a/ksw.c +++ b/ksw.c @@ -543,21 +543,21 @@ int ksw_global(int qlen, const uint8_t *query, int tlen, const uint8_t *target, KSEQ_INIT(gzFile, gzread) unsigned char seq_nt4_table[256] = { - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }; diff --git a/kurl.c b/kurl.c index 3bf9290..a40c12a 100644 --- a/kurl.c +++ b/kurl.c @@ -100,7 +100,7 @@ static int fill_buffer(kurl_t *ku) // fill the buffer int maxfd = -1; long curl_to = -1; struct timeval to; - // the following is adaped from docs/examples/fopen.c + // the following is adaped from docs/examples/fopen.c to.tv_sec = 10, to.tv_usec = 0; // 10 seconds curl_multi_timeout(ku->multi, &curl_to); if (curl_to >= 0) { diff --git a/test/kbit_test.c b/test/kbit_test.c index 3ae3bd3..39c6096 100644 --- a/test/kbit_test.c +++ b/test/kbit_test.c @@ -52,19 +52,19 @@ static uint32_t sse2_bit_count32(const __m128i* block, const __m128i* block_end) __m128i tmp1, tmp2; do - { + { __m128i b = _mm_load_si128(block); ++block; // b = (b & 0x55555555) + (b >> 1 & 0x55555555); tmp1 = _mm_srli_epi32(b, 1); // tmp1 = (b >> 1 & 0x55555555) - tmp1 = _mm_and_si128(tmp1, m1); + tmp1 = _mm_and_si128(tmp1, m1); tmp2 = _mm_and_si128(b, m1); // tmp2 = (b & 0x55555555) b = _mm_add_epi32(tmp1, tmp2); // b = tmp1 + tmp2 // b = (b & 0x33333333) + (b >> 2 & 0x33333333); tmp1 = _mm_srli_epi32(b, 2); // (b >> 2 & 0x33333333) - tmp1 = _mm_and_si128(tmp1, m2); + tmp1 = _mm_and_si128(tmp1, m2); tmp2 = _mm_and_si128(b, m2); // (b & 0x33333333) b = _mm_add_epi32(tmp1, tmp2); // b = tmp1 + tmp2 diff --git a/test/kstring_bench2.c b/test/kstring_bench2.c index b7707a8..866a561 100644 --- a/test/kstring_bench2.c +++ b/test/kstring_bench2.c @@ -112,7 +112,7 @@ int main() memcpy(tmp, data + y, pat_len); ret = strnstr(data, tmp, str_len); } - fprintf(stderr, "Search patterns in %.3f sec\n", (float)(clock() - t) / CLOCKS_PER_SEC); + fprintf(stderr, "Search patterns in %.3f sec\n", (float)(clock() - t) / CLOCKS_PER_SEC); } #endif #ifdef HAVE_MEMMEM diff --git a/test/kthread_test.c b/test/kthread_test.c index 1b67ed4..7452ce9 100644 --- a/test/kthread_test.c +++ b/test/kthread_test.c @@ -27,7 +27,7 @@ static void compute(void *_g, int i, int tid) x *= x; y *= y; if (x + y >= 4) break; x = x - y + x0; - y = z + z + y0; + y = z + z + y0; } g->k[i] = k; }