diff -ru a/ascii.c b/ascii.c --- a/ascii.c 2013-12-11 19:02:11.000000000 +0400 +++ b/ascii.c 2022-11-27 19:17:43.994422598 +0300 @@ -61,6 +61,7 @@ #include #include #include +#include // close typedef int DWORD; #define closesocket close diff -ru a/fileio.c b/fileio.c --- a/fileio.c 2015-04-17 18:28:59.000000000 +0300 +++ b/fileio.c 2022-11-27 19:00:52.786180712 +0300 @@ -61,6 +61,8 @@ #include #include #include +#include // truncate +#include // tolower typedef int DWORD; #define closesocket close diff -ru a/firmware.c b/firmware.c --- a/firmware.c 2019-05-24 15:14:08.000000000 +0300 +++ b/firmware.c 2022-11-27 19:19:58.311741348 +0300 @@ -31,6 +31,7 @@ #include #include #include +#include // lseek #define MAX_PATH 1024 @@ -1864,7 +1865,7 @@ } -GetLANVersions (int bus,char IRVersion[],char LANVersion[],int timeout) +int GetLANVersions (int bus,char IRVersion[],char LANVersion[],int timeout) { int res,i; IRDATA ir; diff -ru a/flashrom.c b/flashrom.c --- a/flashrom.c 2015-04-17 18:29:00.000000000 +0300 +++ b/flashrom.c 2022-11-27 19:56:37.317493293 +0300 @@ -91,6 +91,7 @@ int ConvertToOldActionFlags (int vn); int ConvertToNewActionFlags (int v); +int IRTransLanFlash (DEVICEINFO *dev,IRDATA_LAN_FLASH *ird,int len,uint32_t ip); word flash_data[65536]; FILE *fptrans; @@ -247,8 +248,8 @@ } while (stat < 0 && i < 3); if (i == 3) { - GetError (stat,ERR_TIMEOUT); - log_print (stat,LOG_ERROR); + GetError (ERR_TIMEOUT, st); + log_print (st,LOG_ERROR); return (-ERR_TIMEOUT); } @@ -289,8 +290,8 @@ } while (stat < 0 && i < 3); if (i == 3) { - GetError (stat,ERR_TIMEOUT); - log_print (stat,LOG_ERROR); + GetError (ERR_TIMEOUT, st); + log_print (st,LOG_ERROR); return (-ERR_TIMEOUT); } diff -ru a/global.h b/global.h --- a/global.h 2012-06-26 19:10:19.000000000 +0400 +++ b/global.h 2022-11-27 19:34:05.970480006 +0300 @@ -128,12 +128,12 @@ int BuildXBMCHelo (byte *data,char *name); int BuildXBMCKey (byte *data,char *button); int BuildXBMCAction (byte *data,byte type,char *action); +void PostWindowsMessage (int rem,int com,char name[]); #ifdef WIN32 -void PostWindowsMessage (int rem,int com,char name[]); /* cmd for HSHELL_APPCOMMAND and WM_APPCOMMAND */ #define APPCOMMAND_BROWSER_BACKWARD 1 diff -ru a/lanio.c b/lanio.c --- a/lanio.c 2013-02-21 21:02:23.000000000 +0400 +++ b/lanio.c 2022-11-27 19:21:58.901027450 +0300 @@ -60,6 +60,8 @@ #include #include #include +#include // time +#include // close typedef int DWORD; #define closesocket close diff -ru a/linuxserio.c b/linuxserio.c --- a/linuxserio.c 2012-10-20 19:18:14.000000000 +0400 +++ b/linuxserio.c 2022-11-27 18:55:34.688666275 +0300 @@ -29,6 +29,7 @@ #ifdef LINUX +#include // flock #include #include #include diff -ru a/lowlevel.c b/lowlevel.c --- a/lowlevel.c 2019-05-24 15:14:09.000000000 +0300 +++ b/lowlevel.c 2022-11-27 21:27:59.011084563 +0300 @@ -66,6 +66,7 @@ #include #include #include +#include // unlink typedef int DWORD; #define closesocket close @@ -81,6 +82,7 @@ #include "global.h" #include "flash.h" #include "functioncodes.h" +#include "serio.h" // WriteSerialString #ifdef WIN32 #include "winio.h" @@ -128,10 +130,9 @@ #define FN_HWCARR 1024 #define FN_DUALRCV 2048 */ -void CopyStatusBuffer (STATUS_LINE_N *target,STATUS_LINE_N *source,int flag,int bus); +void CopyStatusBuffer (STATUS_LINE_N const *source,STATUS_LINE_N *target,int flag,int bus); int IRTransLanFlash (DEVICEINFO *dev,IRDATA_LAN_FLASH *ird,int len,uint32_t ip); void SwapWordN (word *pnt); -void SwapIntN (int32_t *pnt); extern IRCOMMAND *cmd_pnt; @@ -1467,7 +1468,7 @@ } -void CopyStatusBuffer (STATUS_LINE_N *source,STATUS_LINE_N *target,int flg,int bus) +void CopyStatusBuffer (STATUS_LINE_N const *source,STATUS_LINE_N *target,int flg,int bus) { STATUS_LINE_1 *sl1; STATUS_LINE_2 *sl2; diff -ru a/lowlevel.h b/lowlevel.h --- a/lowlevel.h 2013-12-11 19:06:35.000000000 +0400 +++ b/lowlevel.h 2022-11-27 19:58:40.393741038 +0300 @@ -142,7 +142,7 @@ void CloseIRTransLANSocket (void); void CloseServerSockets (SOCKET sock,SOCKET lirc, SOCKET udp,SOCKET web); void showDebugTiming (IRDATA *ird); - +void SwapIntN (int32_t *pnt); extern byte byteorder; diff -ru a/serio.h b/serio.h --- a/serio.h 2012-10-20 19:18:16.000000000 +0400 +++ b/serio.h 2022-11-27 20:05:40.324586092 +0300 @@ -38,3 +38,4 @@ int WriteSerialStringEx (DEVICEINFO *dev,byte pnt[],int len); void SetSerialTimeoutEx (DEVICEINFO *dev,int time); void SetSerialTimeoutEx_ITo (DEVICEINFO *dev,int time); +int ReadSerialStringEx (DEVICEINFO *dev,byte pnt[],int len,int timeout); diff -ru a/server.c b/server.c --- a/server.c 2022-11-27 18:36:47.986258298 +0300 +++ b/server.c 2022-11-27 19:38:56.222156459 +0300 @@ -76,6 +76,7 @@ #include #include #include +#include // chdir typedef int DWORD; @@ -101,6 +102,7 @@ #include "flash.h" #include "xap.h" #include "ccf.h" +#include "serio.h" // OpenSerialPortEx #ifdef LINUX SOCKET local_socket; @@ -150,6 +152,10 @@ void SetLearnstatus (int client); int ConvertLongcode (byte cmd[],int len,byte target[]); void GetDataPath (char path[]); +int build_select_table (fd_set *events); +int get_selected_fd (fd_set *events,SOCKET *sockfd,int *ionum); +int FlashDevice (int bus,char filename[],char upg_key[],NETWORKSTATUS *stat,int client); +int AnalyzeUDPString (char *st,int *netcom,char *remote,char *command,char *ccf,int *netmask,int *bus,int *led,int *port,int *macro_wait); @@ -157,10 +163,8 @@ int build_event_table (HANDLE events[],byte event_type[],byte event_num[],OVERLAPPED OvCom[],int *ser_event); int get_selected_event (int eventnum,HANDLE events[],byte event_type[],byte event_num[],SOCKET *sockfd); -int AnalyzeUDPString (char *st,int *netcom,char *remote,char *command,char *ccf,int *netmask,int *bus,int *led,int *port,int *macro_wait); void IRTControlHandler (DWORD request); void IRTransService(int argc, char** argv); -int FlashDevice (int bus,char filename[],char upg_key[],NETWORKSTATUS *stat,int client); WSAEVENT SockEvent; WSAEVENT LircEvent; @@ -908,7 +912,7 @@ #if defined LINUX || defined _CONSOLE -main (int argc,char *argv[]) +int main (int argc,char *argv[]) { int res; char *pnt; diff -ru a/webserver.c b/webserver.c --- a/webserver.c 2011-08-11 14:51:56.000000000 +0400 +++ b/webserver.c 2022-11-27 19:13:57.540894447 +0300 @@ -57,6 +57,7 @@ #include #include #include +#include // gethostname typedef int DWORD; #define closesocket close diff -ru a/xap.c b/xap.c --- a/xap.c 2011-08-11 14:51:56.000000000 +0400 +++ b/xap.c 2022-11-27 19:07:16.708008539 +0300 @@ -73,6 +73,7 @@ #include #include #include +#include // getpid typedef int DWORD; diff -ru a/xbmc.c b/xbmc.c --- a/xbmc.c 2015-04-17 18:29:04.000000000 +0300 +++ b/xbmc.c 2022-11-27 19:42:27.562648968 +0300 @@ -61,6 +61,8 @@ #include #include #include +#include // time +#include // close typedef int DWORD; #define closesocket close @@ -274,13 +276,13 @@ pclose (fp); i = 0; while (ln[i] && ln[i] != ' ' && ln[i] != '\t') i++; - if (!ln[i]) return; + if (!ln[i]) return -1; } while (ln[i] == ' ' || ln[i] == '\t') i++; - if (!ln[i]) return; + if (!ln[i]) return -1; xbmc_pid = atoi (ln + i);