Mercurial > hg > sidinfo
diff sidinfo.c @ 126:c1462b7880e8
Make si_read_sid_file() to allocate the PSIDHeader struct itself, adjust
API/ABI accordingly.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 27 Oct 2016 11:52:27 +0300 |
parents | ffccc712409a |
children | 1786b9d77782 |
line wrap: on
line diff
--- a/sidinfo.c Wed Oct 26 11:59:15 2016 +0300 +++ b/sidinfo.c Thu Oct 27 11:52:27 2016 +0300 @@ -511,7 +511,7 @@ BOOL argHandleFile(char *filename) { - static PSIDHeader psid; + PSIDHeader *psid = NULL; th_ioctx *inFile = NULL; FILE *outFile; int index; @@ -523,7 +523,7 @@ if ((inFile = th_io_fopen(&th_stdio_io_ops, filename, "rb")) == NULL) { THERR("Could not open file '%s'.\n", filename); - return TRUE; + goto error; } // Read PSID data @@ -535,7 +535,7 @@ // Get songlength information, if any if (sidSLDB != NULL) - psid.lengths = si_sldb_get_by_hash(sidSLDB, psid.hash); + psid->lengths = si_sldb_get_by_hash(sidSLDB, psid->hash); // Output for (index = 0; index < optFormat.nitems; index++) @@ -552,7 +552,7 @@ break; default: - siPrintPSIDInformationField(outFile, filename, &psid, &shown, item); + siPrintPSIDInformationField(outFile, filename, psid, &shown, item); break; } } @@ -565,6 +565,7 @@ // Shutdown error: + si_free_sid_file(psid); th_io_free(inFile); return TRUE;