Browse code

Fix warnings

John Hawthorn authored on 13/07/2014 05:16:13
Showing 2 changed files

  • fzy.c index ae20402..7a39084 100644
  • match.c index 967607b..c8af16b 100644
... ...
@@ -1,3 +1,4 @@
1
+#define _GNU_SOURCE
1 2
 #include <stdio.h>
2 3
 #include <string.h>
3 4
 #include <stdlib.h>
... ...
@@ -16,7 +17,7 @@ int choices_n = 0;
16 17
 const char **choices = NULL;
17 18
 double *choices_score = NULL;
18 19
 size_t *choices_sorted = NULL;
19
-int current_selection = 0;
20
+size_t current_selection = 0;
20 21
 
21 22
 void resize_choices(int new_capacity){
22 23
 	choices = realloc(choices, new_capacity * sizeof(const char *));
... ...
@@ -137,11 +138,10 @@ void clear(){
137 138
 
138 139
 void draw(){
139 140
 	int line = 0;
140
-	int i;
141 141
 	const char *prompt = "> ";
142 142
 	clear();
143 143
 	fprintf(ttyout, "%s%s\n", prompt, search);
144
-	for(i = 0; line < 10 && i < choices_available; i++){
144
+	for(size_t i = 0; line < 10 && i < choices_available; i++){
145 145
 		if(i == current_selection)
146 146
 			fprintf(ttyout, "%c%c7m", 0x1b, '[');
147 147
 		else
... ...
@@ -150,7 +150,7 @@ void draw(){
150 150
 		line++;
151 151
 	}
152 152
 	fprintf(ttyout, "%c%c%iA", 0x1b, '[', line + 1);
153
-	fprintf(ttyout, "%c%c%iG", 0x1b, '[', strlen(prompt) + strlen(search) + 1);
153
+	fprintf(ttyout, "%c%c%ziG", 0x1b, '[', strlen(prompt) + strlen(search) + 1);
154 154
 	fflush(ttyout);
155 155
 }
156 156
 
... ...
@@ -18,7 +18,7 @@ void mat_print(int *mat, int n, int m){
18 18
 	int i, j;
19 19
 	for(i = 0; i < n; i++){
20 20
 		for(j = 0; j < m; j++){
21
-			fprintf(stderr, " %3zd", mat[i*m + j]);
21
+			fprintf(stderr, " %3i", mat[i*m + j]);
22 22
 		}
23 23
 		fprintf(stderr, "\n");
24 24
 	}