Mercurial > hg > dmlib
comparison tools/gfxconv.c @ 799:5ec451795ab2
Add some error checking.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 30 Oct 2013 02:25:40 +0200 |
parents | d9888292f971 |
children | 1e4d88fbce19 |
comparison
equal
deleted
inserted
replaced
798:422f85db78fd | 799:5ec451795ab2 |
---|---|
1411 break; | 1411 break; |
1412 } | 1412 } |
1413 | 1413 |
1414 if (optSequential) | 1414 if (optSequential) |
1415 { | 1415 { |
1416 int eres; | |
1417 | |
1416 outFilename = dm_strdup_printf("%s%04d.%s", optOutFilename, itemCount, convFormatList[optOutFormat].fext); | 1418 outFilename = dm_strdup_printf("%s%04d.%s", optOutFilename, itemCount, convFormatList[optOutFormat].fext); |
1417 if (outFilename == NULL) | 1419 if (outFilename == NULL) |
1418 { | 1420 { |
1419 dmError("Could not allocate memory for filename template?\n"); | 1421 dmError("Could not allocate memory for filename template?\n"); |
1420 goto error; | 1422 goto error; |
1421 } | 1423 } |
1422 | 1424 |
1423 dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE); | 1425 eres = dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE); |
1426 if (eres != DMERR_OK) | |
1427 { | |
1428 dmError("Error writing output image, %s.\n", | |
1429 dmErrorStr(eres)); | |
1430 } | |
1431 | |
1424 dmFree(outFilename); | 1432 dmFree(outFilename); |
1425 } | 1433 } |
1426 else | 1434 else |
1427 { | 1435 { |
1428 if (++outX >= optPlanedWidth) | 1436 if (++outX >= optPlanedWidth) |
1435 itemCount++; | 1443 itemCount++; |
1436 } | 1444 } |
1437 | 1445 |
1438 if (!optSequential) | 1446 if (!optSequential) |
1439 { | 1447 { |
1440 dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE); | 1448 int eres = dmWriteImage(optOutFilename, outImage, &optSpec, optOutSubFormat, TRUE); |
1449 if (eres != DMERR_OK) | |
1450 { | |
1451 dmError("Error writing output image, %s.\n", | |
1452 dmErrorStr(eres)); | |
1453 } | |
1441 } | 1454 } |
1442 | 1455 |
1443 dmImageFree(outImage); | 1456 dmImageFree(outImage); |
1444 } | 1457 } |
1445 else | 1458 else |