Skip to content
  • philmd's avatar
    Fix constness warnings · 6826a991
    philmd authored and Samuel Thibault's avatar Samuel Thibault committed
    
    
    Fix the following GCC warnings:
    
      src/ncsi.c: In function ‘ncsi_input’:
      src/ncsi.c:139:31: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
        139 |     struct ncsi_pkt_hdr *nh = (struct ncsi_pkt_hdr *)(pkt + ETH_HLEN);
            |                               ^
      src/dnssearch.c: In function ‘translate_dnssearch’:
      src/dnssearch.c:242:33: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
        242 |     num_domains = g_strv_length((GStrv)names);
            |                                 ^
      src/slirp.c: In function ‘arp_input’:
      src/slirp.c:747:31: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
        747 |     struct slirp_arphdr *ah = (struct slirp_arphdr *)(pkt + ETH_HLEN);
            |                               ^
      src/dnssearch.c: In function ‘translate_dnssearch’:
      src/dnssearch.c:242:33: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
        242 |     num_domains = g_strv_length((const GStrv)names);
            |                                 ^
      src/slirp.c: In function ‘arp_input’:
      src/slirp.c:764:48: error: passing argument 3 of ‘arp_table_add’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
        764 |             arp_table_add(slirp, ah->ar_sip, ah->ar_sha);
            |                                              ~~^~~~~~~~
      In file included from src/slirp.c:25:
      src/slirp.h:101:60: note: expected ‘uint8_t *’ {aka ‘unsigned char *’} but argument is of type ‘const unsigned char *’
        101 | void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN]);
            |                                                    ~~~~~~~~^~~~~~~~~~~~~~~~~
      src/slirp.c:783:48: error: passing argument 3 of ‘arp_table_add’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
        783 |             arp_table_add(slirp, ah->ar_sip, ah->ar_sha);
            |                                              ~~^~~~~~~~
      In file included from src/slirp.c:25:
      src/slirp.h:101:60: note: expected ‘uint8_t *’ {aka ‘unsigned char *’} but argument is of type ‘const unsigned char *’
        101 | void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN]);
            |                                                    ~~~~~~~~^~~~~~~~~~~~~~~~~
      src/slirp.c:804:44: error: passing argument 3 of ‘arp_table_add’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
        804 |         arp_table_add(slirp, ah->ar_sip, ah->ar_sha);
            |                                          ~~^~~~~~~~
      In file included from src/slirp.c:25:
      src/slirp.h:101:60: note: expected ‘uint8_t *’ {aka ‘unsigned char *’} but argument is of type ‘const unsigned char *’
        101 | void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN]);
            |                                                    ~~~~~~~~^~~~~~~~~~~~~~~~~
    
    Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
    6826a991
Loading