]> rtime.felk.cvut.cz Git - frescor/fwp.git/commitdiff
wme_test: Get rid of type related warnings on 64 bit systems
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 3 Aug 2009 16:26:19 +0000 (18:26 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 3 Aug 2009 16:31:55 +0000 (18:31 +0200)
wme_test/wclient.c
wme_test/wserver.c

index 3bc9ea327138b663eb5c74baa198bd7c49f79a2a..f4e386b6db58b21a94bee5e27e7097aaef0de5be 100644 (file)
@@ -20,6 +20,7 @@
 #include <semaphore.h>
 #include <sys/ioctl.h>
 #include <net/if.h>
+#include <inttypes.h>
 
 #ifdef WITH_FWP
 #include <fwp_confdefs.h>
@@ -186,7 +187,7 @@ void stream_to_text(char *stream_desc, size_t n, struct stream *stream, long lon
                real[0]=0;
        }
        
-       snprintf(stream_desc, n, "%d: %s %s (%d bytes per %s +-%s, %d packets/s)%s",
+       snprintf(stream_desc, n, "%"PRIdPTR": %s %s (%d bytes per %s +-%s, %d packets/s)%s",
                 stream-streams, ac_to_text[stream->ac], bandwidth_to_text(buf[0], stream->bandwidth_bps),
                 stream->packet_size, usec_to_text(buf[1], stream->period_usec),
                 usec_to_text(buf[2], stream->jitter*stream->period_usec/100),
@@ -302,7 +303,7 @@ void save_results(int argc, char *argv[], int useconds)
        exit(0);
 }
 
-int create_ac_socket(unsigned int ac) 
+int create_ac_socket(intptr_t ac) 
 {
        int sockfd;
        unsigned int yes=1, tos;
@@ -364,7 +365,7 @@ void reset_statistics()
 }
 
 #ifndef WITH_FWP
-int recv_packet_native(unsigned ac, struct msg_t *msg)
+int recv_packet_native(intptr_t ac, struct msg_t *msg)
 {
        int     mlen, ret;
        fd_set fdset;
@@ -405,7 +406,7 @@ void* receiver(void* arg)
        struct timespec ts;
        uint64_t send_timestamp, server_timestamp, recv_timestamp;
        int     mlen;
-       unsigned ac;
+       intptr_t ac;
        
        min_trans_time = ~0;
        
@@ -418,7 +419,7 @@ void* receiver(void* arg)
                ac = stream->ac;
                mlen = recv_packet_fwp(stream, &msg);
 #else
-               ac = (unsigned)arg;
+               ac = (intptr_t)arg;
                mlen = recv_packet_native(ac, &msg);
 #endif
                if (mlen < 0) {
@@ -745,7 +746,7 @@ calc_stream_params(struct stream *stream)
        }
 
        if (packet_size < sizeof(struct msg_t)) {
-               error(1, 0, "Packet size too small (min %d)", sizeof(struct msg_t));
+               error(1, 0, "Packet size too small (min %zd)", sizeof(struct msg_t));
        }
 
        stream->packet_size = packet_size;
@@ -1041,7 +1042,7 @@ int main(int argc, char *argv[])
                error(1, errno, "FWP initialization failed");
        }
 #else
-       int ac;
+       intptr_t ac;
        /* create four receivers each per AC */
        for (ac = AC_NUM - 1; ac >= 0; ac--) {
                ac_sockfd[ac] = create_ac_socket(ac);
index 1649ed5a97eee9fbcdec456460162e37a389efac..1b716d2583c97f6075503cd3d216b28eea7b3afd 100644 (file)
@@ -91,14 +91,15 @@ void* qhandler(void* queue)
        union msg_buff buff;
        struct  sockaddr_in rem_addr;
        int     mlen;
-       unsigned int ac, rem_addr_length; 
+       unsigned int rem_addr_length;
+       intptr_t ac;
        char cbufrec[512], cbufsend[512];
        struct iovec  iov;
        struct msghdr msg;
        struct in_pktinfo *ipi = NULL;
        struct timespec ts;
        
-       ac = (int) queue;
+       ac = (intptr_t) queue;
         rem_addr_length=sizeof(rem_addr);
 
        block_signals();
@@ -182,7 +183,8 @@ void* qhandler(void* queue)
 
 int main(int argc, char *argv[])
 {
-       int ac,rc;
+       int rc;
+       intptr_t ac;
        pthread_attr_t attr;
        pthread_t thread;