diff options
author | sotech117 <michael_foiani@brown.edu> | 2023-09-26 05:22:04 +0000 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2023-09-26 05:22:04 +0000 |
commit | e42579bec262ee06ba6fc344652914b26ee7e108 (patch) | |
tree | bd150b1eff90467981be93b5daae41e85b5a2248 | |
parent | 0720962e7459e6469e72a0ed6cf4159e4f0b2b86 (diff) |
REMOVE WARNINGS. I BELIEVE I AM DONE!
-rw-r--r-- | server.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -294,7 +294,7 @@ int setup_stations(int argc, char *argv[]) { stations[i].filePath = argv[i+2]; stations[i].readfd = open(argv[i+2], O_RDONLY); if (stations[i].readfd < 0) { perror("read (from station file)"); return -1; } - pthread_create(&stations[i].streamThread, NULL, stream_routine, i); + pthread_create(&stations[i].streamThread, NULL, stream_routine, (void *) (uint64_t) i); // uint64_t to avoid warning in compiler } return 1; @@ -308,7 +308,7 @@ int setup_stations(int argc, char *argv[]) { note: you can modify how often and how much is read off the file by changing the MACROS */ void *stream_routine(void *arg) { - int station_num = (int) arg; + uint64_t station_num = (uint64_t) arg; // printf("stream routine %d\n", station_num); int read_fd = stations[station_num].readfd; @@ -386,7 +386,7 @@ int read_file(int fd, char buffer[FILE_READ_SIZE], int station_num) { if (bytes_read == 0) { // printf("end of file, restarting\n"); pthread_t send_announce_thread; - pthread_create(&send_announce_thread, NULL, send_announce_routine, station_num); + pthread_create(&send_announce_thread, NULL, send_announce_routine, (void *) (uint64_t) station_num); if (lseek(fd, 0, SEEK_SET) == -1) { @@ -912,7 +912,7 @@ void update_user_station(int tcpfd, int stationNum) { */ void *send_announce_routine(void *arg) { // unpack arg - int station_num = (int) arg; + uint64_t station_num = (uint64_t) arg; // send the announce messages for (int i = 0; i < max_active_users; i++) { @@ -1125,7 +1125,7 @@ void add_station(char *file_path) { // reopen the file stations[i].readfd = open(file_path, O_RDONLY); if (stations[i].readfd < 0) { perror("read (from add station)"); return; } - pthread_create(&stations[i].streamThread, NULL, stream_routine, i); + pthread_create(&stations[i].streamThread, NULL, stream_routine, (void *) (uint64_t) i); send_newstation_reply(i); return; @@ -1154,7 +1154,7 @@ void add_station(char *file_path) { fdmax = stations[num_stations].readfd; } if (stations[num_stations].readfd < 0) { perror("read (from add station)"); return; } - pthread_create(&stations[num_stations].streamThread, NULL, stream_routine, num_stations); + pthread_create(&stations[num_stations].streamThread, NULL, stream_routine, (void *) (uint64_t) num_stations); send_newstation_reply(num_stations); printf("add: successfully created station @ index %d\n", num_stations); |