Mercurial > projects > dwt-win
changeset 164:19a760bfd55f
Fix null termination in Combo. Thx torhu for finding this.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 21 Feb 2008 15:20:42 +0100 |
parents | dc6fc0d3f303 |
children | 49d8d2e0faba |
files | dwt/widgets/Combo.d |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/widgets/Combo.d Thu Feb 21 15:20:13 2008 +0100 +++ b/dwt/widgets/Combo.d Thu Feb 21 15:20:42 2008 +0100 @@ -187,7 +187,7 @@ public void add (char[] string) { checkWidget (); if (string is null) error (DWT.ERROR_NULL_ARGUMENT); - auto buffer = StrToTCHARs( string ); + auto buffer = StrToTCHARs( getCodePage(), string, true ); int result = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer.ptr ); if (result is OS.CB_ERR) error (DWT.ERROR_ITEM_NOT_ADDED); if (result is OS.CB_ERRSPACE) error (DWT.ERROR_ITEM_NOT_ADDED); @@ -224,7 +224,7 @@ if (!(0 <= index && index <= count)) { error (DWT.ERROR_INVALID_RANGE); } - auto buffer = StrToTCHARs( string ); + auto buffer = StrToTCHARs( getCodePage(), string, true ); int result = OS.SendMessage (handle, OS.CB_INSERTSTRING, index, buffer.ptr); if (result is OS.CB_ERRSPACE || result is OS.CB_ERR) { error (DWT.ERROR_ITEM_NOT_ADDED); @@ -2326,7 +2326,7 @@ OS.CallWindowProc (EditProc, hwndText, msg, wParam, lParam); } if (msg is OS.WM_SETTEXT) { - TCHAR[] buffer = StrToTCHARs( newText ); + TCHAR[] buffer = StrToTCHARs( getCodePage(), newText, true ); auto hHeap = OS.GetProcessHeap (); int byteCount = buffer.length * TCHAR.sizeof; auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);