catalinii / minisatip

minisatip is an SATIP server for linux using local DVB-S2, DVB-C, DVB-T or ATSC cards
https://minisatip.org
328 stars 81 forks source link

socketworks.c: incompatible integer to pointer conversion for pthread_t #1075

Closed decke closed 1 year ago

decke commented 1 year ago

It seems a51e109 fails to build at least on FreeBSD with recent clang 15 (not sure about Linux).

socketworks.c:677:32: error: incompatible integer to pointer conversion assigning to 'pthread_t' (aka 'struct pthread *') from 'int' [-Wint-conversion]
            thread_info[i].tid = 1;
                               ^ ~

https://pkg-status.freebsd.org/beefy18/data/main-amd64-default/peacac0805609_s08e66b7a37/logs/minisatip-1.2.91.log

lars18th commented 1 year ago

Hi @catalinii ,

https://github.com/catalinii/minisatip/blob/0399dbb6ca3a9aac236d2830d3874b411a7b9df6/src/utils/logging/logging.h#L18-L22

It seems that your implementation of the thread id (tid) is not portable: https://stackoverflow.com/questions/33285562/why-and-in-what-sense-is-pthread-t-an-opaque-type . The incompatibility is when you assing to tid values 0 and 1 directly.

I hope it helps.

catalinii commented 1 year ago

let me know if this occurs again.

decke commented 1 year ago

It builds fine now. Thanks a lot!