fix Windows cross-build of BlinkenOutputWin
Stefan Schuermans

Stefan Schuermans commited on 2019-11-10 13:31:34
Showing 1 changed files, with 12 additions and 12 deletions.

... ...
@@ -17,7 +17,6 @@ static int serial_settings_parse(char *str)
17 17
 {
18 18
   int baud, data, stop;
19 19
   char parity;
20
-  int set = 0;
21 20
 
22 21
   // split and parse settings string
23 22
   if (sscanf(str, "%i,%c,%i,%i", &baud, &parity, &data, &stop) != 4)
... ...
@@ -62,15 +61,16 @@ static int serial_settings_set(HANDLE hDev, char *settings)
62 61
 
63 62
   // set serial parameters
64 63
   if (!GetCommState(hDev, &PortDcb)) {
65
-    printf("error getting device comm state: error %u\n", GetLastError());
64
+    printf("error getting device comm state: error %lu\n", GetLastError());
66 65
     return 0;
67 66
   }
68 67
   if (!BuildCommDCB(hDev, &PortDcb)) {
69
-    printf("error building comm state: error %u\n", GetLastError());
68
+    printf("error building comm state: error %lu\n", GetLastError());
70 69
     return 0;
71 70
   }
71
+  (void) settings; // TODO: set PortDcb fields
72 72
   if (!SetCommState(hDev, &PortDcb)) {
73
-    printf("error setting device comm state: error %u\n", GetLastError());
73
+    printf("error setting device comm state: error %lu\n", GetLastError());
74 74
     return 0;
75 75
   }
76 76
   // set timeout parameters
... ...
@@ -85,7 +85,7 @@ static int serial_settings_set(HANDLE hDev, char *settings)
85 85
   CommTimeouts.WriteTotalTimeoutConstant = 0;
86 86
   CommTimeouts.WriteTotalTimeoutMultiplier = 0;
87 87
   if (!SetCommTimeouts(hDev, &CommTimeouts)) {
88
-    printf("error setting device timeout parameters: error %u\n",
88
+    printf("error setting device timeout parameters: error %lu\n",
89 89
            GetLastError());
90 90
     return 0;
91 91
   }
... ...
@@ -108,12 +108,11 @@ static int recv_and_out(SOCKET udpSocket, HANDLE hDev,
108 108
   fd_set readFds, errFds;
109 109
   stBlinkenFrame *pFrame;
110 110
   char buffer[65536];   // 64kB is more than maximum UDP size
111
-  int len, dev_eof;
111
+  int len;
112 112
   struct timeval timeout, *p_timeout;
113 113
   DWORD DevWrLen, Err, start, end;
114 114
   COMSTAT ComStat;
115 115
 
116
-  dev_eof = 0;
117 116
   for (;;) {
118 117
     // wait for next frame
119 118
     FD_ZERO(&readFds);
... ...
@@ -184,7 +183,7 @@ static int recv_and_out(SOCKET udpSocket, HANDLE hDev,
184 183
       // reception error
185 184
       if (Err & (CE_BREAK | CE_FRAME | CE_OVERRUN | CE_RXOVER | CE_RXPARITY)) {
186 185
         if (*p_device_output_active)
187
-          printf("error reading from device (comm err=%X)\n", Err);
186
+          printf("error reading from device (comm err=%lX)\n", Err);
188 187
         break;
189 188
       }
190 189
     }
... ...
@@ -225,7 +224,7 @@ static int open_and_output(SOCKET udpSocket, char *device,
225 224
                  0, NULL);
226 225
   if (hDev == INVALID_HANDLE_VALUE) {
227 226
     if (*p_device_output_active)
228
-      printf("could not open \"%s\": error %u\n", device, GetLastError());
227
+      printf("could not open \"%s\": error %lu\n", device, GetLastError());
229 228
     return 0;
230 229
   }
231 230
   // setup serial port
... ...
@@ -311,7 +310,8 @@ int main(int argCnt, char **args)
311 310
   unsigned int format_change, format_height, format_width, format_channels,
312 311
       format_colors;
313 312
   unsigned int height, width, channels, colors, reopen_device_ms;
314
-  int serial_settings_change, reopen_device, unblock;
313
+  int serial_settings_change, reopen_device;
314
+  unsigned long unblock;
315 315
   char txt[64];
316 316
   unsigned short port;
317 317
   struct sockaddr_in addr;
... ...
@@ -351,7 +351,7 @@ int main(int argCnt, char **args)
351 351
   // create udp socket
352 352
   udpSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
353 353
   if (udpSocket == INVALID_SOCKET) {
354
-    printf("cannot create UDP socket: error %lu\n", WSAGetLastError());
354
+    printf("cannot create UDP socket: error %u\n", WSAGetLastError());
355 355
     WSACleanup();
356 356
     return -1;
357 357
   }
... ...
@@ -360,7 +360,7 @@ int main(int argCnt, char **args)
360 360
   // unblock udp socket
361 361
   unblock = 1;
362 362
   if (ioctlsocket(udpSocket, FIONBIO, &unblock) == SOCKET_ERROR) {
363
-    printf("cannot unblock UDP socket: error %lu\n", WSAGetLastError());
363
+    printf("cannot unblock UDP socket: error %u\n", WSAGetLastError());
364 364
     closesocket(udpSocket);
365 365
     WSACleanup();
366 366
     return -1;
367 367