diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-05-30 00:41:00 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2022-05-30 00:48:47 +0200 |
commit | a70bd5508214e836dbabc8a0fb940e5df34ecb45 (patch) | |
tree | 336254aba297beeaff81a89476775dcb4d63540d /test | |
parent | b56fbdeef0f1d202ed13c85b6f9698fa2b8565a5 (diff) | |
download | slirp-a70bd5508214e836dbabc8a0fb940e5df34ecb45.zip slirp-a70bd5508214e836dbabc8a0fb940e5df34ecb45.tar.gz slirp-a70bd5508214e836dbabc8a0fb940e5df34ecb45.tar.bz2 |
ncsitest: Fix build with msvc
Diffstat (limited to 'test')
-rw-r--r-- | test/ncsitest.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/ncsitest.c b/test/ncsitest.c index 36aa090..f5ee0b5 100644 --- a/test/ncsitest.c +++ b/test/ncsitest.c @@ -41,7 +41,7 @@ static void test_ncsi_get_version_id(Slirp *slirp) }; slirp_input(slirp, command, sizeof(command)); - const struct ncsi_rsp_gvi_pkt *gvi = slirp->opaque + ETH_HLEN; + const struct ncsi_rsp_gvi_pkt *gvi = (const struct ncsi_rsp_gvi_pkt *) ((const char*) slirp->opaque + ETH_HLEN); assert(ntohs(gvi->rsp.code) == NCSI_PKT_RSP_C_COMPLETED); assert(ntohs(gvi->rsp.code) == NCSI_PKT_RSP_R_NO_ERROR); @@ -78,7 +78,7 @@ static void test_ncsi_oem_mlx_unsupported_command(Slirp *slirp) 0x00, /* Parameter */ 0x00, /* Optional data */ }; - const struct ncsi_rsp_oem_pkt *oem = slirp->opaque + ETH_HLEN; + const struct ncsi_rsp_oem_pkt *oem = (const struct ncsi_rsp_oem_pkt *) ((const char*) slirp->opaque + ETH_HLEN); slirp->mfr_id = 0x00000000; slirp_input(slirp, command, sizeof(command)); @@ -124,7 +124,7 @@ static void test_ncsi_oem_mlx_gma(Slirp *slirp) 0x1b, /* Parameter */ 0x00, /* Optional data */ }; - const struct ncsi_rsp_oem_pkt *oem = slirp->opaque + ETH_HLEN; + const struct ncsi_rsp_oem_pkt *oem = (const struct ncsi_rsp_oem_pkt *) ((const char*) slirp->opaque + ETH_HLEN); memset(slirp->oob_eth_addr, 0, ETH_ALEN); slirp->mfr_id = 0x8119; @@ -157,13 +157,15 @@ static slirp_ssize_t send_packet(const void *buf, size_t len, void *opaque) int main(int argc, char *argv[]) { - SlirpConfig config = {}; - SlirpCb callbacks = {}; + SlirpConfig config = { + .version = SLIRP_CONFIG_VERSION_MAX, + }; + SlirpCb callbacks = { + .send_packet = send_packet, + }; Slirp *slirp = NULL; uint8_t ncsi_response[NCSI_RESPONSE_CAPACITY]; - config.version = SLIRP_CONFIG_VERSION_MAX; - callbacks.send_packet = send_packet; slirp = slirp_new(&config, &callbacks, ncsi_response); test_ncsi_get_version_id(slirp); |