From 4618a6e5653ad0b604647e7115b47fc931079a3f Mon Sep 17 00:00:00 2001 From: "C.W. Betts" Date: Wed, 7 Feb 2024 02:36:39 -0700 Subject: [PATCH] Better usage of const in BXExternalMT32+BXMT32Sysexes. --- Boxer/BXExternalMT32+BXMT32Sysexes.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Boxer/BXExternalMT32+BXMT32Sysexes.m b/Boxer/BXExternalMT32+BXMT32Sysexes.m index df210f1c5..4073f8d04 100644 --- a/Boxer/BXExternalMT32+BXMT32Sysexes.m +++ b/Boxer/BXExternalMT32+BXMT32Sysexes.m @@ -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]; @@ -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; @@ -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])]; @@ -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)];