Ported recent changes to win32 and fixed CRLF problems with project

files (most had CRCRCRLF).
This commit is contained in:
crs 2002-10-29 22:07:55 +00:00
parent e06368b950
commit 9102fb80b9
15 changed files with 1528 additions and 1508 deletions

View File

@ -103,10 +103,6 @@ SOURCE=.\CString.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\CUnicode.cpp
# End Source File
# Begin Source File
SOURCE=.\XBase.cpp SOURCE=.\XBase.cpp
# End Source File # End Source File
# End Group # End Group
@ -139,10 +135,6 @@ SOURCE=.\CString.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\CUnicode.h
# End Source File
# Begin Source File
SOURCE=.\IInterface.h SOURCE=.\IInterface.h
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -74,6 +74,13 @@ setError(bool* errors)
// multibyte conversion stuff when reentrant versions not available // multibyte conversion stuff when reentrant versions not available
// //
#if WINDOWS_LIKE
#define HAVE_MBSTATE_T 1
#define HAVE_MBSINIT 1
#define HAVE_MBRTOWC 1
#define HAVE_WCRTOMB 1
#endif
#if !HAVE_MBSTATE_T #if !HAVE_MBSTATE_T
struct mbstate_t { int m_dummy; }; struct mbstate_t { int m_dummy; };
#undef HAVE_MBSINIT #undef HAVE_MBSINIT

View File

@ -107,6 +107,10 @@ SOURCE=.\CStreamBuffer.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\CUnicode.cpp
# End Source File
# Begin Source File
SOURCE=.\XIO.cpp SOURCE=.\XIO.cpp
# End Source File # End Source File
# End Group # End Group
@ -135,6 +139,10 @@ SOURCE=.\CStreamBuffer.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\CUnicode.h
# End Source File
# Begin Source File
SOURCE=.\IInputStream.h SOURCE=.\IInputStream.h
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -109,6 +109,10 @@ SOURCE=.\CThreadRep.cpp
SOURCE=.\CTimerThread.cpp SOURCE=.\CTimerThread.cpp
# End Source File # End Source File
# Begin Source File
SOURCE=.\XMT.cpp
# End Source File
# End Group # End Group
# Begin Group "Header Files" # Begin Group "Header Files"
@ -139,6 +143,10 @@ SOURCE=.\CTimerThread.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\XMT.h
# End Source File
# Begin Source File
SOURCE=.\XThread.h SOURCE=.\XThread.h
# End Source File # End Source File
# End Group # End Group

View File

