[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/LWIP PATCH v2] Fix compilation warning about comparison between signed and unsigned integer



Hi Justin, this patch looks good, thanks.

Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

On 12.10.19, 00:19, "Jia He" <Justin.He@xxxxxxx> wrote:

    Without this patch, compiler(gcc version 7.4.0) reports:
    proto.c: In function 'getprotoent':
    proto.c:85:10: warning: comparison between signed and unsigned integer
    expressions [-Wsign-compare]
      if (idx >= sizeof(protos))
              ^~
    This fixes it by change idx from int to unsigned int.
    
    Signed-off-by: Jia He <justin.he@xxxxxxx>
    ---
    v2: change the type of idx to size_t (Julien)
    
     proto.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/proto.c b/proto.c
    index 517f258..0127355 100644
    --- a/proto.c
    +++ b/proto.c
    @@ -27,7 +27,7 @@
     
     /* do we really need all these?? */
     
    -static int idx;
    +static size_t idx;
     static const unsigned char protos[] = {
        "\000ip\0"
        "\001icmp\0"
    -- 
    2.17.1
    
    

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.