From: Christian Heller Date: Fri, 30 Aug 2013 08:21:16 +0000 (+0200) Subject: Corrected window title creation. X-Git-Tag: tce~995 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Byoutube_prefix%7D%7D%7B%7Bvideo_data.id_%7D%7D?a=commitdiff_plain;h=e6b7840265f17e8934500815030a2fc0553feb81;p=plomrogue Corrected window title creation. --- diff --git a/src/main.c b/src/main.c index bbc4302..0ecc10a 100644 --- a/src/main.c +++ b/src/main.c @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) world.score = 0; world.log = calloc(1, sizeof(char)); set_cleanup_flag(CLEANUP_LOG); - update_log (&world, " "); + update_log(&world, " "); struct Player player; player.hitpoints = 5; world.player = &player; diff --git a/src/wincontrol.c b/src/wincontrol.c index 715aebb..793b75e 100644 --- a/src/wincontrol.c +++ b/src/wincontrol.c @@ -43,7 +43,8 @@ extern struct Win * init_win_from_file(struct World * world, char * w_name, err = "Trouble in init_win_from_file() with fgets()."; exit_err(NULL == fgets(line, linemax, file), world, err); char * title = malloc(strlen(line)); - memcpy(title, line, strlen(line) - 1); + memcpy(title, line, strlen(line) - 1); /* Eliminate newline char at end */ + title[strlen(line) - 1] = '\0'; /* of string. */ exit_err(NULL == fgets(line, linemax, file), world, err); int16_t height = atoi(line); exit_err(NULL == fgets(line, linemax, file), world, err); diff --git a/src/windows.c b/src/windows.c index af710dd..bb78a8b 100644 --- a/src/windows.c +++ b/src/windows.c @@ -400,7 +400,7 @@ extern uint8_t init_win(struct WinMeta * wmeta, struct Win * w, char * title, { return 1; } - sprintf(w->_title, title, strlen(title)); + sprintf(w->_title, "%s", title); w->data = data; w->_draw = func; if (0 < width)