[Scummvm-cvs-logs] SF.net SVN: scummvm:[44085] scummvm/trunk/sound/softsynth/adlib.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Mon Sep 14 20:41:21 CEST 2009
Revision: 44085
http://scummvm.svn.sourceforge.net/scummvm/?rev=44085&view=rev
Author: lordhoto
Date: 2009-09-14 18:41:21 +0000 (Mon, 14 Sep 2009)
Log Message:
-----------
Use struct packing for AdLib instruments like the SCUMM engine does. (And a comment about this change, which might be rather paranoia than having a real effect)
Modified Paths:
--------------
scummvm/trunk/sound/softsynth/adlib.cpp
Modified: scummvm/trunk/sound/softsynth/adlib.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/adlib.cpp 2009-09-14 18:40:05 UTC (rev 44084)
+++ scummvm/trunk/sound/softsynth/adlib.cpp 2009-09-14 18:41:21 UTC (rev 44085)
@@ -35,9 +35,18 @@
class MidiDriver_ADLIB;
struct AdlibVoice;
+// We use packing for the following two structs, because the code
+// does simply copy them over from byte streams, without any
+// serialization. Check AdlibPart::sysEx_customInstrument for an
+// example of this.
+//
+// It might be very well possible, that none of the compilers we support
+// add any padding bytes at all, since all used variables are only of the
+// type 'byte'. But better safe than sorry.
+#include "common/pack-start.h"
struct InstrumentExtra {
byte a, b, c, d, e, f, g, h;
-};
+} PACKED_STRUCT;
struct AdlibInstrument {
byte mod_characteristic;
@@ -58,7 +67,8 @@
byte duration;
AdlibInstrument() { memset(this, 0, sizeof(AdlibInstrument)); }
-};
+} PACKED_STRUCT;
+#include "common/pack-end.h"
class AdlibPart : public MidiChannel {
friend class MidiDriver_ADLIB;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list