Mercurial > hg > dmlib
diff tools/view64.c @ 938:ba812817a281
Various fixes in view64.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 25 Feb 2015 21:25:59 +0200 |
parents | 8fe48c08dbca |
children | ff18d2511843 |
line wrap: on
line diff
--- a/tools/view64.c Wed Feb 25 20:33:57 2015 +0200 +++ b/tools/view64.c Wed Feb 25 21:25:59 2015 +0200 @@ -195,19 +195,25 @@ forced = NULL; ret = dmC64DecodeBMP(&cimage, dataBuf, dataSize, 0, 2, &fmt, forced); + + if (ret < 0) + { + dmError("Failed to decode bitmap data %d: %s\n", ret, dmErrorStr(ret)); + goto error; + } + if (forced == NULL && fmt != NULL) { dmMsg(0,"Probed %s format image, type %d, %s\n", fmt->name, fmt->type, fmt->fext); } - if (ret < 0) + if (fmt == NULL) { - dmError("Probing could not find any matching image format (%d). Perhaps try forcing a format via -f\n", ret); - return -1; + dmError("Probing could not find any matching image format. Perhaps try forcing a format via -f.\n"); + goto error; } - // Initialize libSDL if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { @@ -245,7 +251,9 @@ // Set window title and caption - windowTitle = dm_strdup_printf("%s - %s", dmProgName, optFilename); + windowTitle = dm_strdup_printf("%s - %s (%d x %d)", + dmProgName, optFilename, cimage->width, cimage->height); + SDL_WM_SetCaption(windowTitle, dmProgName); dmFree(windowTitle);