From 9a5638a03f8ca9d4e1b6e304eff4af0a7e9df5f5 Mon Sep 17 00:00:00 2001 From: Joel Fischer Date: Wed, 25 Mar 2015 13:28:42 -0400 Subject: [PATCH] Fix SDLProtocolHeader ternary order of operations Fixes #84 --- SmartDeviceLink-iOS/SmartDeviceLink/SDLV1ProtocolHeader.m | 2 +- SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolHeader.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLV1ProtocolHeader.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLV1ProtocolHeader.m index 0b8e06d7a..6fbd11886 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLV1ProtocolHeader.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLV1ProtocolHeader.m @@ -21,7 +21,7 @@ - (NSData *)data { Byte headerBytes[V1PROTOCOL_HEADERSIZE] = {0}; Byte version = (self.version & 0xF) << 4; // first 4 bits - Byte compressed = self.compressed?1:0 << 3; // next 1 bit + Byte compressed = (self.compressed?1:0) << 3; // next 1 bit Byte frameType = (self.frameType & 0x7); // last 3 bits headerBytes[0] = version | compressed | frameType; diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolHeader.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolHeader.m index b2b00ed46..adb8a9b63 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolHeader.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLV2ProtocolHeader.m @@ -21,7 +21,7 @@ - (NSData *)data { Byte headerBytes[V2PROTOCOL_HEADERSIZE] = {0}; Byte version = (self.version & 0xF) << 4; // first 4 bits - Byte compressed = self.compressed?1:0 << 3; // next 1 bit + Byte compressed = (self.compressed?1:0) << 3; // next 1 bit Byte frameType = (self.frameType & 0x7); // last 3 bits headerBytes[0] = version | compressed | frameType;