# HG changeset patch # User Frank Benoit # Date 1237983643 -3600 # Node ID 0ecb2b338560824f5c4da84c180c8136357482e3 # Parent 2e09b0e6857a1863ba0d0f2a05cc542dfab50de6 further work on phobosification diff -r 2e09b0e6857a -r 0ecb2b338560 base/src/java/lang/String.d --- a/base/src/java/lang/String.d Wed Mar 25 11:18:25 2009 +0100 +++ b/base/src/java/lang/String.d Wed Mar 25 13:20:43 2009 +0100 @@ -19,6 +19,7 @@ version(Tango){ alias char[] String; alias char[] CString; + alias wchar[] String16; alias wchar[] CString16; } else { // Phobos alias string String; @@ -98,11 +99,11 @@ + dchar res = str[ offset .. $ ].firstCodePoint(); + --- +/ -dchar firstCodePoint( String str ){ +dchar firstCodePoint( CString str ){ int dummy; return firstCodePoint( str, dummy ); } -dchar firstCodePoint( String str, out int consumed ){ +dchar firstCodePoint( CString str, out int consumed ){ version(Tango){ dchar[1] buf; uint ate; @@ -119,7 +120,7 @@ return '\0'; } } -dchar firstCodePoint( wchar[] str, out int consumed ){ +dchar firstCodePoint( CString16 str, out int consumed ){ version(Tango){ dchar[1] buf; uint ate; @@ -256,7 +257,7 @@ } return i; } -int getAbsoluteCodePointOffset( wchar[] str, int startIndex, int searchRelCp ){ +int getAbsoluteCodePointOffset( CString16 str, int startIndex, int searchRelCp ){ int ignore; int i = startIndex; if( searchRelCp > 0 ){ @@ -457,7 +458,7 @@ return v is null ? "null" : v.toString(); } -String String_valueOf( wchar[] wstr ){ +String String_valueOf( CString16 wstr ){ version(Tango){ return tango.text.convert.Utf.toString(wstr); } else { // Phobos @@ -471,7 +472,7 @@ } /// Extension to String -public String toUpperCase( String str ){ +public String toUpperCase( CString str ){ version(Tango){ return tango.text.Unicode.toUpper( str ); } else { // Phobos @@ -481,13 +482,13 @@ } /// Extension to String -public String replaceFirst( String str, String regex, String replacement ){ +public String replaceFirst( CString str, CString regex, CString replacement ){ implMissing(__FILE__,__LINE__); - return str; + return null; } /// Extension to String -public int indexOf( String str, char searched ){ +public int indexOf( CString str, char searched ){ version(Tango){ int res = tango.text.Util.locate( str, searched ); if( res is str.length ) res = -1; @@ -499,7 +500,7 @@ } /// Extension to String -public int indexOf( String str, char searched, int startpos ){ +public int indexOf( CString str, char searched, int startpos ){ version(Tango){ int res = tango.text.Util.locate( str, searched, startpos ); if( res is str.length ) res = -1; @@ -511,12 +512,12 @@ } /// Extension to String -public int indexOf(String str, String ch){ +public int indexOf(CString str, String ch){ return indexOf( str, ch, 0 ); } /// Extension to String -public int indexOf(String str, String ch, int start){ +public int indexOf(CString str, String ch, int start){ version(Tango){ int res = tango.text.Util.locatePattern( str, ch, start ); if( res is str.length ) res = -1; @@ -528,12 +529,12 @@ } /// Extension to String -public int lastIndexOf(String str, char ch){ +public int lastIndexOf(CString str, char ch){ return lastIndexOf( str, ch, str.length ); } /// Extension to String -public int lastIndexOf(String str, char ch, int formIndex){ +public int lastIndexOf(CString str, char ch, int formIndex){ version(Tango){ int res = tango.text.Util.locatePrior( str, ch, formIndex ); if( res is str.length ) res = -1; @@ -545,12 +546,12 @@ } /// Extension to String -public int lastIndexOf(String str, String ch ){ +public int lastIndexOf(CString str, String ch ){ return lastIndexOf( str, ch, str.length ); } /// Extension to String -public int lastIndexOf(String str, String ch, int start ){ +public int lastIndexOf(CString str, String ch, int start ){ version(Tango){ int res = tango.text.Util.locatePatternPrior( str, ch, start ); if( res is str.length ) res = -1; @@ -562,13 +563,13 @@ } /// Extension to String -public String replaceAll( String str, String regex, String replacement ){ +public String replaceAll( CString str, String regex, String replacement ){ implMissing(__FILE__,__LINE__); return null; } /// Extension to String -public String replace( String str, char from, char to ){ +public String replace( CString str, char from, char to ){ version(Tango){ return tango.text.Util.replace( str.dup, from, to ); } else { // Phobos @@ -578,32 +579,32 @@ } /// Extension to String -public String substring( String str, int start ){ +public String substring( CString str, int start ){ return cast(String)str[ start .. $ ].dup; } /// Extension to String -public String substring( String str, int start, int end ){ +public String substring( CString str, int start, int end ){ return cast(String)str[ start .. end ].dup; } /// Extension to String -public wchar[] substring( wchar[] str, int start ){ +public wchar[] substring( CString16 str, int start ){ return cast(wchar[])(str[ start .. $ ].dup); } /// Extension to String -public wchar[] substring( wchar[] str, int start, int end ){ +public wchar[] substring( CString16 str, int start, int end ){ return str[ start .. end ].dup; } /// Extension to String -public char charAt( String str, int pos ){ +public char charAt( CString str, int pos ){ return str[ pos ]; } /// Extension to String -public dchar dcharAt( String str, int pos ){ +public dchar dcharAt( CString str, int pos ){ return str[ pos .. $ ].firstCodePoint(); } @@ -613,7 +614,7 @@ } /// Extension to String -public wchar[] toWCharArray( String str ){ +public String16 toWCharArray( CString str ){ version(Tango){ return tango.text.convert.Utf.toString16(str); } else { // Phobos diff -r 2e09b0e6857a -r 0ecb2b338560 base/src/java/lang/util.d --- a/base/src/java/lang/util.d Wed Mar 25 11:18:25 2009 +0100 +++ b/base/src/java/lang/util.d Wed Mar 25 13:20:43 2009 +0100 @@ -121,11 +121,12 @@ } version( D_Version2 ){ + mixin("invariant(T)[] _idup(T)( T[] str ){ return str.idup; }"); } else { // D1 - String16 idup( String16 str ){ + String16 _idup( String16 str ){ return str.dup; } - String idup( String str ){ + String _idup( String str ){ return str.dup; } } diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d Wed Mar 25 13:20:43 2009 +0100 @@ -2123,10 +2123,10 @@ // SWT extension: allow null string //if (string is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); // TCHAR buffer = new TCHAR (getCodePage(), string, false); - wchar[] wstr = StrToWCHARs( string ); + String16 wstr = StrToWCHARs( string ); int length_ = wstr.length; if (length_ is 0) return; - wchar* buffer = wstr.ptr; + auto buffer = wstr.ptr; auto gdipGraphics = data.gdipGraphics; if (gdipGraphics !is null) { checkGC(FONT | FOREGROUND | (isTransparent ? 0 : BACKGROUND)); @@ -2314,9 +2314,9 @@ auto gdipGraphics = data.gdipGraphics; if (gdipGraphics !is null) { checkGC(FONT | FOREGROUND | ((flags & SWT.DRAW_TRANSPARENT) !is 0 ? 0 : BACKGROUND)); - wchar[] wstr = StrToWCHARs( string ); + String16 wstr = StrToWCHARs( string ); int length_ = wstr.length; - wchar* buffer = wstr.ptr; + auto buffer = wstr.ptr; Gdip.PointF pt; auto format = Gdip.StringFormat_Clone(Gdip.StringFormat_GenericTypographic()); int formatFlags = Gdip.StringFormat_GetFormatFlags(format) | Gdip.StringFormatFlagsMeasureTrailingSpaces; @@ -2368,8 +2368,8 @@ Gdip.StringFormat_delete(format); return; } - TCHAR[] wstr = StrToTCHARs( string ); - TCHAR* buffer = wstr.ptr; + StringT wstr = StrToTCHARs( string ); + auto buffer = wstr.ptr; int length_ = wstr.length; if (length_ is 0) return; RECT rect; @@ -2968,7 +2968,7 @@ if (ch > 0x7F) { char[1] str; str[0] = ch; - TCHAR[] buffer = StrToTCHARs( str ); + StringT buffer = StrToTCHARs( str ); tch = buffer[0]; } int width; @@ -3114,7 +3114,7 @@ if (ch > 0x7F) { char[1] str; str[0] = ch; - TCHAR[] buffer = StrToTCHARs( str ); + StringT buffer = StrToTCHARs( str ); tch = buffer[0]; } ABC abc; @@ -4738,9 +4738,9 @@ if (data.gdipGraphics !is null) { Gdip.PointF pt; Gdip.RectF bounds; - wchar* buffer; + LPCWSTR buffer; if (length_ !is 0) { - wchar[] wstr = StrToWCHARs( string ); + String16 wstr = StrToWCHARs( string ); buffer = wstr.ptr; length_ = wstr.length; } else { @@ -4761,8 +4761,8 @@ return new Point(0, size.cy); } else { // TCHAR buffer = new TCHAR (getCodePage(), string, false); - wchar[] wstr = StrToWCHARs( string ); - wchar* buffer = wstr.ptr; + String16 wstr = StrToWCHARs( string ); + LPCWSTR buffer = wstr.ptr; length_ = wstr.length; OS.GetTextExtentPoint32W(handle, buffer, length_, &size); return new Point(size.cx, size.cy); @@ -4825,10 +4825,10 @@ if (data.gdipGraphics !is null) { Gdip.PointF pt; Gdip.RectF bounds; - wchar* buffer; + LPCWSTR buffer; int length_ = string.length; if (length_ !is 0) { - wchar[] wstr = StrToWCHARs( string ); + String16 wstr = StrToWCHARs( string ); buffer = wstr.ptr; length_ = wstr.length; } else { @@ -4853,7 +4853,7 @@ } RECT rect; auto wstr = StrToTCHARs( string ); - TCHAR* buffer = wstr.ptr; + LPCWSTR buffer = wstr.ptr; int length_ = wstr.length; int uFormat = OS.DT_LEFT | OS.DT_CALCRECT; if ((flags & SWT.DRAW_DELIMITER) is 0) uFormat |= OS.DT_SINGLELINE; diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/Path.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/Path.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/Path.d Wed Mar 25 13:20:43 2009 +0100 @@ -296,8 +296,8 @@ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (font is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - wchar[] wstr = StrToWCHARs( string ); - wchar* buffer = wstr.ptr; + String16 wstr = StrToWCHARs( string ); + LPCWSTR buffer = wstr.ptr; int length = wstr.length; auto hDC = device.internal_new_GC(null); auto gdipFont = GC.createGdipFont(hDC, font.handle); diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/TextLayout.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/TextLayout.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/TextLayout.d Wed Mar 25 13:20:43 2009 +0100 @@ -86,11 +86,11 @@ Font font; String text; - wchar[] wtext; - char[] segmentsText; - wchar[] segmentsWText; // SWT - int[] index8to16; // SWT - int[] index16to8; // SWT + String16 wtext; + String segmentsText; + String16 segmentsWText; // DWT + int[] index8to16; // DWT + int[] index16to8; // DWT int lineSpacing; int ascent, descent; int alignment; @@ -261,7 +261,7 @@ void breakRun(StyleItem run) { if (run.psla !is null) return; - wchar[] chars = segmentsWText[ index8to16[ run.start ] .. index8to16[ run.start + run.length ] ]; + String16 chars = segmentsWText[ index8to16[ run.start ] .. index8to16[ run.start + run.length ] ]; auto hHeap = OS.GetProcessHeap(); run.psla = cast(SCRIPT_LOGATTR*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, SCRIPT_LOGATTR.sizeof * chars.length); if (run.psla is null) SWT.error(SWT.ERROR_NO_HANDLES); @@ -2127,7 +2127,7 @@ return segments; } -void getSegmentsText( out char[] resUtf8, out wchar[] resUtf16 ) { +void getSegmentsText( out String resUtf8, out String16 resUtf16 ) { void buildIndexTables() { // build the index translation tables. index8to16.length = resUtf8.length + 1; @@ -2178,7 +2178,7 @@ } } { - char[] oldChars = text; + auto oldChars = text; // SWT: MARK is now 3 chars long String separator = orientation is SWT.RIGHT_TO_LEFT ? STR_RTL_MARK : STR_LTR_MARK; assert( separator.length is MARK_SIZE ); @@ -2201,12 +2201,12 @@ newChars[ start .. start + MARK_SIZE ] = separator; segmentCount++; } - resUtf8 = newChars[ 0 .. Math.min(charCount + (segmentCount*MARK_SIZE), newChars.length)]; + resUtf8 = cast(String)newChars[ 0 .. Math.min(charCount + (segmentCount*MARK_SIZE), newChars.length)]; } // now for the wide chars { - wchar[] oldWChars = wtext; - wchar[] wseparator = orientation is SWT.RIGHT_TO_LEFT ? WSTR_RTL_MARK : WSTR_LTR_MARK; + String16 oldWChars = wtext; + auto wseparator = orientation is SWT.RIGHT_TO_LEFT ? WSTR_RTL_MARK : WSTR_LTR_MARK; assert( wseparator.length is 1 ); wchar[] newWChars = new wchar[wlength_ + nSegments]; @@ -2227,7 +2227,7 @@ newWChars[ start .. start + WMARK_SIZE ] = wseparator; segmentCount++; } - resUtf16 = newWChars[ 0 .. Math.min(charCount + (segmentCount*WMARK_SIZE), newWChars.length)]; + resUtf16 = cast(String16)newWChars[ 0 .. Math.min(charCount + (segmentCount*WMARK_SIZE), newWChars.length)]; } buildIndexTables(); } @@ -2382,7 +2382,7 @@ auto pItems = cast(SCRIPT_ITEM*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, MAX_ITEM * SCRIPT_ITEM.sizeof); if (pItems is null) SWT.error(SWT.ERROR_NO_HANDLES); int pcItems; - wchar[] chars = segmentsWText; + String16 chars = segmentsWText; OS.ScriptItemize(chars.ptr, chars.length, MAX_ITEM, &scriptControl, &scriptState, pItems, &pcItems); // if (hr is E_OUTOFMEMORY) //TODO handle it // SWT pcItems is not inclusive the trailing item @@ -2871,7 +2871,7 @@ //if (text is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (text.equals(this.text)) return; freeRuns(); - this.text = text.dup; + this.text = text._idup(); this.wtext = StrToWCHARs(text); styles = new StyleItem[2]; styles[0] = new StyleItem(); @@ -2904,7 +2904,7 @@ this.wrapWidth = width; } -bool shape (HDC hdc, StyleItem run, wchar[] wchars, int[] glyphCount, int maxGlyphs, SCRIPT_PROPERTIES* sp) { +bool shape (HDC hdc, StyleItem run, String16 wchars, int[] glyphCount, int maxGlyphs, SCRIPT_PROPERTIES* sp) { bool useCMAPcheck = !sp.fComplex && !run.analysis.fNoGlyphIndex; if (useCMAPcheck) { scope ushort[] glyphs = new ushort[wchars.length]; @@ -2949,7 +2949,7 @@ */ void shape (HDC hdc, StyleItem run) { int[1] buffer; - wchar[] wchars = segmentsWText[ index8to16[ run.start ] .. index8to16[ run.start + run.length ] ]; + auto wchars = segmentsWText[ index8to16[ run.start ] .. index8to16[ run.start + run.length ] ]; int maxGlyphs = (wchars.length * 3 / 2) + 16; auto hHeap = OS.GetProcessHeap(); run.glyphs = cast(ushort*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, maxGlyphs * 2); diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/BidiUtil.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/BidiUtil.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/BidiUtil.d Wed Mar 25 13:20:43 2009 +0100 @@ -172,7 +172,7 @@ * parameter. See org.eclipse.swt.custom.BidiSegmentEvent for details. * @return buffer with the glyphs that should be rendered for the given text */ -public static char[] getRenderInfo(GC gc, String text, int[] order, byte[] classBuffer, int[] dx, int flags, int [] offsets) { +public static String getRenderInfo(GC gc, String text, int[] order, byte[] classBuffer, int[] dx, int flags, int [] offsets) { auto fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle); auto hHeap = OS.GetProcessHeap(); int[8] lpCs; @@ -182,7 +182,7 @@ isRightOriented = OS.GetLayout(gc.handle) !is 0; } OS.TranslateCharsetInfo( cast(uint*)cs, cast(CHARSETINFO*)lpCs.ptr, OS.TCI_SRCCHARSET); - TCHAR[] textBuffer = StrToTCHARs(lpCs[1], text, false); + StringT textBuffer = StrToTCHARs(lpCs[1], text, false); int byteCount = textBuffer.length; bool linkBefore = (flags & LINKBEFORE) is LINKBEFORE; bool linkAfter = (flags & LINKAFTER) is LINKAFTER; @@ -240,7 +240,7 @@ // The number of glyphs expected is <= length (segment length); // the actual number returned may be less in case of Arabic ligatures. result.nGlyphs = length_; - TCHAR[] textBuffer2 = StrToTCHARs(lpCs[1], text.substring(offset, offset + length_), false); + StringT textBuffer2 = StrToTCHARs(lpCs[1], text.substring(offset, offset + length_), false); OS.GetCharacterPlacement(gc.handle, textBuffer2.ptr, textBuffer2.length, 0, &result, dwFlags); if (dx !is null) { @@ -311,7 +311,7 @@ int[8] lpCs; int cs = OS.GetTextCharset(gc.handle); OS.TranslateCharsetInfo( cast(uint*) cs, cast(CHARSETINFO*)lpCs.ptr, OS.TCI_SRCCHARSET); - TCHAR[] textBuffer = StrToTCHARs(lpCs[1], text, false); + StringT textBuffer = StrToTCHARs(lpCs[1], text, false); int byteCount = textBuffer.length; bool isRightOriented = false; if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) { @@ -350,7 +350,7 @@ // The number of glyphs expected is <= length (segment length); // the actual number returned may be less in case of Arabic ligatures. result.nGlyphs = length_; - TCHAR[] textBuffer2 = StrToTCHARs(lpCs[1], text.substring(offset, offset + length_), false); + StringT textBuffer2 = StrToTCHARs(lpCs[1], text.substring(offset, offset + length_), false); OS.GetCharacterPlacement(gc.handle, textBuffer2.ptr, textBuffer2.length, 0, &result, dwFlags); if (order !is null) { diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Compatibility.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Compatibility.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Compatibility.d Wed Mar 25 13:20:43 2009 +0100 @@ -121,10 +121,15 @@ * @return true if the file exists */ public static bool fileExists(String parent, String child) { - return tango.io.Path.exists( - tango.io.Path.join( - tango.io.Path.standard(parent), - tango.io.Path.standard(child))); + version(Tango){ + return tango.io.Path.exists( + tango.io.Path.join( + tango.io.Path.standard(parent), + tango.io.Path.standard(child))); + } else { // Phobos + implMissing( __FILE__, __LINE__ ); + return false; + } } /** @@ -280,8 +285,12 @@ * if the program cannot be executed */ public static void exec(String prog) { - auto proc = new tango.sys.Process.Process( prog ); - proc.execute; + version(Tango){ + auto proc = new tango.sys.Process.Process( prog ); + proc.execute; + } else { // Phobos + implMissing( __FILE__, __LINE__ ); + } } /** @@ -297,8 +306,12 @@ * if the program cannot be executed */ public static void exec(String[] progArray) { - auto proc = new tango.sys.Process.Process( progArray ); - proc.execute; + version(Tango){ + auto proc = new tango.sys.Process.Process( progArray ); + proc.execute; + } else { // Phobos + implMissing( __FILE__, __LINE__ ); + } } const ImportData[] SWTMessagesBundleData = [ @@ -376,7 +389,7 @@ } if (msgs !is null) { try { - char[] frmt = msgs.getString(key); + auto frmt = msgs.getString(key); switch( args.length ){ case 0: answer = Format(frmt); break; case 1: answer = Format(frmt, args[0]); break; @@ -413,15 +426,20 @@ * @return true if the two instances of class String are equal */ public static bool equalsIgnoreCase(String s1, String s2) { - String s1b = new char[ s1.length ]; - String s2b = new char[ s1.length ]; - scope(exit){ - delete s1b; - delete s2b; + version(Tango){ + String s1b = new char[ s1.length ]; + String s2b = new char[ s1.length ]; + scope(exit){ + delete s1b; + delete s2b; + } + String s1c = tango.text.Unicode.toFold( s1, s1b ); + String s2c = tango.text.Unicode.toFold( s2, s2b ); + return s1c == s2c; + } else { // Phobos + implMissing( __FILE__, __LINE__ ); + return false; } - String s1c = tango.text.Unicode.toFold( s1, s1b ); - String s2c = tango.text.Unicode.toFold( s2, s2b ); - return s1c == s2c; } } diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Lock.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Lock.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/Lock.d Wed Mar 25 13:20:43 2009 +0100 @@ -12,6 +12,7 @@ *******************************************************************************/ module org.eclipse.swt.internal.Lock; +import java.lang.all; import java.lang.Thread; version(Tango){ import tango.core.sync.Mutex; diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/Gdip.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/Gdip.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/Gdip.d Wed Mar 25 13:20:43 2009 +0100 @@ -575,7 +575,7 @@ **************************************************************************/ - static Bitmap Bitmap_new( wchar* filename, bool useIcm ) + static Bitmap Bitmap_new( LPCWSTR filename, bool useIcm ) { Bitmap bitmap; if (useIcm) { @@ -1088,7 +1088,7 @@ **************************************************************************/ - static int FontFamily_GetFamilyName( FontFamily family, wchar* name, int language ) + static int FontFamily_GetFamilyName( FontFamily family, LPCWSTR name, int language ) { return SetStatus( GdipGetFamilyName( family, name, language ) ); } @@ -1181,9 +1181,9 @@ if (hfont is null) { Gdip.lastResult = GdipCreateFontFromDC( hdc, font ); } else { - LOGFONTA logfont; - if (GetObjectA( hfont, LOGFONTA.sizeof, &logfont )) - Gdip.lastResult = GdipCreateFontFromLogfontA(hdc, logfont, font); + LOGFONTW logfont; + if (OS.GetObject( hfont, LOGFONTW.sizeof, &logfont )) + Gdip.lastResult = GdipCreateFontFromLogfontW(hdc, logfont, font); else Gdip.lastResult = GdipCreateFontFromDC(hdc, font); } @@ -1196,7 +1196,7 @@ **************************************************************************/ - static Font Font_new( wchar* familyName, float emSize, int style, uint unit, + static Font Font_new( LPCWSTR familyName, float emSize, int style, uint unit, FontCollection fontCollection ) { Font nativeFont = null; @@ -1375,7 +1375,7 @@ **************************************************************************/ - static Status GraphicsPath_AddString( Path path, wchar* string, + static Status GraphicsPath_AddString( Path path, LPCWSTR string, int length, FontFamily family, int style, float emSize, ref PointF origin, StringFormat format ) @@ -1648,7 +1648,7 @@ **************************************************************************/ - static Status Graphics_DrawString( Graphics graphics, wchar* string, int length, + static Status Graphics_DrawString( Graphics graphics, LPCWSTR string, int length, Font font, ref PointF origin, Brush brush ) { RectF rect = {origin.X, origin.Y, 0.0f, 0.0f}; @@ -1660,7 +1660,7 @@ **************************************************************************/ - static Status Graphics_DrawString( Graphics graphics, wchar* string, int length, + static Status Graphics_DrawString( Graphics graphics, LPCWSTR string, int length, Font font, ref PointF origin, StringFormat format, Brush brush ) { @@ -1846,7 +1846,7 @@ **************************************************************************/ - static Status Graphics_MeasureString( Graphics graphics, wchar* string, int length, + static Status Graphics_MeasureString( Graphics graphics, LPCWSTR string, int length, Font font, ref PointF origin, ref RectF boundingBox ) { @@ -1869,7 +1869,7 @@ **************************************************************************/ - static Status Graphics_MeasureString( Graphics graphics, wchar* string, int length, + static Status Graphics_MeasureString( Graphics graphics, LPCWSTR string, int length, Font font, ref PointF origin, StringFormat format, ref RectF boundingBox ) { diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/native.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/native.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/gdip/native.d Wed Mar 25 13:20:43 2009 +0100 @@ -312,12 +312,12 @@ Status GdipFillClosedCurve2(Handle graphics, Handle brush, GpPointF* points, int count, FillMode fillMode, float tension); Status GdipFillClosedCurve2I(Handle graphics, Handle brush, GpPoint* points, int count, FillMode fillMode, float tension); Status GdipFillRegion(Handle graphics, Handle brush, Handle region); -Status GdipDrawString(Handle graphics, wchar* string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, Handle brush); -Status GdipMeasureString(Handle graphics, wchar* string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, ref GpRectF boundingBox, int* codepointsFitted, int* linesFitted); +Status GdipDrawString(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, Handle brush); +Status GdipMeasureString(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, ref GpRectF boundingBox, int* codepointsFitted, int* linesFitted); Status GdipGetStringFormatMeasurableCharacterRangeCount(Handle format, out int count); Status GdipCloneStringFormat(Handle format, out Handle newFormat); -Status GdipMeasureCharacterRanges(Handle graphics, wchar* string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, int regionCount, Handle* regions); +Status GdipMeasureCharacterRanges(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, int regionCount, Handle* regions); Status GdipDrawImage(Handle graphics, Handle image, float x, float y); Status GdipDrawImageI(Handle graphics, Handle image, int x, int y); Status GdipDrawImageRect(Handle graphics, Handle image, float x, float y, float width, float height); @@ -489,14 +489,14 @@ Status GdipDisposeImage(Handle image); Status GdipImageForceValidation(Handle image); -Status GdipLoadImageFromFileICM(wchar* filename, out Handle image); -Status GdipLoadImageFromFile(wchar* filename, out Handle image); +Status GdipLoadImageFromFileICM(LPCWSTR filename, out Handle image); +Status GdipLoadImageFromFile(LPCWSTR filename, out Handle image); // Status GdipLoadImageFromStreamICM(IStream stream, out Handle image); // Status GdipLoadImageFromStream(IStream stream, out Handle image); // Status GdipGetImageRawFormat(Handle image, out GUID format); Status GdipGetImageEncodersSize(out int numEncoders, out int size); // Status GdipGetImageEncoders(int numEncoders, int size, GpImageCodecInfo* encoders); -// Status GdipSaveImageToFile(Handle image, wchar* filename, ref GUID clsidEncoder, GpEncoderParameters* encoderParams); +// Status GdipSaveImageToFile(Handle image, LPCWSTR filename, ref GUID clsidEncoder, GpEncoderParameters* encoderParams); // Status GdipSaveImageToStream(Handle image, IStream stream, ref GUID clsidEncoder, GpEncoderParameters* encoderParams); // Status GdipSaveAdd(Handle image, GpEncoderParameters* encoderParams); // Status GdipSaveAddImage(Handle image, Handle newImage, GpEncoderParameters* encoderParams); @@ -533,8 +533,8 @@ Status GdipCreateBitmapFromScan0(int width, int height, int stride, PixelFormat format, ubyte* scan0, out Handle bitmap); Status GdipCreateBitmapFromHBITMAP(Handle hbitmap, Handle hpalette, out Handle bitmap); Status GdipCreateBitmapFromHICON(Handle hicon, out Handle bitmap); -Status GdipCreateBitmapFromFileICM(wchar* fileName, out Handle bitmap); -Status GdipCreateBitmapFromFile(wchar* fileName, out Handle bitmap); +Status GdipCreateBitmapFromFileICM(LPCWSTR fileName, out Handle bitmap); +Status GdipCreateBitmapFromFile(LPCWSTR fileName, out Handle bitmap); // Status GdipCreateBitmapFromStreamICM(IStream stream, out Handle bitmap); // Status GdipCreateBitmapFromStream(IStream stream, out Handle bitmap); Status GdipCreateBitmapFromGraphics(int width, int height, Handle graphics, out Handle bitmap); @@ -556,21 +556,21 @@ Status GdipSetImageAttributesNoOp(Handle imageattr, ColorAdjustType type, int enableFlag); Status GdipSetImageAttributesColorKeys(Handle imageattr, ColorAdjustType type, int enableFlag, int colorLow, int colorHigh); Status GdipSetImageAttributesOutputChannel(Handle imageattr, ColorAdjustType type, int enableFlag, ColorChannelFlag flags); -Status GdipSetImageAttributesOutputChannelColorProfile(Handle imageattr, ColorAdjustType type, int enableFlag, wchar* colorProfileFilename); +Status GdipSetImageAttributesOutputChannelColorProfile(Handle imageattr, ColorAdjustType type, int enableFlag, LPCWSTR colorProfileFilename); Status GdipSetImageAttributesWrapMode(Handle imageattr, WrapMode wrap, int argb, int clamp); Status GdipNewInstalledFontCollection(out Handle fontCollection); Status GdipNewPrivateFontCollection(out Handle fontCollection); Status GdipDeletePrivateFontCollection(Handle fontCollection); -Status GdipPrivateAddFontFile(Handle fontCollection, wchar* filename); +Status GdipPrivateAddFontFile(Handle fontCollection, LPCWSTR filename); Status GdipPrivateAddMemoryFont(Handle fontCollection, void* memory, int length); Status GdipGetFontCollectionFamilyCount(Handle fontCollection, out int numFound); Status GdipGetFontCollectionFamilyList(Handle fontCollection, int numSought, Handle* gpfamilies, out int numFound); -Status GdipCreateFontFamilyFromName(wchar* name, Handle fontCollection, out Handle FontFamily); +Status GdipCreateFontFamilyFromName(LPCWSTR name, Handle fontCollection, out Handle FontFamily); Status GdipDeleteFontFamily(Handle FontFamily); Status GdipCloneFontFamily(Handle FontFamily, out Handle clonedFontFamily); -Status GdipGetFamilyName(Handle family, wchar* name, int language); +Status GdipGetFamilyName(Handle family, LPCWSTR name, int language); Status GdipGetGenericFontFamilyMonospace(out Handle nativeFamily); Status GdipGetGenericFontFamilySerif(out Handle nativeFamily); Status GdipGetGenericFontFamilySansSerif(out Handle nativeFamily); @@ -653,8 +653,8 @@ Status GdipAddPathPolygon(Handle path, GpPointF* points, int count); Status GdipAddPathPolygonI(Handle path, GpPoint* points, int count); Status GdipAddPathPath(Handle path, Handle addingPath, int connect); -Status GdipAddPathString(Handle path, wchar* string, int length, Handle family, FontStyle style, float emSize, ref GpRectF layoutRect, Handle format); -Status GdipAddPathStringI(Handle path, wchar* string, int length, Handle family, FontStyle style, float emSize, ref GpRect layoutRect, Handle format); +Status GdipAddPathString(Handle path, LPCWSTR string, int length, Handle family, FontStyle style, float emSize, ref GpRectF layoutRect, Handle format); +Status GdipAddPathStringI(Handle path, LPCWSTR string, int length, Handle family, FontStyle style, float emSize, ref GpRect layoutRect, Handle format); Status GdipTransformPath(Handle path, Handle matrix); Status GdipGetPathWorldBounds(Handle path, out GpRectF bounds, Handle matrix, Handle pen); Status GdipFlattenPath(Handle path, Handle matrix, float flatness); @@ -828,11 +828,11 @@ Status function(Handle graphics, Handle brush, GpPointF* points, int count, FillMode fillMode, float tension) GdipFillClosedCurve2; Status function(Handle graphics, Handle brush, GpPoint* points, int count, FillMode fillMode, float tension) GdipFillClosedCurve2I; Status function(Handle graphics, Handle brush, Handle region) GdipFillRegion; -Status function(Handle graphics, wchar* string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, Handle brush) GdipDrawString; -Status function(Handle graphics, wchar* string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, ref GpRectF boundingBox, int* codepointsFitted, int* linesFitted) GdipMeasureString; +Status function(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, Handle brush) GdipDrawString; +Status function(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, ref GpRectF boundingBox, int* codepointsFitted, int* linesFitted) GdipMeasureString; Status function(Handle format, out int count) GdipGetStringFormatMeasurableCharacterRangeCount; Status function(Handle format, out Handle newFormat) GdipCloneStringFormat; -Status function(Handle graphics, wchar* string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, int regionCount, Handle* regions) GdipMeasureCharacterRanges; +Status function(Handle graphics, LPCWSTR string, int length, Handle font, ref GpRectF layoutRect, Handle stringFormat, int regionCount, Handle* regions) GdipMeasureCharacterRanges; Status function(Handle graphics, Handle image, float x, float y) GdipDrawImage; Status function(Handle graphics, Handle image, int x, int y) GdipDrawImageI; Status function(Handle graphics, Handle image, float x, float y, float width, float height) GdipDrawImageRect; @@ -995,8 +995,8 @@ Status function(Handle region, GpRectF* rects, out int count, Handle matrix) GdipGetRegionScans; Status function(Handle image) GdipDisposeImage; Status function(Handle image) GdipImageForceValidation; -Status function(wchar* filename, out Handle image) GdipLoadImageFromFileICM; -Status function(wchar* filename, out Handle image) GdipLoadImageFromFile; +Status function(LPCWSTR filename, out Handle image) GdipLoadImageFromFileICM; +Status function(LPCWSTR filename, out Handle image) GdipLoadImageFromFile; Status function(out int numEncoders, out int size) GdipGetImageEncodersSize; Status function(Handle image, out Handle cloneImage) GdipCloneImage; Status function(Handle image, out int type) GdipGetImageType; @@ -1025,8 +1025,8 @@ Status function(int width, int height, int stride, PixelFormat format, ubyte* scan0, out Handle bitmap) GdipCreateBitmapFromScan0; Status function(Handle hbitmap, Handle hpalette, out Handle bitmap) GdipCreateBitmapFromHBITMAP; Status function(Handle hicon, out Handle bitmap) GdipCreateBitmapFromHICON; -Status function(wchar* fileName, out Handle bitmap) GdipCreateBitmapFromFileICM; -Status function(wchar* fileName, out Handle bitmap) GdipCreateBitmapFromFile; +Status function(LPCWSTR fileName, out Handle bitmap) GdipCreateBitmapFromFileICM; +Status function(LPCWSTR fileName, out Handle bitmap) GdipCreateBitmapFromFile; Status function(int width, int height, Handle graphics, out Handle bitmap) GdipCreateBitmapFromGraphics; Status function(float x, float y, float width, float height, PixelFormat format, Handle srcbitmap, out Handle dstbitmap) GdipCloneBitmapArea; Status function(int x, int y, int width, int height, PixelFormat format, Handle srcbitmap, out Handle dstbitmap) GdipCloneBitmapAreaI; @@ -1045,19 +1045,19 @@ Status function(Handle imageattr, ColorAdjustType type, int enableFlag) GdipSetImageAttributesNoOp; Status function(Handle imageattr, ColorAdjustType type, int enableFlag, int colorLow, int colorHigh) GdipSetImageAttributesColorKeys; Status function(Handle imageattr, ColorAdjustType type, int enableFlag, ColorChannelFlag flags) GdipSetImageAttributesOutputChannel; -Status function(Handle imageattr, ColorAdjustType type, int enableFlag, wchar* colorProfileFilename) GdipSetImageAttributesOutputChannelColorProfile; +Status function(Handle imageattr, ColorAdjustType type, int enableFlag, LPCWSTR colorProfileFilename) GdipSetImageAttributesOutputChannelColorProfile; Status function(Handle imageattr, WrapMode wrap, int argb, int clamp) GdipSetImageAttributesWrapMode; Status function(out Handle fontCollection) GdipNewInstalledFontCollection; Status function(out Handle fontCollection) GdipNewPrivateFontCollection; Status function(Handle fontCollection) GdipDeletePrivateFontCollection; -Status function(Handle fontCollection, wchar* filename) GdipPrivateAddFontFile; +Status function(Handle fontCollection, LPCWSTR filename) GdipPrivateAddFontFile; Status function(Handle fontCollection, void* memory, int length) GdipPrivateAddMemoryFont; Status function(Handle fontCollection, out int numFound) GdipGetFontCollectionFamilyCount; Status function(Handle fontCollection, int numSought, Handle* gpfamilies, out int numFound) GdipGetFontCollectionFamilyList; -Status function(wchar* name, Handle fontCollection, out Handle FontFamily) GdipCreateFontFamilyFromName; +Status function(LPCWSTR name, Handle fontCollection, out Handle FontFamily) GdipCreateFontFamilyFromName; Status function(Handle FontFamily) GdipDeleteFontFamily; Status function(Handle FontFamily, out Handle clonedFontFamily) GdipCloneFontFamily; -Status function(Handle family, wchar* name, int language) GdipGetFamilyName; +Status function(Handle family, LPCWSTR name, int language) GdipGetFamilyName; Status function(out Handle nativeFamily) GdipGetGenericFontFamilyMonospace; Status function(out Handle nativeFamily) GdipGetGenericFontFamilySerif; Status function(out Handle nativeFamily) GdipGetGenericFontFamilySansSerif; @@ -1135,8 +1135,8 @@ Status function(Handle path, GpPointF* points, int count) GdipAddPathPolygon; Status function(Handle path, GpPoint* points, int count) GdipAddPathPolygonI; Status function(Handle path, Handle addingPath, int connect) GdipAddPathPath; -Status function(Handle path, wchar* string, int length, Handle family, FontStyle style, float emSize, ref GpRectF layoutRect, Handle format) GdipAddPathString; -Status function(Handle path, wchar* string, int length, Handle family, FontStyle style, float emSize, ref GpRect layoutRect, Handle format) GdipAddPathStringI; +Status function(Handle path, LPCWSTR string, int length, Handle family, FontStyle style, float emSize, ref GpRectF layoutRect, Handle format) GdipAddPathString; +Status function(Handle path, LPCWSTR string, int length, Handle family, FontStyle style, float emSize, ref GpRect layoutRect, Handle format) GdipAddPathStringI; Status function(Handle path, Handle matrix) GdipTransformPath; Status function(Handle path, out GpRectF bounds, Handle matrix, Handle pen) GdipGetPathWorldBounds; Status function(Handle path, Handle matrix, float flatness) GdipFlattenPath; @@ -1681,15 +1681,19 @@ void loadLib_Gdip(){ - if (auto lib = tango.sys.SharedLib.SharedLib.load(`gdiplus.dll`)) { - foreach( inout s; symbols ){ - *s.symbol = lib.getSymbol( s.name.ptr ); - if( s.symbol is null ){ - getDwtLogger.error( __FILE__, __LINE__, "gdiplus.dll: Symbol '{}' not found", s.name ); + version(Tango){ + if (auto lib = tango.sys.SharedLib.SharedLib.load(`gdiplus.dll`)) { + foreach( inout s; symbols ){ + *s.symbol = lib.getSymbol( s.name.ptr ); + if( s.symbol is null ){ + getDwtLogger.error( __FILE__, __LINE__, "gdiplus.dll: Symbol '{}' not found", s.name ); + } } + } else { + getDwtLogger.error( __FILE__, __LINE__, "Could not load the library gdiplus.dll"); } - } else { - getDwtLogger.error( __FILE__, __LINE__, "Could not load the library gdiplus.dll"); + } else { // Phobos + implMissing( __FILE__, __LINE__ ); } } diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/GIFFileFormat.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/GIFFileFormat.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/GIFFileFormat.d Wed Mar 25 13:20:43 2009 +0100 @@ -493,7 +493,7 @@ try { /* Step 3: Write the GIF89a Header and Logical Screen Descriptor. */ - outputStream.write(GIF89a); + outputStream.write(cast(byte[])GIF89a); int bitField = globalTable*128 + (depth-1)*16 + depth-1; outputStream.writeShort(cast(short)logicalScreenWidth); outputStream.writeShort(cast(short)logicalScreenHeight); @@ -516,7 +516,7 @@ outputStream.write(GIF_EXTENSION_BLOCK_ID); outputStream.write(GIF_APPLICATION_EXTENSION_BLOCK_ID); outputStream.write(NETSCAPE2_0.length); - outputStream.write(NETSCAPE2_0); + outputStream.write(cast(byte[])NETSCAPE2_0); outputStream.write(3); // Three bytes follow outputStream.write(1); // Extension type outputStream.writeShort(cast(short) repeatCount); diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngChunk.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngChunk.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngChunk.d Wed Mar 25 13:20:43 2009 +0100 @@ -44,13 +44,13 @@ // Non-critical chunks. static const int CHUNK_tRNS = 5; - static const byte[] TYPE_IHDR = cast(byte[])"IHDR";//{(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'}; - static const byte[] TYPE_PLTE = cast(byte[])"PLTE";//{(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'}; - static const byte[] TYPE_IDAT = cast(byte[])"IDAT";//{(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'}; - static const byte[] TYPE_IEND = cast(byte[])"IEND";//{(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'}; - static const byte[] TYPE_tRNS = cast(byte[])"tRNS";//{(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'}; + static /*const*/ byte[] TYPE_IHDR = cast(byte[])"IHDR";//{(byte) 'I', (byte) 'H', (byte) 'D', (byte) 'R'}; + static /*const*/ byte[] TYPE_PLTE = cast(byte[])"PLTE";//{(byte) 'P', (byte) 'L', (byte) 'T', (byte) 'E'}; + static /*const*/ byte[] TYPE_IDAT = cast(byte[])"IDAT";//{(byte) 'I', (byte) 'D', (byte) 'A', (byte) 'T'}; + static /*const*/ byte[] TYPE_IEND = cast(byte[])"IEND";//{(byte) 'I', (byte) 'E', (byte) 'N', (byte) 'D'}; + static /*const*/ byte[] TYPE_tRNS = cast(byte[])"tRNS";//{(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'}; - static const int[] CRC_TABLE; + static int[] CRC_TABLE; //public static void static_this() { static this() { CRC_TABLE = new int[256]; diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngDeflater.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngDeflater.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/image/PngDeflater.d Wed Mar 25 13:20:43 2009 +0100 @@ -120,8 +120,8 @@ } -static const Code lengthCodes[]; -static const Code distanceCodes[]; +static /*const*/ Code lengthCodes[]; +static /*const*/ Code distanceCodes[]; static this() { lengthCodes = [ diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/mozilla/nsEmbedString.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/mozilla/nsEmbedString.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/mozilla/nsEmbedString.d Wed Mar 25 13:20:43 2009 +0100 @@ -78,7 +78,7 @@ char* buffer = null; PRBool terminated; uint len = NS_CStringGetData(cast(nsACString*)&str, &buffer, &terminated); - return buffer[0 .. len].dup; + return buffer[0 .. len]._idup(); } ~this() diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/mozilla/nsStringAPI.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/mozilla/nsStringAPI.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/mozilla/nsStringAPI.d Wed Mar 25 13:20:43 2009 +0100 @@ -82,15 +82,15 @@ return result; } - static wchar[] toString16( nsAString* str ) + static String16 toString16( nsAString* str ) { wchar* buffer = null; PRBool terminated; uint len = NS_StringGetData(str, &buffer, &terminated); - return buffer[0 .. len].dup; + return buffer[0 .. len]._idup(); } - static char[] toString( nsAString* str ) + static String toString( nsAString* str ) { return String_valueOf( nsAString.toString16( str ) ); } diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMAPI.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMAPI.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/COMAPI.d Wed Mar 25 13:20:43 2009 +0100 @@ -32,7 +32,7 @@ LPCLSID pclsid ); HRESULT CLSIDFromString( - LPOLESTR lpsz, + LPCOLESTR lpsz, LPCLSID pclsid ); STDAPI CoCreateInstance( @@ -215,18 +215,18 @@ DWORD *pdwEffect ); HRESULT StgCreateDocfile( - WCHAR* pwcsName, + LPCWSTR pwcsName, DWORD grfMode, DWORD reserved, LPSTORAGE* ppstgOpen ); WINOLEAPI StgIsStorageFile( - WCHAR* pwcsName + LPCWSTR pwcsName ); HRESULT StgOpenStorage( - WCHAR* pwcsName, + LPCWSTR pwcsName, LPSTORAGE pstgPriority, DWORD grfMode, SNB snbExclude, diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OAIDL.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OAIDL.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/OAIDL.d Wed Mar 25 13:20:43 2009 +0100 @@ -859,7 +859,7 @@ { HRESULT GetTypeInfoCount(UINT * pctinfo); HRESULT GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo * ppTInfo); -HRESULT GetIDsOfNames(REFIID riid, LPOLESTR * rgszNames, UINT cNames, LCID lcid, DISPID * rgDispId); +HRESULT GetIDsOfNames(REFIID riid, LPCOLESTR * rgszNames, UINT cNames, LCID lcid, DISPID * rgDispId); HRESULT Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS* pDispParams,VARIANT* pVarResult,EXCEPINFO* pExcepInfo,UINT* puArgErr); } alias IDispatch LPDISPATCH; diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/extras.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/extras.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/ole/win32/extras.d Wed Mar 25 13:20:43 2009 +0100 @@ -49,8 +49,7 @@ } version(Tango){ - static assert(0); - alias GUID IID; + //alias GUID IID; } alias GUID CLSID; diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/OS.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/OS.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/OS.d Wed Mar 25 13:20:43 2009 +0100 @@ -3622,6 +3622,7 @@ return tango.stdc.string.strlen( cast(char*)ptr ); } else { // Phobos implMissing( __FILE__, __LINE__ ); + return 0; } } @@ -3643,7 +3644,7 @@ { CHAR[] result; int i; - wchar[] ws = toWCharArray(sc); + auto ws = toWCharArray(sc); result.length = OS.WideCharToMultiByte(codepage, 0, ws.ptr, ws.length, null, 0, null, null); i = OS.WideCharToMultiByte(codepage, 0, ws.ptr, ws.length, result.ptr, result.length, null, null); assert(i == result.length); @@ -3660,22 +3661,22 @@ // convert UTF-8 to MBCSz public char* StrToMBCSz(CString sc) { char* ret = null; - try{ - if( CodePage.isAscii( sc )){ - return .toStringz( sc ); - } - char[] dst; - dst.length = sc.length; - version(Tango){ + version(Tango){ + try{ + if( CodePage.isAscii( sc )){ + return .toStringz( sc ); + } + char[] dst; + dst.length = sc.length; return toStringz( tango.sys.win32.CodePage.CodePage.into( sc, dst )); - } else { // Phobos - implMissing( __FILE__, __LINE__ ); + }catch(Exception e){ + // do nothing + ret = ""; } - }catch(Exception e){ - // do nothing - ret = ""; + + } else { // Phobos + implMissing( __FILE__, __LINE__ ); } - return ret; } @@ -3683,7 +3684,7 @@ return StrToWCHARs( sc, terminated ); } public String16 StrToWCHARs(CString sc, bool terminated = false ) { - wchar[] ret; + String16 ret; try{ ret = toWCharArray(sc); }catch(Exception e){ @@ -3696,11 +3697,11 @@ return ret; } -public wchar* StrToWCHARz( uint codepage, CString sc, uint* length = null ) { +public LPCWSTR StrToWCHARz( uint codepage, CString sc, uint* length = null ) { return StrToWCHARz( sc, length ); } -public wchar* StrToWCHARz(CString sc, uint* length = null ) { +public LPCWSTR StrToWCHARz(CString sc, uint* length = null ) { return StrToWCHARs(sc, true ).ptr; } @@ -3719,8 +3720,8 @@ if(_length == 0) return null; - wchar[] wcs = _mbcszToWs(pString, _length, codepage); - char[] result; + String16 wcs = _mbcszToWs(pString, _length, codepage); + String result; try{ result = String_valueOf(wcs); }catch(Exception e){ @@ -3746,9 +3747,9 @@ if(_length == 0) return null; // convert wchar* to UTF-8 - wchar[] wcs = pString[0.._length]; + auto wcs = pString[0.._length]; - char[] result; + String result; try{ result = String_valueOf(wcs); }catch(Exception e){ @@ -3782,14 +3783,14 @@ } // end of OLE_COM -public static wchar[] _mbcszToWs(PCHAR pMBCS, int len, uint codepage = 0) +public static String16 _mbcszToWs(PCHAR pMBCS, int len, uint codepage = 0) { wchar[] wbuf; // Convert MBCS to unicode wbuf.length = OS.MultiByteToWideChar(codepage, 0, pMBCS, len, null, 0); int n = OS.MultiByteToWideChar(codepage, 0, pMBCS, len, wbuf.ptr, wbuf.length); assert(n == wbuf.length); - return wbuf; + return cast(String16)wbuf; } // static methods @@ -3810,14 +3811,14 @@ The length of a is 11, but the length of b,c is 18 now. * */ -public char[] tolower(char[] string) { - TCHAR* ps = StrToTCHARz(string); - TCHAR* ps2 = OS.CharLower(ps); +public String tolower(char[] string) { + LPCTSTR ps = StrToTCHARz(string); + LPCTSTR ps2 = OS.CharLower(cast(LPTSTR)ps); return TCHARzToStr(ps2); } -public char[] toupper(char[] string) { - TCHAR* ps = StrToTCHARz(string); - TCHAR* ps2 = OS.CharUpper(ps); +public String toupper(char[] string) { + LPCTSTR ps = StrToTCHARz(string); + LPCTSTR ps2 = OS.CharUpper(cast(LPTSTR)ps); return TCHARzToStr(ps2); } diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINAPI.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINAPI.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINAPI.d Wed Mar 25 13:20:43 2009 +0100 @@ -1777,8 +1777,8 @@ extern (Windows){ HRESULT AssocQueryStringA(ASSOCF flags, int str, LPCSTR pszAssoc, LPCSTR pszExtra, LPSTR pszOut, DWORD *pcchOut); HRESULT AssocQueryStringW(ASSOCF flags, int str, LPCWSTR pszAssoc, LPCWSTR pszExtra, LPWSTR pszOut, DWORD *pcchOut); -int AddFontResourceExA(char* lpszFilename, int fl, void* pdv); -int AddFontResourceExW(wchar* lpszFilename, int fl, void* pdv); +int AddFontResourceExA(LPCSTR lpszFilename, int fl, void* pdv); +int AddFontResourceExW(LPCWSTR lpszFilename, int fl, void* pdv); BOOL AlphaBlend( HDC hdcDest, // handle to destination DC @@ -3417,7 +3417,7 @@ // USP methods (Unicode Complex Script processor) HRESULT ScriptBreak( - WCHAR *pwcChars, + LPCWSTR pwcChars, int cChars, SCRIPT_ANALYSIS *psa, SCRIPT_LOGATTR *psla @@ -3462,14 +3462,14 @@ HRESULT ScriptGetCMap( HDC hdc, SCRIPT_CACHE* psc, - WCHAR* pwcInChars, + LPCWSTR pwcInChars, int cChars, DWORD dwFlags, WORD* pwOutGlyphs ); HRESULT ScriptStringAnalyse( HDC hdc, - void* pString, + LPCVOID pString, int cString, int cGlyphs, int iCharset, @@ -3497,7 +3497,7 @@ ); HRESULT ScriptItemize( - WCHAR *pwcInChars, + LPCWSTR pwcInChars, int cInChars, int cMaxItems, SCRIPT_CONTROL *psControl, @@ -3525,7 +3525,7 @@ HRESULT ScriptShape( HDC hdc, // in SCRIPT_CACHE *psc, // in/out - WCHAR *pwcChars, // + LPCWSTR pwcChars, // int cChars, int cMaxGlyphs, SCRIPT_ANALYSIS *psa, diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINTYPES.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINTYPES.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/win32/WINTYPES.d Wed Mar 25 13:20:43 2009 +0100 @@ -16,6 +16,12 @@ //alias TLOGFONTA LOGFONTA; //alias char CHAR; version(Tango){ + version(Win32SansUnicode){ + alias String StringT; + }else{ + alias String16 StringT; + } + alias wchar CWCHAR; } else { // Phobos /* Module: Windows Types diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OleAutomation.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OleAutomation.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/ole/win32/OleAutomation.d Wed Mar 25 13:20:43 2009 +0100 @@ -353,7 +353,7 @@ public int[] getIDsOfNames(String[] names) { int count = names.length; - wchar*[] wcNames = new wchar*[count]; + LPCWSTR[] wcNames = new LPCWSTR[count]; for(int i=0; i 0) { commaIndex = 0; while (buf[commaIndex] !is ',' && commaIndex < length) commaIndex++; if (commaIndex < length) { - driver = buf[0 .. commaIndex].idup; + driver = buf[0 .. commaIndex]._idup(); } } return new PrinterData(driver, deviceName); diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Button.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Button.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Button.d Wed Mar 25 13:20:43 2009 +0100 @@ -326,7 +326,7 @@ text = OS.IsWindowEnabled (handle) ? text : " " ~ text ~ " "; } } - TCHAR* buffer = StrToTCHARz ( text ); + LPCTSTR buffer = StrToTCHARz ( text ); OS.SetWindowText (handle, buffer); } @@ -405,7 +405,7 @@ auto hDC = OS.GetDC (handle); HFONT newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont); - TCHAR* buffer = StrToTCHARz( getCodePage (), text); + LPCTSTR buffer = StrToTCHARz( getCodePage (), text); RECT rect; int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE; OS.DrawText (hDC, buffer, -1, &rect, flags); @@ -481,7 +481,7 @@ height = Math.max (height, lptm.tmHeight); } else { extra = Math.max (MARGIN * 2, lptm.tmAveCharWidth); - TCHAR* buffer = StrToTCHARz( getCodePage (), text); + LPCTSTR buffer = StrToTCHARz( getCodePage (), text); RECT rect; int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE; OS.DrawText (hDC, buffer, -1, &rect, flags); @@ -596,7 +596,7 @@ bool hasImage = (bits & (OS.BS_BITMAP | OS.BS_ICON)) !is 0; if (!hasImage) { String string = enabled ? text : " " ~ text ~ " "; - TCHAR* buffer = StrToTCHARz (getCodePage (), string); + LPCTSTR buffer = StrToTCHARz (getCodePage (), string); OS.SetWindowText (handle, buffer); } } @@ -1038,7 +1038,7 @@ this.message = message; if (OS.COMCTL32_VERSION >= OS.VERSION (6, 1)) { if ((style & SWT.COMMAND) !is 0) { - OS.SendMessage (handle, OS.BCM_SETNOTE, 0, StrToTCHARz( message )); + OS.SendMessage (handle, OS.BCM_SETNOTE, 0, cast(void*)StrToTCHARz( message )); } } } diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Combo.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Combo.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Combo.d Wed Mar 25 13:20:43 2009 +0100 @@ -1028,9 +1028,9 @@ int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0); if (!(0 <= start && start < count)) return -1; int index = start - 1, last = 0; - TCHAR* buffer = StrToTCHARz( string ); + LPCTSTR buffer = StrToTCHARz( string ); do { - index = OS.SendMessage (handle, OS.CB_FINDSTRINGEXACT, last = index, buffer); + index = OS.SendMessage (handle, OS.CB_FINDSTRINGEXACT, last = index, cast(void*)buffer); if (index is OS.CB_ERR || index <= last) return -1; } while (string!=/*eq*/getItem (index)); return index; @@ -1409,9 +1409,9 @@ String newText = verifyText (oldText, start, end, event); if (newText is null) return false; if (newText is oldText) return true; - TCHAR* buffer = StrToTCHARz( newText ); + LPCTSTR buffer = StrToTCHARz( newText ); OS.SendMessage (hwndText, OS.EM_SETSEL, start, end); - OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer); + OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, cast(void*)buffer); return false; } @@ -1578,8 +1578,8 @@ int codePage = getCodePage (); for (int i=0; i limit) string = string.substring (0, limit); - TCHAR* buffer = StrToTCHARz( string ); + LPCTSTR buffer = StrToTCHARz( string ); if (OS.SetWindowText (handle, buffer)) { sendEvent (SWT.Modify); // widget could be disposed at this point @@ -2398,8 +2398,8 @@ OS.HeapFree (hHeap, 0, pszText); return new LRESULT (code); } else { - TCHAR* buffer = StrToTCHARz( newText ); - OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer); + LPCTSTR buffer = StrToTCHARz( newText ); + OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, cast(void*)buffer); return LRESULT.ZERO; } } diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Display.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Display.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Display.d Wed Mar 25 13:20:43 2009 +0100 @@ -1817,7 +1817,7 @@ } /* Use the character encoding for the default locale */ - TCHAR* buffer1 = StrToTCHARz( "Control Panel\\Desktop\\WindowMetrics" ); //$NON-NLS-1$ + LPCTSTR buffer1 = StrToTCHARz( "Control Panel\\Desktop\\WindowMetrics" ); //$NON-NLS-1$ void* phkResult; int result = OS.RegOpenKeyEx ( cast(void*)OS.HKEY_CURRENT_USER, buffer1, 0, OS.KEY_READ, &phkResult); @@ -1826,7 +1826,7 @@ uint lpcbData; /* Use the character encoding for the default locale */ - TCHAR* buffer2 = StrToTCHARz( "Shell Icon BPP" ); //$NON-NLS-1$ + LPCTSTR buffer2 = StrToTCHARz( "Shell Icon BPP" ); //$NON-NLS-1$ result = OS.RegQueryValueEx (phkResult , buffer2, null, null, null, &lpcbData); if (result is 0) { ubyte[] lpData = new ubyte[ lpcbData / TCHAR.sizeof ]; @@ -2700,11 +2700,11 @@ * NOTE: X-Mouse is active when bit 1 of the UserPreferencesMask is set. */ bool xMouseActive = false; - TCHAR* key = StrToTCHARz( "Control Panel\\Desktop" ); //$NON-NLS-1$ + LPCTSTR key = StrToTCHARz( "Control Panel\\Desktop" ); //$NON-NLS-1$ void* phKey; int result = OS.RegOpenKeyEx (cast(void*)OS.HKEY_CURRENT_USER, key, 0, OS.KEY_READ, &phKey); if (result is 0) { - TCHAR* lpValueName = StrToTCHARz ( "UserPreferencesMask" ); //$NON-NLS-1$ + LPCTSTR lpValueName = StrToTCHARz ( "UserPreferencesMask" ); //$NON-NLS-1$ uint[4] lpcbData; uint lpData; result = OS.RegQueryValueEx (phKey, lpValueName, null, null, cast(ubyte*)&lpData, lpcbData.ptr); diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Group.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Group.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Group.d Wed Mar 25 13:20:43 2009 +0100 @@ -202,7 +202,7 @@ * If the group has text, and the text is wider than the * client area, pad the width so the text is not clipped. */ - TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string); + LPCTSTR buffer = StrToTCHARz (/+getCodePage (),+/ string); HFONT newFont, oldFont; auto hDC = OS.GetDC (handle); newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); @@ -264,7 +264,7 @@ if ((style & SWT.RIGHT_TO_LEFT) !is 0) { if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) { String string = enabled || text.length is 0 ? text : " " ~ text ~ " "; - TCHAR* buffer = StrToTCHARz (/+getCodePage (),+/ string); + LPCTSTR buffer = StrToTCHARz (/+getCodePage (),+/ string); OS.SetWindowText (handle, buffer); } } @@ -404,7 +404,7 @@ } } } - TCHAR* buffer = StrToTCHARz(/+getCodePage (),+/ string); + LPCTSTR buffer = StrToTCHARz(/+getCodePage (),+/ string); OS.SetWindowText (handle, buffer); } diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Label.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Label.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Label.d Wed Mar 25 13:20:43 2009 +0100 @@ -427,7 +427,7 @@ if (oldBits !is newBits) OS.SetWindowLong (handle, OS.GWL_STYLE, newBits); } string = Display.withCrLf (string); - TCHAR* buffer = StrToTCHARz ( getCodePage (), string); + LPCTSTR buffer = StrToTCHARz ( getCodePage (), string); OS.SetWindowText (handle, buffer); /* * Bug in Windows. For some reason, the HBRUSH that @@ -662,7 +662,7 @@ imageHeight = rect.height; } RECT rect; - TCHAR* buffer = null; + LPCTSTR buffer = null; int textWidth = 0, textHeight = 0, flags = 0; if (drawText) { //rect = new RECT (); diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Link.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Link.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Link.d Wed Mar 25 13:20:43 2009 +0100 @@ -524,7 +524,7 @@ parseMnemonics (buffer, linkStart, endtagStart, result); offsets [linkIndex] = new Point (offset, result.length - 1); if (ids [linkIndex] is null) { - ids [linkIndex] = buffer[ linkStart .. endtagStart ].idup; + ids [linkIndex] = buffer[ linkStart .. endtagStart ]._idup(); } linkIndex++; start = tagStart = linkStart = endtagStart = refStart = index + 1; @@ -555,7 +555,7 @@ break; case 12: if (c is '"') { - ids[linkIndex] = buffer[ refStart .. index ].idup; + ids[linkIndex] = buffer[ refStart .. index ]._idup(); state = 2; } break; @@ -691,7 +691,7 @@ * text to a space instead. */ if (string.length is 0) string = " "; //$NON-NLS-1$ - TCHAR* buffer = StrToTCHARz (getCodePage (), string); + LPCTSTR buffer = StrToTCHARz (getCodePage (), string); OS.SetWindowText (handle, buffer); parse (text); enableWidget (enabled); diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/List.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/List.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/List.d Wed Mar 25 13:20:43 2009 +0100 @@ -123,8 +123,8 @@ checkWidget (); // SWT extension: allow null string //if (string is null) error (SWT.ERROR_NULL_ARGUMENT); - TCHAR* buffer = StrToTCHARz ( getCodePage (), string); - int result = OS.SendMessage (handle, OS.LB_ADDSTRING, 0, buffer); + LPCTSTR buffer = StrToTCHARz ( getCodePage (), string); + int result = OS.SendMessage (handle, OS.LB_ADDSTRING, 0, cast(void*)buffer); if (result is OS.LB_ERR) error (SWT.ERROR_ITEM_NOT_ADDED); if (result is OS.LB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED); if ((style & SWT.H_SCROLL) !is 0) setScrollWidth (buffer, true); @@ -156,8 +156,8 @@ // SWT extension: allow null string //if (string is null) error (SWT.ERROR_NULL_ARGUMENT); if (index is -1) error (SWT.ERROR_INVALID_RANGE); - TCHAR* buffer = StrToTCHARz(getCodePage (), string); - int result = OS.SendMessage (handle, OS.LB_INSERTSTRING, index, buffer); + LPCTSTR buffer = StrToTCHARz(getCodePage (), string); + int result = OS.SendMessage (handle, OS.LB_INSERTSTRING, index, cast(void*)buffer); if (result is OS.LB_ERRSPACE) error (SWT.ERROR_ITEM_NOT_ADDED); if (result is OS.LB_ERR) { int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0); @@ -704,9 +704,9 @@ int count = OS.SendMessage (handle, OS.LB_GETCOUNT, 0, 0); if (!(0 <= start && start < count)) return -1; int index = start - 1, last; - TCHAR* buffer = StrToTCHARz (getCodePage (), string ); + LPCTSTR buffer = StrToTCHARz (getCodePage (), string ); do { - index = OS.SendMessage (handle, OS.LB_FINDSTRINGEXACT, last = index, buffer); + index = OS.SendMessage (handle, OS.LB_FINDSTRINGEXACT, last = index, cast(void*)buffer); if (index is OS.LB_ERR || index <= last) return -1; } while (string !=/*eq*/ getItem (index)); return index; @@ -1243,8 +1243,8 @@ int cp = getCodePage (); while (index < length) { String string = items [index]; - TCHAR* buffer = StrToTCHARz (cp, string); - int result = OS.SendMessage (handle, OS.LB_ADDSTRING, 0, buffer); + LPCTSTR buffer = StrToTCHARz (cp, string); + int result = OS.SendMessage (handle, OS.LB_ADDSTRING, 0, cast(void*)buffer); if (result is OS.LB_ERR || result is OS.LB_ERRSPACE) break; if ((style & SWT.H_SCROLL) !is 0) { int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX; @@ -1301,7 +1301,7 @@ OS.SendMessage (handle, OS.LB_SETHORIZONTALEXTENT, newWidth + INSET, 0); } -void setScrollWidth (TCHAR* buffer, bool grow) { +void setScrollWidth (LPCTSTR buffer, bool grow) { RECT rect; HFONT newFont, oldFont; auto hDC = OS.GetDC (handle); diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/MenuItem.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/MenuItem.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/MenuItem.d Wed Mar 25 13:20:43 2009 +0100 @@ -1066,7 +1066,7 @@ for (i=0; i= 6 && OS.IsAppThemed ()) headerWidth += Table.HEADER_EXTRA; bool hasHeaderImage = false; if (image !is null || parent.sortColumn is this) { diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TableItem.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TableItem.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/TableItem.d Wed Mar 25 13:20:43 2009 +0100 @@ -276,8 +276,8 @@ int width = 0; auto hFont = fontHandle (column); if (hFont is cast(HFONT)-1 && hDC is null) { - TCHAR* buffer = StrToTCHARz (parent.getCodePage (), text); - width = OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer); + LPCTSTR buffer = StrToTCHARz (parent.getCodePage (), text); + width = OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, cast(void*)buffer); } else { StringT buffer = StrToTCHARs (parent.getCodePage (), text, false); auto textDC = hDC !is null ? hDC : OS.GetDC (hwnd), oldFont = cast(HFONT)-1; @@ -1187,7 +1187,7 @@ checkWidget(); if (index is 0) { if (string.equals(text)) return; - super.setText (string.idup); + super.setText (string._idup()); } int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count - 1) return; @@ -1197,7 +1197,7 @@ } if (strings !is null) { if (string==/*eq*/strings [index]) return; - strings [index] = string.idup; + strings [index] = string._idup(); } if ((parent.style & SWT.VIRTUAL) !is 0) cached = true; if (index is 0) { diff -r 2e09b0e6857a -r 0ecb2b338560 org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Text.d --- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Text.d Wed Mar 25 11:18:25 2009 +0100 +++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Text.d Wed Mar 25 13:20:43 2009 +0100 @@ -356,7 +356,7 @@ if (string is null) return; } OS.SendMessage (handle, OS.EM_SETSEL, length, length); - TCHAR* buffer = StrToTCHARz (getCodePage (), string); + LPCTSTR buffer = StrToTCHARz (getCodePage (), string); /* * Feature in Windows. When an edit control with ES_MULTILINE * style that does not have the WS_VSCROLL style is full (i.e. @@ -369,7 +369,7 @@ * handler from WM_CHAR. */ ignoreCharacter = true; - OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer); + OS.SendMessage (handle, OS.EM_REPLACESEL, 0, cast(void*)buffer); ignoreCharacter = false; OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0); } @@ -696,10 +696,10 @@ * handler from WM_CHAR. */ ignoreCharacter = ignoreModify = true; - OS.SendMessage (handle, OS.EM_REPLACESEL, 0, StrToTCHARz (cp, " ")); + OS.SendMessage (handle, OS.EM_REPLACESEL, 0, cast(void*)StrToTCHARz (cp, " ")); caretPos = OS.SendMessage (handle, OS.EM_POSFROMCHAR, position, 0); OS.SendMessage (handle, OS.EM_SETSEL, position, position + 1); - OS.SendMessage (handle, OS.EM_REPLACESEL, 0, StrToTCHARz (cp, "")); + OS.SendMessage (handle, OS.EM_REPLACESEL, 0, cast(void*)StrToTCHARz (cp, "")); ignoreCharacter = ignoreModify = false; OS.SendMessage (handle, OS.EM_SETSEL, start , start ); OS.SendMessage (handle, OS.EM_SETSEL, start , end ); @@ -1227,7 +1227,7 @@ string = verifyText (string, start, end, null); if (string is null) return; } - TCHAR* buffer = StrToTCHARz (getCodePage (), string ); + LPCTSTR buffer = StrToTCHARz (getCodePage (), string ); /* * Feature in Windows. When an edit control with ES_MULTILINE * style that does not have the WS_VSCROLL style is full (i.e. @@ -1240,7 +1240,7 @@ * handler from WM_CHAR. */ ignoreCharacter = true; - OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer); + OS.SendMessage (handle, OS.EM_REPLACESEL, 0, cast(void*)buffer); ignoreCharacter = false; } @@ -1489,7 +1489,7 @@ if (newText is null) return false; if (newText is oldText) return true; newText = Display.withCrLf (newText); - TCHAR* buffer = StrToTCHARz (getCodePage (), newText); + LPCTSTR buffer = StrToTCHARz (getCodePage (), newText); OS.SendMessage (handle, OS.EM_SETSEL, start, end); /* * Feature in Windows. When an edit control with ES_MULTILINE @@ -1503,7 +1503,7 @@ * handler from WM_CHAR. */ ignoreCharacter = true; - OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer); + OS.SendMessage (handle, OS.EM_REPLACESEL, 0, cast(void*)buffer); ignoreCharacter = false; return false; } @@ -1673,7 +1673,7 @@ if ((style & SWT.SEARCH) !is 0) { int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); if ((bits & OS.ES_MULTILINE) is 0) { - OS.SendMessage (handle, OS.EM_SETCUEBANNER, 0, StrToTCHARz( 0, message )); + OS.SendMessage (handle, OS.EM_SETCUEBANNER, 0, cast(void*)StrToTCHARz( 0, message )); } } } @@ -1892,7 +1892,7 @@ } int limit = OS.SendMessage (handle, OS.EM_GETLIMITTEXT, 0, 0) & 0x7FFFFFFF; if (string.length > limit) string = string.substring (0, limit); - TCHAR* buffer = StrToTCHARz (getCodePage (), string); + LPCTSTR buffer = StrToTCHARz (getCodePage (), string); OS.SetWindowText (handle, buffer); /* * Bug in Windows. When the widget is multi line @@ -2395,7 +2395,7 @@ callWindowProc (handle, msg, wParam, lParam); } newText = Display.withCrLf (newText); - TCHAR* buffer = StrToTCHARz(getCodePage (), newText); + LPCTSTR buffer = StrToTCHARz(getCodePage (), newText); /* * Feature in Windows. When an edit control with ES_MULTILINE * style that does not have the WS_VSCROLL style is full (i.e. @@ -2408,7 +2408,7 @@ * handler from WM_CHAR. */ ignoreCharacter = true; - OS.SendMessage (handle, OS.EM_REPLACESEL, 0, buffer); + OS.SendMessage (handle, OS.EM_REPLACESEL, 0, cast(void*)buffer); ignoreCharacter = false; return LRESULT.ZERO; }