From 1398d76e14ad2b4e1ea6c4a0cf2abee3e4e7aeaf Mon Sep 17 00:00:00 2001 From: sletz Date: Mon, 7 Nov 2011 10:03:58 +0000 Subject: [PATCH] Add missing method in JackNetWinSocket. git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4570 0c269be4-1314-0410-8aa9-9f06e86f4224 --- windows/JackNetWinSocket.cpp | 272 ++++++++++++++++---------------- windows/JackNetWinSocket.h | 49 +++--- windows/JackWinServerLaunch.cpp | 37 ++--- 3 files changed, 179 insertions(+), 179 deletions(-) diff --git a/windows/JackNetWinSocket.cpp b/windows/JackNetWinSocket.cpp index adf8a434..7a6c953e 100644 --- a/windows/JackNetWinSocket.cpp +++ b/windows/JackNetWinSocket.cpp @@ -1,20 +1,20 @@ /* Copyright (C) 2004-2008 Grame - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - + */ @@ -23,12 +23,11 @@ namespace Jack { //utility ********************************************************************************************************* - SERVER_EXPORT int GetHostName ( char * name, int size ) + SERVER_EXPORT int GetHostName(char * name, int size) { - if ( gethostname ( name, size ) == SOCKET_ERROR ) - { - jack_error ( "Can't get 'hostname' : %s", strerror ( NET_ERROR_CODE ) ); - strcpy ( name, "default" ); + if (gethostname(name, size) == SOCKET_ERROR) { + jack_error("Can't get 'hostname' : %s", strerror(NET_ERROR_CODE)); + strcpy(name, "default"); return -1; } return 0; @@ -36,68 +35,67 @@ namespace Jack win_net_error_t NetErrorList[] = { - E ( 0, "No error" ), - E ( WSAEINTR, "Interrupted system call" ), - E ( WSAEBADF, "Bad file number" ), - E ( WSAEACCES, "Permission denied" ), - E ( WSAEFAULT, "Bad address" ), - E ( WSAEINVAL, "Invalid argument" ), - E ( WSAEMFILE, "Too many open sockets" ), - E ( WSAEWOULDBLOCK, "Operation would block" ), - E ( WSAEINPROGRESS, "Operation now in progress" ), - E ( WSAEALREADY, "Operation already in progress" ), - E ( WSAENOTSOCK, "Socket operation on non-socket" ), - E ( WSAEDESTADDRREQ, "Destination address required" ), - E ( WSAEMSGSIZE, "Message too long" ), - E ( WSAEPROTOTYPE, "Protocol wrong type for socket" ), - E ( WSAENOPROTOOPT, "Bad protocol option" ), - E ( WSAEPROTONOSUPPORT, "Protocol not supported" ), - E ( WSAESOCKTNOSUPPORT, "Socket type not supported" ), - E ( WSAEOPNOTSUPP, "Operation not supported on socket" ), - E ( WSAEPFNOSUPPORT, "Protocol family not supported" ), - E ( WSAEAFNOSUPPORT, "Address family not supported" ), - E ( WSAEADDRINUSE, "Address already in use" ), - E ( WSAEADDRNOTAVAIL, "Can't assign requested address" ), - E ( WSAENETDOWN, "Network is down" ), - E ( WSAENETUNREACH, "Network is unreachable" ), - E ( WSAENETRESET, "Net connection reset" ), - E ( WSAECONNABORTED, "Software caused connection abort" ), - E ( WSAECONNRESET, "Connection reset by peer" ), - E ( WSAENOBUFS, "No buffer space available" ), - E ( WSAEISCONN, "Socket is already connected" ), - E ( WSAENOTCONN, "Socket is not connected" ), - E ( WSAESHUTDOWN, "Can't send after socket shutdown" ), - E ( WSAETOOMANYREFS, "Too many references, can't splice" ), - E ( WSAETIMEDOUT, "Connection timed out" ), - E ( WSAECONNREFUSED, "Connection refused" ), - E ( WSAELOOP, "Too many levels of symbolic links" ), - E ( WSAENAMETOOLONG, "File name too long" ), - E ( WSAEHOSTDOWN, "Host is down" ), - E ( WSAEHOSTUNREACH, "No route to host" ), - E ( WSAENOTEMPTY, "Directory not empty" ), - E ( WSAEPROCLIM, "Too many processes" ), - E ( WSAEUSERS, "Too many users" ), - E ( WSAEDQUOT, "Disc quota exceeded" ), - E ( WSAESTALE, "Stale NFS file handle" ), - E ( WSAEREMOTE, "Too many levels of remote in path" ), - E ( WSASYSNOTREADY, "Network system is unavailable" ), - E ( WSAVERNOTSUPPORTED, "Winsock version out of range" ), - E ( WSANOTINITIALISED, "WSAStartup not yet called" ), - E ( WSAEDISCON, "Graceful shutdown in progress" ), - E ( WSAHOST_NOT_FOUND, "Host not found" ), - E ( WSANO_DATA, "No host data of that type was found" ), + E(0, "No error"), + E(WSAEINTR, "Interrupted system call"), + E(WSAEBADF, "Bad file number"), + E(WSAEACCES, "Permission denied"), + E(WSAEFAULT, "Bad address"), + E(WSAEINVAL, "Invalid argument"), + E(WSAEMFILE, "Too many open sockets"), + E(WSAEWOULDBLOCK, "Operation would block"), + E(WSAEINPROGRESS, "Operation now in progress"), + E(WSAEALREADY, "Operation already in progress"), + E(WSAENOTSOCK, "Socket operation on non-socket"), + E(WSAEDESTADDRREQ, "Destination address required"), + E(WSAEMSGSIZE, "Message too long"), + E(WSAEPROTOTYPE, "Protocol wrong type for socket"), + E(WSAENOPROTOOPT, "Bad protocol option"), + E(WSAEPROTONOSUPPORT, "Protocol not supported"), + E(WSAESOCKTNOSUPPORT, "Socket type not supported"), + E(WSAEOPNOTSUPP, "Operation not supported on socket"), + E(WSAEPFNOSUPPORT, "Protocol family not supported"), + E(WSAEAFNOSUPPORT, "Address family not supported"), + E(WSAEADDRINUSE, "Address already in use"), + E(WSAEADDRNOTAVAIL, "Can't assign requested address"), + E(WSAENETDOWN, "Network is down"), + E(WSAENETUNREACH, "Network is unreachable"), + E(WSAENETRESET, "Net connection reset"), + E(WSAECONNABORTED, "Software caused connection abort"), + E(WSAECONNRESET, "Connection reset by peer"), + E(WSAENOBUFS, "No buffer space available"), + E(WSAEISCONN, "Socket is already connected"), + E(WSAENOTCONN, "Socket is not connected"), + E(WSAESHUTDOWN, "Can't send after socket shutdown"), + E(WSAETOOMANYREFS, "Too many references, can't splice"), + E(WSAETIMEDOUT, "Connection timed out"), + E(WSAECONNREFUSED, "Connection refused"), + E(WSAELOOP, "Too many levels of symbolic links"), + E(WSAENAMETOOLONG, "File name too long"), + E(WSAEHOSTDOWN, "Host is down"), + E(WSAEHOSTUNREACH, "No route to host"), + E(WSAENOTEMPTY, "Directory not empty"), + E(WSAEPROCLIM, "Too many processes"), + E(WSAEUSERS, "Too many users"), + E(WSAEDQUOT, "Disc quota exceeded"), + E(WSAESTALE, "Stale NFS file handle"), + E(WSAEREMOTE, "Too many levels of remote in path"), + E(WSASYSNOTREADY, "Network system is unavailable"), + E(WSAVERNOTSUPPORTED, "Winsock version out of range"), + E(WSANOTINITIALISED, "WSAStartup not yet called"), + E(WSAEDISCON, "Graceful shutdown in progress"), + E(WSAHOST_NOT_FOUND, "Host not found"), + E(WSANO_DATA, "No host data of that type was found"), { -1, NULL }, }; - SERVER_EXPORT const char* PrintError ( int error ) + SERVER_EXPORT const char* PrintError(int error) { int i; - for ( i = 0; NetErrorList[i].code >= 0; ++i ) - { - if ( error == NetErrorList[i].code ) + for (i = 0; NetErrorList[i].code >= 0; ++i) { + if (error == NetErrorList[i].code) return NetErrorList[i].msg; } - return strerror ( error ); + return strerror(error); } //construct/destruct*********************************************************************************************** @@ -105,28 +103,28 @@ namespace Jack { fSockfd = 0; fSendAddr.sin_family = AF_INET; - fSendAddr.sin_addr.s_addr = htonl ( INADDR_ANY ); - memset ( &fSendAddr.sin_zero, 0, 8 ); + fSendAddr.sin_addr.s_addr = htonl(INADDR_ANY); + memset(&fSendAddr.sin_zero, 0, 8); fRecvAddr.sin_family = AF_INET; - fRecvAddr.sin_addr.s_addr = htonl ( INADDR_ANY ); - memset ( &fRecvAddr.sin_zero, 0, 8 ); + fRecvAddr.sin_addr.s_addr = htonl(INADDR_ANY); + memset(&fRecvAddr.sin_zero, 0, 8); } - JackNetWinSocket::JackNetWinSocket ( const char* ip, int port ) + JackNetWinSocket::JackNetWinSocket(const char* ip, int port) { fSockfd = 0; fPort = port; fSendAddr.sin_family = AF_INET; - fSendAddr.sin_port = htons ( port ); - fSendAddr.sin_addr.s_addr = inet_addr ( ip ); - memset ( &fSendAddr.sin_zero, 0, 8 ); + fSendAddr.sin_port = htons(port); + fSendAddr.sin_addr.s_addr = inet_addr(ip); + memset(&fSendAddr.sin_zero, 0, 8); fRecvAddr.sin_family = AF_INET; - fRecvAddr.sin_port = htons ( port ); - fRecvAddr.sin_addr.s_addr = htonl ( INADDR_ANY ); - memset ( &fRecvAddr.sin_zero, 0, 8 ); + fRecvAddr.sin_port = htons(port); + fRecvAddr.sin_addr.s_addr = htonl(INADDR_ANY); + memset(&fRecvAddr.sin_zero, 0, 8); } - JackNetWinSocket::JackNetWinSocket ( const JackNetWinSocket& socket ) + JackNetWinSocket::JackNetWinSocket(const JackNetWinSocket& socket) { fSockfd = 0; fPort = socket.fPort; @@ -139,10 +137,9 @@ namespace Jack Close(); } - JackNetWinSocket& JackNetWinSocket::operator= ( const JackNetWinSocket& socket ) + JackNetWinSocket& JackNetWinSocket::operator=(const JackNetWinSocket& socket) { - if ( this != &socket ) - { + if (this != &socket) { fSockfd = 0; fPort = socket.fPort; fSendAddr = socket.fSendAddr; @@ -154,73 +151,72 @@ namespace Jack //socket*********************************************************************************************************** int JackNetWinSocket::NewSocket() { - if ( fSockfd ) - { + if (fSockfd) { Close(); Reset(); } - fSockfd = socket ( AF_INET, SOCK_DGRAM, 0 ); + fSockfd = socket(AF_INET, SOCK_DGRAM, 0); return fSockfd; } int JackNetWinSocket::Bind() { - return bind ( fSockfd, reinterpret_cast ( &fRecvAddr ), sizeof ( SOCKADDR ) ); + return bind(fSockfd, reinterpret_cast(&fRecvAddr), sizeof(SOCKADDR)); } - int JackNetWinSocket::BindWith ( const char* ip ) + int JackNetWinSocket::BindWith(const char* ip) { - fRecvAddr.sin_addr.s_addr = inet_addr ( ip ); + fRecvAddr.sin_addr.s_addr = inet_addr(ip); return Bind(); } - int JackNetWinSocket::BindWith ( int port ) + int JackNetWinSocket::BindWith(int port) { - fRecvAddr.sin_port = htons ( port ); + fRecvAddr.sin_port = htons(port); return Bind(); } int JackNetWinSocket::Connect() { - return connect ( fSockfd, reinterpret_cast ( &fSendAddr ), sizeof ( SOCKADDR ) ); + return connect(fSockfd, reinterpret_cast(&fSendAddr), sizeof(SOCKADDR)); } - int JackNetWinSocket::ConnectTo ( const char* ip ) + int JackNetWinSocket::ConnectTo(const char* ip) { - fSendAddr.sin_addr.s_addr = inet_addr ( ip ); + fSendAddr.sin_addr.s_addr = inet_addr(ip); return Connect(); } void JackNetWinSocket::Close() { - if ( fSockfd ) - closesocket ( fSockfd ); + if (fSockfd) + closesocket(fSockfd); fSockfd = 0; } void JackNetWinSocket::Reset() { fSendAddr.sin_family = AF_INET; - fSendAddr.sin_port = htons ( fPort ); - fSendAddr.sin_addr.s_addr = htonl ( INADDR_ANY ); - memset ( &fSendAddr.sin_zero, 0, 8 ); + fSendAddr.sin_port = htons(fPort); + fSendAddr.sin_addr.s_addr = htonl(INADDR_ANY); + memset(&fSendAddr.sin_zero, 0, 8); fRecvAddr.sin_family = AF_INET; - fRecvAddr.sin_port = htons ( fPort ); - fRecvAddr.sin_addr.s_addr = htonl ( INADDR_ANY ); - memset ( &fRecvAddr.sin_zero, 0, 8 ); + fRecvAddr.sin_port = htons(fPort); + fRecvAddr.sin_addr.s_addr = htonl(INADDR_ANY); + memset(&fRecvAddr.sin_zero, 0, 8); } bool JackNetWinSocket::IsSocket() { - return ( fSockfd ) ? true : false; + return(fSockfd) ? true : false; } //IP/PORT*********************************************************************************************************** - void JackNetWinSocket::SetPort ( int port ) + void JackNetWinSocket::SetPort(int port) { fPort = port; - fSendAddr.sin_port = htons ( port ); - fRecvAddr.sin_port = htons ( port ); + fSendAddr.sin_port = htons(port); + fRecvAddr.sin_port = htons(port); } int JackNetWinSocket::GetPort() @@ -229,59 +225,59 @@ namespace Jack } //address*********************************************************************************************************** - int JackNetWinSocket::SetAddress ( const char* ip, int port ) + int JackNetWinSocket::SetAddress(const char* ip, int port) { - fSendAddr.sin_addr.s_addr = inet_addr ( ip ); - fSendAddr.sin_port = htons ( port ); + fSendAddr.sin_addr.s_addr = inet_addr(ip); + fSendAddr.sin_port = htons(port); return 0; } char* JackNetWinSocket::GetSendIP() { - return inet_ntoa ( fSendAddr.sin_addr ); + return inet_ntoa(fSendAddr.sin_addr); } char* JackNetWinSocket::GetRecvIP() { - return inet_ntoa ( fRecvAddr.sin_addr ); + return inet_ntoa(fRecvAddr.sin_addr); } //utility************************************************************************************************************ - int JackNetWinSocket::GetName ( char* name ) + int JackNetWinSocket::GetName(char* name) { - return gethostname ( name, 255 ); + return gethostname(name, 255); } - int JackNetWinSocket::JoinMCastGroup ( const char* ip ) + int JackNetWinSocket::JoinMCastGroup(const char* ip) { struct ip_mreq multicast_req; - multicast_req.imr_multiaddr.s_addr = inet_addr ( ip ); - multicast_req.imr_interface.s_addr = htonl ( INADDR_ANY ); + multicast_req.imr_multiaddr.s_addr = inet_addr(ip); + multicast_req.imr_interface.s_addr = htonl(INADDR_ANY); //12 is IP_ADD_MEMBERSHIP in winsock2 (differs from winsock1...) - return SetOption ( IPPROTO_IP, 12, &multicast_req, sizeof ( multicast_req ) ); + return SetOption(IPPROTO_IP, 12, &multicast_req, sizeof(multicast_req)); } //options************************************************************************************************************ - int JackNetWinSocket::SetOption ( int level, int optname, const void* optval, SOCKLEN optlen ) + int JackNetWinSocket::SetOption(int level, int optname, const void* optval, SOCKLEN optlen) { - return setsockopt ( fSockfd, level, optname, static_cast ( optval ), optlen ); + return setsockopt(fSockfd, level, optname, static_cast(optval), optlen); } - int JackNetWinSocket::GetOption ( int level, int optname, void* optval, SOCKLEN* optlen ) + int JackNetWinSocket::GetOption(int level, int optname, void* optval, SOCKLEN* optlen) { - return getsockopt ( fSockfd, level, optname, static_cast ( optval ), optlen ); + return getsockopt(fSockfd, level, optname, static_cast(optval), optlen); } //tiemout************************************************************************************************************ - int JackNetWinSocket::SetTimeOut ( int usec ) + int JackNetWinSocket::SetTimeOut(int usec) { - jack_log ( "JackNetWinSocket::SetTimeout %d usec", usec ); + jack_log("JackNetWinSocket::SetTimeout %d usec", usec); //negative timeout, or exceeding 10s, return - if ( ( usec < 0 ) || ( usec > 10000000 ) ) + if (( usec < 0) || (usec > 10000000)) return SOCKET_ERROR; int time = usec / 1000; - return SetOption ( SOL_SOCKET, SO_RCVTIMEO, &time, sizeof ( time ) ); + return SetOption(SOL_SOCKET, SO_RCVTIMEO, &time, sizeof(time)); } //local loop********************************************************************************************************* @@ -294,46 +290,46 @@ namespace Jack which the socket is joined, including data sent from the same socket, will be echoed to its receive buffer. */ char disable = 1; - return SetOption ( IPPROTO_IP, IP_MULTICAST_LOOP, &disable, sizeof ( disable ) ); + return SetOption(IPPROTO_IP, IP_MULTICAST_LOOP, &disable, sizeof(disable)); } //network operations************************************************************************************************* - int JackNetWinSocket::SendTo ( const void* buffer, size_t nbytes, int flags ) + int JackNetWinSocket::SendTo(const void* buffer, size_t nbytes, int flags) { - return sendto ( fSockfd, reinterpret_cast ( buffer ), nbytes, flags, reinterpret_cast ( &fSendAddr ), sizeof ( SOCKADDR ) ); + return sendto(fSockfd, reinterpret_cast(buffer), nbytes, flags, reinterpret_cast(&fSendAddr), sizeof(SOCKADDR)); } - int JackNetWinSocket::SendTo ( const void* buffer, size_t nbytes, int flags, const char* ip ) + int JackNetWinSocket::SendTo(const void* buffer, size_t nbytes, int flags, const char* ip) { - fSendAddr.sin_addr.s_addr = inet_addr ( ip ); - return SendTo ( buffer, nbytes, flags ); + fSendAddr.sin_addr.s_addr = inet_addr(ip); + return SendTo(buffer, nbytes, flags); } - int JackNetWinSocket::Send ( const void* buffer, size_t nbytes, int flags ) + int JackNetWinSocket::Send(const void* buffer, size_t nbytes, int flags) { - return send ( fSockfd, reinterpret_cast ( buffer ), nbytes, flags ); + return send(fSockfd, reinterpret_cast(buffer), nbytes, flags); } - int JackNetWinSocket::RecvFrom ( void* buffer, size_t nbytes, int flags ) + int JackNetWinSocket::RecvFrom(void* buffer, size_t nbytes, int flags) { - SOCKLEN addr_len = sizeof ( SOCKADDR ); - return recvfrom ( fSockfd, reinterpret_cast ( buffer ), nbytes, flags, reinterpret_cast ( &fRecvAddr ), &addr_len ); + SOCKLEN addr_len = sizeof(SOCKADDR); + return recvfrom(fSockfd, reinterpret_cast(buffer), nbytes, flags, reinterpret_cast(&fRecvAddr), &addr_len); } - int JackNetWinSocket::Recv ( void* buffer, size_t nbytes, int flags ) + int JackNetWinSocket::Recv(void* buffer, size_t nbytes, int flags) { - return recv ( fSockfd, reinterpret_cast ( buffer ), nbytes, flags ); + return recv(fSockfd, reinterpret_cast(buffer), nbytes, flags); } - int JackNetWinSocket::CatchHost ( void* buffer, size_t nbytes, int flags ) + int JackNetWinSocket::CatchHost(void* buffer, size_t nbytes, int flags) { - SOCKLEN addr_len = sizeof ( SOCKADDR ); - return recvfrom ( fSockfd, reinterpret_cast ( buffer ), nbytes, flags, reinterpret_cast ( &fSendAddr ), &addr_len ); + SOCKLEN addr_len = sizeof(SOCKADDR); + return recvfrom(fSockfd, reinterpret_cast(buffer), nbytes, flags, reinterpret_cast(&fSendAddr), &addr_len); } net_error_t JackNetWinSocket::GetError() { - switch ( NET_ERROR_CODE ) + switch (NET_ERROR_CODE) { case WSABASEERR: return NET_NO_ERROR; diff --git a/windows/JackNetWinSocket.h b/windows/JackNetWinSocket.h index 1041fab8..acb5a09b 100644 --- a/windows/JackNetWinSocket.h +++ b/windows/JackNetWinSocket.h @@ -23,7 +23,7 @@ #include "JackNetSocket.h" #ifdef __MINGW32__ #include -#include +#include #include #endif @@ -32,9 +32,9 @@ namespace Jack { #define E(code, s) { code, s } #define NET_ERROR_CODE WSAGetLastError() -#define StrError PrintError +#define StrError PrintError - typedef uint32_t uint; + typedef uint32_t uint; typedef int SOCKLEN; typedef struct _win_net_error win_net_error_t; @@ -44,7 +44,7 @@ namespace Jack const char* msg; }; - SERVER_EXPORT const char* PrintError ( int error ); + SERVER_EXPORT const char* PrintError(int error); //JeckNetWinSocket*************************************************************************** class SERVER_EXPORT JackNetWinSocket @@ -56,53 +56,55 @@ namespace Jack SOCKADDR_IN fRecvAddr; public: JackNetWinSocket(); - JackNetWinSocket ( const char* ip, int port ); - JackNetWinSocket ( const JackNetWinSocket& ); + JackNetWinSocket(const char* ip, int port); + JackNetWinSocket(const JackNetWinSocket&); ~JackNetWinSocket(); - JackNetWinSocket& operator= ( const JackNetWinSocket& ); + JackNetWinSocket& operator=(const JackNetWinSocket&); //socket management int NewSocket(); int Bind(); - int BindWith ( const char* ip ); - int BindWith ( int port ); + int BindWith(const char* ip); + int BindWith(int port); int Connect(); - int ConnectTo ( const char* ip ); + int ConnectTo(const char* ip); void Close(); void Reset(); bool IsSocket(); //IP/PORT management - void SetPort ( int port ); + void SetPort(int port); int GetPort(); //address management - int SetAddress ( const char* ip, int port ); + int SetAddress(const char* ip, int port); char* GetSendIP(); char* GetRecvIP(); //utility - int GetName ( char* name ); - int JoinMCastGroup ( const char* mcast_ip ); + int GetName(char* name); + int JoinMCastGroup(const char* mcast_ip); //options management - int SetOption ( int level, int optname, const void* optval, SOCKLEN optlen ); - int GetOption ( int level, int optname, void* optval, SOCKLEN* optlen ); + int SetOption(int level, int optname, const void* optval, SOCKLEN optlen); + int GetOption(int level, int optname, void* optval, SOCKLEN* optlen); //timeout - int SetTimeOut ( int usec ); + int SetTimeOut(int usec); //disable local loop int SetLocalLoop(); + + bool IsLocal(char* ip) { return false; } //network operations - int SendTo ( const void* buffer, size_t nbytes, int flags ); - int SendTo ( const void* buffer, size_t nbytes, int flags, const char* ip ); - int Send ( const void* buffer, size_t nbytes, int flags ); - int RecvFrom ( void* buffer, size_t nbytes, int flags ); - int Recv ( void* buffer, size_t nbytes, int flags ); - int CatchHost ( void* buffer, size_t nbytes, int flags ); + int SendTo(const void* buffer, size_t nbytes, int flags); + int SendTo(const void* buffer, size_t nbytes, int flags, const char* ip); + int Send(const void* buffer, size_t nbytes, int flags); + int RecvFrom(void* buffer, size_t nbytes, int flags); + int Recv(void* buffer, size_t nbytes, int flags); + int CatchHost(void* buffer, size_t nbytes, int flags); //error management net_error_t GetError(); @@ -110,3 +112,4 @@ namespace Jack } #endif + diff --git a/windows/JackWinServerLaunch.cpp b/windows/JackWinServerLaunch.cpp index 3c1788b2..88f446c3 100644 --- a/windows/JackWinServerLaunch.cpp +++ b/windows/JackWinServerLaunch.cpp @@ -55,7 +55,7 @@ find_path_to_jackdrc(char *path_to_jackdrc) // The above call should have given us the path to the user's home folder char* pos; - char ch = user_jackdrc[strlen(user_jackdrc)-1]; + char ch = user_jackdrc[strlen(user_jackdrc)-1]; if (('/' != ch) && ('\\' != ch)) strcat(user_jackdrc, "\\"); @@ -94,24 +94,25 @@ find_path_to_jackdrc(char *path_to_jackdrc) */ #include + static int start_server_aux(const char* server_name) { -FILE* fp = 0; -size_t pos = 0; -size_t result = 0; -int i = 0; -int good = 0; -int ret = 0; -char* command = 0; -char** argv = 0; -char* p; -char* back_slash; -char* forward_slash; -char arguments [256]; -char buffer [MAX_PATH]; -char filename [MAX_PATH]; -char curr_wd [MAX_PATH]; -char temp_wd [MAX_PATH]; + FILE* fp = 0; + size_t pos = 0; + size_t result = 0; + int i = 0; + int good = 0; + int ret = 0; + char* command = 0; + char** argv = 0; + char* p; + char* back_slash; + char* forward_slash; + char arguments [256]; + char buffer [MAX_PATH]; + char filename [MAX_PATH]; + char curr_wd [MAX_PATH]; + char temp_wd [MAX_PATH]; curr_wd[0] = '\0'; if (find_path_to_jackdrc(filename)) @@ -309,7 +310,7 @@ int try_start_server(jack_varargs_t* va, jack_options_t options, jack_status_t* } return 0; - } +} #endif // WIN32 && !__CYGWIN__