Mercurial > hg > sidinfo
comparison sidinfo.c @ 388:c96448875797
Change "new SLDB" boolean to a flags int.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 23 Feb 2022 20:09:55 +0200 |
parents | 1049033c6bbd |
children | e89e5d956a63 |
comparison
equal
deleted
inserted
replaced
387:51d6e86aa196 | 388:c96448875797 |
---|---|
99 | 99 |
100 // Option variables | 100 // Option variables |
101 char *setHVSCPath = NULL, | 101 char *setHVSCPath = NULL, |
102 *setSLDBPath = NULL, | 102 *setSLDBPath = NULL, |
103 *setSTILDBPath = NULL; | 103 *setSTILDBPath = NULL; |
104 BOOL setSLDBNewFormat = FALSE, | 104 BOOL optParsable = FALSE, |
105 optParsable = FALSE, | |
106 optFieldNamePrefix = TRUE, | 105 optFieldNamePrefix = TRUE, |
107 optHexadecimal = FALSE, | 106 optHexadecimal = FALSE, |
108 optFieldOutput = TRUE, | 107 optFieldOutput = TRUE, |
109 optRecurseDirs = FALSE, | 108 optRecurseDirs = FALSE, |
110 optShowHelp = FALSE; | 109 optShowHelp = FALSE; |
111 char *optOneLineFieldSep = NULL, | 110 char *optOneLineFieldSep = NULL, |
112 *optEscapeChars = NULL; | 111 *optEscapeChars = NULL; |
113 int optNFiles = 0; | 112 int optNFiles = 0, |
113 setSIDLibFlags = 0; | |
114 | |
114 | 115 |
115 PSFStack optFormat; | 116 PSFStack optFormat; |
116 | 117 |
117 SIDLibSLDB *sidSLDB = NULL; | 118 SIDLibSLDB *sidSLDB = NULL; |
118 SIDLibSTILDB *sidSTILDB = NULL; | 119 SIDLibSTILDB *sidSTILDB = NULL; |
1012 } | 1013 } |
1013 | 1014 |
1014 th_io_set_handlers(infh, siPSIDError, NULL); | 1015 th_io_set_handlers(infh, siPSIDError, NULL); |
1015 | 1016 |
1016 // Read PSID data | 1017 // Read PSID data |
1017 if ((res = sidlib_read_sid_file_alloc(infh, &psid, setSLDBNewFormat, NULL)) != THERR_OK) | 1018 if ((res = sidlib_read_sid_file_alloc(infh, &psid, setSIDLibFlags, NULL)) != THERR_OK) |
1018 goto error; | 1019 goto error; |
1019 | 1020 |
1020 // Get songlength information, if any | 1021 // Get songlength information, if any |
1021 if (sidSLDB != NULL) | 1022 if (sidSLDB != NULL) |
1022 psid->lengths = sidlib_sldb_get_by_hash(sidSLDB, psid->hash); | 1023 psid->lengths = sidlib_sldb_get_by_hash(sidSLDB, psid->hash); |
1253 } | 1254 } |
1254 | 1255 |
1255 // Read SLDB and STILDB | 1256 // Read SLDB and STILDB |
1256 if (setSLDBPath != NULL) | 1257 if (setSLDBPath != NULL) |
1257 { | 1258 { |
1258 setSLDBNewFormat = th_strrcasecmp(setSLDBPath, ".md5") != NULL; | 1259 if (th_strrcasecmp(setSLDBPath, ".md5") != NULL) |
1260 setSIDLibFlags |= SIDLIB_FLG_NEW_SLDB; | |
1259 | 1261 |
1260 THMSG(1, "Reading SLDB (%s format [%s]): %s\n", | 1262 THMSG(1, "Reading SLDB (%s format [%s]): %s\n", |
1261 setSLDBNewFormat ? "new" : "old", | 1263 (setSIDLibFlags & SIDLIB_FLG_NEW_SLDB) ? "new" : "old", |
1262 setSLDBNewFormat ? ".md5" : ".txt", | 1264 (setSIDLibFlags & SIDLIB_FLG_NEW_SLDB) ? ".md5" : ".txt", |
1263 setSLDBPath); | 1265 setSLDBPath); |
1264 | 1266 |
1265 if ((res = sidutil_read_sldb_file(setSLDBPath, &sidSLDB)) != THERR_OK) | 1267 if ((res = sidutil_read_sldb_file(setSLDBPath, &sidSLDB)) != THERR_OK) |
1266 goto exit; | 1268 goto exit; |
1267 } | 1269 } |