On Wed, 9 Jan 2013 16:10:18 +0100
Christian Costa <titan.co...@gmail.com> wrote:

> 2013/1/9 Johannes Kroll <jkr...@lavabit.com>
> 
> > On Wed, 09 Jan 2013 10:19:54 +0100
> > Christian Costa <titan.co...@gmail.com> wrote:
> >
> > > Le 09/01/2013 04:26, Johannes Kroll a écrit :
> > > > Hi,
> > > >
> > > > On Wed, 09 Jan 2013 03:55:25 +0100
> > > > Christian Costa <titan.co...@gmail.com> wrote:
> > > >
> > > >> Hi,
> > > >>
> > > >> Please be consistent when using space. 1 space before and after
> > > >> operators (<, ==, =, ...).
> > > > spaces inserted. HTH.
> > > >
> > > > J.
> > > That's better. You forgot some occurences in the for loop though.
> >
> > Is it OK if I leave the rest of the formatting to you? Any style is
> > fine with me, whatever makes you happy and hopefully gets the patch
> > included.
> >
> > Formatting only patch are not allowed. Clean patch and consistency in code
> style help your patch get in.
> Alexandre Julliard is the only judge not me. If he is ok with your patch
> that's fine.
> Anyway having the for loop consistent with rest should not be that hard.
> 
> for(i= 0; i<lpMidiOutHdr->dwBufferLength; i++)

The original patch was consistent with my coding style. To make
assignments stick out visually, I use no space to the left of the
assignment operator, one space to the right. On comparison operators, I
use space either on both sides, or none. You will see this in all code
I write.

I attached another version of the patch. I added 3 more spaces and one
line break in a long comment line. You or Alexandre can choose the
version they like best. If you still see style issues, please consider
changing the style to your liking. If that's not possible, the patch
will have to be rejected.

If anybody sees non-style-related issues with the patch, please let me
know.

Please keep any replies on the list(s).

Have a nice day.
Johannes


>From b8b97bb56dd6460b2b422061cc565dafe9d94d46 Mon Sep 17 00:00:00 2001
From: Johannes Kroll <jkr...@lavabit.com>
Date: Wed, 9 Jan 2013 02:40:34 +0100
Subject: terminate sysex messages

---
 dlls/winmm/winmm.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c
index aecb9cf..f4fecb1 100644
--- a/dlls/winmm/winmm.c
+++ b/dlls/winmm/winmm.c
@@ -531,11 +531,28 @@ UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut,
                           MIDIHDR* lpMidiOutHdr, UINT uSize)
 {
     LPWINE_MLD         wmld;
+    int i;
 
     TRACE("(%p, %p, %d)\n", hMidiOut, lpMidiOutHdr, uSize);
 
     if ((wmld = MMDRV_Get(hMidiOut, MMDRV_MIDIOUT, FALSE)) == NULL)
        return MMSYSERR_INVALHANDLE;
+    
+    for(i = 0; i < lpMidiOutHdr->dwBufferLength; i++)
+    {
+        /* SysEx messages are terminated by a 0xF7 byte. If the buffer 
contains additional 
+           bytes, send only the bytes up to the termination byte. */
+        if((unsigned char)lpMidiOutHdr->lpData[i] == 0xF7 && i < 
lpMidiOutHdr->dwBufferLength-1)
+        {
+            DWORD oldBufferLength = lpMidiOutHdr->dwBufferLength;
+            DWORD ret;
+            lpMidiOutHdr->dwBufferLength = i+1;
+            ret = MMDRV_Message(wmld, MODM_LONGDATA, (DWORD_PTR)lpMidiOutHdr, 
uSize);
+            /* restore the midi header to its original state. */
+            lpMidiOutHdr->dwBufferLength = oldBufferLength;
+            return ret;
+        }
+    }
 
     return MMDRV_Message(wmld, MODM_LONGDATA, (DWORD_PTR)lpMidiOutHdr, uSize);
 }
-- 
1.7.9.5



Reply via email to