[PATCH] fix -Wsign-conversion warning with gcc 8.2

Andres Beltran abeltran at linux.microsoft.com
Thu May 26 21:42:14 UTC 2022


Hello,

Gently ping on this patch. Any comments?

Best,
Andres Beltran

On 3/14/2022 4:42 PM, Sinan Kaya wrote:
> Subject:
 > [PATCH] fix -Wsign-conversion warning with gcc 8.2
 > From:
 > Sinan Kaya <okaya at kernel.org>
 > Date:
 > 3/14/2022, 4:42 PM
 >
 > To:
 > nginx-devel at nginx.org
 >
 >
 >
 > # HG changeset patch
 > # User Sinan Kaya <sinan.kaya at microsoft.com>
 > # Date 1647289518 14400
 > #      Mon Mar 14 16:25:18 2022 -0400
 > # Node ID f22520b612969dbfa17205129510927519370000
 > # Parent  a736a7a613ea6e182ff86fbadcb98bb0f8891c0b
 > fix -Wsign-conversion warning with gcc 8.2
 >
 > Getting compiler warning with -Wsign-conversion.
 >
 > /usr/include/nginx/core/ngx_crc32.h:31:47: warning: conversion to
 > 'uint32_t' {aka 'unsigned int'} from 'int' may change the sign of the
 > result [-Wsign-conversion]
 >    31 |         crc = ngx_crc32_table_short[(crc ^ (c >> 4)) & 0xf] ^
 > (crc >> 4);
 >
 > diff -r a736a7a613ea -r f22520b61296 src/core/ngx_crc32.h
 > --- a/src/core/ngx_crc32.h    Tue Feb 08 17:35:27 2022 +0300
 > +++ b/src/core/ngx_crc32.h    Mon Mar 14 16:25:18 2022 -0400
 > @@ -28,7 +28,8 @@
 >      while (len--) {
 >          c = *p++;
 >          crc = ngx_crc32_table_short[(crc ^ (c & 0xf)) & 0xf] ^ (crc >>
 > 4);
 > -        crc = ngx_crc32_table_short[(crc ^ (c >> 4)) & 0xf] ^ (crc 
 >> 4);
 > +        crc = ngx_crc32_table_short[(crc ^ (u_char)(c >> 4)) & 0xf];
 > +        crc = crc ^ (crc >> 4);
 >      }
 >
 >      return crc ^ 0xffffffff;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20220526/cc9647b8/attachment.htm>


More information about the nginx-devel mailing list