comparison tools/gfxconv.c @ 1585:a076c9d9b321

Improve error handling.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 14 May 2018 03:39:07 +0300
parents f1b279ba47a8
children ca087c0cc9c4
comparison
equal deleted inserted replaced
1584:f1b279ba47a8 1585:a076c9d9b321
1055 int dmWriteBitmap(const char *filename, const DMC64Image *image, const DMC64ImageFormat *fmt) 1055 int dmWriteBitmap(const char *filename, const DMC64Image *image, const DMC64ImageFormat *fmt)
1056 { 1056 {
1057 int res = DMERR_OK; 1057 int res = DMERR_OK;
1058 DMGrowBuf buf; 1058 DMGrowBuf buf;
1059 1059
1060 dmGrowBufInit(&buf);
1061
1060 // Encode to target format 1062 // Encode to target format
1061 dmMsg(1, "Encoding C64 bitmap data to format '%s'\n", fmt->name); 1063 dmMsg(1, "Encoding C64 bitmap data to format '%s'\n", fmt->name);
1062 if ((res = dmC64EncodeBMP(&buf, image, fmt)) != DMERR_OK) 1064 if ((res = dmC64EncodeBMP(&buf, image, fmt)) != DMERR_OK)
1065 {
1066 dmErrorMsg("Error encoding bitmap data: %s\n", dmErrorStr(res));
1063 goto error; 1067 goto error;
1068 }
1064 1069
1065 // And output the file 1070 // And output the file
1066 dmMsg(1, "Writing output file '%s'\n", filename); 1071 dmMsg(1, "Writing output file '%s'\n", filename);
1067 res = dmWriteDataFile(NULL, filename, buf.data, buf.len); 1072 res = dmWriteDataFile(NULL, filename, buf.data, buf.len);
1068 1073