diff options
Diffstat (limited to 'win/tclWinInit.c')
-rw-r--r-- | win/tclWinInit.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 2ce19ce..f4c6e06 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -155,7 +155,7 @@ TclpInitPlatform(void) /* * Fill available functions depending on windows version */ - handle = GetModuleHandle(TEXT("KERNEL32")); + handle = GetModuleHandle(L"KERNEL32"); tclWinProcs.cancelSynchronousIo = (BOOL (WINAPI *)(HANDLE)) GetProcAddress(handle, "CancelSynchronousIo"); @@ -188,6 +188,7 @@ TclpInitLibraryPath( Tcl_Obj *pathPtr; char installLib[LIBRARY_SIZE]; const char *bytes; + int length; pathPtr = Tcl_NewObj(); @@ -223,10 +224,10 @@ TclpInitLibraryPath( TclGetProcessGlobalValue(&sourceLibraryDir)); *encodingPtr = NULL; - bytes = TclGetString(pathPtr); - *lengthPtr = pathPtr->length; - *valuePtr = ckalloc(*lengthPtr + 1); - memcpy(*valuePtr, bytes, *lengthPtr + 1); + bytes = TclGetStringFromObj(pathPtr, &length); + *lengthPtr = length++; + *valuePtr = ckalloc(length); + memcpy(*valuePtr, bytes, length); Tcl_DecrRefCount(pathPtr); } @@ -269,7 +270,7 @@ AppendEnvironment( for (shortlib = (char *) &lib[strlen(lib)-1]; shortlib>lib ; shortlib--) { if (*shortlib == '/') { - if ((unsigned)(shortlib - lib) == strlen(lib) - 1) { + if ((size_t)(shortlib - lib) == strlen(lib) - 1) { Tcl_Panic("last character in lib cannot be '/'"); } shortlib++; @@ -468,14 +469,14 @@ TclpGetUserName( Tcl_DStringInit(bufferPtr); if (TclGetEnv("USERNAME", bufferPtr) == NULL) { - TCHAR szUserName[UNLEN+1]; + WCHAR szUserName[UNLEN+1]; DWORD cchUserNameLen = UNLEN; if (!GetUserName(szUserName, &cchUserNameLen)) { return NULL; } cchUserNameLen--; - cchUserNameLen *= sizeof(TCHAR); + cchUserNameLen *= sizeof(WCHAR); Tcl_WinTCharToUtf(szUserName, cchUserNameLen, bufferPtr); } return Tcl_DStringValue(bufferPtr); @@ -516,7 +517,7 @@ TclpSetVariables( TclGetProcessGlobalValue(&defaultLibraryDir), TCL_GLOBAL_ONLY); if (!osInfoInitialized) { - HMODULE handle = GetModuleHandle(TEXT("NTDLL")); + HMODULE handle = GetModuleHandle(L"NTDLL"); int(__stdcall *getversion)(void *) = (int(__stdcall *)(void *)) GetProcAddress(handle, "RtlGetVersion"); osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); @@ -637,7 +638,7 @@ TclpFindVariable( length = strlen(name); nameUpper = ckalloc(length + 1); - memcpy(nameUpper, name, (size_t) length+1); + memcpy(nameUpper, name, length+1); Tcl_UtfToUpper(nameUpper); Tcl_DStringInit(&envString); |