0001-SerialPort.cpp-fix-build-when-size_t-is-an-unsigned-.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 2e4cf095afdcf843e93d1bdea9dbd961558f09bd Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sun, 13 Jan 2019 21:01:19 +0100
  4. Subject: [PATCH] SerialPort.cpp: fix build when size_t is an unsigned int
  5. size_t can be defined as an unsigned int instead of long unsigned int so
  6. replace 1UL to (size_t)1 when calling max function
  7. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  8. [Upstream status: https://github.com/crayzeewulf/libserial/pull/126]
  9. ---
  10. src/SerialPort.cpp | 4 ++--
  11. 1 file changed, 2 insertions(+), 2 deletions(-)
  12. diff --git a/src/SerialPort.cpp b/src/SerialPort.cpp
  13. index e354fcb..75e762e 100644
  14. --- a/src/SerialPort.cpp
  15. +++ b/src/SerialPort.cpp
  16. @@ -2208,7 +2208,7 @@ namespace LibSerial
  17. // Local variables.
  18. size_t number_of_bytes_read = 0 ;
  19. - size_t number_of_bytes_remaining = std::max(numberOfBytes, 1UL) ;
  20. + size_t number_of_bytes_remaining = std::max(numberOfBytes, (size_t)1) ;
  21. size_t maximum_number_of_bytes = dataBuffer.max_size() ;
  22. // Clear the data buffer and reserve enough space in the buffer to store the incoming data.
  23. @@ -2302,7 +2302,7 @@ namespace LibSerial
  24. // Local variables.
  25. size_t number_of_bytes_read = 0 ;
  26. - size_t number_of_bytes_remaining = std::max(numberOfBytes, 1UL) ;
  27. + size_t number_of_bytes_remaining = std::max(numberOfBytes, (size_t)1) ;
  28. size_t maximum_number_of_bytes = dataString.max_size() ;
  29. // Clear the data buffer and reserve enough space in the buffer to store the incoming data.
  30. --
  31. 2.14.1