From 997091e0d67867c72f8628891a3b3b0568f5e71b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 9 Nov 2011 08:44:19 +1100 Subject: [PATCH] desktop: be more careful with signed/unsigned in DataFlash --- libraries/Desktop/support/DataFlash.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/Desktop/support/DataFlash.cpp b/libraries/Desktop/support/DataFlash.cpp index 0e5354a980..faf89b7eb9 100644 --- a/libraries/Desktop/support/DataFlash.cpp +++ b/libraries/Desktop/support/DataFlash.cpp @@ -237,22 +237,22 @@ byte DataFlash_Class::ReadByte() int16_t DataFlash_Class::ReadInt() { - int16_t result; + uint16_t result; result = ReadByte(); // High byte result = (result<<8) | ReadByte(); // Low byte - return result; + return (int16_t)result; } int32_t DataFlash_Class::ReadLong() { - int32_t result; + uint32_t result; result = ReadByte(); // First byte result = (result<<8) | ReadByte(); result = (result<<8) | ReadByte(); result = (result<<8) | ReadByte(); // Last byte - return result; + return (int32_t)result; } // make one instance for the user to use