@@ -90,20 +90,23 @@ class AppleMIDIParser
9090 while (i < buffer.size ())
9191 i++;
9292#endif
93- parserReturn parserReturn = parserReturn::Processed;
93+ auto retVal = parserReturn::Processed;
9494
95+ // when given a Session Name and the buffer has been fully processed and the
96+ // last character is not 'endl', then we got a very long sessionName. It will
97+ // continue in the next memory chunk of the packet. We don't care, so indicated
98+ // flush the remainder of the packet.
99+ // First part if the session name is kept, processing continues
95100 if (i > minimumLen)
96101 if (i == buffer.size () && buffer[i] != 0x00 )
97- parserReturn = parserReturn::SessionNameVeryLong;
102+ retVal = parserReturn::SessionNameVeryLong;
98103
99104 while (i--)
100105 buffer.pop_front (); // consume all the bytes that made up this message
101106
102107 session->ReceivedInvitation (invitation, portType);
103108
104- int yy = buffer.size ();
105-
106- return parserReturn;
109+ return retVal;
107110 }
108111 else if (0 == memcmp (command, amEndSession, sizeof (amEndSession)))
109112 {
@@ -283,20 +286,23 @@ class AppleMIDIParser
283286 i++;
284287#endif
285288
286- parserReturn parserReturn = parserReturn::Processed;
289+ auto retVal = parserReturn::Processed;
287290
291+ // when given a Session Name and the buffer has been fully processed and the
292+ // last character is not 'endl', then we got a very long sessionName. It will
293+ // continue in the next memory chunk of the packet. We don't care, so indicated
294+ // flush the remainder of the packet.
295+ // First part if the session name is kept, processing continues
288296 if (i > minimumLen)
289297 if (i == buffer.size () && buffer[i] != 0x00 )
290- parserReturn = parserReturn::SessionNameVeryLong;
298+ retVal = parserReturn::SessionNameVeryLong;
291299
292300 while (i--)
293301 buffer.pop_front (); // consume all the bytes that made up this message
294302
295- int yy = buffer.size ();
296-
297303 session->ReceivedInvitationAccepted (invitationAccepted, portType);
298304
299- return parserReturn ;
305+ return retVal ;
300306 }
301307 else if (0 == memcmp (command, amInvitationRejected, sizeof (amInvitationRejected)))
302308 {
0 commit comments