• R/O
  • HTTP
  • SSH
  • HTTPS

cinnamon: Commit

Cinnamon audio library


Commit MetaInfo

Revisionb92bdd25bc3e9df684639484084ec0addaf33800 (tree)
Zeit2019-07-08 02:43:16
AutorAlaskanEmily <emily@alas...>
CommiterAlaskanEmily

Log Message

Fix off-by-one error in DirectSound backend

Ändern Zusammenfassung

Diff

--- a/src/dsound/cin_dsound_sound.cpp
+++ b/src/dsound/cin_dsound_sound.cpp
@@ -105,10 +105,16 @@ Cin_Sound::Cin_Sound(IDirectSound8 *dsound, const Cin_Loader &ld)
105105 fmt.Format.wBitsPerSample = bytes_per_sample << 3;
106106
107107 // Check the size of the loader data.
108- unsigned byte_size = 0;
109- for(const struct Cin_LoaderData *i = ld.first, *const end = ld.last; i != end; i = i->next){
110- byte_size += i->len;
108+ const unsigned byte_size = ld.bytes_placed;
109+#ifndef NDEBUG
110+ {
111+ unsigned debug_byte_size = 0;
112+ for(const struct Cin_LoaderData *i = ld.first; i != NULL; i = i->next){
113+ debug_byte_size += i->len;
114+ }
115+ assert(debug_byte_size == byte_size);
111116 }
117+#endif
112118
113119 DSBUFFERDESC descriptor;
114120 descriptor.dwSize = sizeof(DSBUFFERDESC);
Show on old repository browser