diff --git a/.travis.yml b/.travis.yml index add12ec..73f3c9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,5 @@ compiler: - gcc - clang script: - - gcc -O3 test.cpp -o test + - $CC -O3 test.cpp -o test diff --git a/test.cpp b/test.cpp index 519dfec..feec63d 100644 --- a/test.cpp +++ b/test.cpp @@ -20,8 +20,9 @@ LatencySimulator *vnet; // 模拟网络:模拟发送一个 udp包 int udp_output(const char *buf, int len, ikcpcb *kcp, void *user) { - int id = (int)user; - vnet->send(id, buf, len); + union { int id; void *ptr; } parameter; + parameter.ptr = user; + vnet->send(parameter.id, buf, len); return 0; }