1. ホーム
  2. アーム

警告: 互換性のないポインタ型からの代入

2022-02-10 15:31:03
<パス

ビルド環境を変更すると突然警告が表示される

warning: assignment from incompatible pointer type
regd_aids = ioctl_buf;


これは許されることなのでしょうか?

unsigned char ioctl_buf[4096] = {0};
int v2x_ioctl(int sk, int cnt)
{
    struct register_aids reg_aids;
    int ret = 0;
    int *regd_aids = NULL;
    unsigned long long utc;
    unsigned int psn;
    unsigned int psn_delay[2] = {0};
    ret = ioctl(sk, GETREGDAIDSCNT, &reg_aids);
    printf("ioctl[%d] GETREGDAIDSCNT ret %d, cnt %d\n", cnt, ret, reg_aids.cnt);
#if 0
    regd_aids = calloc(1, (cnt+1)*sizeof(int));
#else
    memset(ioctl_buf, 0, sizeof(ioctl_buf)); 
    regd_aids = ioctl_buf;
#endif
    if (regd_aids) {
        ret = ioctl(sk, GETREGDAIDS, regd_aids);
        printf("ioctl[%d] GETREGDAIDS ret %d, cnt %d\n", cnt, ret, regd_aids[0]);
#if 0
        free(regd_aids);
#endif
    } else {
        printf("ioctl[%d] GETREGDAIDS calloc failed\n", cnt);
    }
    ret = ioctl(sk, GETLASTPSN, &psn);
    printf("ioctl[%d] GETLASTPSN ret %d, psn %u\n", cnt, ret, psn);
    ret = ioctl(sk, GETLASTUTC, &utc);
    printf("ioctl[%d] GETLASTUTC ret %d, utc %llu\n", cnt, ret, utc);
    ret = ioctl(sk, GETLASTXMITEDPSN, &psn);
    printf("ioctl[%d] GETLASTXMITEDPSN ret %d, psn %u\n", cnt, ret, psn);
    ret = ioctl(sk, GETLASTXMITEDUTC, &utc);
    printf("ioctl[%d] GETLASTXMITEDUTC ret %d, utc %llu\n", cnt, ret, utc);
    ret = ioctl(sk, GETNEXTPSN, &psn);
    printf("ioctl[%d] GETNEXTPSN ret %d, psn %u\n", cnt, ret, psn);
    ret = ioctl(sk, GETLASTPSNDELAY, psn_delay);
    printf("ioctl[%d] GETLASTPSNDELAY ret %d, psn %u, delay %uus\n", cnt, ret, psn_delay[0], psn_delay[1]);
    return 0;
}


regd_aids = (int *)ioctl_buf、ちょうど強いターンを追加します。