comparison minijss/jloadxm.c @ 1257:60dc14a2e4c5

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 09 Mar 2015 18:46:12 +0200
parents d88d5f88b77a
children 8e854dfee26d
comparison
equal deleted inserted replaced
1256:d88d5f88b77a 1257:60dc14a2e4c5
750 } 750 }
751 return DMERR_OK; 751 return DMERR_OK;
752 } 752 }
753 753
754 // Allocate instrument 754 // Allocate instrument
755 JSSDEBUG("Allocating extended instrument #%d [%d]\n",
756 neinst, module->nextInstruments);
757
755 if ((einst = jssAllocateExtInstrument()) == NULL) 758 if ((einst = jssAllocateExtInstrument()) == NULL)
756 {
757 JSSERROR(DMERR_MALLOC, DMERR_MALLOC, 759 JSSERROR(DMERR_MALLOC, DMERR_MALLOC,
758 "Could not allocate extended instrument structure #%d\n", neinst); 760 "Could not allocate extended instrument #%d.\n",
759 } 761 neinst);
760 762
761 module->extInstruments[neinst] = einst; 763 module->extInstruments[neinst] = einst;
762 764
763 // Get instrument header #2 765 // Get instrument header #2
764 if (!dmf_read_le32(inFile, &xmI2.headSize) || 766 if (!dmf_read_le32(inFile, &xmI2.headSize) ||
885 { 887 {
886 JSSModule *module; 888 JSSModule *module;
887 XMHeader xmH; 889 XMHeader xmH;
888 int index, ret = DMERR_OK; 890 int index, ret = DMERR_OK;
889 891
890 assert(pmodule != NULL);
891 assert(inFile != NULL);
892 *pmodule = NULL; 892 *pmodule = NULL;
893 893
894 // Try to get the XM-header 894 // Try to read the XM header
895 if (!dmf_read_str(inFile, &xmH.idMagic, sizeof(xmH.idMagic)) || 895 if (!dmf_read_str(inFile, &xmH.idMagic, sizeof(xmH.idMagic)) ||
896 !dmf_read_str(inFile, &xmH.songName, sizeof(xmH.songName)) || 896 !dmf_read_str(inFile, &xmH.songName, sizeof(xmH.songName)) ||
897 !dmf_read_byte(inFile, &xmH.unUsed1A) || 897 !dmf_read_byte(inFile, &xmH.unUsed1A) ||
898 !dmf_read_str(inFile, &xmH.trackerName, sizeof(xmH.trackerName)) || 898 !dmf_read_str(inFile, &xmH.trackerName, sizeof(xmH.trackerName)) ||
899 !dmf_read_le16(inFile, &xmH.version) || 899 !dmf_read_le16(inFile, &xmH.version) ||
905 !dmf_read_le16(inFile, &xmH.ninstruments) || 905 !dmf_read_le16(inFile, &xmH.ninstruments) ||
906 !dmf_read_le16(inFile, &xmH.flags) || 906 !dmf_read_le16(inFile, &xmH.flags) ||
907 !dmf_read_le16(inFile, &xmH.defSpeed) || 907 !dmf_read_le16(inFile, &xmH.defSpeed) ||
908 !dmf_read_le16(inFile, &xmH.defTempo)) 908 !dmf_read_le16(inFile, &xmH.defTempo))
909 return DMERR_FREAD; 909 return DMERR_FREAD;
910
911 910
912 // Check the fields, none of these are considered fatal 911 // Check the fields, none of these are considered fatal
913 if (strncmp(xmH.idMagic, "Extended Module: ", 17) != 0) 912 if (strncmp(xmH.idMagic, "Extended Module: ", 17) != 0)
914 { 913 {
915 if (probe) 914 if (probe)
1071 } 1070 }
1072 break; 1071 break;
1073 } 1072 }
1074 1073
1075 out: 1074 out:
1076
1077 return ret; 1075 return ret;
1078 } 1076 }