Skip to content

Commit fa7a8f6

Browse files
committed
adlmidiplay.cpp: Workaround for GCC-15's std::deque
The .resize() method behaving faulty when -std=c++11 is set. It's definitely a bug of compiler. #291
1 parent ac37199 commit fa7a8f6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

utils/midiplay/adlmidiplay.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,10 +1113,15 @@ static int runAudioLoop(ADL_MIDIPlayer *myDevice, AudioOutputSpec &spec)
11131113
# endif
11141114

11151115
g_audioBuffer_lock.Lock();
1116+
#if defined(__GNUC__) && (__GNUC__ == 15) // Workaround on faulty std::deque's resize() call when C++11 is set
1117+
for(size_t p = 0; p < got; ++p)
1118+
g_audioBuffer.push_back(buff[p]);
1119+
#else
11161120
size_t pos = g_audioBuffer.size();
11171121
g_audioBuffer.resize(pos + got);
11181122
for(size_t p = 0; p < got; ++p)
11191123
g_audioBuffer[pos + p] = buff[p];
1124+
#endif
11201125
g_audioBuffer_lock.Unlock();
11211126

11221127
const AudioOutputSpec &spec = obtained;

0 commit comments

Comments
 (0)