@@ -802,6 +802,7 @@ int MidiFile::addTrack(int count) {
802
802
}
803
803
804
804
805
+
805
806
// ////////////////////////////
806
807
//
807
808
// MidiFile::allocateEvents --
@@ -810,8 +811,7 @@ int MidiFile::addTrack(int count) {
810
811
void MidiFile::allocateEvents (int track, int aSize) {
811
812
int oldsize = events[track]->size ();
812
813
if (oldsize < aSize) {
813
- events[track]->resize (aSize);
814
- events[track]->resize (oldsize);
814
+ events[track]->reserve (aSize);
815
815
}
816
816
}
817
817
@@ -1090,7 +1090,7 @@ int MidiFile::read(const string& filename) {
1090
1090
setFilename (filename);
1091
1091
1092
1092
fstream input;
1093
- input.open (filename, ios::binary | ios::in);
1093
+ input.open (filename. data () , ios::binary | ios::in);
1094
1094
1095
1095
if (!input.is_open ()) {
1096
1096
return 0 ;
@@ -1110,7 +1110,6 @@ int MidiFile::read(istream& input) {
1110
1110
int character;
1111
1111
// uchar buffer[123456] = {0};
1112
1112
ulong longdata;
1113
- uchar chardata;
1114
1113
ushort shortdata;
1115
1114
1116
1115
@@ -1125,7 +1124,7 @@ int MidiFile::read(istream& input) {
1125
1124
} else if (character != ' M' ) {
1126
1125
cout << " File " << filename << " is not a MIDI file" << endl;
1127
1126
cout << " Expecting 'M' at first byte but got '"
1128
- << chardata << " '" << endl;
1127
+ << character << " '" << endl;
1129
1128
return 0 ;
1130
1129
}
1131
1130
@@ -1137,7 +1136,7 @@ int MidiFile::read(istream& input) {
1137
1136
} else if (character != ' T' ) {
1138
1137
cout << " File " << filename << " is not a MIDI file" << endl;
1139
1138
cout << " Expecting 'T' at first byte but got '"
1140
- << chardata << " '" << endl;
1139
+ << character << " '" << endl;
1141
1140
return 0 ;
1142
1141
}
1143
1142
@@ -1149,7 +1148,7 @@ int MidiFile::read(istream& input) {
1149
1148
} else if (character != ' h' ) {
1150
1149
cout << " File " << filename << " is not a MIDI file" << endl;
1151
1150
cout << " Expecting 'h' at first byte but got '"
1152
- << chardata << " '" << endl;
1151
+ << character << " '" << endl;
1153
1152
return 0 ;
1154
1153
}
1155
1154
@@ -1161,7 +1160,7 @@ int MidiFile::read(istream& input) {
1161
1160
} else if (character != ' d' ) {
1162
1161
cout << " File " << filename << " is not a MIDI file" << endl;
1163
1162
cout << " Expecting 'd' at first byte but got '"
1164
- << chardata << " '" << endl;
1163
+ << character << " '" << endl;
1165
1164
return 0 ;
1166
1165
}
1167
1166
@@ -1264,7 +1263,7 @@ int MidiFile::read(istream& input) {
1264
1263
} else if (character != ' M' ) {
1265
1264
cout << " File " << filename << " is not a MIDI file" << endl;
1266
1265
cout << " Expecting 'M' at first byte in track but got '"
1267
- << chardata << " '" << endl;
1266
+ << character << " '" << endl;
1268
1267
return 0 ;
1269
1268
}
1270
1269
@@ -1277,7 +1276,7 @@ int MidiFile::read(istream& input) {
1277
1276
} else if (character != ' T' ) {
1278
1277
cout << " File " << filename << " is not a MIDI file" << endl;
1279
1278
cout << " Expecting 'T' at first byte in track but got '"
1280
- << chardata << " '" << endl;
1279
+ << character << " '" << endl;
1281
1280
return 0 ;
1282
1281
}
1283
1282
@@ -1290,7 +1289,7 @@ int MidiFile::read(istream& input) {
1290
1289
} else if (character != ' r' ) {
1291
1290
cout << " File " << filename << " is not a MIDI file" << endl;
1292
1291
cout << " Expecting 'r' at first byte in track but got '"
1293
- << chardata << " '" << endl;
1292
+ << character << " '" << endl;
1294
1293
return 0 ;
1295
1294
}
1296
1295
@@ -1303,7 +1302,7 @@ int MidiFile::read(istream& input) {
1303
1302
} else if (character != ' k' ) {
1304
1303
cout << " File " << filename << " is not a MIDI file" << endl;
1305
1304
cout << " Expecting 'k' at first byte in track but got '"
1306
- << chardata << " '" << endl;
1305
+ << character << " '" << endl;
1307
1306
return 0 ;
1308
1307
}
1309
1308
0 commit comments