8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tclInt.h"
#if defined(_WIN32) && defined(UNICODE)
/* On Windows, we always need the ASCII version. */
# undef gai_strerror
# define gai_strerror gai_strerrorA
#endif
/*
*---------------------------------------------------------------------------
*
* TclSockGetPort --
*
|
>
|
>
>
>
>
>
>
|
>
>
|
>
>
>
>
>
>
>
>
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tclInt.h"
#if defined(_WIN32) && defined(UNICODE)
/* On Windows, we need to do proper Unicode->UTF-8 conversion. */
typedef struct ThreadSpecificData {
int initialized;
Tcl_DString errorMsg; /* UTF-8 encoded error-message */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
#undef gai_strerror
static const char *gai_strerror(int code) {
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
if (tsdPtr->initialized) {
Tcl_DStringFree(&tsdPtr->errorMsg);
} else {
tsdPtr->initialized = 1;
}
Tcl_WinTCharToUtf(gai_strerrorW(code), -1, &tsdPtr->errorMsg);
return Tcl_DStringValue(&tsdPtr->errorMsg);
}
#endif
/*
*---------------------------------------------------------------------------
*
* TclSockGetPort --
*
|