Mercurial > hg > dmlib
comparison tools/view64.c @ 1404:89725addaeaf
Improve error checking.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 30 Oct 2017 20:33:28 +0200 |
parents | 009534f27de5 |
children | c29f1cea4a1c |
comparison
equal
deleted
inserted
replaced
1403:6aa0897265e8 | 1404:89725addaeaf |
---|---|
244 else | 244 else |
245 forced = NULL; | 245 forced = NULL; |
246 | 246 |
247 ret = dmC64DecodeBMP(&cimage, dataBuf, dataSize, 0, 2, &fmt, forced); | 247 ret = dmC64DecodeBMP(&cimage, dataBuf, dataSize, 0, 2, &fmt, forced); |
248 | 248 |
249 if (ret < 0) | 249 if (ret != DMERR_OK) |
250 { | 250 { |
251 dmErrorMsg("Failed to decode bitmap data %d: %s\n", ret, dmErrorStr(ret)); | 251 dmErrorMsg("Failed to decode bitmap data %d: %s\n", ret, dmErrorStr(ret)); |
252 goto error; | 252 goto error; |
253 } | 253 } |
254 | 254 |
296 if (fmt->convertFrom != NULL) | 296 if (fmt->convertFrom != NULL) |
297 ret = fmt->convertFrom(&bmap, cimage, fmt); | 297 ret = fmt->convertFrom(&bmap, cimage, fmt); |
298 else | 298 else |
299 ret = dmC64ConvertGenericBMP2Image(&bmap, cimage, fmt); | 299 ret = dmC64ConvertGenericBMP2Image(&bmap, cimage, fmt); |
300 | 300 |
301 if (ret != DMERR_OK) | |
302 { | |
303 dmErrorMsg("Failed to convert bitmap data %d: %s\n", ret, dmErrorStr(ret)); | |
304 goto error; | |
305 } | |
301 | 306 |
302 // Set window title and caption | 307 // Set window title and caption |
303 windowTitle = dm_strdup_printf("%s - %s (%d x %d)", | 308 windowTitle = dm_strdup_printf("%s - %s (%d x %d)", |
304 dmProgName, optFilename, cimage->width, cimage->height); | 309 dmProgName, optFilename, cimage->width, cimage->height); |
305 | 310 |