# HG changeset patch # User Matti Hamalainen # Date 1578925497 -7200 # Node ID 6f8c431a30409cd445db1f9de72da8ba7790e56a # Parent 923e63b9653b211a47b4e6c5e99bc45d682289d8 Rename some variables and function arguments. diff -r 923e63b9653b -r 6f8c431a3040 sidinfo.c --- a/sidinfo.c Mon Jan 13 15:14:16 2020 +0200 +++ b/sidinfo.c Mon Jan 13 16:24:57 2020 +0200 @@ -710,34 +710,34 @@ } -static void siPrintFieldPrefixName(FILE *outFile, const char *name, const BOOL multifield) +static void siPrintFieldPrefixName(FILE *outfh, const char *name, const BOOL multifield) { if (optFieldNamePrefix) { if (optFieldOutput && optOneLineFieldSep == NULL) - fprintf(outFile, optParsable ? "%s=" : "%-20s : ", name); + fprintf(outfh, optParsable ? "%s=" : "%-20s : ", name); else if (multifield) - fprintf(outFile, "[%s] ", name); + fprintf(outfh, "[%s] ", name); } } -static void siPrintFieldPrefix(FILE *outFile, const PSFOption *opt) +static void siPrintFieldPrefix(FILE *outfh, const PSFOption *opt) { - siPrintFieldPrefixName(outFile, + siPrintFieldPrefixName(outfh, (optParsable || opt->lname == NULL) ? opt->name : opt->lname, FALSE); } -static void siPrintFieldSeparator(FILE *outFile, const BOOL multifield, const BOOL last) +static void siPrintFieldSeparator(FILE *outfh, const BOOL multifield, const BOOL last) { if (optFieldOutput) - fputs(optOneLineFieldSep != NULL ? optOneLineFieldSep : "\n", outFile); + fputs(optOneLineFieldSep != NULL ? optOneLineFieldSep : "\n", outfh); else if (multifield && !last) - fputs(optOneLineFieldSep != NULL ? optOneLineFieldSep : ", ", outFile); + fputs(optOneLineFieldSep != NULL ? optOneLineFieldSep : ", ", outfh); } @@ -763,7 +763,7 @@ } -static void siPrintPSIDInfoLine(FILE *outFile, BOOL *shown, +static void siPrintPSIDInfoLine(FILE *outfh, BOOL *shown, const char *fmt, const int otype, const char *d_str, const int d_int, const BOOL convert) @@ -780,7 +780,7 @@ tmp = sidutil_escape_string(d_str, optEscapeChars); if ((str = siItemFormatStrPrint(fmt, otype, tmp, d_int)) != NULL) - fputs(str, outFile); + fputs(str, outfh); th_free(str); th_free(tmp); @@ -790,19 +790,19 @@ #define PRS(d_str, d_conv) do { \ - siPrintFieldPrefix(outFile, opt); \ - siPrintPSIDInfoLine(outFile, shown, siGetInfoFormat(item, opt->type), opt->type, d_str, -1, d_conv); \ - siPrintFieldSeparator(outFile, FALSE, TRUE); \ + siPrintFieldPrefix(outfh, opt); \ + siPrintPSIDInfoLine(outfh, shown, siGetInfoFormat(item, opt->type), opt->type, d_str, -1, d_conv); \ + siPrintFieldSeparator(outfh, FALSE, TRUE); \ } while (0) #define PRI(d_int) do { \ - siPrintFieldPrefix(outFile, opt); \ - siPrintPSIDInfoLine(outFile, shown, siGetInfoFormat(item, opt->type), opt->type, NULL, d_int, FALSE); \ - siPrintFieldSeparator(outFile, FALSE, TRUE); \ + siPrintFieldPrefix(outfh, opt); \ + siPrintPSIDInfoLine(outfh, shown, siGetInfoFormat(item, opt->type), opt->type, NULL, d_int, FALSE); \ + siPrintFieldSeparator(outfh, FALSE, TRUE); \ } while (0) -static void siPrintPSIDInformationField(FILE *outFile, const char *filename, +static void siPrintPSIDInformationField(FILE *outfh, const char *filename, const SIDLibPSIDHeader *psid, BOOL *shown, const PSFStackItem *item) { const PSFOption *opt = &optPSOptions[item->cmd]; @@ -886,7 +886,7 @@ case 22: if (psid->lengths != NULL && psid->lengths->nlengths > 0) { - siPrintFieldPrefix(outFile, opt); + siPrintFieldPrefix(outfh, opt); for (int i = 0; i < psid->lengths->nlengths; i++) { int len = psid->lengths->lengths[i]; @@ -895,13 +895,13 @@ len / 60, len % 60, (i < psid->lengths->nlengths - 1) ? ", " : ""); - siPrintPSIDInfoLine(outFile, shown, + siPrintPSIDInfoLine(outfh, shown, siGetInfoFormat(item, OTYPE_STR), OTYPE_STR, tmp, -1, FALSE); } - siPrintFieldSeparator(outFile, FALSE, TRUE); + siPrintFieldSeparator(outfh, FALSE, TRUE); } break; @@ -950,14 +950,14 @@ sidlib_stil_fields[nfield]); } - siPrintFieldPrefixName(outFile, tmp, TRUE); - siPrintPSIDInfoLine(outFile, shown, + siPrintFieldPrefixName(outfh, tmp, TRUE); + siPrintPSIDInfoLine(outfh, shown, siGetInfoFormat(item, OTYPE_STR), OTYPE_STR, fld->data[nitem], -1, TRUE); - siPrintFieldSeparator(outFile, TRUE, + siPrintFieldSeparator(outfh, TRUE, ++nfieldn >= nfieldcount); } } @@ -985,24 +985,24 @@ BOOL siHandleSIDFile(const char *filename) { SIDLibPSIDHeader *psid = NULL; - th_ioctx *inFile = NULL; - FILE *outFile; + th_ioctx *infh = NULL; + FILE *outfh; BOOL shown = FALSE; int res; - outFile = stdout; + outfh = stdout; - if ((res = th_io_fopen(&inFile, &th_stdio_io_ops, filename, "rb")) != THERR_OK) + if ((res = th_io_fopen(&infh, &th_stdio_io_ops, filename, "rb")) != THERR_OK) { THERR("Could not open file '%s': %s\n", filename, th_error_str(res)); goto error; } - th_io_set_handlers(inFile, siPSIDError, NULL); + th_io_set_handlers(infh, siPSIDError, NULL); // Read PSID data - if ((res = sidlib_read_sid_file_alloc(inFile, &psid, setSLDBNewFormat, NULL)) != THERR_OK) + if ((res = sidlib_read_sid_file_alloc(infh, &psid, setSLDBNewFormat, NULL)) != THERR_OK) goto error; // Get songlength information, if any @@ -1026,28 +1026,28 @@ switch (item->cmd) { case -1: - sidutil_print_string_escaped(outFile, item->str); + sidutil_print_string_escaped(outfh, item->str); break; case -2: - fputc(item->chr, outFile); + fputc(item->chr, outfh); break; default: - siPrintPSIDInformationField(outFile, filename, psid, &shown, item); + siPrintPSIDInformationField(outfh, filename, psid, &shown, item); break; } } if (optFieldOutput && shown) { - fprintf(outFile, "\n"); + fprintf(outfh, "\n"); } // Shutdown error: sidlib_free_sid_file(psid); - th_io_free(inFile); + th_io_free(infh); return TRUE; } @@ -1157,7 +1157,7 @@ int main(int argc, char *argv[]) { - th_ioctx *inFile = NULL; + th_ioctx *infh = NULL; char *setLang = getenv("LANG"); int ret; @@ -1247,14 +1247,14 @@ // Initialize SLDB setSLDBNewFormat = th_strrcasecmp(setSLDBPath, ".md5") != NULL; - if ((ret = th_io_fopen(&inFile, &th_stdio_io_ops, setSLDBPath, "r")) != THERR_OK) + if ((ret = th_io_fopen(&infh, &th_stdio_io_ops, setSLDBPath, "r")) != THERR_OK) { THERR("Could not open SLDB '%s': %s\n", setSLDBPath, th_error_str(ret)); goto err1; } - th_io_set_handlers(inFile, siSTILError, NULL); + th_io_set_handlers(infh, siSTILError, NULL); THMSG(1, "Reading SLDB (%s format [%s]): %s\n", setSLDBNewFormat ? "new" : "old", @@ -1268,7 +1268,7 @@ goto err1; } - if ((ret = sidlib_sldb_read(inFile, sidSLDB)) != THERR_OK) + if ((ret = sidlib_sldb_read(infh, sidSLDB)) != THERR_OK) { THERR("Error parsing SLDB: %s\n", th_error_str(ret)); @@ -1283,21 +1283,21 @@ } err1: - th_io_free(inFile); - inFile = NULL; + th_io_free(infh); + infh = NULL; } if (setSTILDBPath != NULL) { // Initialize STILDB - if ((ret = th_io_fopen(&inFile, &th_stdio_io_ops, setSTILDBPath, "r")) != THERR_OK) + if ((ret = th_io_fopen(&infh, &th_stdio_io_ops, setSTILDBPath, "r")) != THERR_OK) { THERR("Could not open STIL database '%s': %s\n", setSTILDBPath, th_error_str(ret)); goto err2; } - th_io_set_handlers(inFile, siSTILError, NULL); + th_io_set_handlers(infh, siSTILError, NULL); THMSG(1, "Reading STIL database: %s\n", setSTILDBPath); @@ -1309,7 +1309,7 @@ goto err2; } - if ((ret = sidlib_stildb_read(inFile, sidSTILDB, NULL)) != THERR_OK) + if ((ret = sidlib_stildb_read(infh, sidSTILDB, NULL)) != THERR_OK) { THERR("Error parsing STIL: %s\n", th_error_str(ret)); @@ -1324,8 +1324,8 @@ } err2: - th_io_free(inFile); - inFile = NULL; + th_io_free(infh); + infh = NULL; } // Process files