comparison sidinfo.c @ 150:0288c4d138f7

Make the hash field also formattable.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 25 Oct 2017 23:30:48 +0300
parents 01cde57da297
children e3be2ae6120e
comparison
equal deleted inserted replaced
149:422d95735359 150:0288c4d138f7
80 { "SID3Addr" , "3rd SID address" , OTYPE_INT }, 80 { "SID3Addr" , "3rd SID address" , OTYPE_INT },
81 81
82 { "Name" , NULL , OTYPE_STR }, 82 { "Name" , NULL , OTYPE_STR },
83 { "Author" , NULL , OTYPE_STR }, 83 { "Author" , NULL , OTYPE_STR },
84 { "Copyright" , NULL , OTYPE_STR }, 84 { "Copyright" , NULL , OTYPE_STR },
85 { "Hash" , NULL , OTYPE_OTHER }, 85 { "Hash" , NULL , OTYPE_STR },
86 86
87 { "Songlengths" , "Song lengths" , OTYPE_OTHER }, 87 { "Songlengths" , "Song lengths" , OTYPE_OTHER },
88 }; 88 };
89 89
90 static const int noptPSOptions = sizeof(optPSOptions) / sizeof(optPSOptions[0]); 90 static const int noptPSOptions = sizeof(optPSOptions) / sizeof(optPSOptions[0]);
736 736
737 737
738 static void siPrintPSIDInformationField(FILE *outFile, const char *filename, const PSIDHeader *psid, BOOL *shown, const PSFStackItem *item) 738 static void siPrintPSIDInformationField(FILE *outFile, const char *filename, const PSIDHeader *psid, BOOL *shown, const PSFStackItem *item)
739 { 739 {
740 const PSFOption *opt = &optPSOptions[item->cmd]; 740 const PSFOption *opt = &optPSOptions[item->cmd];
741 char tmp[64]; 741 char tmp[128];
742 742
743 switch (item->cmd) 743 switch (item->cmd)
744 { 744 {
745 case 0: PR(filename, -1); break; 745 case 0: PR(filename, -1); break;
746 case 1: PR(psid->magic, -1); break; 746 case 1: PR(psid->magic, -1); break;
805 case 19: PR(psid->sidAuthor, -1); break; 805 case 19: PR(psid->sidAuthor, -1); break;
806 case 20: PR(psid->sidCopyright, -1); break; 806 case 20: PR(psid->sidCopyright, -1); break;
807 807
808 case 21: 808 case 21:
809 { 809 {
810 siPrintFieldPrefix(outFile, opt); 810 size_t i, k;
811 th_md5_print(outFile, psid->hash); 811 for (i = k = 0; i < TH_MD5HASH_LENGTH && k < sizeof(tmp) - 1; i++, k += 2)
812 siPrintFieldSeparator(outFile); 812 sprintf(&tmp[k], "%02x", psid->hash[i]);
813
814 PR(tmp, -1);
813 } 815 }
814 break; 816 break;
815 817
816 case 22: 818 case 22:
817 if (psid->lengths != NULL && psid->lengths->nlengths > 0) 819 if (psid->lengths != NULL && psid->lengths->nlengths > 0)