Browse Source

Enable and resolve several warnings

K. Lange 4 years ago
parent
commit
8e07883088

+ 1 - 1
Makefile

@@ -23,7 +23,7 @@ TARGET_TRIPLET=i686-pc-toaru
 
 CC=$(TARGET_TRIPLET)-gcc
 AR=$(TARGET_TRIPLET)-ar
-CFLAGS= -O3 -m32 -Wa,--32 -g -std=c99 -I. -Iapps -pipe -mfpmath=sse -mmmx -msse -msse2 -fplan9-extensions
+CFLAGS= -O3 -m32 -Wa,--32 -g -std=c99 -I. -Iapps -pipe -mfpmath=sse -mmmx -msse -msse2 -fplan9-extensions -Wall -Wextra -Wno-unused-parameter
 
 LIBC_OBJS=$(patsubst %.c,%.o,$(wildcard libc/*.c))
 LC=base/lib/libc.so

+ 0 - 13
apps/about.c

@@ -44,19 +44,6 @@ static void redraw(void) {
 	yutani_flip(yctx, window);
 }
 
-static void resize_finish(int w, int h) {
-	yutani_window_resize_accept(yctx, window, w, h);
-	reinit_graphics_yutani(ctx, window);
-
-	width  = w - decor_left_width - decor_right_width;
-	height = h - decor_top_height - decor_bottom_height;
-
-	redraw();
-
-	yutani_window_resize_done(yctx, window);
-	yutani_flip(yctx, window);
-}
-
 int main(int argc, char * argv[]) {
 	struct utsname u;
 	uname(&u);

+ 0 - 1
apps/background.c

@@ -61,7 +61,6 @@ int main (int argc, char ** argv) {
 		if (m) {
 			switch (m->type) {
 				case YUTANI_MSG_WELCOME:
-					fprintf(stderr, "Request to resize desktop received, resizing to %d x %d\n", yctx->display_width, yctx->display_height);
 					yutani_window_resize_offer(yctx, wallpaper_window, yctx->display_width, yctx->display_height);
 					break;
 				case YUTANI_MSG_RESIZE_OFFER:

+ 24 - 27
apps/bim.c

@@ -42,8 +42,8 @@ typedef struct {
 } __attribute__((packed)) char_t;
 
 typedef struct {
-	uint32_t available;
-	uint32_t actual;
+	int available;
+	int actual;
 	char_t   text[0];
 } line_t;
 
@@ -66,8 +66,8 @@ typedef struct _env {
 
 buffer_t * env;
 
-uint32_t    buffers_len;
-uint32_t    buffers_avail;
+int    buffers_len;
+int    buffers_avail;
 buffer_t ** buffers;
 
 buffer_t * buffer_new() {
@@ -83,7 +83,7 @@ buffer_t * buffer_new() {
 }
 
 buffer_t * buffer_close(buffer_t * buf) {
-	uint32_t i;
+	int i;
 	for (i = 0; i < buffers_len; i++) {
 		if (buf == buffers[i])
 			break;
@@ -106,7 +106,7 @@ buffer_t * buffer_close(buffer_t * buf) {
 	return buffers[buffers_len];
 }
 
-line_t * line_insert(line_t * line, char_t c, uint32_t offset) {
+line_t * line_insert(line_t * line, char_t c, int offset) {
 	if (line->actual == line->available) {
 		line->available *= 2;
 		line = realloc(line, sizeof(line_t) + sizeof(char_t) * line->available);
@@ -119,7 +119,7 @@ line_t * line_insert(line_t * line, char_t c, uint32_t offset) {
 	return line;
 }
 
-void line_delete(line_t * line, uint32_t offset) {
+void line_delete(line_t * line, int offset) {
 	if (offset == 0) return;
 	if (offset < line->actual) {
 		memmove(&line->text[offset-1], &line->text[offset], sizeof(char_t) * (line->actual - offset - 1));
@@ -127,7 +127,7 @@ void line_delete(line_t * line, uint32_t offset) {
 	line->actual -= 1;
 }
 
-line_t ** add_line(line_t ** lines, uint32_t offset) {
+line_t ** add_line(line_t ** lines, int offset) {
 	if (env->line_count == env->line_avail) {
 		env->line_avail *= 2;
 		lines = realloc(lines, sizeof(line_t *) * env->line_avail);
@@ -142,7 +142,7 @@ line_t ** add_line(line_t ** lines, uint32_t offset) {
 	return lines;
 }
 
-line_t ** split_line(line_t ** lines, uint32_t line, uint32_t split) {
+line_t ** split_line(line_t ** lines, int line, int split) {
 	if (split == 0) {
 		return add_line(lines, line - 1);
 	}
@@ -153,9 +153,9 @@ line_t ** split_line(line_t ** lines, uint32_t line, uint32_t split) {
 	if (line < env->line_count) {
 		memmove(&lines[line+1], &lines[line], sizeof(line_t *) * (env->line_count - line));
 	}
-	uint32_t remaining = lines[line-1]->actual - split;
+	int remaining = lines[line-1]->actual - split;
 
-	uint32_t v = remaining;
+	int v = remaining;
 	v--;
 	v |= v >> 1;
 	v |= v >> 2;
@@ -229,11 +229,11 @@ void set_buffered() {
 	tcsetattr(fileno(stdin), TCSAFLUSH, &old);
 }
 
-int to_eight(uint32_t codepoint, uint8_t * out) {
+int to_eight(uint32_t codepoint, char * out) {
 	memset(out, 0x00, 7);
 
 	if (codepoint < 0x0080) {
-		out[0] = (uint8_t)codepoint;
+		out[0] = (char)codepoint;
 	} else if (codepoint < 0x0800) {
 		out[0] = 0xC0 | (codepoint >> 6);
 		out[1] = 0x80 | (codepoint & 0x3F);
@@ -318,7 +318,7 @@ void clear_screen() {
 
 void redraw_tabbar() {
 	place_cursor(1,1);
-	for (uint32_t i = 0; i < buffers_len; i++) {
+	for (int i = 0; i < buffers_len; i++) {
 		buffer_t * _env = buffers[i];
 		if (_env == env) {
 			reset();
@@ -351,8 +351,8 @@ int log_base_10(unsigned int v) {
 }
 
 void render_line(line_t * line, int width, int offset) {
-	uint32_t i = 0;
-	uint32_t j = 0;
+	int i = 0;
+	int j = 0;
 	set_colors(COLOR_FG, COLOR_BG);
 	while (i < line->actual) {
 		char_t c = line->text[i];
@@ -390,7 +390,6 @@ void render_line(line_t * line, int width, int offset) {
 }
 
 void realign_cursor() {
-	line_t * line = env->lines[env->line_no-1];
 	int x = -env->coffset;
 	int i = 0;
 	for (; i < env->col_no - 1; ++i) {
@@ -623,7 +622,7 @@ void quit() {
 }
 
 void try_quit() {
-	for (uint32_t i = 0; i < buffers_len; i++ ) {
+	for (int i = 0; i < buffers_len; i++ ) {
 		buffer_t * _env = buffers[i];
 		if (_env->modified) {
 			char msg[100];
@@ -637,7 +636,7 @@ void try_quit() {
 
 void previous_tab() {
 	buffer_t * last = NULL;
-	for (uint32_t i = 0; i < buffers_len; i++) {
+	for (int i = 0; i < buffers_len; i++) {
 		buffer_t * _env = buffers[i];
 		if (_env == env) {
 			if (last) {
@@ -655,7 +654,7 @@ void previous_tab() {
 }
 
 void next_tab() {
-	for (uint32_t i = 0; i < buffers_len; i++) {
+	for (int i = 0; i < buffers_len; i++) {
 		buffer_t * _env = buffers[i];
 		if (_env == env) {
 			if (i != buffers_len - 1) {
@@ -692,7 +691,7 @@ void write_file(char * file) {
 		render_error("Failed to open file for writing.");
 	}
 
-	uint32_t i, j;
+	int i, j;
 	for (i = 0; i < env->line_count; ++i) {
 		line_t * line = env->lines[i];
 		for (j = 0; j < line->actual; j++) {
@@ -797,7 +796,7 @@ void command_mode() {
 	printf(":");
 	fflush(stdout);
 
-	while (c = fgetc(stdin)) {
+	while ((c = fgetc(stdin))) {
 		if (c == '\033') {
 			break;
 		} else if (c == ENTER_KEY) {
@@ -824,7 +823,7 @@ void command_mode() {
 }
 
 void insert_mode() {
-	uint8_t cin;
+	int cin;
 	uint32_t c;
 	redraw_commandline();
 	set_bold();
@@ -832,7 +831,7 @@ void insert_mode() {
 	reset();
 	place_cursor_actual();
 	set_colors(COLOR_FG, COLOR_BG);
-	while (cin = fgetc(stdin)) {
+	while ((cin = fgetc(stdin))) {
 		if (!decode(&istate, &c, cin)) {
 			switch (c) {
 				case '\033':
@@ -907,9 +906,8 @@ int main(int argc, char * argv[]) {
 	while (1) {
 		redraw_all();
 		place_cursor_actual();
-		char buf[1];
 		char c;
-		while (c = fgetc(stdin)) {
+		while ((c = fgetc(stdin))) {
 			switch (c) {
 				case '\033':
 					redraw_all();
@@ -1021,7 +1019,6 @@ _insert:
 			}
 			place_cursor_actual();
 		}
-_continue:
 		printf("%c", c);
 	}
 

+ 5 - 5
apps/compositor.c

@@ -194,8 +194,8 @@ static uint32_t yutani_current_time(yutani_globals_t * yg) {
 	struct timeval t;
 	gettimeofday(&t, NULL);
 
-	uint32_t sec_diff = t.tv_sec - yg->start_time;
-	uint32_t usec_diff = t.tv_usec - yg->start_subtime;
+	time_t sec_diff = t.tv_sec - yg->start_time;
+	suseconds_t usec_diff = t.tv_usec - yg->start_subtime;
 
 	if (t.tv_usec < yg->start_subtime) {
 		sec_diff -= 1;
@@ -1408,7 +1408,7 @@ static void handle_key_event(yutani_globals_t * yg, struct yutani_msg_key_event
 	if (hashmap_has(yg->key_binds, (void*)key_code)) {
 		struct key_bind * bind = hashmap_get(yg->key_binds, (void*)key_code);
 
-		yutani_msg_t * response = yutani_msg_build_key_event(focused ? focused->wid : -1, &ke->event, &ke->state);
+		yutani_msg_t * response = yutani_msg_build_key_event(focused ? focused->wid : UINT32_MAX, &ke->event, &ke->state);
 		pex_send(yg->server, bind->owner, response->size, (char *)response);
 		free(response);
 
@@ -1589,8 +1589,8 @@ static void handle_mouse_event(yutani_globals_t * yg, struct yutani_msg_mouse_ev
 
 	if (yg->mouse_x < 0) yg->mouse_x = 0;
 	if (yg->mouse_y < 0) yg->mouse_y = 0;
-	if (yg->mouse_x > (yg->width) * MOUSE_SCALE) yg->mouse_x = (yg->width) * MOUSE_SCALE;
-	if (yg->mouse_y > (yg->height) * MOUSE_SCALE) yg->mouse_y = (yg->height) * MOUSE_SCALE;
+	if (yg->mouse_x > (int)(yg->width) * MOUSE_SCALE) yg->mouse_x = (yg->width) * MOUSE_SCALE;
+	if (yg->mouse_y > (int)(yg->height) * MOUSE_SCALE) yg->mouse_y = (yg->height) * MOUSE_SCALE;
 
 	switch (yg->mouse_state) {
 		case YUTANI_MOUSE_STATE_NORMAL:

+ 0 - 1
apps/date.c

@@ -17,7 +17,6 @@ void print_time(time_t time) {
     if (!date) {
         fprintf(stderr, "Failure.\n");
     } else {
-        int t_year = 1900 + date->tm_year;
         printf("%d-%02d-%02d %02d:%02d:%02d (%s, day %d)\n",
                 date->tm_year + 1900,
                 date->tm_mon + 1,

+ 1 - 8
apps/drawlines.c

@@ -26,14 +26,6 @@ static yutani_window_t * wina;
 static gfx_context_t * ctx;
 static int should_exit = 0;
 
-static int32_t min(int32_t a, int32_t b) {
-	return (a < b) ? a : b;
-}
-
-static int32_t max(int32_t a, int32_t b) {
-	return (a > b) ? a : b;
-}
-
 uint32_t __attribute__ ((pure)) krand(void) {
 	static uint32_t x = 123456789;
 	static uint32_t y = 362436069;
@@ -55,6 +47,7 @@ void * draw_thread(void * garbage) {
 		usleep(16666);
 	}
 	pthread_exit(0);
+	return NULL;
 }
 
 int main (int argc, char ** argv) {

+ 3 - 3
apps/echo.c

@@ -42,17 +42,17 @@ int main(int argc, char ** argv) {
 
 	for (int i = start; i < argc; ++i) {
 		if (process_escapes) {
-			for (int j = 0; j < strlen(argv[i]) - 1; ++j) {
+			for (int j = 0; j < (int)strlen(argv[i]) - 1; ++j) {
 				if (argv[i][j] == '\\') {
 					if (argv[i][j+1] == 'e') {
 						argv[i][j] = '\033';
-						for (int k = j + 1; k < strlen(argv[i]); ++k) {
+						for (int k = j + 1; k < (int)strlen(argv[i]); ++k) {
 							argv[i][k] = argv[i][k+1];
 						}
 					}
 					if (argv[i][j+1] == 'n') {
 						argv[i][j] = '\n';
-						for (int k = j + 1; k < strlen(argv[i]); ++k) {
+						for (int k = j + 1; k < (int)strlen(argv[i]); ++k) {
 							argv[i][k] = argv[i][k+1];
 						}
 					}

+ 1 - 1
apps/http-get.c

@@ -208,7 +208,7 @@ int main(int argc, char * argv[]) {
 	list_t * hash_keys = hashmap_keys(headers);
 	foreach(_key, hash_keys) {
 		char * key = (char *)_key->value;
-		fprintf(stderr, "[%s] = %s\n", key, hashmap_get(headers, key));
+		fprintf(stderr, "[%s] = %s\n", key, (char*)hashmap_get(headers, key));
 	}
 	list_free(hash_keys);
 	free(hash_keys);

+ 5 - 10
apps/init.c

@@ -12,6 +12,9 @@ void set_console() {
 		_stdout = syscall_open("/dev/null", 1, 0);
 		_stderr = syscall_open("/dev/null", 1, 0);
 	}
+
+	(void)_stderr;
+	(void)_stdin;
 }
 
 int start_options(char * args[]) {
@@ -26,7 +29,7 @@ int start_options(char * args[]) {
 			"WM_THEME=fancy",
 			NULL,
 		};
-		int i = syscall_execve(args[0], args, _envp);
+		syscall_execve(args[0], args, _envp);
 		syscall_exit(0);
 	} else {
 		int pid = 0;
@@ -34,23 +37,15 @@ int start_options(char * args[]) {
 			pid = wait(NULL);
 		} while ((pid > 0) || (pid == -1 && errno == EINTR));
 	}
+	return 0;
 }
 
 int main(int argc, char * argv[]) {
 	set_console();
 
-	char * _argv[] = {
-		"/bin/compositor",
-		NULL,
-	};
-
 	syscall_sethostname("base");
 
 	if (argc > 1) {
-		char * args = NULL;
-		if (argc > 2) {
-			args = argv[2];
-		}
 		if (!strcmp(argv[1], "--vga")) {
 			return start_options((char *[]){"/bin/terminal-vga","-l",NULL});
 		} else if (!strcmp(argv[1], "--migrate")) {

+ 1 - 1
apps/kdebug.c

@@ -6,7 +6,7 @@
 #include <sys/wait.h>
 
 int main(int argc, char * argv[]) {
-	int pid = syscall_system_function(7, NULL);
+	syscall_system_function(7, NULL);
 	int status;
 	wait(&status);
 	return status;

+ 9 - 9
apps/ls.c

@@ -54,7 +54,6 @@
 static int human_readable = 0;
 static int stdout_is_tty = 1;
 static int this_year = 0;
-static int explicit_path_set = 0;
 static int show_hidden = 0;
 static int long_mode   = 0;
 static int print_dir   = 0;
@@ -100,6 +99,7 @@ static int filecmp(const void * c1, const void * c2) {
 	if (a == b) return strcmp(d1->name, d2->name);
 	else if (a < b) return -1;
 	else if (a > b) return 1;
+	return 0; /* impossible ? */
 }
 
 static int filecmp_notypesort(const void * c1, const void * c2) {
@@ -147,12 +147,12 @@ static int print_username(char * _out, int uid) {
 static int print_human_readable_size(char * _out, size_t s) {
 	if (s >= 1<<20) {
 		size_t t = s / (1 << 20);
-		return sprintf(_out, "%d.%1dM", t, (s - t * (1 << 20)) / ((1 << 20) / 10));
+		return sprintf(_out, "%d.%1dM", (int)t, (int)(s - t * (1 << 20)) / ((1 << 20) / 10));
 	} else if (s >= 1<<10) {
 		size_t t = s / (1 << 10);
-		return sprintf(_out, "%d.%1dK", t, (s - t * (1 << 10)) / ((1 << 10) / 10));
+		return sprintf(_out, "%d.%1dK", (int)t, (int)(s - t * (1 << 10)) / ((1 << 10) / 10));
 	} else {
-		return sprintf(_out, "%d", s);
+		return sprintf(_out, "%d", (int)s);
 	}
 }
 
@@ -180,7 +180,7 @@ static void update_column_widths(int * widths, struct tfile * file) {
 	if (human_readable) {
 		n = print_human_readable_size(tmp, file->statbuf.st_size);
 	} else {
-		n = sprintf(tmp, "%d", file->statbuf.st_size);
+		n = sprintf(tmp, "%d", (int)file->statbuf.st_size);
 	}
 	if (n > widths[3]) widths[3] = n;
 }
@@ -220,11 +220,11 @@ static void print_entry_long(int * widths, struct tfile * file) {
 		print_human_readable_size(tmp, file->statbuf.st_size);
 		printf("%*s ", widths[3], tmp);
 	} else {
-		printf("%*d ", widths[3], file->statbuf.st_size);
+		printf("%*d ", widths[3], (int)file->statbuf.st_size);
 	}
 
 	char time_buf[80];
-	struct tm * timeinfo = localtime(&file->statbuf.st_mtime);
+	struct tm * timeinfo = localtime((time_t*)&file->statbuf.st_mtime);
 	if (timeinfo->tm_year == this_year) {
 		strftime(time_buf, 80, "%b %d %H:%M", timeinfo);
 	} else {
@@ -277,7 +277,7 @@ static void display_tfiles(struct tfile ** ents_array, int numents) {
 		/* Determine the gridding dimensions */
 		int ent_max_len = 0;
 		for (int i = 0; i < numents; i++) {
-			ent_max_len = MAX(ent_max_len, strlen(ents_array[i]->name));
+			ent_max_len = MAX(ent_max_len, (int)strlen(ents_array[i]->name));
 		}
 
 		int col_ext = ent_max_len + MIN_COL_SPACING;
@@ -324,7 +324,7 @@ static int display_dir(char * p) {
 
 			char tmp[strlen(p)+strlen(ent->d_name)+2];
 			sprintf(tmp, "%s/%s", p, ent->d_name);
-			int t = lstat(tmp, &f->statbuf);
+			lstat(tmp, &f->statbuf);
 			if (S_ISLNK(f->statbuf.st_mode)) {
 				stat(tmp, &f->statbufl);
 				f->link = malloc(4096);

+ 3 - 3
apps/migrate.c

@@ -30,7 +30,7 @@ int tokenize(char * str, char * sep, char **buf) {
 }
 
 void copy_link(char * source, char * dest) {
-	fprintf(stderr, "need to copy link %s to %s\n");
+	fprintf(stderr, "need to copy link %s to %s\n", source, dest);
 }
 
 void copy_file(char * source, char * dest, int mode) {
@@ -69,7 +69,7 @@ void copy_directory(char * source, char * dest, int mode) {
 	}
 
 	//fprintf(stderr, "Creating %s\n", dest);
-	if (dest == "/") {
+	if (!strcmp(dest, "/")) {
 		dest = "";
 	} else {
 		mkdir(dest, mode);
@@ -89,7 +89,7 @@ void copy_directory(char * source, char * dest, int mode) {
 		char tmp2[strlen(dest)+strlen(ent->d_name)+2];
 		sprintf(tmp2, "%s/%s", dest, ent->d_name);
 		//fprintf(stderr,"%s → %s\n", tmp, tmp2);
-		int t = lstat(tmp,&statbuf);
+		lstat(tmp,&statbuf);
 		if (S_ISLNK(statbuf.st_mode)) {
 			copy_link(tmp, tmp2);
 		} else if (S_ISDIR(statbuf.st_mode)) {

+ 4 - 4
apps/nyancat.c

@@ -357,14 +357,14 @@ int main(int argc, char ** argv) {
 	char term[1024] = {'a','n','s','i', 0};
 	unsigned int k;
 	int ttype;
-	uint32_t option = 0, done = 0, sb_mode = 0;
+	//uint32_t option = 0, done = 0, sb_mode = 0;
 	/* Various pieces for the telnet communication */
-	char  sb[1024] = {0};
-	unsigned short sb_len   = 0;
+	//char  sb[1024] = {0};
+	//unsigned short sb_len   = 0;
 
 	/* Whether or not to show the MOTD intro */
 	char show_intro = 0;
-	char skip_intro = 0;
+	//char skip_intro = 0;
 
 #if 0
 	/* Long option names */

+ 3 - 15
apps/panel.c

@@ -121,10 +121,6 @@ static int center_x_a(int x) {
 	return (ALTTAB_WIDTH - x) / 2;
 }
 
-static int center_y_a(int y) {
-	return (ALTTAB_HEIGHT - y) / 2;
-}
-
 static void redraw(void);
 
 static volatile int _continue = 1;
@@ -286,18 +282,15 @@ static void update_network_status(void) {
 	FILE * net = fopen("/proc/netif","r");
 
 	char line[256];
-	int found = 0;
 
 	do {
 		memset(line, 0, 256);
 		read_line(net, line, 256);
 		if (!*line) break;
 		if (strstr(line,"no network") != NULL) {
-			found = 1;
 			network_status = 0;
 			break;
 		} else if (strstr(line,"ip:") != NULL) {
-			found = 1;
 			network_status = 1;
 			break;
 		}
@@ -532,7 +525,6 @@ static void redraw(void) {
 	spin_lock(&drawlock);
 
 	struct timeval now;
-	int last = 0;
 	struct tm * timeinfo;
 	char   buffer[80];
 
@@ -544,7 +536,6 @@ static void redraw(void) {
 
 	/* Get the current time for the clock */
 	gettimeofday(&now, NULL);
-	last = now.tv_sec;
 	timeinfo = localtime((time_t *)&now.tv_sec);
 
 	/* Hours : Minutes : Seconds */
@@ -802,7 +793,7 @@ static void resize_finish(int xwidth, int xheight) {
 
 	/* Draw the background */
 	draw_fill(ctx, rgba(0,0,0,0));
-	for (uint32_t i = 0; i < xwidth; i += sprite_panel->width) {
+	for (int i = 0; i < xwidth; i += sprite_panel->width) {
 		draw_sprite(ctx, sprite_panel, i, 0);
 	}
 
@@ -821,8 +812,6 @@ static void sig_usr2(int sig) {
 }
 
 int main (int argc, char ** argv) {
-	int tick = 0;
-
 	/* Connect to window server */
 	yctx = yutani_init();
 
@@ -884,7 +873,7 @@ int main (int argc, char ** argv) {
 	}
 
 	/* Draw the background */
-	for (uint32_t i = 0; i < width; i += sprite_panel->width) {
+	for (int i = 0; i < width; i += sprite_panel->width) {
 		draw_sprite(ctx, sprite_panel, i, 0);
 	}
 
@@ -919,7 +908,7 @@ int main (int argc, char ** argv) {
 	/* This lets us receive all just-modifier key releases */
 	yutani_key_bind(yctx, KEY_LEFT_ALT, 0, YUTANI_BIND_PASSTHROUGH);
 
-	unsigned int last_tick = 0;
+	time_t last_tick = 0;
 
 	int fds[1] = {fileno(yctx->sock)};
 
@@ -972,7 +961,6 @@ int main (int argc, char ** argv) {
 				update_volume_level();
 				update_network_status();
 				redraw();
-				tick = 0;
 			}
 		}
 	}

+ 1 - 3
apps/plasma.c

@@ -70,9 +70,6 @@ void * draw_thread(void * garbage) {
 
 		time += 1.0;
 
-		int w = win_width;
-		int h = win_height;
-
 		spin_lock(&draw_lock);
 		for (int x = 0; x < win_width; ++x) {
 			for (int y = 0; y < win_height; ++y) {
@@ -89,6 +86,7 @@ void * draw_thread(void * garbage) {
 		spin_unlock(&draw_lock);
 		syscall_yield();
 	}
+	return NULL;
 }
 
 void resize_finish(int w, int h) {

+ 1 - 1
apps/play.c

@@ -31,7 +31,7 @@ int main(int argc, char * argv[]) {
 
 	char buf[0x1000];
 	int r;
-	while (r = read(song, buf, sizeof(buf))) {
+	while ((r = read(song, buf, sizeof(buf)))) {
 		write(spkr, buf, r);
 	}
 	return 0;

+ 1 - 1
apps/ps.c

@@ -44,7 +44,7 @@ void print_entry(struct dirent * dent) {
 	int read = 1;
 	char line[LINE_LEN];
 
-	int pid, uid, tgid;
+	int pid = 0, uid = 0, tgid = 0;
 	char name[100];
 
 	sprintf(tmp, "/proc/%s/status", dent->d_name);

+ 6 - 8
apps/pstree.c

@@ -33,13 +33,10 @@ typedef struct process {
 #define LINE_LEN 4096
 
 p_t * build_entry(struct dirent * dent) {
-	char tmp[256], buf[4096];
+	char tmp[256];
 	FILE * f;
-	int read = 1;
 	char line[LINE_LEN];
 
-	int pid, uid;
-
 	sprintf(tmp, "/proc/%s/status", dent->d_name);
 	f = fopen(tmp, "r");
 
@@ -103,7 +100,7 @@ void print_process_tree_node(tree_node_t * node, size_t depth, int indented, int
 
 	p_t * proc = node->value;
 
-	for (int i = 0; i < strlen(proc->name)+3; ++i) {
+	for (int i = 0; i < (int)strlen(proc->name)+3; ++i) {
 		lines[depth+i] = 0;
 	}
 
@@ -116,7 +113,7 @@ void print_process_tree_node(tree_node_t * node, size_t depth, int indented, int
 		}
 		depth += 3;
 	} else if (depth) {
-		for (int i = 0; i < depth; ++i) {
+		for (int i = 0; i < (int)depth; ++i) {
 			if (lines[i]) {
 				printf("│");
 			} else {
@@ -142,11 +139,12 @@ void print_process_tree_node(tree_node_t * node, size_t depth, int indented, int
 		int t = 0;
 		foreach(child, node->children) {
 			/* Recursively print the children */
-			print_process_tree_node(child->value, depth, !!(t++), ((t+1)!=node->children->length), lines);
+			print_process_tree_node(child->value, depth, !!(t), ((t+1)!=(int)node->children->length), lines);
+			t++;
 		}
 	}
 
-	for (int i = 0; i < strlen(proc->name)+3; ++i) {
+	for (int i = 0; i < (int)strlen(proc->name)+3; ++i) {
 		lines[depth+i] = 0;
 	}
 }

+ 16 - 22
apps/sh.c

@@ -50,7 +50,7 @@ shell_command_t shell_pointers[SHELL_COMMANDS]; /* Command functions */
 char * shell_descript[SHELL_COMMANDS];          /* Command descriptions */
 
 /* This is the number of actual commands installed */
-uint32_t shell_commands_len = 0;
+int shell_commands_len = 0;
 
 int    shell_interactive = 1;
 
@@ -68,7 +68,7 @@ void shell_install_command(char * name, shell_command_t func, char * desc) {
 }
 
 shell_command_t shell_find(char * str) {
-	for (uint32_t i = 0; i < shell_commands_len; ++i) {
+	for (int i = 0; i < shell_commands_len; ++i) {
 		if (!strcmp(str, shell_commands[i])) {
 			return shell_pointers[i];
 		}
@@ -178,7 +178,7 @@ void tab_complete_func(rline_context_t * c) {
 	
 	memcpy(dup, c->buffer, LINE_LEN);
 
-	char *pch, *cmd, *save;
+	char *pch, *save;
 	char *argv[1024];
 	int argc = 0;
 	int cursor = 0;
@@ -256,9 +256,9 @@ void tab_complete_func(rline_context_t * c) {
 					if (last_slash) {
 						char * x = malloc(strlen(tmp) + 1 + strlen(ent->d_name) + 1);
 						sprintf(x,"%s/%s",tmp,ent->d_name);
-						int t = lstat(x, &statbuf);
+						lstat(x, &statbuf);
 					} else {
-						int t = lstat(ent->d_name, &statbuf);
+						lstat(ent->d_name, &statbuf);
 					}
 					char * s;
 					if (S_ISDIR(statbuf.st_mode)) {
@@ -281,7 +281,7 @@ void tab_complete_func(rline_context_t * c) {
 	if (matches->length == 1) {
 		/* Insert */
 		rline_insert(c, &match[word_offset]);
-		if (word && word_offset == strlen(word) && !no_space_if_only) {
+		if (word && word_offset == (int)strlen(word) && !no_space_if_only) {
 			rline_insert(c, " ");
 		}
 		rline_redraw(c);
@@ -298,8 +298,8 @@ void tab_complete_func(rline_context_t * c) {
 				}
 				if (diff) break;
 				j++;
-			} while (j < c->requested);
-			if (j > word_offset) {
+			} while (j < (size_t)c->requested);
+			if (j > (size_t)word_offset) {
 				char * tmp = strdup(match);
 				tmp[j] = '\0';
 				rline_insert(c, &tmp[word_offset]);
@@ -386,14 +386,13 @@ void run_cmd(char ** args) {
 	exit(i);
 }
 
-int shell_exec(char * buffer, int buffer_size) {
+int shell_exec(char * buffer) {
 
 	/* Read previous history entries */
 	if (buffer[0] == '!') {
 		int x = atoi((char *)((uintptr_t)buffer + 1));
 		if (x > 0 && x <= rline_history_count) {
 			buffer = rline_history_get(x - 1);
-			buffer_size = strlen(buffer);
 		} else {
 			fprintf(stderr, "esh: !%d: event not found\n", x);
 			return 0;
@@ -458,7 +457,7 @@ int shell_exec(char * buffer, int buffer_size) {
 						char *c = getenv(var);
 						if (c) {
 							backtick = 0;
-							for (int i = 0; i < strlen(c); ++i) {
+							for (int i = 0; i < (int)strlen(c); ++i) {
 								buffer_[collected] = c[i];
 								collected++;
 							}
@@ -562,7 +561,7 @@ _done:
 		if (quoted) {
 			if (shell_interactive) {
 				draw_prompt_c();
-				buffer_size = read_entry_continued(buffer);
+				read_entry_continued(buffer);
 				rline_history_append_line(buffer);
 				continue;
 			} else {
@@ -812,8 +811,6 @@ void show_usage(int argc, char * argv[]) {
 
 int main(int argc, char ** argv) {
 
-	int  nowait = 0;
-	int  free_cmd = 0;
 	int  last_ret = 0;
 
 	pid = getpid();
@@ -831,7 +828,7 @@ int main(int argc, char ** argv) {
 
 	for (int i = 1; i < argc; ++i) {
 		if (!strcmp(argv[i], "-c")) {
-			return shell_exec(argv[i+1], strlen(argv[i+1]));
+			return shell_exec(argv[i+1]);
 		}
 		if (!strcmp(argv[i], "-v")) {
 			show_version();
@@ -850,7 +847,7 @@ int main(int argc, char ** argv) {
 			switch (c) {
 				case 'c':
 					shell_interactive = 0;
-					return shell_exec(optarg, strlen(optarg));
+					return shell_exec(optarg);
 				case 'v':
 					show_version();
 					return 0;
@@ -867,16 +864,13 @@ int main(int argc, char ** argv) {
 	while (1) {
 		draw_prompt(last_ret);
 		char buffer[LINE_LEN] = {0};
-		int  buffer_size;
 
-		buffer_size = read_entry(buffer);
-		last_ret = shell_exec(buffer, buffer_size);
+		read_entry(buffer);
+		last_ret = shell_exec(buffer);
 		rline_scroll = 0;
 
 	}
 
-exit:
-
 	return 0;
 }
 
@@ -995,7 +989,7 @@ uint32_t shell_cmd_help(int argc, char * argv[]) {
 	printf("\nThis shell is not POSIX-compliant, please be careful.\n\n");
 
 	printf("Built-in commands:\n");
-	for (uint32_t i = 0; i < shell_commands_len; ++i) {
+	for (int i = 0; i < shell_commands_len; ++i) {
 		if (!shell_descript[i]) continue;
 		printf(" %-20s - %s\n", shell_commands[i], shell_descript[i]);
 	}

+ 3 - 3
apps/sysinfo.c

@@ -93,8 +93,8 @@ int main(int argc, char * argv[]) {
 
 			/* Print half block */
 			printf("\033[38;6;%d;%d;%d;%dm\033[48;6;%d;%d;%d;%dm▄",
-					_RED(back), _GRE(back), _BLU(back), _ALP(back),
-					_RED(out), _GRE(out), _BLU(out), _ALP(out));
+					(int)_RED(back), (int)_GRE(back), (int)_BLU(back), (int)_ALP(back),
+					(int)_RED(out), (int)_GRE(out), (int)_BLU(out), (int)_ALP(out));
 
 		}
 		if (j < i) {
@@ -106,7 +106,7 @@ int main(int argc, char * argv[]) {
 	}
 
 	while (j < i) {
-		for (int x = 0; x < gimp_image.width; x++) {
+		for (int x = 0; x < (int)gimp_image.width; x++) {
 			printf(" ");
 		}
 		print_thing(j);

+ 12 - 10
apps/terminal-vga.c

@@ -59,9 +59,6 @@ term_state_t * ansi_state = NULL;
 void reinit(); /* Defined way further down */
 void term_redraw_cursor();
 
-/* Cursor bink timer */
-static unsigned int timer_tick = 0;
-
 void term_clear();
 
 void dump_buffer();
@@ -109,6 +106,7 @@ static uint32_t vga_base_colors[] = {
 	0xFFFFFF,
 };
 
+#if 0
 static int is_gray(uint32_t a) {
 	int a_r = (a & 0xFF0000) >> 16;
 	int a_g = (a & 0xFF00) >> 8;
@@ -116,12 +114,12 @@ static int is_gray(uint32_t a) {
 
 	return (a_r == a_g && a_g == a_b);
 }
+#endif
 
 static int best_match(uint32_t a) {
 	int best_distance = INT32_MAX;
 	int best_index = 0;
 	for (int j = 0; j < 16; ++j) {
-		if (is_gray(a) && !is_gray(vga_base_colors[j]));
 		int distance = color_distance(a, vga_base_colors[j]);
 		if (distance < best_distance) {
 			best_index = j;
@@ -393,6 +391,7 @@ static void cell_redraw_inverted(uint16_t x, uint16_t y) {
 	}
 }
 
+#if 0
 static void cell_redraw_box(uint16_t x, uint16_t y) {
 	if (x >= term_width || y >= term_height) return;
 	term_cell_t * cell = (term_cell_t *)((uintptr_t)term_buffer + (y * term_width + x) * sizeof(term_cell_t));
@@ -402,6 +401,7 @@ static void cell_redraw_box(uint16_t x, uint16_t y) {
 		term_write_char(cell->c, x * char_width, y * char_height, cell->fg, cell->bg, cell->flags | ANSI_BORDER);
 	}
 }
+#endif
 
 void render_cursor() {
 	cell_redraw_inverted(csr_x, csr_y);
@@ -617,7 +617,7 @@ void clear_input() {
 	input_collected = 0;
 }
 
-uint32_t child_pid = 0;
+pid_t child_pid = 0;
 
 void handle_input(char c) {
 	write(fd_master, &c, 1);
@@ -768,7 +768,7 @@ void maybe_flip_cursor(void) {
 void check_for_exit(void) {
 	if (exit_application) return;
 
-	int pid = waitpid(-1, NULL, WNOHANG);
+	pid_t pid = waitpid(-1, NULL, WNOHANG);
 
 	if (pid != child_pid) return;
 
@@ -874,12 +874,14 @@ int main(int argc, char ** argv) {
 #endif
 			if (_login_shell) {
 				char * tokens[] = {"/bin/login",NULL};
-				int i = execvp(tokens[0], tokens);
+				execvp(tokens[0], tokens);
+				exit(1);
 			} else {
 				char * shell = getenv("SHELL");
 				if (!shell) shell = "/bin/sh"; /* fallback */
 				char * tokens[] = {shell,NULL};
-				int i = execvp(tokens[0], tokens);
+				execvp(tokens[0], tokens);
+				exit(1);
 			}
 #if 0
 		}
@@ -901,7 +903,7 @@ int main(int argc, char ** argv) {
 		/* Prune any keyboard input we got before the terminal started. */
 		struct stat s;
 		fstat(kfd, &s);
-		for (int i = 0; i < s.st_size; i++) {
+		for (unsigned int i = 0; i < s.st_size; i++) {
 			char tmp[1];
 			read(kfd, tmp, 1);
 		}
@@ -918,7 +920,7 @@ int main(int argc, char ** argv) {
 			if (index == 0) {
 				maybe_flip_cursor();
 				int r = read(fd_master, buf, 1024);
-				for (uint32_t i = 0; i < r; ++i) {
+				for (int i = 0; i < r; ++i) {
 					ansi_put(ansi_state, buf[i]);
 				}
 			} else if (index == 1) {

+ 15 - 12
apps/terminal.c

@@ -753,7 +753,7 @@ struct scrollback_row {
 
 list_t * scrollback_list = NULL;
 
-uint32_t scrollback_offset = 0;
+int scrollback_offset = 0;
 
 void save_scrollback() {
 	/* Save the current top row for scrollback */
@@ -1084,7 +1084,7 @@ void clear_input() {
 	input_collected = 0;
 }
 
-uint32_t child_pid = 0;
+pid_t child_pid = 0;
 
 void handle_input(char c) {
 	write(fd_master, &c, 1);
@@ -1098,7 +1098,7 @@ void handle_input_s(char * c) {
 
 void scroll_up(int amount) {
 	int i = 0;
-	while (i < amount && scrollback_list && scrollback_offset < scrollback_list->length) {
+	while (i < amount && scrollback_list && scrollback_offset < (int)scrollback_list->length) {
 		scrollback_offset ++;
 		i++;
 	}
@@ -1273,7 +1273,7 @@ void key_event(int ret, key_event_t * event) {
 void check_for_exit(void) {
 	if (exit_application) return;
 
-	int pid = waitpid(-1, NULL, WNOHANG);
+	pid_t pid = waitpid(-1, NULL, WNOHANG);
 
 	if (pid != child_pid) return;
 
@@ -1349,7 +1349,6 @@ void reinit(int send_sig) {
 		FT_Set_Pixel_Sizes(face_variable, font_size, font_size);
 #endif
 	}
-	int i = 0;
 
 	int old_width  = term_width;
 	int old_height = term_height;
@@ -1424,7 +1423,7 @@ static void resize_finish(int width, int height) {
 		return;
 	}
 
-	if (!_free_size && (t_window_width % char_width != 0 || t_window_height % char_height != 0 && resize_attempts < 3)) {
+	if (!_free_size && ((t_window_width % char_width != 0 || t_window_height % char_height != 0) && resize_attempts < 3)) {
 		resize_attempts++;
 		int n_width  = extra_x + t_window_width  - (t_window_width  % char_width);
 		int n_height = extra_y + t_window_height - (t_window_height % char_height);
@@ -1495,7 +1494,7 @@ void * handle_incoming(void) {
 							break;
 						}
 					}
-					if (me->new_x < 0 || me->new_x >= window_width || me->new_y < 0 || me->new_y >= window_height) {
+					if (me->new_x < 0 || me->new_x >= (int)window_width || me->new_y < 0 || me->new_y >= (int)window_height) {
 						break;
 					}
 					/* Map Cursor Action */
@@ -1550,6 +1549,8 @@ void * handle_incoming(void) {
 		}
 		free(m);
 	}
+
+	return NULL;
 }
 
 void maybe_flip_cursor(void) {
@@ -1735,8 +1736,8 @@ int main(int argc, char ** argv) {
 
 	fflush(stdin);
 
-	int pid = getpid();
-	uint32_t f = fork();
+	pid_t pid = getpid();
+	pid_t f = fork();
 
 	if (getpid() != pid) {
 		dup2(fd_slave, 0);
@@ -1752,12 +1753,14 @@ int main(int argc, char ** argv) {
 #endif
 			if (_login_shell) {
 				char * tokens[] = {"/bin/login",NULL};
-				int i = execvp(tokens[0], tokens);
+				execvp(tokens[0], tokens);
+				exit(1);
 			} else {
 				char * shell = getenv("SHELL");
 				if (!shell) shell = "/bin/sh"; /* fallback */
 				char * tokens[] = {shell,NULL};
-				int i = execvp(tokens[0], tokens);
+				execvp(tokens[0], tokens);
+				exit(1);
 			}
 #if 0
 		}
@@ -1787,7 +1790,7 @@ int main(int argc, char ** argv) {
 			if (index == 1) {
 				maybe_flip_cursor();
 				int r = read(fd_master, buf, 1024);
-				for (uint32_t i = 0; i < r; ++i) {
+				for (int i = 0; i < r; ++i) {
 					ansi_put(ansi_state, buf[i]);
 				}
 				display_flip();

+ 0 - 1
apps/uname.c

@@ -44,7 +44,6 @@ void show_usage(int argc, char * argv[]) {
 int main(int argc, char * argv[]) {
 	struct utsname u;
 
-	int c;
 	int flags = 0;
 	int space = 0;
 

+ 1 - 4
apps/uptime.c

@@ -44,7 +44,7 @@ void print_uptime(void) {
 	FILE * f = fopen("/proc/uptime", "r");
 	if (!f) return;
 
-	int seconds, subseconds;
+	int seconds;
 
 	char buf[1024] = {0};
 	fgets(buf, 1024, f);
@@ -54,9 +54,6 @@ void print_uptime(void) {
 	dot[3] = '\0';
 
 	seconds = atoi(buf);
-	subseconds = atoi(dot);
-
-	//fscanf(f, "%d.%2d", &seconds, &subseconds);
 
 	printf("up ");
 

+ 1 - 1
apps/yutani-query.c

@@ -19,7 +19,7 @@ void show_usage(int argc, char * argv[]) {
 }
 
 int show_resolution(void) {
-	printf("%dx%d\n", yctx->display_width, yctx->display_height);
+	printf("%dx%d\n", (int)yctx->display_width, (int)yctx->display_height);
 	return 0;
 }
 

+ 7 - 7
apps/yutani-test.c

@@ -144,10 +144,10 @@ int main (int argc, char ** argv) {
 							"\told = %d, %d\n"
 							"\tbuttons = %s\n"
 							"\tcommand = %d\n",
-							me->wid,
+							(int)me->wid,
 							mouse_command(me->command),
-							me->new_x, me->new_y,
-							me->old_x, me->old_y,
+							(int)me->new_x, (int)me->new_y,
+							(int)me->old_x, (int)me->old_y,
 							mouse_buttons(me->buttons),
 							me->command);
 					}
@@ -161,7 +161,7 @@ int main (int argc, char ** argv) {
 				case YUTANI_MSG_WINDOW_MOVE:
 					{
 						struct yutani_msg_window_move * wm = (void*)m->data;
-						fprintf(stderr, "Window Moved (wid=%d) %d, %d\n", wm->wid, wm->x, wm->y);
+						fprintf(stderr, "Window Moved (wid=%d) %d, %d\n", (int)wm->wid, (int)wm->x, (int)wm->y);
 					}
 					break;
 				case YUTANI_MSG_RESIZE_OFFER:
@@ -169,9 +169,9 @@ int main (int argc, char ** argv) {
 						struct yutani_msg_window_resize * wr = (void*)m->data;
 						fprintf(stderr, "Resize Offer (wid=%d) %d x %d\n"
 							"\tbufid = %d\n",
-							wr->wid,
-							wr->width, wr->height,
-							wr->bufid);
+							(int)wr->wid,
+							(int)wr->width, (int)wr->height,
+							(int)wr->bufid);
 					}
 					break;
 				case YUTANI_MSG_SESSION_END:

+ 2 - 2
apps/yutani_int.h

@@ -128,7 +128,7 @@ typedef struct {
 
 	list_t * window_subscribers;
 
-	uint32_t start_time;
+	time_t start_time;
 
 	volatile int redraw_lock;
 
@@ -148,7 +148,7 @@ typedef struct {
 
 	int screenshot_frame;
 
-	uint32_t start_subtime;
+	suseconds_t start_subtime;
 
 	yutani_scale_direction_t resizing_direction;
 	int32_t resizing_offset_x;

+ 1 - 1
base/usr/include/toaru/graphics.h

@@ -39,7 +39,7 @@ typedef struct context {
 	char *   buffer;
 	char *   backbuffer;
 	char *   clips;
-	size_t   clips_size;
+	int32_t  clips_size;
 } gfx_context_t;
 
 extern gfx_context_t * init_graphics_fullscreen();

+ 1 - 1
base/usr/include/toaru/yutani.h

@@ -189,7 +189,7 @@ typedef struct yutani_window {
 	uint32_t width;
 	uint32_t height;
 
-	uint8_t * buffer;
+	char * buffer;
 	uint32_t bufid;/* We occasionally replace the buffer; each is uniquely-indexed */
 
 	uint8_t focused;

+ 11 - 7
lib/decor-fancy.c

@@ -12,15 +12,19 @@
 static int u_height = 33;
 static int ul_width = 10;
 static int ur_width = 10;
+#if 0
 static int ml_width = 6;
+#endif
 static int mr_width = 6;
 static int l_height = 9;
 static int ll_width = 9;
 static int lr_width = 9;
+#if 0
 static int llx_offset = 3;
 static int lly_offset = 3;
 static int lrx_offset = 3;
 static int lry_offset = 3;
+#endif
 
 static sprite_t * sprites[20];
 
@@ -36,22 +40,22 @@ static void render_decorations_fancy(yutani_window_t * window, gfx_context_t * c
 	int width = window->width;
 	int height = window->height;
 
-	for (int j = 0; j < decor_top_height; ++j) {
+	for (int j = 0; j < (int)decor_top_height; ++j) {
 		for (int i = 0; i < width; ++i) {
 			GFX(ctx,i,j) = 0;
 		}
 	}
 
-	for (int j = decor_top_height; j < height - decor_bottom_height; ++j) {
-		for (int i = 0; i < decor_left_width; ++i) {
+	for (int j = (int)decor_top_height; j < height - (int)decor_bottom_height; ++j) {
+		for (int i = 0; i < (int)decor_left_width; ++i) {
 			GFX(ctx,i,j) = 0;
 		}
-		for (int i = width - decor_right_width; i < width; ++i) {
+		for (int i = width - (int)decor_right_width; i < width; ++i) {
 			GFX(ctx,i,j) = 0;
 		}
 	}
 
-	for (int j = height - decor_bottom_height; j < height; ++j) {
+	for (int j = height - (int)decor_bottom_height; j < height; ++j) {
 		for (int i = 0; i < width; ++i) {
 			GFX(ctx,i,j) = 0;
 		}
@@ -103,12 +107,12 @@ static void render_decorations_fancy(yutani_window_t * window, gfx_context_t * c
 }
 
 static int check_button_press_fancy(yutani_window_t * window, int x, int y) {
-	if (x >= window->width - 28 && x <= window->width - 18 &&
+	if (x >= (int)window->width - 28 && x <= (int)window->width - 18 &&
 		y >= 16 && y <= 26) {
 		return DECOR_CLOSE;
 	}
 
-	if (x >= window->width - 50 && x <= window->width - 40 &&
+	if (x >= (int)window->width - 50 && x <= (int)window->width - 40 &&
 		y >= 16 && y <= 26) {
 		return DECOR_MAXIMIZE;
 	}

+ 15 - 12
lib/decorations.c

@@ -49,13 +49,13 @@ static void render_decorations_simple(yutani_window_t * window, gfx_context_t *
 	}
 
 
-	for (uint32_t i = 0; i < window->height; ++i) {
+	for (int i = 0; i < (int)window->height; ++i) {
 		GFX(ctx, 0, i) = color;
 		GFX(ctx, window->width - 1, i) = color;
 	}
 
-	for (uint32_t i = 1; i < decor_top_height; ++i) {
-		for (uint32_t j = 1; j < window->width - 1; ++j) {
+	for (int i = 1; i < (int)decor_top_height; ++i) {
+		for (int j = 1; j < (int)window->width - 1; ++j) {
 			GFX(ctx, j, i) = BACKCOLOR;
 		}
 	}
@@ -76,7 +76,7 @@ static void render_decorations_simple(yutani_window_t * window, gfx_context_t *
 }
 
 static int check_button_press_simple(yutani_window_t * window, int x, int y) {
-	if (x >= window->width - 20 && x <= window->width - 2 && y >= 2) {
+	if (x >= (int)window->width - 20 && x <= (int)window->width - 2 && y >= 2) {
 		return DECOR_CLOSE;
 	}
 
@@ -159,15 +159,15 @@ void decor_set_maximize_callback(void (*callback)(yutani_window_t *)) {
 }
 
 static int within_decors(yutani_window_t * window, int x, int y) {
-	if ((x <= decor_left_width || x >= window->width - decor_right_width) && (x > 0 && x < window->width)) return 1;
-	if ((y <= decor_top_height || y >= window->height - decor_bottom_height) && (y > 0 && y < window->height)) return 1;
+	if ((x <= (int)decor_left_width || x >= (int)window->width - (int)decor_right_width) && (x > 0 && x < (int)window->width)) return 1;
+	if ((y <= (int)decor_top_height || y >= (int)window->height - (int)decor_bottom_height) && (y > 0 && y < (int)window->height)) return 1;
 	return 0;
 }
 
-#define LEFT_SIDE (me->new_x <= decor_left_width)
-#define RIGHT_SIDE (me->new_x >= window->width - decor_right_width)
-#define TOP_SIDE (me->new_y <= decor_top_height)
-#define BOTTOM_SIDE (me->new_y >= window->height - decor_bottom_height)
+#define LEFT_SIDE (me->new_x <= (int)decor_left_width)
+#define RIGHT_SIDE (me->new_x >= (int)window->width - (int)decor_right_width)
+#define TOP_SIDE (me->new_y <= (int)decor_top_height)
+#define BOTTOM_SIDE (me->new_y >= (int)window->height - (int)decor_bottom_height)
 
 static yutani_scale_direction_t check_resize_direction(struct yutani_msg_window_mouse_event * me, yutani_window_t * window) {
 	yutani_scale_direction_t resize_direction = SCALE_NONE;
@@ -191,7 +191,7 @@ static yutani_scale_direction_t check_resize_direction(struct yutani_msg_window_
 	return resize_direction;
 }
 
-static int old_resize_direction = SCALE_NONE;
+static yutani_scale_direction_t old_resize_direction = SCALE_NONE;
 
 int decor_handle_event(yutani_t * yctx, yutani_msg_t * m) {
 	if (m) {
@@ -212,7 +212,7 @@ int decor_handle_event(yutani_t * yctx, yutani_msg_t * m) {
 									yutani_window_resize_start(yctx, window, resize_direction);
 								}
 
-								if (me->new_y < decor_top_height && resize_direction == SCALE_NONE) {
+								if (me->new_y < (int)decor_top_height && resize_direction == SCALE_NONE) {
 									yutani_window_drag_start(yctx, window);
 								}
 								return DECOR_OTHER;
@@ -243,6 +243,9 @@ int decor_handle_event(yutani_t * yctx, yutani_msg_t * m) {
 											case SCALE_UP_RIGHT:
 												yutani_window_show_mouse(yctx, window, YUTANI_CURSOR_TYPE_RESIZE_DOWN_UP);
 												break;
+											case SCALE_AUTO:
+											case SCALE_NONE:
+												break;
 										}
 									}
 									old_resize_direction = resize_direction;

+ 5 - 1
lib/graphics.c

@@ -45,6 +45,8 @@ static int _is_in_clip(gfx_context_t * ctx, int32_t y) {
 
 
 void gfx_add_clip(gfx_context_t * ctx, int32_t x, int32_t y, int32_t w, int32_t h) {
+	(void)x;
+	(void)w; // TODO Horizontal clipping
 	if (!ctx->clips) {
 		ctx->clips = malloc(ctx->height);
 		memset(ctx->clips, 0, ctx->height);
@@ -410,6 +412,8 @@ void load_sprite(sprite_t * sprite, char * filename) {
 							(bufferb[i+3 + 4 * x] & 0xFF) * 0x10000;
 					color = premultiply(color);
 				}
+			} else {
+				color = rgb(0,0,0); /* Unsupported */
 			}
 			/* Set our point */
 			sprite->bitmap[(height - y - 1) * width + x] = color;
@@ -480,7 +484,7 @@ void draw_sprite(gfx_context_t * ctx, sprite_t * sprite, int32_t x, int32_t y) {
 					continue;
 
 				// opaque
-				if (_mm_movemask_epi8(_mm_cmpeq_epi8(s, _mm_cmpeq_epi8(s,s))) & 0x8888 == 0x8888)
+				if ((_mm_movemask_epi8(_mm_cmpeq_epi8(s, _mm_cmpeq_epi8(s,s))) & 0x8888) == 0x8888)
 					_mm_storeu_si128((void*)&GFX(ctx, x + _x, y + _y), s);
 
 				__m128i d_l, d_h;

+ 1 - 0
lib/hashmap.c

@@ -40,6 +40,7 @@ void * hashmap_int_dupe(void * key) {
 }
 
 static void hashmap_int_free(void * ptr) {
+	(void)ptr;
 	return;
 }
 

+ 1 - 1
lib/icon_cache.c

@@ -89,5 +89,5 @@ sprite_t * icon_get_16(const char * name) {
 }
 
 sprite_t * icon_get_48(const char * name) {
-	return icon_get_int(name, icon_cache_16, icon_directories_16);
+	return icon_get_int(name, icon_cache_16, icon_directories_48);
 }

+ 4 - 4
lib/rline.c

@@ -190,7 +190,7 @@ static void history_previous(rline_context_t * context) {
 	}
 	if (rline_scroll < rline_history_count) {
 		rline_scroll++;
-		for (int i = 0; i < strlen(context->buffer); ++i) {
+		for (int i = 0; i < (int)strlen(context->buffer); ++i) {
 			printf("\010 \010");
 		}
 		char * h = rline_history_prev(rline_scroll);
@@ -205,7 +205,7 @@ static void history_previous(rline_context_t * context) {
 static void history_next(rline_context_t * context) {
 	if (rline_scroll > 1) {
 		rline_scroll--;
-		for (int i = 0; i < strlen(context->buffer); ++i) {
+		for (int i = 0; i < (int)strlen(context->buffer); ++i) {
 			printf("\010 \010");
 		}
 		char * h = rline_history_prev(rline_scroll);
@@ -213,7 +213,7 @@ static void history_next(rline_context_t * context) {
 		printf("%s", h);
 		fflush(stdout);
 	} else if (rline_scroll == 1) {
-		for (int i = 0; i < strlen(context->buffer); ++i) {
+		for (int i = 0; i < (int)strlen(context->buffer); ++i) {
 			printf("\010 \010");
 		}
 		rline_scroll = 0;
@@ -232,7 +232,7 @@ static void history_next(rline_context_t * context) {
 void rline_insert(rline_context_t * context, const char * what) {
 	size_t insertion_length = strlen(what);
 
-	if (context->collected + insertion_length > context->requested) {
+	if (context->collected + (int)insertion_length > context->requested) {
 		insertion_length = context->requested - context->collected;
 	}
 

+ 4 - 4
lib/sdf.c

@@ -148,15 +148,15 @@ static sprite_t * _select_font(int font) {
 static int _select_width(char ch, int font) {
 	switch (font) {
 		case SDF_FONT_BOLD:
-			return _char_data[ch].width_bold;
+			return _char_data[(int)ch].width_bold;
 		case SDF_FONT_THIN:
 		default:
-			return _char_data[ch].width_bold * 0.8;
+			return _char_data[(int)ch].width_bold * 0.8;
 	}
 }
 
 static int draw_sdf_character(gfx_context_t * ctx, int32_t x, int32_t y, int ch, int size, uint32_t color, sprite_t * tmp, int font, sprite_t * _font_data) {
-	if (ch != ' ' && ch < '!' || ch > '~') {
+	if (ch != ' ' && (ch < '!' || ch > '~')) {
 		/* TODO: Draw missing symbol? */
 		return 0;
 	}
@@ -232,7 +232,7 @@ int draw_sdf_string(gfx_context_t * ctx, int32_t x, int32_t y, const char * str,
 }
 
 static int char_width(char ch, int font) {
-	if (ch != ' ' && ch < '!' || ch > '~') {
+	if (ch != ' ' && (ch < '!' || ch > '~')) {
 		/* TODO: Draw missing symbol? */
 		return 0;
 	}

+ 29 - 30
lib/yutani.c

@@ -530,8 +530,7 @@ yutani_msg_t * yutani_msg_build_special_request(yutani_wid_t wid, uint32_t reque
 }
 
 int yutani_msg_send(yutani_t * y, yutani_msg_t * msg) {
-	int result = pex_reply(y->sock, msg->size, (char *)msg);
-	return result;
+	return pex_reply(y->sock, msg->size, (char *)msg);
 }
 
 yutani_t * yutani_context_create(FILE * socket) {
@@ -559,7 +558,7 @@ yutani_t * yutani_init(void) {
 
 	yutani_t * y = yutani_context_create(c);
 	yutani_msg_t * m = yutani_msg_build_hello();
-	int result = yutani_msg_send(y, m);
+	yutani_msg_send(y, m);
 	free(m);
 
 	m = yutani_wait_for(y, YUTANI_MSG_WELCOME);
@@ -576,7 +575,7 @@ yutani_window_t * yutani_window_create_flags(yutani_t * y, int width, int height
 	yutani_window_t * win = malloc(sizeof(yutani_window_t));
 
 	yutani_msg_t * m = yutani_msg_build_window_new_flags(width, height, flags);
-	int result = yutani_msg_send(y, m);
+	yutani_msg_send(y, m);
 	free(m);
 
 	m = yutani_wait_for(y, YUTANI_MSG_WINDOW_INIT);
@@ -594,7 +593,7 @@ yutani_window_t * yutani_window_create_flags(yutani_t * y, int width, int height
 	YUTANI_SHMKEY(y->server_ident, key, 1024, win);
 
 	size_t size = (width * height * 4);
-	win->buffer = (uint8_t *)syscall_shm_obtain(key, &size);
+	win->buffer = (char *)syscall_shm_obtain(key, &size);
 	return win;
 
 }
@@ -605,19 +604,19 @@ yutani_window_t * yutani_window_create(yutani_t * y, int width, int height) {
 
 void yutani_flip(yutani_t * y, yutani_window_t * win) {
 	yutani_msg_t * m = yutani_msg_build_flip(win->wid);
-	int result = yutani_msg_send(y, m);
+	yutani_msg_send(y, m);
 	free(m);
 }
 
 void yutani_flip_region(yutani_t * yctx, yutani_window_t * win, int32_t x, int32_t y, int32_t width, int32_t height) {
 	yutani_msg_t * m = yutani_msg_build_flip_region(win->wid, x, y, width, height);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_close(yutani_t * y, yutani_window_t * win) {
 	yutani_msg_t * m = yutani_msg_build_window_close(win->wid);
-	int result = yutani_msg_send(y, m);
+	yutani_msg_send(y, m);
 	free(m);
 
 	/* Now destroy our end of the window */
@@ -633,31 +632,31 @@ void yutani_close(yutani_t * y, yutani_window_t * win) {
 
 void yutani_window_move(yutani_t * yctx, yutani_window_t * window, int x, int y) {
 	yutani_msg_t * m = yutani_msg_build_window_move(window->wid, x, y);
-	int reuslt = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_set_stack(yutani_t * yctx, yutani_window_t * window, int z) {
 	yutani_msg_t * m = yutani_msg_build_window_stack(window->wid, z);
-	int reuslt = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_window_resize(yutani_t * yctx, yutani_window_t * window, uint32_t width, uint32_t height) {
 	yutani_msg_t * m = yutani_msg_build_window_resize(YUTANI_MSG_RESIZE_REQUEST, window->wid, width, height, 0);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_window_resize_offer(yutani_t * yctx, yutani_window_t * window, uint32_t width, uint32_t height) {
 	yutani_msg_t * m = yutani_msg_build_window_resize(YUTANI_MSG_RESIZE_OFFER, window->wid, width, height, 0);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_window_resize_accept(yutani_t * yctx, yutani_window_t * window, uint32_t width, uint32_t height) {
 	yutani_msg_t * m = yutani_msg_build_window_resize(YUTANI_MSG_RESIZE_ACCEPT, window->wid, width, height, 0);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 
 	/* Now wait for the new bufid */
@@ -682,7 +681,7 @@ void yutani_window_resize_accept(yutani_t * yctx, yutani_window_t * window, uint
 		YUTANI_SHMKEY(yctx->server_ident, key, 1024, window);
 
 		size_t size = (window->width * window->height * 4);
-		window->buffer = (uint8_t *)syscall_shm_obtain(key, &size);
+		window->buffer = (char *)syscall_shm_obtain(key, &size);
 	}
 }
 
@@ -695,7 +694,7 @@ void yutani_window_resize_done(yutani_t * yctx, yutani_window_t * window) {
 	}
 
 	yutani_msg_t * m = yutani_msg_build_window_resize(YUTANI_MSG_RESIZE_DONE, window->wid, window->width, window->height, window->bufid);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
@@ -720,7 +719,7 @@ void yutani_window_advertise(yutani_t * yctx, yutani_window_t * window, char * n
 	}
 
 	yutani_msg_t * m = yutani_msg_build_window_advertise(window->wid, flags, offsets, length, strings);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
@@ -748,87 +747,87 @@ void yutani_window_advertise_icon(yutani_t * yctx, yutani_window_t * window, cha
 	}
 
 	yutani_msg_t * m = yutani_msg_build_window_advertise(window->wid, flags, offsets, length, strings);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 	free(strings);
 }
 
 void yutani_subscribe_windows(yutani_t * y) {
 	yutani_msg_t * m = yutani_msg_build_subscribe();
-	int result = yutani_msg_send(y, m);
+	yutani_msg_send(y, m);
 	free(m);
 }
 
 void yutani_unsubscribe_windows(yutani_t * y) {
 	yutani_msg_t * m = yutani_msg_build_unsubscribe();
-	int result = yutani_msg_send(y, m);
+	yutani_msg_send(y, m);
 	free(m);
 }
 
 void yutani_query_windows(yutani_t * y) {
 	yutani_msg_t * m = yutani_msg_build_query_windows();
-	int result = yutani_msg_send(y, m);
+	yutani_msg_send(y, m);
 	free(m);
 }
 
 void yutani_session_end(yutani_t * y) {
 	yutani_msg_t * m = yutani_msg_build_session_end();
-	int result = yutani_msg_send(y, m);
+	yutani_msg_send(y, m);
 	free(m);
 }
 
 void yutani_focus_window(yutani_t * yctx, yutani_wid_t wid) {
 	yutani_msg_t * m = yutani_msg_build_window_focus(wid);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_key_bind(yutani_t * yctx, kbd_key_t key, kbd_mod_t mod, int response) {
 	yutani_msg_t * m = yutani_msg_build_key_bind(key,mod,response);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_window_drag_start(yutani_t * yctx, yutani_window_t * window) {
 	yutani_msg_t * m = yutani_msg_build_window_drag_start(window->wid);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_window_drag_start_wid(yutani_t * yctx, yutani_wid_t wid) {
 	yutani_msg_t * m = yutani_msg_build_window_drag_start(wid);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_window_update_shape(yutani_t * yctx, yutani_window_t * window, int set_shape) {
 	yutani_msg_t * m = yutani_msg_build_window_update_shape(window->wid, set_shape);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_window_warp_mouse(yutani_t * yctx, yutani_window_t * window, int32_t x, int32_t y) {
 	yutani_msg_t * m = yutani_msg_build_window_warp_mouse(window->wid, x, y);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_window_show_mouse(yutani_t * yctx, yutani_window_t * window, int32_t show_mouse) {
 	yutani_msg_t * m = yutani_msg_build_window_show_mouse(window->wid, show_mouse);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_window_resize_start(yutani_t * yctx, yutani_window_t * window, yutani_scale_direction_t direction) {
 	yutani_msg_t * m = yutani_msg_build_window_resize_start(window->wid, direction);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 
 void yutani_special_request(yutani_t * yctx, yutani_window_t * window, uint32_t request) {
 	/* wid isn't necessary; if window is null, set to 0 */
 	yutani_msg_t * m = yutani_msg_build_special_request(window ? window->wid : 0, request);
-	int result = yutani_msg_send(yctx, m);
+	yutani_msg_send(yctx, m);
 	free(m);
 }
 

+ 4 - 10
linker/linker.c

@@ -80,9 +80,7 @@ static char * find_lib(const char * file) {
 		path = "/usr/lib:/lib:/opt/lib";
 	}
 	char * xpath = strdup(path);
-	int found = 0;
-	char * p, * tokens[10], * last;
-	int i = 0;
+	char * p, * last;
 	for ((p = strtok_r(xpath, ":", &last)); p; p = strtok_r(NULL, ":", &last)) {
 		int r;
 		struct stat stat_buf;
@@ -301,7 +299,6 @@ static int object_postload(elf_t * object) {
 		}
 	}
 
-	size_t i = 0;
 	for (uintptr_t x = 0; x < object->header.e_shentsize * object->header.e_shnum; x += object->header.e_shentsize) {
 		Elf32_Shdr shdr;
 		fseek(object->file, object->header.e_shoff + x, SEEK_SET);
@@ -355,7 +352,6 @@ static int object_relocate(elf_t * object) {
 		}
 	}
 
-	size_t i = 0;
 	for (uintptr_t x = 0; x < object->header.e_shentsize * object->header.e_shnum; x += object->header.e_shentsize) {
 		Elf32_Shdr shdr;
 		fseek(object->file, object->header.e_shoff + x, SEEK_SET);
@@ -373,7 +369,7 @@ static int object_relocate(elf_t * object) {
 				if (need_symbol_for_type(type) || (type == 5)) {
 					symname = (char *)((uintptr_t)object->dyn_string_table + sym->st_name);
 				}
-				if ((sym->st_shndx == 0) && need_symbol_for_type(type) || (type == 5)) {
+				if (((sym->st_shndx == 0) && need_symbol_for_type(type)) || (type == 5)) {
 					if (symname && hashmap_has(dumb_symbol_table, symname)) {
 						x = (uintptr_t)hashmap_get(dumb_symbol_table, symname);
 					} else {
@@ -421,7 +417,6 @@ static int object_relocate(elf_t * object) {
 }
 
 static void object_find_copy_relocations(elf_t * object) {
-	size_t i = 0;
 	for (uintptr_t x = 0; x < object->header.e_shentsize * object->header.e_shnum; x += object->header.e_shentsize) {
 		Elf32_Shdr shdr;
 		fseek(object->file, object->header.e_shoff + x, SEEK_SET);
@@ -484,7 +479,7 @@ static void * do_actual_load(const char * filename, elf_t * lib, int flags) {
 	object_postload(lib);
 
 	node_t * item;
-	while (item = list_pop(lib->dependencies)) {
+	while ((item = list_pop(lib->dependencies))) {
 
 		elf_t * lib = open_object(item->value);
 
@@ -605,7 +600,6 @@ int main(int argc, char * argv[]) {
 		return 1;
 	}
 
-	size_t main_size = object_calculate_size(main_obj);
 	uintptr_t end_addr = object_load(main_obj, 0x0);
 
 	object_postload(main_obj);
@@ -623,7 +617,7 @@ int main(int argc, char * argv[]) {
 
 	TRACE_LD("Loading dependencies.");
 	node_t * item;
-	while (item = list_pop(main_obj->dependencies)) {
+	while ((item = list_pop(main_obj->dependencies))) {
 		while (end_addr & 0xFFF) {
 			end_addr++;
 		}