Mercurial > hg > sidinfo
comparison sidinfo.c @ 226:c32015f4969e
Rename PSIDHeader struct to SIDLibPSIDHeader to conform with the SIDLib
prefix used otherwise. Add new function sidlib_read_sid_file_alloc()
which allocates the PSID header struct, instead of sidlib_read_sid_file()
which just reads into the given struct.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 03 Jan 2020 10:38:18 +0200 |
parents | 15a51252b73a |
children | 2b3d5d49086d |
comparison
equal
deleted
inserted
replaced
225:15a51252b73a | 226:c32015f4969e |
---|---|
852 if (optFieldOutput) | 852 if (optFieldOutput) |
853 fputs(optOneLineFieldSep != NULL ? optOneLineFieldSep : "\n", outFile); | 853 fputs(optOneLineFieldSep != NULL ? optOneLineFieldSep : "\n", outFile); |
854 } | 854 } |
855 | 855 |
856 | 856 |
857 static void siPrintPSIDInfoLine(FILE *outFile, BOOL *shown, const PSFStackItem *item, const char *d_str, const int d_int, const BOOL useConv) | 857 static void siPrintPSIDInfoLine(FILE *outFile, BOOL *shown, |
858 const PSFStackItem *item, const char *d_str, | |
859 const int d_int, const BOOL useConv) | |
858 { | 860 { |
859 const PSFOption *opt = &optPSOptions[item->cmd]; | 861 const PSFOption *opt = &optPSOptions[item->cmd]; |
860 char *fmt, *str, *tmp; | 862 char *fmt, *str, *tmp; |
861 | 863 |
862 switch (opt->type) | 864 switch (opt->type) |
903 | 905 |
904 #define PRS(d_str, d_conv) siPrintPSIDInfoLine(outFile, shown, item, d_str, -1, d_conv) | 906 #define PRS(d_str, d_conv) siPrintPSIDInfoLine(outFile, shown, item, d_str, -1, d_conv) |
905 #define PRI(d_int) siPrintPSIDInfoLine(outFile, shown, item, NULL, d_int, FALSE) | 907 #define PRI(d_int) siPrintPSIDInfoLine(outFile, shown, item, NULL, d_int, FALSE) |
906 | 908 |
907 | 909 |
908 static void siPrintPSIDInformationField(FILE *outFile, const char *filename, const PSIDHeader *psid, BOOL *shown, const PSFStackItem *item) | 910 static void siPrintPSIDInformationField(FILE *outFile, const char *filename, |
911 const SIDLibPSIDHeader *psid, BOOL *shown, const PSFStackItem *item) | |
909 { | 912 { |
910 const PSFOption *opt = &optPSOptions[item->cmd]; | 913 const PSFOption *opt = &optPSOptions[item->cmd]; |
911 char tmp[128]; | 914 char tmp[128]; |
912 | 915 |
913 switch (item->cmd) | 916 switch (item->cmd) |
1011 } | 1014 } |
1012 | 1015 |
1013 | 1016 |
1014 BOOL siHandleSIDFile(const char *filename) | 1017 BOOL siHandleSIDFile(const char *filename) |
1015 { | 1018 { |
1016 PSIDHeader *psid = NULL; | 1019 SIDLibPSIDHeader *psid = NULL; |
1017 th_ioctx *inFile = NULL; | 1020 th_ioctx *inFile = NULL; |
1018 FILE *outFile; | 1021 FILE *outFile; |
1019 BOOL shown = FALSE; | 1022 BOOL shown = FALSE; |
1020 int res; | 1023 int res; |
1021 | 1024 |
1029 } | 1032 } |
1030 | 1033 |
1031 th_io_set_handlers(inFile, siError, NULL); | 1034 th_io_set_handlers(inFile, siError, NULL); |
1032 | 1035 |
1033 // Read PSID data | 1036 // Read PSID data |
1034 if (!sidlib_read_sid_file(inFile, &psid, setSLDBNewFormat)) | 1037 if (!sidlib_read_sid_file_alloc(inFile, &psid, setSLDBNewFormat)) |
1035 goto error; | 1038 goto error; |
1036 | 1039 |
1037 // Get songlength information, if any | 1040 // Get songlength information, if any |
1038 if (sidSLDB != NULL) | 1041 if (sidSLDB != NULL) |
1039 psid->lengths = sidlib_sldb_get_by_hash(sidSLDB, psid->hash); | 1042 psid->lengths = sidlib_sldb_get_by_hash(sidSLDB, psid->hash); |