From 0238ce3c73b9a28981dc7342515f10b878dedc4a Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 1 Feb 2011 15:43:59 +0100 Subject: [PATCH] fix some compiler warnings --- include/config.h | 2 +- src/cmdparse.y | 10 +++++----- src/load_layout.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/config.h b/include/config.h index ccff0fc8..6ab6baee 100644 --- a/include/config.h +++ b/include/config.h @@ -35,7 +35,7 @@ struct context { char *line_copy; const char *filename; - const char *compact_error; + char *compact_error; /* These are the same as in YYLTYPE */ int first_column; diff --git a/src/cmdparse.y b/src/cmdparse.y index cea93d1a..50738f70 100644 --- a/src/cmdparse.y +++ b/src/cmdparse.y @@ -262,8 +262,8 @@ criteria: { printf("criteria: id = %s\n", $3); /* TODO: correctly parse number */ - current_match.con_id = atoi($3); - printf("id as int = %d\n", current_match.con_id); + current_match.con_id = (Con*)atoi($3); + printf("id as int = %p\n", current_match.con_id); } | TOK_ID '=' STR { @@ -360,8 +360,8 @@ focus: printf("should focus\n"); if (match_is_empty(¤t_match)) { /* TODO: better error message */ - LOG("Error: The foucs command requires you to use some criteria.\n"); - return; + LOG("Error: The focus command requires you to use some criteria.\n"); + break; } /* TODO: warning if the match contains more than one entry. does not @@ -406,7 +406,7 @@ open: { printf("opening new container\n"); Con *con = tree_open_con(NULL); - asprintf(&json_output, "{\"success\":true, \"id\":%d}", (long int)con); + asprintf(&json_output, "{\"success\":true, \"id\":%ld}", (long int)con); } ; diff --git a/src/load_layout.c b/src/load_layout.c index 7602d620..035b87c4 100644 --- a/src/load_layout.c +++ b/src/load_layout.c @@ -197,7 +197,7 @@ void tree_append_json(const char *filename) { stat != yajl_status_insufficient_data) { unsigned char * str = yajl_get_error(hand, 1, (const unsigned char*)buf, n); - fprintf(stderr, (const char *) str); + fprintf(stderr, "%s\n", (const char *) str); yajl_free_error(hand, str); }