From dbfbc756d78bc25a0a763fff76f866713fa3ce15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Tue, 9 Sep 2025 19:55:30 +0200 Subject: [PATCH] 2025-09-09 19:55 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbbmp/core.c ! pacified BCC warnings * src/vm/macro.c * minor modification to test if it can pacify false warning in recent GCC --- ChangeLog.txt | 7 +++++++ contrib/hbbmp/core.c | 24 ++++++++++++------------ src/vm/macro.c | 4 ++-- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 0e299a8112..47aabbf5a4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,13 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2025-09-09 19:55 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/hbbmp/core.c + ! pacified BCC warnings + + * src/vm/macro.c + * minor modification to test if it can pacify false warning in recent GCC + 2025-09-09 18:58 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/3rd/png/pngrutil.c ! moved PNG_UNUSED() before return statement to avoid BCC W8070 Warning diff --git a/contrib/hbbmp/core.c b/contrib/hbbmp/core.c index 5eaf2387c3..0c311cc326 100644 --- a/contrib/hbbmp/core.c +++ b/contrib/hbbmp/core.c @@ -268,13 +268,13 @@ HB_MAXINT hb_bmp_color( PHB_BMPINFO pBMP, int r, int g, int b, int a ) } if( iColor == -1 ) { - if( pBMP->clrused < 1 << pBMP->depth ) + if( pBMP->clrused < ( 1 << pBMP->depth ) ) { iColor = pBMP->clrused++; - pBMP->palette[ iColor ].blue = b; - pBMP->palette[ iColor ].green = g; - pBMP->palette[ iColor ].red = r; - pBMP->palette[ iColor ].alpha = a; + pBMP->palette[ iColor ].blue = ( HB_BYTE ) b; + pBMP->palette[ iColor ].green = ( HB_BYTE ) g; + pBMP->palette[ iColor ].red = ( HB_BYTE ) r; + pBMP->palette[ iColor ].alpha = ( HB_BYTE ) a; } else pBMP->error = HB_BMP_ERROR_PALETTEFULL; @@ -301,10 +301,10 @@ HB_BOOL hb_bmp_color2rgb( PHB_BMPINFO pBMP, HB_MAXINT clr, int * r, int * g, int case 8: if( clr < ( HB_MAXINT ) pBMP->clrused ) { - * b = pBMP->palette[ clr ].blue; - * g = pBMP->palette[ clr ].green; - * r = pBMP->palette[ clr ].red; - * a = pBMP->palette[ clr ].alpha; + * b = ( int ) pBMP->palette[ clr ].blue; + * g = ( int ) pBMP->palette[ clr ].green; + * r = ( int ) pBMP->palette[ clr ].red; + * a = ( int ) pBMP->palette[ clr ].alpha; pBMP->error = 0; } break; @@ -552,7 +552,7 @@ PHB_BMPINFO hb_bmp_decode( const HB_BYTE * data, HB_SIZE size, int * piError ) */ int bmpoffset = HB_GET_LE_INT32( header->bmpoffset ), headersize = HB_GET_LE_INT32( header->headersize ), - width = 0, height = 0, depth = 0, rowlen = 0, dpi = 0, + width = 0, height = 0, depth = 0, rowlen, dpi = 0, clrused = 0, palette_bytes = 0; HB_BOOL fromtop; @@ -795,8 +795,8 @@ HB_FUNC( HB_BMP_FROMBITMAP ) fromtop = HB_FALSE; } if( ! bitmap || ( align & ( align - 1 ) ) != 0 || - ( HB_SIZE ) ( ( ( width * depth + align - 1 ) & ~( align - 1 ) ) * - height + 0x07 ) >> 3 > hb_parclen( 1 ) ) + ( HB_SIZE ) ( ( ( ( width * depth + align - 1 ) & ~( align - 1 ) ) * + height + 0x07 ) >> 3 ) > hb_parclen( 1 ) ) iError = HB_BMP_ERROR_PARAM; else { diff --git a/src/vm/macro.c b/src/vm/macro.c index ca0962c20c..137de4c739 100644 --- a/src/vm/macro.c +++ b/src/vm/macro.c @@ -745,8 +745,8 @@ char * hb_macroTextSymbol( const char * szString, HB_SIZE nLength, HB_BOOL * pfN { if( szResult == szString ) { - szResult = ( char * ) hb_xgrab( nLength + 1 ); - memcpy( szResult, szString, nLength ); + szResult = ( char * ) memcpy( hb_xgrab( nLength + 1 ), + szString, nLength ); szResult[ nLength ] = '\0'; } szResult[ nLen ] = c - ( 'a' - 'A' );