# HG changeset patch # User Matti Hamalainen # Date 1475474761 -10800 # Node ID 132706e3b94b689b7918b2d7a659b2fa199b41b4 # Parent acae5f8ebc67d33cd60305b0e41a1a94db2b80f4 Improve error handling and reporting slightly. diff -r acae5f8ebc67 -r 132706e3b94b src/dmlib.c --- a/src/dmlib.c Thu May 19 12:08:16 2016 +0300 +++ b/src/dmlib.c Mon Oct 03 09:06:01 2016 +0300 @@ -187,8 +187,10 @@ case DMERR_DATA_ERROR: return "Data decoding/encoding/parsing error"; + case DMERR_VERSION: return "Unsupported file format version"; + case DMERR_NOTPACK: return "File is not a PACK"; - case DMERR_VERSION: return "Unsupported PACK version"; + case DMERR_PACK_VERSION: return "Unsupported PACK version"; case DMERR_INVALID: return "Invalid data, corrupted file"; case DMERR_COMPRESSION: return "Error in compression"; diff -r acae5f8ebc67 -r 132706e3b94b src/dmlib.h --- a/src/dmlib.h Thu May 19 12:08:16 2016 +0300 +++ b/src/dmlib.h Mon Oct 03 09:06:01 2016 +0300 @@ -112,10 +112,12 @@ DMERR_BOUNDS, DMERR_DATA_ERROR, // Data decoding/encoding/parsing error + + DMERR_VERSION, // Unsupported data version // PACK-file subsystem DMERR_NOTPACK, - DMERR_VERSION, + DMERR_PACK_VERSION, DMERR_INVALID, DMERR_COMPRESSION, }; diff -r acae5f8ebc67 -r 132706e3b94b src/dmpack.c --- a/src/dmpack.c Thu May 19 12:08:16 2016 +0300 +++ b/src/dmpack.c Mon Oct 03 09:06:01 2016 +0300 @@ -123,7 +123,7 @@ if (hdr.version != DPACK_VERSION) { - ret = DMERR_VERSION; + ret = DMERR_PACK_VERSION; goto out; } diff -r acae5f8ebc67 -r 132706e3b94b src/dmsimple.c --- a/src/dmsimple.c Thu May 19 12:08:16 2016 +0300 +++ b/src/dmsimple.c Mon Oct 03 09:06:01 2016 +0300 @@ -735,7 +735,7 @@ if ((err = engineInitAudioParts(&engine)) != DMERR_OK) { - dmErrorDBGMsg( + dmErrorMsg( "engineInitAudioParts() failed: #%d: %s\n", err, dmErrorStr(err)); goto out; @@ -745,7 +745,7 @@ if (engine.demoInitPreVideo != NULL && (err = engine.demoInitPreVideo(&engine)) != DMERR_OK) { - dmErrorDBGMsg( + dmErrorMsg( "demoInitPreVideo() failed, #%d: %s\n", err, dmErrorStr(err)); goto out; @@ -770,7 +770,7 @@ dmPrint(1, "Loading resources, please wait...\n"); if ((err = engineLoadResources()) != DMERR_OK) { - dmErrorDBGMsg( + dmErrorMsg( "Error loading resources, #%d: %s.\n", err, dmErrorStr(err)); goto out; @@ -780,7 +780,7 @@ dmPrint(1, "Initializing demo...\n"); if ((err = engine.demoInit(&engine)) != DMERR_OK) { - dmErrorDBGMsg( + dmErrorMsg( "Failure in demoInit(), #%d: %s\n", err, dmErrorStr(err)); goto out; @@ -789,7 +789,7 @@ // Initialize effects if ((err = engineInitializeEffects(&engine)) != DMERR_OK) { - dmErrorDBGMsg( + dmErrorMsg( "Effects initialization failed, #%d: %s\n", err, dmErrorStr(err)); goto out;