Diff
Not logged in

Differences From Artifact [081d7dece3]:

To Artifact [c0a96e3b00]:


1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18










-
+







/*
 * tclWinSock.c --
 *
 *	This file contains Windows-specific socket related code.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclWinSock.c,v 1.37.2.11 2006/04/28 16:10:51 dgp Exp $
 * RCS: @(#) $Id: tclWinSock.c,v 1.37.2.12 2006/08/29 16:19:48 dgp Exp $
 */

#include "tclWinInt.h"

/*
 * Make sure to remove the redirection defines set in tclWinPort.h that is in
 * use in other sections of the core, except for us.
2547
2548
2549
2550
2551
2552
2553


2554
2555
2556
2557
2558
2559
2560







2561
2562
2563
2564
2565
2566
2567
2568







2569
2570
2571
2572
2573
2574
2575
2547
2548
2549
2550
2551
2552
2553
2554
2555







2556
2557
2558
2559
2560
2561
2562
2563







2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577







+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+







    if ((*tclWinProcs->getComputerNameProc)(wbuf, &length) != 0) {
	/*
	 * Convert string from native to UTF then change to lowercase.
	 */

	Tcl_UtfToLower(Tcl_WinTCharToUtf((TCHAR *) wbuf, -1, &ds));

    } else {
	Tcl_DStringInit(&ds);
    } else if (TclpHasSockets(NULL) == TCL_OK) {
	/*
	 * Buffer length of 255 copied slavishly from previous version of this
	 * routine. Presumably there's a more "correct" macro value for a
	 * properly sized buffer for a gethostname() call. Maintainers are
	 * welcome to supply it.
	 */
	if (TclpHasSockets(NULL) == TCL_OK) {
	    /*
	     * Buffer length of 255 copied slavishly from previous version
	     * of this routine. Presumably there's a more "correct" macro
	     * value for a properly sized buffer for a gethostname() call.
	     * Maintainers are welcome to supply it.
	     */

	Tcl_DStringInit(&ds);
	Tcl_DStringSetLength(&ds, 255);
	if (winSock.gethostname(Tcl_DStringValue(&ds),
		Tcl_DStringLength(&ds)) == 0) {
	    Tcl_DStringSetLength(&ds, 0);
	} else {
	    Tcl_DStringSetLength(&ds, strlen(Tcl_DStringValue(&ds)));
	    Tcl_DStringSetLength(&ds, 255);
	    if (winSock.gethostname(Tcl_DStringValue(&ds),
		    Tcl_DStringLength(&ds)) == 0) {
		Tcl_DStringSetLength(&ds, 0);
	    } else {
		Tcl_DStringSetLength(&ds, strlen(Tcl_DStringValue(&ds)));
	    }
	}
    }

    *encodingPtr = Tcl_GetEncoding(NULL, "utf-8");
    *lengthPtr = Tcl_DStringLength(&ds);
    *valuePtr = ckalloc((unsigned int) (*lengthPtr)+1);
    memcpy((VOID *) *valuePtr, (VOID *) Tcl_DStringValue(&ds),