From d359899a21d96987d86014fc1d3642d7ef8824b3 Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Fri, 12 Jan 2007 16:05:43 +0000 Subject: [PATCH] removed strange "warning: converting negative value 'B_ERROR' to 'long unsigned int'" that seemed to be generated by the ? operator converting B_ERROR's type. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19772 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/translators/sgi/SGIImage.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/add-ons/translators/sgi/SGIImage.cpp b/src/add-ons/translators/sgi/SGIImage.cpp index 072ae12594..1389cf2ab8 100644 --- a/src/add-ons/translators/sgi/SGIImage.cpp +++ b/src/add-ons/translators/sgi/SGIImage.cpp @@ -684,6 +684,9 @@ SGIImage::_ReadRLE8(uint8* row, uint8* rleBuffer, int32 numPixels) const uint32 count; // RLE count uint32 length = 0; // number of bytes read + if (numPixels <= 0) + return B_ERROR; + while (numPixels > 0) { ch = *rleBuffer ++; @@ -713,7 +716,7 @@ SGIImage::_ReadRLE8(uint8* row, uint8* rleBuffer, int32 numPixels) const } } - return (numPixels > 0 ? B_ERROR : length); + return length; } /*ssize_t SGIImage::_ReadRLE8(uint8* row, int32 numPixels) const @@ -851,6 +854,9 @@ SGIImage::_ReadRLE16(uint16* row, uint16* rleBuffer, int32 numPixels) const uint32 count; // RLE count uint32 length = 0; // number of bytes read... + if (numPixels <= 0) + return B_ERROR; + while (numPixels > 0) { ch = *rleBuffer ++; @@ -879,7 +885,7 @@ SGIImage::_ReadRLE16(uint16* row, uint16* rleBuffer, int32 numPixels) const } } } - return (numPixels > 0 ? B_ERROR : length * 2); + return length * 2; } // _WriteRLE8