From e4a31eec9f77cbb78ee3b6cb1d8a6b9cd030e966 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 28 Jun 2016 16:43:42 +0200 Subject: [PATCH] Small fixes * format string in debug * quit SDL subsystem * some assertions in src/video_frame.c to check allocation success --- src/debug.cpp | 4 ++-- src/video_display/sdl.cpp | 1 + src/video_frame.c | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 1d9a3dce1..74baec333 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -109,8 +109,8 @@ void log_msg(int level, const char *format, ...) strcat(format_new, color); } if (log_level >= LOG_LEVEL_VERBOSE) { - uint64_t time_ms = time_since_epoch_in_ms(); - sprintf(format_new + strlen(format_new), "[%ld.%03ld] ", time_ms / 1000, + unsigned long long time_ms = time_since_epoch_in_ms(); + sprintf(format_new + strlen(format_new), "[%llu.%03llu] ", time_ms / 1000, time_ms % 1000); } strcat(format_new, format); diff --git a/src/video_display/sdl.cpp b/src/video_display/sdl.cpp index 3d00774ed..63987c102 100644 --- a/src/video_display/sdl.cpp +++ b/src/video_display/sdl.cpp @@ -592,6 +592,7 @@ static void display_sdl_done(void *state) /*FIXME: free all the stuff */ SDL_ShowCursor(SDL_ENABLE); + SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE); SDL_Quit(); #ifdef HAVE_MACOSX autorelease_pool_destroy(s->autorelease_pool); diff --git a/src/video_frame.c b/src/video_frame.c index 29e9b883a..f13433e54 100644 --- a/src/video_frame.c +++ b/src/video_frame.c @@ -66,9 +66,11 @@ struct video_frame * vf_alloc(int count) assert(count > 0); buf = (struct video_frame *) calloc(1, sizeof(struct video_frame)); + assert(buf != NULL); buf->tiles = (struct tile *) calloc(1, sizeof(struct tile) * count); + assert(buf->tiles != NULL); buf->tile_count = count; return buf; @@ -108,6 +110,7 @@ struct video_frame * vf_alloc_desc_data(struct video_desc desc) desc.color_spec) * desc.height; buf->tiles[i].data = (char *) malloc(buf->tiles[i].data_len); + assert(buf->tiles[i].data != NULL); } }