comparison tools/xm2jss.c @ 2384:36edd316184a

Fix some format strings to use proper PRI*_SIZE_T where necessary.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 09 Jan 2020 15:20:23 +0200
parents dcf1016f3d27
children b7cd5dd0b82e
comparison
equal deleted inserted replaced
2383:43e39d9ec42f 2384:36edd316184a
596 JSSERROR(DMERR_FWRITE, DMERR_FWRITE, 596 JSSERROR(DMERR_FWRITE, DMERR_FWRITE,
597 "Error writing JSSMOD header!\n"); 597 "Error writing JSSMOD header!\n");
598 } 598 }
599 599
600 totalSize = sizeof(jssH); 600 totalSize = sizeof(jssH);
601 dmMsg(1," * JSSMOD-header 0x%04x, %d bytes.\n", JSSMOD_VERSION, totalSize); 601 dmMsg(1," * JSSMOD-header 0x%04x, %" DM_PRIu_SIZE_T " bytes.\n",
602 JSSMOD_VERSION, totalSize);
602 603
603 // Write orders list 604 // Write orders list
604 for (totalSize = index = 0; index < module->norders; index++) 605 for (totalSize = index = 0; index < module->norders; index++)
605 { 606 {
606 int tmp = module->orderList[index]; 607 int tmp = module->orderList[index];
620 index, tmp); 621 index, tmp);
621 622
622 totalSize += sizeof(Uint16); 623 totalSize += sizeof(Uint16);
623 } 624 }
624 625
625 dmMsg(1," * %d item orders list, %d bytes.\n", 626 dmMsg(1," * %d item orders list, %" DM_PRIu_SIZE_T " bytes.\n",
626 module->norders, totalSize); 627 module->norders, totalSize);
627 628
628 // Allocate pattern compression buffer 629 // Allocate pattern compression buffer
629 if ((patBuf = dmMalloc(patBufSize)) == NULL) 630 if ((patBuf = dmMalloc(patBufSize)) == NULL)
630 { 631 {
683 { 684 {
684 JSSERROR(ret, ret, "Error converting pattern data #%d.\n", 685 JSSERROR(ret, ret, "Error converting pattern data #%d.\n",
685 pattern); 686 pattern);
686 } 687 }
687 688
688 dmMsg(3, " - Pattern %d size %d bytes\n", index, dataSize); 689 dmMsg(3, " - Pattern %d size %" DM_PRIu_SIZE_T " bytes\n",
690 index, dataSize);
691
689 totalSize += dataSize + sizeof(JSSMODPattern); 692 totalSize += dataSize + sizeof(JSSMODPattern);
690 693
691 if (!dm_fwrite_le32(outFile, dataSize) || 694 if (!dm_fwrite_le32(outFile, dataSize) ||
692 !dm_fwrite_le16(outFile, pattern->nrows) || 695 !dm_fwrite_le16(outFile, pattern->nrows) ||
693 !dm_fwrite_le16(outFile, pattern->nmap)) 696 !dm_fwrite_le16(outFile, pattern->nmap))
715 index); 718 index);
716 } 719 }
717 } 720 }
718 721
719 dmFree(patBuf); 722 dmFree(patBuf);
720 dmMsg(1," * %d patterns, %d bytes.\n", 723 dmMsg(1," * %d patterns, %" DM_PRIu_SIZE_T " bytes.\n",
721 module->npatterns, totalSize); 724 module->npatterns, totalSize);
722 725
723 // Write extended instruments 726 // Write extended instruments
724 for (totalSize = index = 0; index < module->nextInstruments; index++) 727 for (totalSize = index = 0; index < module->nextInstruments; index++)
725 { 728 {
763 } 766 }
764 767
765 totalSize += sizeof(JSSMODExtInstrument); 768 totalSize += sizeof(JSSMODExtInstrument);
766 } 769 }
767 770
768 dmMsg(1," * %d Extended Instruments, %d bytes.\n", 771 dmMsg(1," * %d Extended Instruments, %" DM_PRIu_SIZE_T " bytes.\n",
769 module->nextInstruments, totalSize); 772 module->nextInstruments, totalSize);
770 773
771 // Write sample instrument headers 774 // Write sample instrument headers
772 for (totalSize = index = 0; index < module->ninstruments; index++) 775 for (totalSize = index = 0; index < module->ninstruments; index++)
773 if (module->instruments[index] != NULL) 776 if (module->instruments[index] != NULL)
803 JSSWARNING(DMERR_NULLPTR, DMERR_NULLPTR, 806 JSSWARNING(DMERR_NULLPTR, DMERR_NULLPTR,
804 "Instrument #%d NULL!\n", 807 "Instrument #%d NULL!\n",
805 index); 808 index);
806 } 809 }
807 810
808 dmMsg(1," * %d Instrument headers, %d bytes.\n", 811 dmMsg(1," * %d Instrument headers, %" DM_PRIu_SIZE_T " bytes.\n",
809 module->ninstruments, totalSize); 812 module->ninstruments, totalSize);
810 813
811 // Write sample data 814 // Write sample data
812 for (totalSize = index = 0; index < module->ninstruments; index++) 815 for (totalSize = index = 0; index < module->ninstruments; index++)
813 { 816 {
842 845
843 totalSize += bsize; 846 totalSize += bsize;
844 } 847 }
845 } 848 }
846 849
847 dmMsg(1," * %d samples, %d bytes.\n", 850 dmMsg(1," * %d samples, %" DM_PRIu_SIZE_T " bytes.\n",
848 module->ninstruments, totalSize); 851 module->ninstruments, totalSize);
849 852
850 return DMERR_OK; 853 return DMERR_OK;
851 } 854 }
852 855
1022 usedInstruments[q] = TRUE; 1025 usedInstruments[q] = TRUE;
1023 } 1026 }
1024 else 1027 else
1025 { 1028 {
1026 dmErrorMsg("Ext.instrument #%d sNumForNotes[%d] value out range (%d < %d).\n", 1029 dmErrorMsg("Ext.instrument #%d sNumForNotes[%d] value out range (%d < %d).\n",
1027 i + 1, m->ninstruments, q + 1); 1030 i + 1, note, m->ninstruments, q + 1);
1028 } 1031 }
1029 } 1032 }
1030 } 1033 }
1031 1034
1032 // 1035 //