Skip to content

Commit

Permalink
Better usage of const in BXExternalMT32+BXMT32Sysexes.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddTheSane committed Feb 7, 2024
1 parent 79a359c commit 4618a6e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Boxer/BXExternalMT32+BXMT32Sysexes.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ + (NSData *) dataInSysex: (NSData *)sysex includingAddress: (BOOL)includeAddress
}

//Calculate the Roland checksum for the specified raw bytes.
+ (NSUInteger) _checksumForBytes: (UInt8 *)bytes length: (NSUInteger)length
+ (NSUInteger) _checksumForBytes: (const UInt8 *)bytes length: (NSUInteger)length
{
NSUInteger i, checksum = 0;
for (i = 0; i < length; i++) checksum += bytes[i];
Expand All @@ -110,7 +110,7 @@ + (NSUInteger) checksumForSysex: (NSData *)sysex
//The checksum for a Roland sysex message is calculated from
//the bytes of the message address and the message data:
//skip the bytes before and after that block.
UInt8 *bytes = (UInt8 *)sysex.bytes;
const UInt8 *bytes = sysex.bytes;

NSUInteger length = sysex.length - BXRolandSysexHeaderLength - BXRolandSysexTailLength;

Expand Down Expand Up @@ -152,7 +152,7 @@ + (NSData *) sysexWithData: (NSData *)data forAddress: (UInt8[3])address
[sysex appendData: data];

//Calculate the checksum based on the address and data parts of the overall sysex
UInt8 *bytes = (UInt8 *)sysex.bytes;
const UInt8 *bytes = sysex.bytes;
NSUInteger checksum = [self _checksumForBytes: &bytes[BXRolandSysexHeaderLength]
length: (BXRolandSysexAddressLength + [data length])];

Expand Down Expand Up @@ -187,7 +187,7 @@ + (NSData *) sysexRequestForDataOfLength: (NSUInteger)numBytes
[sysex appendBytes: requestSize length: BXRolandSysexRequestSizeLength];

//Calculate the checksum based on the address and request size parts of the overall sysex
UInt8 *bytes = (UInt8 *)sysex.bytes;
const UInt8 *bytes = sysex.bytes;
NSUInteger checksum = [self _checksumForBytes: &bytes[BXRolandSysexHeaderLength]
length: (BXRolandSysexAddressLength + BXRolandSysexRequestSizeLength)];

Expand Down

0 comments on commit 4618a6e

Please sign in to comment.