diff options
-rw-r--r-- | win/tkWinDialog.c | 34 | ||||
-rw-r--r-- | win/tkWinFont.c | 9 | ||||
-rw-r--r-- | win/tkWinSend.c | 9 | ||||
-rw-r--r-- | win/tkWinSendCom.c | 3 | ||||
-rw-r--r-- | win/tkWinWm.c | 5 | ||||
-rw-r--r-- | win/ttkWinXPTheme.c | 8 |
6 files changed, 27 insertions, 41 deletions
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index aaf455b..51a7b8d 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -589,8 +589,7 @@ static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam); static void SetTkDialog(ClientData clientData); -static const char *ConvertExternalFilename(WCHAR *filename, - Tcl_DString *dsPtr); +static const char *ConvertExternalFilename(LPCWSTR, Tcl_DString *); static void LoadShellProcs(void); @@ -1627,17 +1626,16 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper if (optsPtr->extObj != NULL) { str = Tcl_GetString(optsPtr->extObj); - if (str[0] == '.') + if (str[0] == '.') { ++str; + } Tcl_DStringInit(&extString); - Tcl_UtfToWCharDString(str, -1, &extString); - ofn.lpstrDefExt = (WCHAR *) Tcl_DStringValue(&extString); + ofn.lpstrDefExt = Tcl_UtfToWCharDString(str, -1, &extString); } Tcl_DStringInit(&filterString); - Tcl_UtfToWCharDString(Tcl_DStringValue(&utfFilterString), + ofn.lpstrFilter = Tcl_UtfToWCharDString(Tcl_DStringValue(&utfFilterString), Tcl_DStringLength(&utfFilterString), &filterString); - ofn.lpstrFilter = (WCHAR *) Tcl_DStringValue(&filterString); ofn.nFilterIndex = filterIndex; if (Tcl_DStringValue(&optsPtr->utfDirString)[0] != '\0') { @@ -1668,8 +1666,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper if (optsPtr->titleObj != NULL) { Tcl_DStringInit(&titleString); - Tcl_UtfToWCharDString(Tcl_GetString(optsPtr->titleObj), -1, &titleString); - ofn.lpstrTitle = (WCHAR *) Tcl_DStringValue(&titleString); + ofn.lpstrTitle = Tcl_UtfToWCharDString(Tcl_GetString(optsPtr->titleObj), -1, &titleString); } /* @@ -2016,7 +2013,7 @@ OFNHookProc( if (TCL_PATH_ABSOLUTE == Tcl_GetPathType(Tcl_DStringValue(&tmpfile))) { /* re-get the full path to the start of the buffer */ - buffer = (WCHAR *) ofnData->dynFileBuffer; + buffer = ofnData->dynFileBuffer; SendMessageW(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer); } else { *(buffer-1) = '\\'; @@ -2660,13 +2657,11 @@ ChooseDirectoryValidateProc( chooseDirSharedData->retDir[0] = '\0'; return 1; } - Tcl_DStringFree(&initDirString); - Tcl_DStringInit(&initDirString); - Tcl_UtfToWCharDString(Tcl_DStringValue(&tempString), -1, &initDirString); - Tcl_DStringFree(&tempString); - wcsncpy(string, (WCHAR *) Tcl_DStringValue(&initDirString), + Tcl_DStringSetLength(&initDirString, 0); + wcsncpy(string, Tcl_UtfToWCharDString(Tcl_DStringValue(&tempString), -1, &initDirString), MAX_PATH); Tcl_DStringFree(&initDirString); + Tcl_DStringFree(&tempString); if (SetCurrentDirectoryW(string) == 0) { @@ -2747,8 +2742,8 @@ ChooseDirectoryValidateProc( ULONG ulCount, ulAttr; if (SUCCEEDED(psfFolder->lpVtbl->ParseDisplayName( - psfFolder, hwnd, NULL, (WCHAR *) - initDir, &ulCount,&pidlMain,&ulAttr)) + psfFolder, hwnd, NULL, initDir, + &ulCount,&pidlMain,&ulAttr)) && (pidlMain != NULL)) { SendMessageW(hwnd, BFFM_SETSELECTIONW, FALSE, (LPARAM) pidlMain); @@ -3039,7 +3034,7 @@ SetTkDialog( static const char * ConvertExternalFilename( - WCHAR *filename, + LPCWSTR filename, Tcl_DString *dsPtr) { char *p; @@ -3488,8 +3483,7 @@ FontchooserShowCmd( fontPtr = (TkFont *) f; cf.Flags |= CF_INITTOLOGFONTSTRUCT; Tcl_DStringInit(&ds); - Tcl_UtfToWCharDString(fontPtr->fa.family, -1, &ds); - wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds), + wcsncpy(lf.lfFaceName, Tcl_UtfToWCharDString(fontPtr->fa.family, -1, &ds), LF_FACESIZE-1); Tcl_DStringFree(&ds); lf.lfFaceName[LF_FACESIZE-1] = 0; diff --git a/win/tkWinFont.c b/win/tkWinFont.c index b84652e..980fd4b 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -2481,8 +2481,8 @@ GetScreenFont( lf.lfQuality = DEFAULT_QUALITY; lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - Tcl_WinUtfToTChar(faceName, -1, &ds); - wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds), LF_FACESIZE-1); + Tcl_DStringInit(&ds); + wcsncpy(lf.lfFaceName, Tcl_UtfToWCharDString(faceName, -1, &ds), LF_FACESIZE-1); Tcl_DStringFree(&ds); lf.lfFaceName[LF_FACESIZE-1] = 0; hFont = CreateFontIndirectW(&lf); @@ -2516,8 +2516,6 @@ FamilyExists( int result; Tcl_DString faceString; - Tcl_WinUtfToTChar(faceName, -1, &faceString); - /* * If the family exists, WinFontExistProc() will be called and * EnumFontFamilies() will return whatever WinFontExistProc() returns. If @@ -2525,7 +2523,8 @@ FamilyExists( * non-zero value. */ - result = EnumFontFamiliesW(hdc, (WCHAR*) Tcl_DStringValue(&faceString), + Tcl_DStringInit(&faceString); + result = EnumFontFamiliesW(hdc, Tcl_UtfToWCharDString(faceName, -1, &faceString), (FONTENUMPROCW) WinFontExistProc, 0); Tcl_DStringFree(&faceString); return (result == 0); diff --git a/win/tkWinSend.c b/win/tkWinSend.c index 8968255..ba296a3 100644 --- a/win/tkWinSend.c +++ b/win/tkWinSend.c @@ -764,8 +764,7 @@ Send( vCmd.vt = VT_BSTR; src = Tcl_GetString(cmd); Tcl_DStringInit(&ds); - Tcl_UtfToWCharDString(src, cmd->length, &ds); - vCmd.bstrVal = SysAllocString((WCHAR *) Tcl_DStringValue(&ds)); + vCmd.bstrVal = SysAllocString(Tcl_UtfToWCharDString(src, cmd->length, &ds)); Tcl_DStringFree(&ds); dp.cArgs = 1; @@ -874,15 +873,13 @@ TkWinSend_SetExcepInfo( src = Tcl_GetString(opError); Tcl_DStringInit(&ds); - Tcl_UtfToWCharDString(src, opError->length, &ds); pExcepInfo->bstrDescription = - SysAllocString((WCHAR *) Tcl_DStringValue(&ds)); + SysAllocString(Tcl_UtfToWCharDString(src, opError->length, &ds)); Tcl_DStringFree(&ds); src = Tcl_GetString(opErrorCode); Tcl_DStringInit(&ds); - Tcl_UtfToWCharDString(src, opErrorCode->length, &ds); pExcepInfo->bstrSource = - SysAllocString((WCHAR *) Tcl_DStringValue(&ds)); + SysAllocString(Tcl_UtfToWCharDString(src, opErrorCode->length, &ds)); Tcl_DStringFree(&ds); Tcl_DecrRefCount(opErrorCode); pExcepInfo->scode = E_FAIL; diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c index 5cd57d5..2422300 100644 --- a/win/tkWinSendCom.c +++ b/win/tkWinSendCom.c @@ -458,8 +458,7 @@ Send( obj = Tcl_GetObjResult(interp); src = Tcl_GetString(obj); Tcl_DStringInit(&ds); - Tcl_UtfToWCharDString(src, obj->length, &ds); - pvResult->bstrVal = SysAllocString((WCHAR *) Tcl_DStringValue(&ds)); + pvResult->bstrVal = SysAllocString(Tcl_UtfToWCharDString(src, obj->length, &ds)); Tcl_DStringFree(&ds); } if (result == TCL_ERROR) { diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 83ff7d0..d273b4c 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -1242,10 +1242,9 @@ ReadIconFromFile( return NULL; } Tcl_DStringInit(&ds2); - Tcl_UtfToWCharDString(file, -1, &ds2); - Tcl_DStringFree(&ds); - res = (DWORD *)SHGetFileInfoW((WCHAR *)Tcl_DStringValue(&ds2), 0, &sfiSM, + res = (DWORD *)SHGetFileInfoW(Tcl_UtfToWCharDString(file, -1, &ds2), 0, &sfiSM, sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_ICON); + Tcl_DStringFree(&ds); if (res != 0) { SHFILEINFOW sfi; diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index a7e59a3..8a97852 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -834,13 +834,12 @@ static void TextElementSize( src = TkGetStringFromObj(element->textObj, &len); Tcl_DStringInit(&ds); - Tcl_UtfToWCharDString(src, len, &ds); hr = elementData->procs->GetThemeTextExtent( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, 0), - (WCHAR *) Tcl_DStringValue(&ds), + Tcl_UtfToWCharDString(src, len, &ds), -1, DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, NULL, @@ -874,13 +873,12 @@ static void TextElementDraw( src = TkGetStringFromObj(element->textObj, &len); Tcl_DStringInit(&ds); - Tcl_UtfToWCharDString(src, len, &ds); hr = elementData->procs->DrawThemeText( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, state), - (WCHAR *) Tcl_DStringValue(&ds), + Tcl_UtfToWCharDString(src, len, &ds), -1, DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, (state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0, @@ -1113,7 +1111,7 @@ Ttk_CreateVsapiElement( XPThemeData *themeData = clientData; ElementInfo *elementPtr = NULL; ClientData elementData; - WCHAR *className; + LPCWSTR className; int partId = 0; Ttk_StateTable *stateTable; Ttk_Padding pad = {0, 0, 0, 0}; |