warning: assignment from incompatible pointer type

换了个编译环境突然报了个警告

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,加个强转即可

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Klay_Wiot

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值