[PATCH 2/2] rtemstoolkit/rld-compression.cpp: Fix warning for comparing signed to unsigned

Chris Johns chrisj at rtems.org
Thu Sep 14 23:24:27 UTC 2017


On 15/09/2017 09:06, Joel Sherrill wrote:
> ---
>  rtemstoolkit/rld-compression.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rtemstoolkit/rld-compression.cpp b/rtemstoolkit/rld-compression.cpp
> index 2abeff1..5ccd76a 100644
> --- a/rtemstoolkit/rld-compression.cpp
> +++ b/rtemstoolkit/rld-compression.cpp
> @@ -285,7 +285,7 @@ namespace rld
>                std::cout << "rtl: decomp: block-size=" << block_size
>                          << std::endl;
>  
> -            if (image.read (io, block_size) != block_size)
> +            if (image.read (io, block_size) != (ssize_t) block_size)
>                throw rld::error ("Read past end", "compression");
>  
>              level = ::fastlz_decompress (io, block_size, buffer, size);
> 

I would make block_size a ssize_t. The block size will never be greater than
16bits so the shift will be safe. Using ssize_t is better for 64bit hosts.

Please push once changed.

Thank you for the cygwin testing report.

Chris



More information about the devel mailing list