Small fixes

* format string in debug
* quit SDL subsystem
* some assertions in src/video_frame.c to check allocation success
This commit is contained in:
Martin Pulec
2016-06-28 16:43:42 +02:00
parent 2d79d418ec
commit e4a31eec9f
3 changed files with 6 additions and 2 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);
}
}