Skip to content
Snippets Groups Projects
Commit a51bb085 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Make the types correct and eliminate infinite loop.

If a write() to the sound device fails (for example USB device goes
away), this would loop forever (in it's own thread and whatnot,
so you only notice because sounds stops and a core gets used up).
parent 8c4af199
No related branches found
No related tags found
1 merge request!488Overhaul LZH code
Pipeline #7545 passed
......@@ -833,10 +833,6 @@ do_xp_play_sample(unsigned char *sampo, size_t sz, int *freed)
#if defined(WITH_PORTAUDIO) || defined(_WIN32) || defined(WITH_SDL_AUDIO)
int need_copy = 0;
#endif
#ifdef AFMT_U8
size_t wr;
int i;
#endif
#ifdef WITH_PORTAUDIO
if(handle_type==SOUND_DEVICE_PORTAUDIO) {
......@@ -977,14 +973,14 @@ do_xp_play_sample(unsigned char *sampo, size_t sz, int *freed)
#ifdef AFMT_U8
if (handle_type == SOUND_DEVICE_OSS) {
size_t wr = 0;
wr = 0;
while (wr < sz) {
i = write(dsp, samp + wr, sz - wr);
if (i >= 0) {
if ((SIZE_MAX - i) < wr)
wr = SIZE_MAX;
ssize_t i = write(dsp, samp + wr, sz - wr);
if (i >= 0)
wr += i;
}
else
return false;
}
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment