phev-remote / phevcore

MIT License
29 stars 11 forks source link

Non breaking space in src/phev_tcpip.c #21

Closed martingjohn closed 2 years ago

martingjohn commented 2 years ago

There looks to be a non breaking space (utf-8 c2a0) in src/phev_tcpip.c

# head -50 src/phev_tcpip.c | tail -1 | xxd
00000000: 2365 6c69 6620 6465 6669 6e65 6428 5f5f  #elif defined(__
00000010: 6c69 6e75 785f 5f29 207c 7cc2 a064 6566  linux__) ||..def
00000020: 696e 6564 285f 5f75 6e69 785f 5f29 0d0a  ined(__unix__)..

Which causes make to fail

# make
Scanning dependencies of target phev
[ 12%] Building C object CMakeFiles/phev.dir/src/phev_tcpip.c.o
/root/phevcore/src/phev_tcpip.c:50:28: error: token "▒" is not valid in preprocessor expressions
   50 | #elif defined(__linux__) ||▒▒defined(__unix__)
      |                            ^
/root/phevcore/src/phev_tcpip.c: In function ‘tcp_read’:
/root/phevcore/src/phev_tcpip.c:169:20: warning: implicit declaration of function ‘TCP_READ’ [-Wimplicit-function-declaration]
  169 |     int read_len = TCP_READ(soc, buffer, len);
      |                    ^~~~~~~~
/root/phevcore/src/phev_tcpip.c: In function ‘phev_tcpClientConnectSocket’:
/root/phevcore/src/phev_tcpip.c:272:21: warning: implicit declaration of function ‘TCP_HTONS’ [-Wimplicit-function-declaration]
  272 |     addr.sin_port = TCP_HTONS(port);
      |                     ^~~~~~~~~
/root/phevcore/src/phev_tcpip.c:277:16: warning: implicit declaration of function ‘TCP_SOCKET’; did you mean ‘SOL_SOCKET’? [-Wimplicit-function-declaration]
  277 |     int sock = TCP_SOCKET(AF_INET, SOCK_STREAM, 0);
      |                ^~~~~~~~~~
      |                SOL_SOCKET
/root/phevcore/src/phev_tcpip.c:285:15: warning: implicit declaration of function ‘TCP_CONNECT’ [-Wimplicit-function-declaration]
  285 |     int ret = TCP_CONNECT(sock, (struct sockaddr *)(&addr), sizeof(addr));
      |               ^~~~~~~~~~~
/root/phevcore/src/phev_tcpip.c: In function ‘phev_tcpClientWrite’:
/root/phevcore/src/phev_tcpip.c:334:15: warning: implicit declaration of function ‘TCP_WRITE’ [-Wimplicit-function-declaration]
  334 |     int num = TCP_WRITE(soc, buf, len);
      |               ^~~~~~~~~
make[2]: *** [CMakeFiles/phev.dir/build.make:128: CMakeFiles/phev.dir/src/phev_tcpip.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/phev.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

When changed back to a normal space this seems to be fine.

This is on a fresh install of Ubuntu 20.0, which has

# make -v
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.