* include/ws2tcpip.h (gai_strerror{AW}): Implement as inline function.

This commit is contained in:
Dimitri Papadopoulos 2006-04-14 16:40:30 +00:00
parent 285ae543e2
commit 538146072a
2 changed files with 30 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2006-04-14 Dimitri Papadopoulos <papadopo@users.sourceforge.net>
* include/ws2tcpip.h (gai_strerror{AW}): Implement as inline function.
2006-04-14 Dimitri Papadopoulos <papadopo@users.sourceforge.net> 2006-04-14 Dimitri Papadopoulos <papadopo@users.sourceforge.net>
* include/wsahelp.h (system_header): Add pragma. * include/wsahelp.h (system_header): Add pragma.

View File

@ -304,17 +304,33 @@ int WSAAPI getnameinfo(const struct sockaddr*,socklen_t,char*,DWORD,
/* FIXME: Need WS protocol-independent API helpers. */ /* FIXME: Need WS protocol-independent API helpers. */
#endif #endif
#if 0 static __inline char*
/* These are not exported from any known w32api library. Are they gai_strerrorA(int ecode)
implemented as macros or inline finctions? */ {
char* WSAAPI gai_strerrorA(int); static char message[1024+1];
WCHAR* WSAAPI gai_strerrorW(int); DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS
| FORMAT_MESSAGE_MAX_WIDTH_MASK;
DWORD dwLanguageId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
FormatMessageA(dwFlags, NULL, ecode, dwLanguageId, (LPSTR)message, 1024, NULL);
return message;
}
static __inline WCHAR*
gai_strerrorW(int ecode)
{
static WCHAR message[1024+1];
DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS
| FORMAT_MESSAGE_MAX_WIDTH_MASK;
DWORD dwLanguageId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
FormatMessageW(dwFlags, NULL, ecode, dwLanguageId, (LPWSTR)message, 1024, NULL);
return message;
}
#ifdef UNICODE #ifdef UNICODE
#define gai_strerror gai_strerrorW #define gai_strerror gai_strerrorW
#else #else
#define gai_strerror gai_strerrorA #define gai_strerror gai_strerrorA
#endif /* UNICODE */ #endif
#endif /* 0 */
/* Some older IPv4/IPv6 compatibility stuff */ /* Some older IPv4/IPv6 compatibility stuff */
@ -360,5 +376,4 @@ typedef struct _OLD_INTERFACE_INFO {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif
#endif /* _WS2TCPIP_H */