@ -48,6 +48,8 @@ int (PASCAL FAR *CNetwork::getsockerror)(void);
int (PASCAL FAR *CNetwork::select)(int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout); int (PASCAL FAR *CNetwork::select)(int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, const struct timeval FAR *timeout);
int (PASCAL FAR *CNetwork::WSACleanup)(void); int (PASCAL FAR *CNetwork::WSACleanup)(void);
int (PASCAL FAR *CNetwork::__WSAFDIsSet)(CNetwork::Socket, fd_set FAR *); int (PASCAL FAR *CNetwork::__WSAFDIsSet)(CNetwork::Socket, fd_set FAR *);
char FAR * (PASCAL FAR *CNetwork::inet_ntoa_n)(struct in_addr in);
unsigned long (PASCAL FAR *CNetwork::inet_addr_n)(const char FAR * cp);
struct hostent FAR * (PASCAL FAR *CNetwork::gethostbyaddr_n)(const char FAR * addr, int len, int type); struct hostent FAR * (PASCAL FAR *CNetwork::gethostbyaddr_n)(const char FAR * addr, int len, int type);
struct hostent FAR * (PASCAL FAR *CNetwork::gethostbyname_n)(const char FAR * name); struct hostent FAR * (PASCAL FAR *CNetwork::gethostbyname_n)(const char FAR * name);
struct servent FAR * (PASCAL FAR *CNetwork::getservbyport_n)(int port, const char FAR * proto); struct servent FAR * (PASCAL FAR *CNetwork::getservbyport_n)(int port, const char FAR * proto);
@ -248,7 +250,7 @@ CNetwork::inet_aton(const char FAR * cp, InternetAddress FAR * addr)
return 0; return 0;
} }
else { else {
*(addr->s_addr) = inetAddr; addr->s_addr = inetAddr;
return 1; return 1;
} }
} }
@ -269,7 +271,7 @@ CNetwork::gethostbyaddr(CHostInfo* hostinfo,
// winsock returns structures per-thread // winsock returns structures per-thread
struct hostent FAR* info = gethostbyaddr_n(addr, len, type); struct hostent FAR* info = gethostbyaddr_n(addr, len, type);
if (info == NULL) { if (info == NULL) {
return WSAGetLastError(); return getsockerror();
} }
else { else {
CHostInfo tmp(info); CHostInfo tmp(info);
@ -287,7 +289,7 @@ CNetwork::gethostbyname(CHostInfo* hostinfo,
// winsock returns structures per-thread // winsock returns structures per-thread
struct hostent FAR* info = gethostbyname_n(name); struct hostent FAR* info = gethostbyname_n(name);
if (info == NULL) { if (info == NULL) {
return WSAGetLastError(); return getsockerror();
} }
else { else {
CHostInfo tmp(info); CHostInfo tmp(info);
@ -305,7 +307,7 @@ CNetwork::getservbyport(CServiceInfo* servinfo,
// winsock returns structures per-thread // winsock returns structures per-thread
struct servent FAR* info = getservbyport_n(port, proto); struct servent FAR* info = getservbyport_n(port, proto);
if (info == NULL) { if (info == NULL) {
return WSAGetLastError(); return getsockerror();
} }
else { else {
CServiceInfo tmp(info); CServiceInfo tmp(info);
@ -323,7 +325,7 @@ CNetwork::getservbyname(CServiceInfo* servinfo,
// winsock returns structures per-thread // winsock returns structures per-thread
struct servent FAR* info = getservbyname_n(name, proto); struct servent FAR* info = getservbyname_n(name, proto);
if (info == NULL) { if (info == NULL) {
return WSAGetLastError(); return getsockerror();
} }
else { else {
CServiceInfo tmp(info); CServiceInfo tmp(info);
@ -339,9 +341,9 @@ CNetwork::getprotobynumber(CProtocolInfo* protoinfo,
assert(protoinfo != NULL); assert(protoinfo != NULL);
// winsock returns structures per-thread // winsock returns structures per-thread
struct protoinfo FAR* info = getprotobynumber_n(proto); struct protoent FAR* info = getprotobynumber_n(proto);
if (info == NULL) { if (info == NULL) {
return WSAGetLastError(); return getsockerror();
} }
else { else {
CProtocolInfo tmp(info); CProtocolInfo tmp(info);
@ -357,9 +359,9 @@ CNetwork::getprotobyname(CProtocolInfo* protoinfo,
assert(protoinfo != NULL); assert(protoinfo != NULL);
// winsock returns structures per-thread // winsock returns structures per-thread
struct protoinfo FAR* info = getprotobyname_n(name); struct protoent FAR* info = getprotobyname_n(name);
if (info == NULL) { if (info == NULL) {
return WSAGetLastError(); return getsockerror();
} }
else { else {
CProtocolInfo tmp(info); CProtocolInfo tmp(info);
@ -379,7 +381,7 @@ int PASCAL FAR
CNetwork::setnodelay(CNetwork::Socket s, bool nodelay) CNetwork::setnodelay(CNetwork::Socket s, bool nodelay)
{ {
BOOL flag = nodelay ? 1 : 0; BOOL flag = nodelay ? 1 : 0;
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag)); return setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag));
} }
#endif #endif
@ -681,25 +683,26 @@ CNetwork::poll2(PollEntry fd[], int nfds, int timeout)
FD_ZERO(&writeSet); FD_ZERO(&writeSet);
FD_ZERO(&errSet); FD_ZERO(&errSet);
for (i = 0; i < nfds; ++i) { for (i = 0; i < nfds; ++i) {
int fdi = static_cast<int>(fd[i].fd);
if (fd[i].events & kPOLLIN) { if (fd[i].events & kPOLLIN) {
FD_SET(fd[i].fd, &readSet); FD_SET(fd[i].fd, &readSet);
readSetP = &readSet; readSetP = &readSet;
if (fd[i].fd > n) { if (fdi > n) {
n = fd[i].fd; n = fdi;
} }
} }
if (fd[i].events & kPOLLOUT) { if (fd[i].events & kPOLLOUT) {
FD_SET(fd[i].fd, &writeSet); FD_SET(fd[i].fd, &writeSet);
writeSetP = &writeSet; writeSetP = &writeSet;
if (fd[i].fd > n) { if (fdi > n) {
n = fd[i].fd; n = fdi;
} }
} }
if (true) { if (true) {
FD_SET(fd[i].fd, &errSet); FD_SET(fd[i].fd, &errSet);
errSetP = &errSet; errSetP = &errSet;
if (fd[i].fd > n) { if (fdi > n) {
n = fd[i].fd; n = fdi;
} }
} }
} }

View File

@ -55,11 +55,13 @@ public:
typedef SOCKET Socket; typedef SOCKET Socket;
typedef struct sockaddr Address; typedef struct sockaddr Address;
typedef int AddressLength; typedef int AddressLength;
typedef short AddressType;
typedef struct in_addr InternetAddress; typedef struct in_addr InternetAddress;
#elif UNIX_LIKE #elif UNIX_LIKE
typedef int Socket; typedef int Socket;
typedef struct sockaddr Address; typedef struct sockaddr Address;
typedef socklen_t AddressLength; typedef socklen_t AddressLength;
typedef int AddressType;
typedef struct in_addr InternetAddress; typedef struct in_addr InternetAddress;
#endif #endif
@ -100,7 +102,7 @@ public:
CString m_name; CString m_name;
AliasList m_aliases; AliasList m_aliases;
int m_addressType; AddressType m_addressType;
int m_addressLength; int m_addressLength;
AddressList m_addresses; AddressList m_addresses;

View File

@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release" # PROP Intermediate_Dir "Release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /I "..\mt" /I "..\synergy" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c # ADD CPP /nologo /MT /W4 /GX /O2 /I "..\base" /I "..\mt" /I "..\io" /I "..\synergy" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
# SUBTRACT CPP /YX # SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG"
@ -65,7 +65,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug" # PROP Intermediate_Dir "Debug"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\base" /I "..\mt" /I "..\synergy" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c # ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\base" /I "..\mt" /I "..\io" /I "..\synergy" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
# SUBTRACT CPP /YX # SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG"