Mercurial > projects > dwt-linux
changeset 255:5a30aa9820f3
removed tango.stdc.stringz imports and allow null for arrays and string arguments.
line wrap: on
line diff
--- a/dwt/accessibility/AccessibleFactory.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/accessibility/AccessibleFactory.d Sun Jun 15 22:32:20 2008 +0200 @@ -25,7 +25,6 @@ import dwt.DWT; -import tango.stdc.stringz; import tango.io.Stdout; class AccessibleFactory {
--- a/dwt/accessibility/AccessibleObject.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/accessibility/AccessibleObject.d Sun Jun 15 22:32:20 2008 +0200 @@ -26,7 +26,6 @@ import dwt.widgets.Display; import dwt.dwthelper.utils; import tango.io.Stdout; -import tango.stdc.stringz; import tango.text.Util; import Math = tango.math.Math;
--- a/dwt/custom/CCombo.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/custom/CCombo.d Sun Jun 15 22:32:20 2008 +0200 @@ -192,9 +192,6 @@ * * @param string the new item * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -204,7 +201,8 @@ */ public void add (String string) { checkWidget(); - if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); list.add (string); } /** @@ -220,7 +218,6 @@ * @param index the index for the item * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li> * </ul> * @exception DWTException <ul> @@ -232,7 +229,8 @@ */ public void add (String string, int index) { checkWidget(); - if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); list.add (string, index); } /** @@ -869,9 +867,6 @@ * @param string the search item * @return the index of the item * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -879,7 +874,8 @@ */ public int indexOf (String string) { checkWidget (); - if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); return list.indexOf (string); } /** @@ -893,9 +889,6 @@ * @param start the zero-relative index at which to begin the search * @return the index of the item * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -903,7 +896,8 @@ */ public int indexOf (String string, int start) { checkWidget (); - if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); return list.indexOf (string, start); } @@ -1237,7 +1231,6 @@ * @param string the item to remove * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li> * </ul> * @exception DWTException <ul> @@ -1247,7 +1240,8 @@ */ public void remove (String string) { checkWidget(); - if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); list.remove (string); } /** @@ -1421,7 +1415,6 @@ * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -1438,7 +1431,6 @@ * @param items the array of items * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the items array is null</li> * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li> * </ul> * @exception DWTException <ul> @@ -1530,9 +1522,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1540,7 +1529,8 @@ */ public void setText (String string) { checkWidget(); - if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); int index = list.indexOf (string); if (index is -1) { list.deselectAll ();
--- a/dwt/custom/CTabItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/custom/CTabItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -772,14 +772,14 @@ * Returns <code>true</code> to indicate that the receiver's close button should be shown. * Otherwise return <code>false</code>. The initial value is defined by the style (DWT.CLOSE) * that was used to create the receiver. - * + * * @return <code>true</code> if the close button should be shown * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public bool getShowClose() { @@ -1021,14 +1021,14 @@ * Sets to <code>true</code> to indicate that the receiver's close button should be shown. * If the parent (CTabFolder) was created with DWT.CLOSE style, changing this value has * no effect. - * + * * @param close the new state of the close button * * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * + * * @since 3.4 */ public void setShowClose(bool close) { @@ -1040,8 +1040,9 @@ } public override void setText (String string) { checkWidget(); - if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); - if (string==getText()) return; + // DWT extension: allow null for zero length string + //if (string is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + if (string.equals (getText())) return; super.setText(string); shortenedText = null; shortenedTextWidth = 0;
--- a/dwt/custom/PopupList.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/custom/PopupList.d Sun Jun 15 22:32:20 2008 +0200 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -263,7 +263,6 @@ * or could not be added in the OS. * * @exception IllegalArgumentException <ul> -* <li>ERROR_NULL_ARGUMENT - if the items array is null</li> * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li> * </ul> * @exception DWTException <ul>
--- a/dwt/custom/StyledText.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/custom/StyledText.d Sun Jun 15 22:32:20 2008 +0200 @@ -1598,15 +1598,13 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT when listener is null</li> - * </ul> */ public void append(String string) { checkWidget(); - if (string is null) { - DWT.error(DWT.ERROR_NULL_ARGUMENT); - } + // DWT extension: allow null for zero length string +// if (string is null) { +// DWT.error(DWT.ERROR_NULL_ARGUMENT); +// } int lastChar = Math.max(getCharCount(), 0); replaceTextRange(lastChar, 0, string); } @@ -4934,15 +4932,13 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT when string is null</li> - * </ul> */ public void insert(String string) { checkWidget(); - if (string is null) { - DWT.error(DWT.ERROR_NULL_ARGUMENT); - } + // DWT extension: allow null for zero length string +// if (string is null) { +// DWT.error(DWT.ERROR_NULL_ARGUMENT); +// } Point sel = getSelectionRange(); replaceTextRange(sel.x, sel.y, string); } @@ -6457,7 +6453,6 @@ * </ul> * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())</li> - * <li>ERROR_NULL_ARGUMENT when ranges is null</li> * </ul> * * @since 2.0 @@ -6467,7 +6462,8 @@ public void replaceStyleRanges(int start, int length, StyleRange[] ranges) { checkWidget(); if (isListening(LineGetStyle)) return; - if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); setStyleRanges(start, length, null, ranges, false); } /** @@ -6500,14 +6496,14 @@ * <li>ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())</li> * <li>ERROR_INVALID_ARGUMENT when either start or end is inside a multi byte line delimiter. * Splitting a line delimiter for example by inserting text in between the CR and LF and deleting part of a line delimiter is not supported</li> - * <li>ERROR_NULL_ARGUMENT when string is null</li> * </ul> */ public void replaceTextRange(int start, int length, String text) { checkWidget(); - if (text is null) { - DWT.error(DWT.ERROR_NULL_ARGUMENT); - } + // DWT extension: allow null for zero length string +// if (text is null) { +// DWT.error(DWT.ERROR_NULL_ARGUMENT); +// } int contentLength = getCharCount(); int end = start + length; if (start > end || start < 0 || end > contentLength) { @@ -8095,7 +8091,6 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT when the list of ranges is null</li> * <li>ERROR_INVALID_RANGE when the last of the style ranges is outside the valid range (> getCharCount())</li> * </ul> * @@ -8104,7 +8099,8 @@ public void setStyleRanges(StyleRange[] ranges) { checkWidget(); if (isListening(LineGetStyle)) return; - if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (ranges is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); setStyleRanges(0, 0, null, ranges, true); } /** @@ -8142,15 +8138,13 @@ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT when string is null</li> - * </ul> */ public void setText(String text) { checkWidget(); - if (text is null) { - DWT.error(DWT.ERROR_NULL_ARGUMENT); - } + // DWT extension: allow null for zero length string +// if (text is null) { +// DWT.error(DWT.ERROR_NULL_ARGUMENT); +// } Event event = new Event(); event.start = 0; event.end = getCharCount();
--- a/dwt/custom/TableTree.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/custom/TableTree.d Sun Jun 15 22:32:20 2008 +0200 @@ -764,7 +764,7 @@ * @param items the array of items * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li> + * <li>ERROR_NULL_ARGUMENT - if one of the items is null</li> * <li>ERROR_INVALID_ARGUMENT - if one of the item has been disposed</li> * </ul> * @exception DWTException <ul> @@ -776,7 +776,8 @@ */ public void setSelection (TableTreeItem[] items) { checkWidget (); - if (items is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (items is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); int length = items.length; if (length is 0 || ((table.getStyle() & DWT.SINGLE) !is 0 && length > 1)) { deselectAll();
--- a/dwt/custom/TableTreeItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/custom/TableTreeItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -819,9 +819,6 @@ * @param index the column number * @param text the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li> * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li> @@ -829,7 +826,8 @@ */ public void setText(int index, String text) { checkWidget(); - if (text is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (text is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); int columnCount = Math.max(parent.getTable().getColumnCount(), 1); if (index < 0 || index >= columnCount) return; if (texts.length < columnCount) {
--- a/dwt/dnd/Clipboard.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/dnd/Clipboard.d Sun Jun 15 22:32:20 2008 +0200 @@ -28,7 +28,6 @@ import dwt.dwthelper.utils; import tango.core.Thread; -static import tango.stdc.stringz; static import tango.stdc.string; /** @@ -563,7 +562,7 @@ if (pName is null) { continue; } - String buffer = tango.stdc.stringz.fromStringz( pName ).dup; + String buffer = fromStringz( pName ).dup; OS.g_free (pName); result[count++] = "GTKCLIPBOARD "~buffer; } @@ -572,7 +571,7 @@ if (pName is null) { continue; } - String buffer = tango.stdc.stringz.fromStringz( pName ).dup; + String buffer = fromStringz( pName ).dup; OS.g_free (pName); result[count++] = "GTKPRIMARYCLIPBOARD "~buffer; }
--- a/dwt/dnd/FileTransfer.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/dnd/FileTransfer.d Sun Jun 15 22:32:20 2008 +0200 @@ -89,7 +89,7 @@ auto uriPtr = OS.g_filename_to_uri(localePtr, null, &error); OS.g_free(localePtr); if (error !is null || uriPtr is null) continue; - String temp = tango.stdc.stringz.fromStringz( uriPtr ).dup; + String temp = fromStringz( uriPtr ).dup; OS.g_free(uriPtr); int newLength = (i > 0) ? buffer.length+separator.length+temp.length : temp.length; String newBuffer = new char[newLength]; @@ -162,7 +162,7 @@ auto utf8Ptr = OS.g_filename_to_utf8(localePtr, -1, null, null, &error); OS.g_free(localePtr); if (error !is null || utf8Ptr is null) continue; - String buffer = tango.stdc.stringz.fromStringz( utf8Ptr ).dup; + String buffer = fromStringz( utf8Ptr ).dup; OS.g_free(utf8Ptr); String name = buffer; String[] newFileNames = new String[]( fileNames.length + 1 );
--- a/dwt/dnd/TextTransfer.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/dnd/TextTransfer.d Sun Jun 15 22:32:20 2008 +0200 @@ -20,8 +20,6 @@ import dwt.dnd.DND; -static import tango.stdc.stringz; - /** * The class <code>TextTransfer</code> provides a platform specific mechanism * for converting plain text represented as a java <code>String</code> @@ -80,7 +78,7 @@ DND.error(DND.ERROR_INVALID_DATA); } String string = (cast(ArrayWrapperString)object).array; - char* utf8 = tango.stdc.stringz.toStringz(string); + char* utf8 = toStringz(string); if (transferData.type is cast(void*) COMPOUND_TEXT_ID) { void* encoding; int format; @@ -130,7 +128,7 @@ char** list; int count = OS.gdk_text_property_to_utf8_list(transferData.type, transferData.format, transferData.pValue, transferData.length, &list); if (count is 0) return null; - String utf8 = tango.stdc.stringz.fromStringz( list[0] ).dup; + String utf8 = fromStringz( list[0] ).dup; OS.g_strfreev(list); return new ArrayWrapperString( utf8 ); }
--- a/dwt/dnd/Transfer.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/dnd/Transfer.d Sun Jun 15 22:32:20 2008 +0200 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -19,7 +19,6 @@ import dwt.internal.gtk.OS; import dwt.dnd.TransferData; -static import tango.stdc.stringz; /** * <code>Transfer</code> provides a mechanism for converting between a java @@ -139,7 +138,7 @@ */ public static int registerType(String formatName){ if (formatName is null) return OS.GDK_NONE; - char* buffer = tango.stdc.stringz.toStringz( formatName ); + char* buffer = toStringz( formatName ); return cast(int)/*64*/OS.gdk_atom_intern(buffer, false); }
--- a/dwt/dnd/URLTransfer.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/dnd/URLTransfer.d Sun Jun 15 22:32:20 2008 +0200 @@ -96,7 +96,7 @@ if (!isSupportedType(transferData) || transferData.pValue is null) return null; int size = (transferData.format * transferData.length / 8); if (size <= 0) return null; - String string = tango.stdc.stringz.fromStringz(cast(char*)transferData.pValue).dup; + String string = fromStringz(cast(char*)transferData.pValue).dup; int end = string.indexOf('\0'); return new ArrayWrapperString((end is -1) ? string : string.substring(0, end)); }
--- a/dwt/dwthelper/utils.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/dwthelper/utils.d Sun Jun 15 22:32:20 2008 +0200 @@ -10,7 +10,7 @@ import tango.io.Stdout; import tango.io.Print; -import tango.stdc.stringz; +static import tango.stdc.stringz; static import tango.text.Util; static import tango.text.Text; import tango.text.Unicode; @@ -629,6 +629,11 @@ } } +public alias tango.stdc.stringz.toStringz toStringz; +public alias tango.stdc.stringz.toString16z toString16z; +public alias tango.stdc.stringz.fromStringz fromStringz; +public alias tango.stdc.stringz.fromString16z fromString16z; + static String toHex(uint value, bool prefix = true, int radix = 8){ return tango.text.convert.Integer.toString( value,
--- a/dwt/graphics/Device.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/graphics/Device.d Sun Jun 15 22:32:20 2008 +0200 @@ -28,7 +28,6 @@ import dwt.dwthelper.utils; import tango.core.Exception; -import tango.stdc.stringz; import tango.io.Stdout; /** @@ -590,7 +589,7 @@ if (debugging) { int flags = OS.G_LOG_LEVEL_MASK | OS.G_LOG_FLAG_FATAL | OS.G_LOG_FLAG_RECURSION; for (int i=0; i<log_domains.length; i++) { - handler_ids [i] = OS.g_log_set_handler (toStringz(log_domains [i]), flags, & logFunction, cast(void*)this); + handler_ids [i] = OS.g_log_set_handler (log_domains [i].toStringzValidPtr(), flags, & logFunction, cast(void*)this); } } } @@ -690,7 +689,7 @@ public bool loadFont (String path) { checkDevice(); if (path is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); - return cast(bool) OS.FcConfigAppFontAddFile (null, toStringz(path)); + return cast(bool) OS.FcConfigAppFontAddFile (null, path.toStringzValidPtr()); } private static extern(C) void logFunction (char* log_domain, int log_level, char* message, void* user_data) { @@ -791,7 +790,7 @@ if (xDisplay !is null) { for (int i=0; i<handler_ids.length; i++) { if (handler_ids [i] !is 0 ) { - OS.g_log_remove_handler (toStringz(log_domains [i]), handler_ids [i]); + OS.g_log_remove_handler (log_domains [i].toStringzValidPtr(), handler_ids [i]); handler_ids [i] = 0; } } @@ -820,7 +819,7 @@ if (debugging) return; for (int i=0; i<handler_ids.length; i++) { if (handler_ids [i] !is 0) { - OS.g_log_remove_handler (toStringz(log_domains [i]), handler_ids [i]); + OS.g_log_remove_handler (log_domains [i].toStringzValidPtr(), handler_ids [i]); handler_ids [i] = 0; } } @@ -830,7 +829,7 @@ if (debugging) return; int flags = OS.G_LOG_LEVEL_MASK | OS.G_LOG_FLAG_FATAL | OS.G_LOG_FLAG_RECURSION; for (int i=0; i<log_domains.length; i++) { - handler_ids [i] = OS.g_log_set_handler (toStringz(log_domains [i]), flags, & logFunction, cast(void*)this ); + handler_ids [i] = OS.g_log_set_handler (log_domains [i].toStringzValidPtr(), flags, & logFunction, cast(void*)this ); } } }
--- a/dwt/graphics/Font.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/graphics/Font.d Sun Jun 15 22:32:20 2008 +0200 @@ -23,7 +23,6 @@ import dwt.internal.gtk.OS; import tango.text.convert.Format; -import tango.stdc.stringz; /** * Instances of this class manage operating system resources that
--- a/dwt/graphics/GC.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/graphics/GC.d Sun Jun 15 22:32:20 2008 +0200 @@ -45,7 +45,6 @@ import tango.text.convert.Format; import tango.stdc.string; -import tango.stdc.stringz; /**
--- a/dwt/graphics/Image.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/graphics/Image.d Sun Jun 15 22:32:20 2008 +0200 @@ -33,7 +33,6 @@ import tango.text.convert.Format; import tango.stdc.string; -import tango.stdc.stringz; /** * Instances of this class are graphics which have been prepared
--- a/dwt/graphics/ImageData.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/graphics/ImageData.d Sun Jun 15 22:32:20 2008 +0200 @@ -444,7 +444,7 @@ int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1)) / scanlinePad * scanlinePad; - + /* * When the image is being loaded from a PNG, we need to use the theoretical minimum * number of bytes per line to check whether there is enough data, because the actual
--- a/dwt/graphics/TextLayout.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/graphics/TextLayout.d Sun Jun 15 22:32:20 2008 +0200 @@ -32,7 +32,6 @@ import dwt.dwthelper.utils; import tango.text.convert.Format; -import tango.stdc.stringz; import tango.stdc.string; import tango.text.convert.Utf; import Math = tango.math.Math;
--- a/dwt/internal/Converter.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/internal/Converter.d Sun Jun 15 22:32:20 2008 +0200 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -14,10 +14,6 @@ import dwt.dwthelper.utils; - -//import dwt.internal.gtk.OS; -import tango.stdc.stringz; - extern(C) { struct GError{}; char* g_utf16_to_utf8 ( wchar *str,
--- a/dwt/printing/PrintDialog.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/printing/PrintDialog.d Sun Jun 15 22:32:20 2008 +0200 @@ -28,7 +28,6 @@ import tango.util.Convert; import Math = tango.math.Math; -static import tango.stdc.stringz; /** * Instances of this class allow the user to select @@ -284,7 +283,7 @@ if (OS.GTK_VERSION < OS.buildVERSION (2, 10, 0)) { return Printer.getDefaultPrinterData(); } else { - char* titleBytes = tango.stdc.stringz.toStringz( getText() ); + char* titleBytes = toStringz( getText() ); auto topHandle = getParent().handle; while (topHandle !is null && !OS.GTK_IS_WINDOW(topHandle)) { topHandle = OS.gtk_widget_get_parent(topHandle); @@ -309,11 +308,11 @@ Printer.setScope(settings, printerData.scope_, printerData.startPage, printerData.endPage); //TODO: Should we look at printToFile, or driver/name for "Print to File", or both? (see gtk bug 345590) if (printerData.printToFile) { - char* buffer = tango.stdc.stringz.toStringz(printerData.fileName); + char* buffer = toStringz(printerData.fileName); OS.gtk_print_settings_set(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI.ptr, buffer); } if (printerData.driver.equals("GtkPrintBackendFile") && printerData.name.equals("Print to File")) { //$NON-NLS-1$ //$NON-NLS-2$ - char* buffer = tango.stdc.stringz.toStringz(printerData.fileName); + char* buffer = toStringz(printerData.fileName); OS.gtk_print_settings_set(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI.ptr, buffer); } OS.gtk_print_settings_set_n_copies(settings, printerData.copyCount); @@ -323,7 +322,7 @@ Printer.setScope(settings, scope_, startPage, endPage); if (printToFile) { - char* buffer = tango.stdc.stringz.toStringz( "Print to File" ); //$NON-NLS-1$ + char* buffer = toStringz( "Print to File" ); //$NON-NLS-1$ OS.gtk_print_settings_set_printer(settings, buffer); } OS.gtk_print_unix_dialog_set_settings(handle, settings); @@ -392,7 +391,7 @@ printToFile = ( data.name.equals("Print to File")); //$NON-NLS-1$ if (printToFile) { auto address = OS.gtk_print_settings_get(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI.ptr); - data.fileName = tango.stdc.stringz.fromStringz( address).dup; + data.fileName = fromStringz( address).dup; } data.scope_ = scope_; @@ -439,7 +438,7 @@ } void GtkPrintSettingsMeth (char* key, char* value) { - store( tango.stdc.stringz.fromStringz(key).dup, tango.stdc.stringz.fromStringz(value).dup ); + store( fromStringz(key).dup, fromStringz(value).dup ); } void store(String key, int value) { @@ -455,7 +454,7 @@ } void storeBytes(String key, char* value) { - store(key, tango.stdc.stringz.fromStringz(value).dup ); + store(key, fromStringz(value).dup ); } void store(char [] key, String value) {
--- a/dwt/printing/Printer.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/printing/Printer.d Sun Jun 15 22:32:20 2008 +0200 @@ -28,7 +28,6 @@ import dwt.printing.PrinterData; import dwt.dwthelper.utils; -static import tango.stdc.stringz; import tango.io.Stdout; import tango.util.Convert; @@ -178,10 +177,10 @@ static PrinterData printerDataFromGtkPrinter(GtkPrinter* printer) { auto backend = OS.gtk_printer_get_backend(printer); auto address = OS.G_OBJECT_TYPE_NAME(backend); - String backendType =tango.stdc.stringz.fromStringz( address ).dup; + String backendType = fromStringz( address ).dup; address = OS.gtk_printer_get_name (printer); - String name =tango.stdc.stringz.fromStringz( address ).dup; + String name = fromStringz( address ).dup; return new PrinterData (backendType, name); } @@ -468,7 +467,7 @@ */ public bool startJob(String jobName) { checkDevice(); - char* buffer = tango.stdc.stringz.toStringz(jobName); + char* buffer = toStringz(jobName); printJob = OS.gtk_print_job_new (buffer, printer, settings, pageSetup); if (printJob is null) return false; surface = OS.gtk_print_job_get_surface(printJob, null); @@ -736,11 +735,11 @@ setScope(settings, data.scope_, data.startPage, data.endPage); //TODO: Should we look at printToFile, or driver/name for "Print to File", or both? (see gtk bug 345590) if (data.printToFile) { - char* buffer = tango.stdc.stringz.toStringz( data.fileName ); + char* buffer = toStringz( data.fileName ); OS.gtk_print_settings_set(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI.ptr, buffer); } if (data.driver.equals("GtkPrintBackendFile") && data.name.equals("Print to File")) { //$NON-NLS-1$ //$NON-NLS-2$ - char* buffer = tango.stdc.stringz.toStringz( data.fileName ); + char* buffer = toStringz( data.fileName ); OS.gtk_print_settings_set(settings, OS.GTK_PRINT_SETTINGS_OUTPUT_URI.ptr, buffer); } OS.gtk_print_settings_set_n_copies(settings, data.copyCount);
--- a/dwt/program/Program.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/program/Program.d Sun Jun 15 22:32:20 2008 +0200 @@ -24,7 +24,6 @@ import dwt.dwthelper.utils; import tango.sys.SharedLib; -import tango.stdc.stringz; import tango.core.Exception; import tango.core.Array; import tango.text.convert.Format; @@ -705,9 +704,6 @@ * @param extension the program extension * @return the program or <code>null</code> * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT when extension is null</li> - * </ul> */ public static Program findProgram(String extension) { return findProgram(Display.getCurrent(), extension); @@ -718,7 +714,8 @@ * become public and the original method above can be deprecated. */ static Program findProgram(Display display, String extension) { - if (extension is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (extension is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (extension.length is 0) return null; if (extension.charAt(0) !is '.') extension = "." ~ extension; int desktop = getDesktop(display);
--- a/dwt/widgets/Button.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Button.d Sun Jun 15 22:32:20 2008 +0200 @@ -26,7 +26,6 @@ import dwt.widgets.TypedListener; import dwt.widgets.Decorations; -import tango.stdc.stringz; import tango.io.Stdout; /** @@ -782,9 +781,6 @@ * </p> * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -792,7 +788,8 @@ */ public void setText (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.ARROW) !is 0) return; text = string; char [] chars = fixMnemonic (string);
--- a/dwt/widgets/ColorDialog.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/ColorDialog.d Sun Jun 15 22:32:20 2008 +0200 @@ -12,8 +12,6 @@ *******************************************************************************/ module dwt.widgets.ColorDialog; - - import dwt.DWT; import dwt.DWTException; import dwt.graphics.PaletteData; @@ -23,7 +21,7 @@ import dwt.widgets.Shell; import dwt.widgets.Display; -import tango.stdc.stringz; +import dwt.dwthelper.utils; /** * Instances of this class allow the user to select a color
--- a/dwt/widgets/Combo.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Combo.d Sun Jun 15 22:32:20 2008 +0200 @@ -26,7 +26,6 @@ import dwt.widgets.TypedListener; import dwt.dwthelper.utils; -import tango.stdc.stringz; import Math = tango.math.Math; /** @@ -138,9 +137,6 @@ * * @param string the new item * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -150,7 +146,8 @@ */ public void add (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); add (string, items.length); } @@ -167,7 +164,6 @@ * @param index the index for the item * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li> * </ul> * @exception DWTException <ul> @@ -179,7 +175,8 @@ */ public void add (String string, int index) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (!(0 <= index && index <= items.length)) { error (DWT.ERROR_INVALID_RANGE); } @@ -188,7 +185,7 @@ newItems [index] = string; System.arraycopy (items, index, newItems, index + 1, items.length - index); items = newItems; - char* buffer = toStringz(string); + char* buffer = string.toStringzValidPtr(); if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { OS.gtk_combo_box_insert_text (handle, index, buffer); if ((style & DWT.RIGHT_TO_LEFT) !is 0 && popupHandle !is null) { @@ -1402,9 +1399,6 @@ * @param string the search item * @return the index of the item * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1426,9 +1420,6 @@ * @param start the zero-relative index at which to begin the search * @return the index of the item * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1436,10 +1427,11 @@ */ public int indexOf (String string, int start) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (!(0 <= start && start < items.length)) return -1; for (int i=start; i<items.length; i++) { - if (string==/*eq*/items [i]) return i; + if (string.equals (items [i])) return i; } return -1; } @@ -1612,7 +1604,6 @@ * @param string the item to remove * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li> * </ul> * @exception DWTException <ul> @@ -1622,7 +1613,8 @@ */ public void remove (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); int index = indexOf (string, 0); if (index is -1) error (DWT.ERROR_INVALID_ARGUMENT); remove (index); @@ -1845,7 +1837,6 @@ * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -1854,12 +1845,13 @@ */ public void setItem (int index, String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (!(0 <= index && index < items.length)) { error (DWT.ERROR_INVALID_ARGUMENT); } items [index] = string; - char* buffer = toStringz(string); + char* buffer = string.toStringzValidPtr(); if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { OS.gtk_combo_box_remove_text (handle, index); OS.gtk_combo_box_insert_text (handle, index, buffer); @@ -1883,7 +1875,6 @@ * @param items the array of items * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the items array is null</li> * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li> * </ul> * @exception DWTException <ul> @@ -1893,7 +1884,8 @@ */ public void setItems (String [] items) { checkWidget(); - if (items is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; i<items.length; i++) { if (items [i] is null) error (DWT.ERROR_INVALID_ARGUMENT); } @@ -1907,7 +1899,7 @@ } for (int i = 0; i < items.length; i++) { String string = items [i]; - char* buffer = toStringz(string); + char* buffer = string.toStringzValidPtr(); OS.gtk_combo_box_insert_text (handle, i, buffer); if ((style & DWT.RIGHT_TO_LEFT) !is 0 && popupHandle !is null) { display.doSetDirectionProc(popupHandle, OS.GTK_TEXT_DIR_RTL); @@ -1922,7 +1914,7 @@ int i = 0; while (i < items.length) { String string = items [i]; - char * buffer = toStringz(string); + char * buffer = string.toStringzValidPtr(); auto item = OS.gtk_list_item_new_with_label (buffer); auto label = OS.gtk_bin_get_child (item); setForegroundColor (label, color); @@ -2038,9 +2030,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -2048,7 +2037,8 @@ */ public void setText (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.READ_ONLY) !is 0) { int index = indexOf (string); if (index is -1) return; @@ -2075,7 +2065,7 @@ string = verifyText (string, 0, cast(int)/*64*/OS.g_utf8_strlen (ptr, -1)); if (string is null) return; } - auto buffer = toStringz(string); + auto buffer = string.toStringzValidPtr(); if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED); }
--- a/dwt/widgets/Control.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Control.d Sun Jun 15 22:32:20 2008 +0200 @@ -57,7 +57,6 @@ import dwt.accessibility.Accessible; import Math = tango.math.Math; -import tango.stdc.stringz; import tango.core.Thread; import tango.io.Stdout; @@ -2596,7 +2595,7 @@ char* buffer = null; if (toolTipText !is null && toolTipText.length !is 0) { char [] chars = fixMnemonic (toolTipText, false); - buffer = tango.stdc.stringz.toStringz(chars); + buffer = toStringz(chars); } auto toolHandle = getShell().handle; OS.gtk_widget_set_tooltip_text (toolHandle, buffer);
--- a/dwt/widgets/CoolBar.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/CoolBar.d Sun Jun 15 22:32:20 2008 +0200 @@ -12,8 +12,6 @@ *******************************************************************************/ module dwt.widgets.CoolBar; - - import dwt.DWT; import dwt.DWTException; import dwt.graphics.Color; @@ -26,6 +24,7 @@ import dwt.widgets.Event; import dwt.widgets.Control; import dwt.widgets.Listener; + import dwt.dwthelper.utils; /** @@ -950,7 +949,8 @@ return indices; } void setItemOrder (int[] itemOrder) { - if (itemOrder is null) error(DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (itemOrder is null) error(DWT.ERROR_NULL_ARGUMENT); int count = originalItems.length; if (itemOrder.length !is count) error(DWT.ERROR_INVALID_ARGUMENT); @@ -992,7 +992,8 @@ return sizes; } void setItemSizes (Point[] sizes) { - if (sizes is null) error(DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (sizes is null) error(DWT.ERROR_NULL_ARGUMENT); CoolItem[] items = getItems(); if (sizes.length !is items.length) error(DWT.ERROR_INVALID_ARGUMENT); for (int i = 0; i < items.length; i++) { @@ -1143,7 +1144,6 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if item order or sizes is null</li> * <li>ERROR_INVALID_ARGUMENT - if item order or sizes is not the same length as the number of items</li> * </ul> */
--- a/dwt/widgets/CoolItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/CoolItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -12,8 +12,6 @@ *******************************************************************************/ module dwt.widgets.CoolItem; - - import dwt.DWT; import dwt.DWTException; import dwt.events.SelectionEvent;
--- a/dwt/widgets/Decorations.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Decorations.d Sun Jun 15 22:32:20 2008 +0200 @@ -596,7 +596,6 @@ * @param images the new image array * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of images is null</li> * <li>ERROR_INVALID_ARGUMENT - if one of the images is null or has been disposed</li> * </ul> * @exception DWTException <ul> @@ -608,7 +607,8 @@ */ public void setImages (Image [] images) { checkWidget (); - if (images is null) error (DWT.ERROR_INVALID_ARGUMENT); + // DWT extension: allow null for zero length string + //if (images is null) error (DWT.ERROR_INVALID_ARGUMENT); for (int i = 0; i < images.length; i++) { if (images [i] is null || images [i].isDisposed ()) error (DWT.ERROR_INVALID_ARGUMENT); } @@ -709,9 +709,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -719,7 +716,8 @@ */ public void setText (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); text = string; }
--- a/dwt/widgets/Dialog.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Dialog.d Sun Jun 15 22:32:20 2008 +0200 @@ -256,16 +256,14 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public void setText (String string) { - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); title = string; }
--- a/dwt/widgets/DirectoryDialog.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/DirectoryDialog.d Sun Jun 15 22:32:20 2008 +0200 @@ -24,7 +24,6 @@ import dwt.widgets.Display; static import tango.io.FileConst; -static import tango.stdc.stringz; static import tango.text.Util; /** @@ -131,7 +130,7 @@ } } String openChooserDialog () { - char* titleBytes = tango.stdc.stringz.toStringz(title); + char* titleBytes = toStringz(title); auto shellHandle = parent.topHandle (); auto handle = OS.gtk_file_chooser_dialog_new2 ( titleBytes, @@ -154,7 +153,7 @@ else{ p = filterPath; } - char* buffer = tango.stdc.stringz.toStringz(p); + char* buffer = toStringz(p); /* * Bug in GTK. GtkFileChooser may crash on GTK versions 2.4.10 to 2.6 * when setting a file name that is not a true canonical path. @@ -167,7 +166,7 @@ } } if (message.length > 0) { - char* buffer = tango.stdc.stringz.toStringz(message); + char* buffer = toStringz(message); auto box = OS.gtk_hbox_new (false, 0); if (box is null) error (DWT.ERROR_NO_HANDLES); auto label = OS.gtk_label_new (buffer); @@ -220,7 +219,7 @@ return answer; } String openClassicDialog () { - char* titleBytes = tango.stdc.stringz.toStringz(title); + char* titleBytes = toStringz(title); auto handle = OS.gtk_file_selection_new (titleBytes); if (parent !is null) { auto shellHandle = parent.topHandle (); @@ -237,7 +236,7 @@ if (path.length > 0 && path[ $-1 .. $ ] != SEPARATOR ) { path ~= SEPARATOR; } - char* fileNamePtr = OS.g_filename_from_utf8 (tango.stdc.stringz.toStringz(path), -1, null, null, null); + char* fileNamePtr = OS.g_filename_from_utf8 (toStringz(path), -1, null, null, null); OS.gtk_file_selection_set_filename (handle, fileNamePtr); OS.g_free (fileNamePtr); } @@ -247,7 +246,7 @@ OS.gtk_widget_hide (selection.file_list); OS.gtk_widget_hide (fileListParent); if (message.length > 0) { - auto labelHandle = OS.gtk_label_new (tango.stdc.stringz.toStringz(message)); + auto labelHandle = OS.gtk_label_new (toStringz(message)); OS.gtk_label_set_line_wrap (labelHandle, true); OS.gtk_misc_set_alignment (labelHandle, 0.0f, 0.0f); OS.gtk_container_add (selection.main_vbox, labelHandle); @@ -321,12 +320,10 @@ * * @param string the message * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> */ public void setMessage (String string) { - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); message = string.dup; } }
--- a/dwt/widgets/Display.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Display.d Sun Jun 15 22:32:20 2008 +0200 @@ -44,7 +44,6 @@ import dwt.widgets.Widget; import tango.stdc.string; -import tango.stdc.stringz; import dwt.dwthelper.utils; import dwt.dwthelper.Runnable; @@ -1597,9 +1596,6 @@ * @param key the name of the property * @return the value of the property or null if it has not been set * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the key is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> @@ -1610,7 +1606,8 @@ */ public Object getData (String key) { checkDevice (); - if (key is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (key is null) error (DWT.ERROR_NULL_ARGUMENT); if (key.equals (DISPATCH_EVENT_KEY)) { return new ArrayWrapperInt(dispatchEvents); } @@ -3522,9 +3519,6 @@ * @param key the name of the property * @param value the new value for the property * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the key is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li> @@ -3535,9 +3529,10 @@ */ public void setData (String key, Object value) { checkDevice (); - if (key is null) error (DWT.ERROR_NULL_ARGUMENT); - - if (key==/*eq*/ DISPATCH_EVENT_KEY) { + // DWT extension: allow null for zero length string + //if (key is null) error (DWT.ERROR_NULL_ARGUMENT); + + if (key.equals (DISPATCH_EVENT_KEY)) { ArrayWrapperInt wrappedValue; if (value is null || (null !is (wrappedValue=cast(ArrayWrapperInt)value))) { dispatchEvents = wrappedValue.array;
--- a/dwt/widgets/ExpandItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/ExpandItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -31,7 +31,6 @@ import dwt.widgets.Event; import Math = tango.math.Math; -static import tango.stdc.stringz; /** * Instances of this class represent a selectable user interface object @@ -606,7 +605,7 @@ public override void setText (String string) { super.setText (string); if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { - OS.gtk_label_set_text (labelHandle, tango.stdc.stringz.toStringz(string)); + OS.gtk_label_set_text (labelHandle, toStringz(string)); } else { redraw (); }
--- a/dwt/widgets/FileDialog.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/FileDialog.d Sun Jun 15 22:32:20 2008 +0200 @@ -149,7 +149,7 @@ if (filter !is null) { auto filterNamePtr = OS.gtk_file_filter_get_name (filter); if (filterNamePtr !is null) { - String filterName = tango.stdc.stringz.fromStringz(filterNamePtr).dup; + String filterName = fromStringz(filterNamePtr).dup; //OS.g_free (filterNamePtr); //GTK owns this pointer - do not free for (int i = 0; i < filterExtensions.length; i++) { if (filterNames.length > 0) { @@ -179,7 +179,7 @@ GtkFileSelection* selection = cast(GtkFileSelection*)handle; auto entry = selection.selection_entry; auto entryText = OS.gtk_entry_get_text (entry); - String txt = tango.stdc.stringz.fromStringz( entryText ); + String txt = fromStringz( entryText ); if (txt.length is 0) { auto fileList = selection.file_list; auto listSelection = OS.gtk_tree_view_get_selection (fileList); @@ -345,7 +345,7 @@ } } String openChooserDialog () { - char* titleBytes = tango.stdc.stringz.toStringz( title ); + char* titleBytes = toStringz( title ); int action = (style & DWT.SAVE) !is 0 ? OS.GTK_FILE_CHOOSER_ACTION_SAVE : OS.GTK_FILE_CHOOSER_ACTION_OPEN; @@ -394,7 +394,7 @@ return answer; } String openClassicDialog () { - char* titleBytes = tango.stdc.stringz.toStringz( title ); + char* titleBytes = toStringz( title ); handle = OS.gtk_file_selection_new (titleBytes); if (parent !is null) { auto shellHandle = parent.topHandle (); @@ -456,7 +456,7 @@ stringBuffer.append (SEPARATOR); } stringBuffer.append (fileName); - char* buffer = tango.stdc.stringz.toStringz( stringBuffer.toString ()); + char* buffer = toStringz( stringBuffer.toString ()); /* * Bug in GTK. GtkFileChooser may crash on GTK versions 2.4.10 to 2.6 * when setting a file name that is not a true canonical path. @@ -468,7 +468,7 @@ OS.g_free (ptr); } } else { - char* buffer = tango.stdc.stringz.toStringz( stringBuffer.toString () ); + char* buffer = toStringz( stringBuffer.toString () ); /* * Bug in GTK. GtkFileChooser may crash on GTK versions 2.4.10 to 2.6 * when setting a file name that is not a true canonical path. @@ -483,7 +483,7 @@ } else { if (fileName.length > 0) { if (fileName[0] is SEPARATOR) { - char* buffer = tango.stdc.stringz.toStringz(fileName); + char* buffer = toStringz(fileName); /* * Bug in GTK. GtkFileChooser may crash on GTK versions 2.4.10 to 2.6 @@ -499,7 +499,7 @@ } } if ((style & DWT.SAVE) !is 0 && fileName.length > 0) { - char* buffer = tango.stdc.stringz.toStringz(fileName); + char* buffer = toStringz(fileName); OS.gtk_file_chooser_set_current_name (handle, buffer); } if ((style & DWT.SAVE) !is 0) { @@ -516,23 +516,23 @@ if (filterExtensions [i] !is null) { auto filter = OS.gtk_file_filter_new (); if (filterNames.length > i && filterNames [i] !is null) { - char* name = tango.stdc.stringz.toStringz(filterNames [i]); + char* name = toStringz(filterNames [i]); OS.gtk_file_filter_set_name (filter, name); } else { - char* name = tango.stdc.stringz.toStringz(filterExtensions [i]); + char* name = toStringz(filterExtensions [i]); OS.gtk_file_filter_set_name (filter, name); } int start = 0; int index = tango.text.Util.locate( filterExtensions [i], EXTENSION_SEPARATOR ); while (index !is filterExtensions [i].length ) { String current = filterExtensions [i][ start .. index ]; - char* filterString = tango.stdc.stringz.toStringz(current); + char* filterString = toStringz(current); OS.gtk_file_filter_add_pattern (filter, filterString); start = index + 1; index = tango.text.Util.locate( filterExtensions [i], EXTENSION_SEPARATOR, start); } String current = filterExtensions [i][ start .. $ ]; - char* filterString = tango.stdc.stringz.toStringz(current); + char* filterString = toStringz(current); OS.gtk_file_filter_add_pattern (filter, filterString); OS.gtk_file_chooser_add_filter (handle, filter); if (i is filterIndex) { @@ -567,7 +567,7 @@ stringBuffer.append (fileName); } fullPath = stringBuffer.toString (); - auto fileNamePtr = OS.g_filename_from_utf8 (tango.stdc.stringz.toStringz( fullPath ), -1, null, null, null); + auto fileNamePtr = OS.g_filename_from_utf8 (toStringz( fullPath ), -1, null, null, null); OS.gtk_file_selection_set_filename (handle, fileNamePtr); OS.g_free (fileNamePtr);
--- a/dwt/widgets/FontDialog.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/FontDialog.d Sun Jun 15 22:32:20 2008 +0200 @@ -12,8 +12,6 @@ *******************************************************************************/ module dwt.widgets.FontDialog; - - import dwt.DWT; import dwt.DWTException; import dwt.graphics.Font; @@ -25,7 +23,7 @@ import dwt.widgets.Shell; import dwt.widgets.Display; -static import tango.stdc.stringz; +import dwt.dwthelper.utils; /** * Instances of this class allow the user to select a font @@ -143,7 +141,7 @@ public FontData open () { GtkWidget* handle; char* titleBytes; - titleBytes = tango.stdc.stringz.toStringz(title); + titleBytes = toStringz(title); Display display = parent !is null ? parent.getDisplay (): Display.getCurrent (); handle = OS.gtk_font_selection_dialog_new (titleBytes); if (parent !is null) {
--- a/dwt/widgets/Group.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Group.d Sun Jun 15 22:32:20 2008 +0200 @@ -22,7 +22,6 @@ import dwt.widgets.Composite; import Math = tango.math.Math; -import tango.stdc.stringz; /** * Instances of this class provide an etched border @@ -272,9 +271,6 @@ * </p> * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -282,7 +278,8 @@ */ public void setText (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); text = string; char [] chars = fixMnemonic (string); OS.gtk_label_set_text_with_mnemonic (cast(GtkLabel*)labelHandle, chars.toStringzValidPtr());
--- a/dwt/widgets/IME.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/IME.d Sun Jun 15 22:32:20 2008 +0200 @@ -116,7 +116,7 @@ if (textPtr !is null && inComposition) { int length = OS.strlen (textPtr); if (length !is 0) { - char [] chars = tango.stdc.stringz.fromStringz(textPtr).dup; + char [] chars = fromStringz(textPtr).dup; Event event = new Event(); event.detail = DWT.COMPOSITION_CHANGED; event.start = startOffset; @@ -148,7 +148,7 @@ char [] chars = null; if (preeditString !is null) { int length = OS.strlen (preeditString); - chars = tango.stdc.stringz.fromStringz(preeditString).dup; + chars = fromStringz(preeditString).dup; if (pangoAttrs !is null) { int count = 0; auto iterator = OS.pango_attr_list_get_iterator (pangoAttrs );
--- a/dwt/widgets/Item.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Item.d Sun Jun 15 22:32:20 2008 +0200 @@ -172,9 +172,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -182,7 +179,8 @@ */ public void setText (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); text = string.dup; }
--- a/dwt/widgets/Label.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Label.d Sun Jun 15 22:32:20 2008 +0200 @@ -562,9 +562,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
--- a/dwt/widgets/Link.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Link.d Sun Jun 15 22:32:20 2008 +0200 @@ -708,9 +708,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -718,7 +715,8 @@ */ public void setText (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (string.equals(text)) return; text = string; layout.setText (parse (string));
--- a/dwt/widgets/List.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/List.d Sun Jun 15 22:32:20 2008 +0200 @@ -26,7 +26,6 @@ import dwt.dwthelper.utils; import Math = tango.math.Math; -import tango.stdc.stringz; import tango.text.convert.Integer; /** @@ -96,9 +95,6 @@ * * @param string the new item * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -108,8 +104,9 @@ */ public void add (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); - char* buffer = toStringz(string); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + char* buffer = string.toStringzValidPtr(); GtkTreeIter iter; OS.gtk_list_store_append (cast(GtkListStore*)modelHandle, &iter); OS.gtk_list_store_set1 (cast(GtkListStore*)modelHandle, &iter, TEXT_COLUMN, buffer); @@ -128,7 +125,6 @@ * @param index the index for the item * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li> * </ul> * @exception DWTException <ul> @@ -140,12 +136,13 @@ */ public void add (String string, int index) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); int count = OS.gtk_tree_model_iter_n_children (cast(GtkTreeStore*)modelHandle, null); if (!(0 <= index && index <= count)) { error (DWT.ERROR_INVALID_RANGE); } - char* buffer = toStringz(string); + char* buffer = string.toStringzValidPtr(); GtkTreeIter iter; /* * Feature in GTK. It is much faster to append to a list store @@ -335,9 +332,6 @@ * * @param indices the array of indices for the items to deselect * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the set of indices is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -345,7 +339,8 @@ */ public void deselect (int [] indices) { checkWidget(); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); GtkTreeIter iter; int count = OS.gtk_tree_model_iter_n_children (cast(GtkTreeStore*)modelHandle, null); auto selection = OS.gtk_tree_view_get_selection (cast(GtkTreeView*)handle); @@ -830,9 +825,6 @@ * @param string the search item * @return the index of the item * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -854,9 +846,6 @@ * @param start the zero-relative index at which to start the search * @return the index of the item * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -864,10 +853,11 @@ */ public int indexOf (String string, int start) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); String [] items = getItems (); for (int i=start; i<items.length; i++) { - if (items [i] ==/*eq*/ (string)) return i; + if (items [i].equals (string)) return i; } return -1; } @@ -979,7 +969,6 @@ * @param string the item to remove * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li> * </ul> * @exception DWTException <ul> @@ -989,7 +978,8 @@ */ public void remove (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); int index = indexOf (string, 0); if (index is -1) error (DWT.ERROR_INVALID_ARGUMENT); remove (index); @@ -1003,7 +993,6 @@ * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * <li>ERROR_NULL_ARGUMENT - if the indices array is null</li> * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -1012,7 +1001,8 @@ */ public void remove (int [] indices) { checkWidget(); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); if (indices.length is 0) return; int [] newIndices = new int []( indices.length ); System.arraycopy (indices, 0, newIndices, 0, indices.length); @@ -1162,9 +1152,6 @@ * * @param indices the array of indices for the items to select * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1174,7 +1161,8 @@ */ public void select (int [] indices) { checkWidget (); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); int length = indices.length; if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return; GtkTreeIter iter; @@ -1278,7 +1266,6 @@ * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -1287,13 +1274,14 @@ */ public void setItem (int index, String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (!(0 <= index && index < OS.gtk_tree_model_iter_n_children (cast(GtkTreeStore*)modelHandle, null))) { error (DWT.ERROR_INVALID_RANGE); } GtkTreeIter iter; OS.gtk_tree_model_iter_nth_child (cast(GtkTreeStore*)modelHandle, &iter, null, index); - char* buffer = toStringz(string); + char* buffer = string.toStringzValidPtr(); OS.gtk_list_store_set1 (cast(GtkListStore*)modelHandle, &iter, TEXT_COLUMN, buffer); } @@ -1303,7 +1291,6 @@ * @param items the array of items * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the items array is null</li> * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li> * </ul> * @exception DWTException <ul> @@ -1399,9 +1386,6 @@ * * @param indices the indices of the items to select * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1412,7 +1396,8 @@ */ public void setSelection(int[] indices) { checkWidget (); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); deselectAll (); int length = indices.length; if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return; @@ -1433,9 +1418,6 @@ * * @param items the array of items * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1447,7 +1429,8 @@ */ public void setSelection (String [] items) { checkWidget (); - if (items is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); deselectAll (); int length = items.length; if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return;
--- a/dwt/widgets/Menu.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Menu.d Sun Jun 15 22:32:20 2008 +0200 @@ -28,8 +28,6 @@ import dwt.widgets.Shell; import dwt.dwthelper.utils; -import tango.stdc.stringz; - /** * Instances of this class are user interface objects that contain * menu items. @@ -191,7 +189,7 @@ if (getItemCount () !is 0) { if ((OS.GTK_VERSION >= OS.buildVERSION (2, 8, 0))) { /* - * Feature in GTK. ON_TOP shells will send out + * Feature in GTK. ON_TOP shells will send out * DWT.Deactivate whenever a context menu is shown. * The fix is to prevent the menu from taking focus * when it is being shown in an ON_TOP shell. @@ -720,7 +718,7 @@ int reqy = this.y; if (reqy + requisition.height > screenHeight) { reqy = Math.max (0, reqy - requisition.height); - } + } int screenWidth = OS.gdk_screen_width (); int reqx = this.x; if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
--- a/dwt/widgets/MenuItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/MenuItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -30,7 +30,6 @@ import dwt.widgets.Display; import dwt.dwthelper.utils; -import tango.stdc.stringz; /** * Instances of this class represent a selectable user interface object @@ -828,9 +827,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -840,7 +836,8 @@ */ public override void setText (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SEPARATOR) !is 0) return; if (text.equals(string)) return; super.setText (string);
--- a/dwt/widgets/MessageBox.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/MessageBox.d Sun Jun 15 22:32:20 2008 +0200 @@ -23,7 +23,6 @@ import dwt.widgets.Shell; import dwt.widgets.Display; -import tango.stdc.stringz; /** * Instances of this class are used to inform or warn the user. @@ -131,12 +130,10 @@ * * @param string the message * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> */ public void setMessage (String string) { - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); message = string; }
--- a/dwt/widgets/Scrollable.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Scrollable.d Sun Jun 15 22:32:20 2008 +0200 @@ -23,7 +23,6 @@ import dwt.widgets.Widget; import tango.stdc.string; -import tango.stdc.stringz; /** * This class is the abstract superclass of all classes which
--- a/dwt/widgets/Shell.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Shell.d Sun Jun 15 22:32:20 2008 +0200 @@ -43,7 +43,6 @@ import dwt.widgets.Widget; import Unicode = tango.text.Unicode; -import tango.stdc.stringz; /** * Instances of this class represent the "windows" @@ -1927,7 +1926,7 @@ char * buffer = null; if (string !is null && string.length > 0) { char [] chars = fixMnemonic (string, false); - buffer = tango.stdc.stringz.toStringz( chars ); + buffer = toStringz( chars ); } OS.gtk_widget_set_tooltip_text (rootWidget, null); /* @@ -1966,7 +1965,7 @@ char* buffer = null; if (string !is null && string.length > 0) { char [] chars = fixMnemonic (string, false); - buffer = tango.stdc.stringz.toStringz( chars ); + buffer = toStringz( chars ); } if (tooltipsHandle is null) { tooltipsHandle = cast(GtkWidget*)OS.gtk_tooltips_new ();
--- a/dwt/widgets/Spinner.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Spinner.d Sun Jun 15 22:32:20 2008 +0200 @@ -26,7 +26,6 @@ import dwt.events.ModifyListener; import dwt.events.VerifyListener; -import tango.stdc.stringz; import tango.util.Convert; import dwt.dwthelper.utils; @@ -483,7 +482,7 @@ public String getText () { checkWidget (); auto str = OS.gtk_entry_get_text (handle); - return tango.stdc.stringz.fromStringz(str).dup; + return fromStringz(str).dup; } public int getTextLimit () {
--- a/dwt/widgets/TabFolder.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/TabFolder.d Sun Jun 15 22:32:20 2008 +0200 @@ -696,9 +696,6 @@ * * @param items the array of items * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the items array is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -706,7 +703,8 @@ */ public void setSelection (TabItem [] items) { checkWidget(); - if (items is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); if (items.length is 0) { setSelection (-1, false); } else {
--- a/dwt/widgets/TabItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/TabItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -26,8 +26,6 @@ import dwt.widgets.TabFolder; import dwt.widgets.ImageList; -static import tango.stdc.stringz; - /** * Instances of this class represent a selectable user interface object * corresponding to a tab for a page in a tab folder. @@ -331,9 +329,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -342,7 +337,8 @@ */ public override void setText (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); super.setText (string); char [] chars = fixMnemonic (string); OS.gtk_label_set_text_with_mnemonic (labelHandle, chars.toStringzValidPtr() );
--- a/dwt/widgets/Table.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Table.d Sun Jun 15 22:32:20 2008 +0200 @@ -40,7 +40,6 @@ import dwt.widgets.TypedListener; import dwt.dwthelper.utils; -static import tango.stdc.stringz; import tango.util.Convert; /** @@ -476,7 +475,6 @@ * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * <li>ERROR_NULL_ARGUMENT - if the indices array is null</li> * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -490,7 +488,8 @@ */ public void clear (int [] indices) { checkWidget (); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); if (indices.length is 0) return; for (int i=0; i<indices.length; i++) { if (!(0 <= indices [i] && indices [i] < itemCount)) { @@ -941,9 +940,6 @@ * * @param indices the array of indices for the items to deselect * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the set of indices is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -951,7 +947,8 @@ */ public void deselect (int [] indices) { checkWidget(); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); bool fixColumn = showFirstColumn (); auto selection = OS.gtk_tree_view_get_selection (handle); OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, udCHANGED); @@ -2129,7 +2126,7 @@ public bool isSelected (int index) { checkWidget(); auto selection = OS.gtk_tree_view_get_selection (handle); - char* buffer = tango.stdc.stringz.toStringz( to!(String)(index)); + char* buffer = toStringz( to!(String)(index)); auto path = OS.gtk_tree_path_new_from_string (buffer); bool answer = cast(bool)OS.gtk_tree_selection_path_is_selected (selection, path); OS.gtk_tree_path_free (path); @@ -2310,7 +2307,6 @@ * * @exception IllegalArgumentException <ul> * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li> - * <li>ERROR_NULL_ARGUMENT - if the indices array is null</li> * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -2319,7 +2315,8 @@ */ public void remove (int [] indices) { checkWidget(); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); if (indices.length is 0) return; int [] newIndices = new int [indices.length]; System.arraycopy (indices, 0, newIndices, 0, indices.length); @@ -2755,9 +2752,6 @@ * * @param indices the array of indices for the items to select * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -2767,7 +2761,8 @@ */ public void select (int [] indices) { checkWidget (); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); int length = indices.length; if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return; bool fixColumn = showFirstColumn (); @@ -2880,7 +2875,6 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the item order is null</li> * <li>ERROR_INVALID_ARGUMENT - if the item order is not the same length as the number of items</li> * </ul> * @@ -2893,7 +2887,8 @@ */ public void setColumnOrder (int [] order) { checkWidget (); - if (order is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (order is null) error (DWT.ERROR_NULL_ARGUMENT); if (columnCount is 0) { if (order.length > 0) error (DWT.ERROR_INVALID_ARGUMENT); return; @@ -3169,9 +3164,6 @@ * * @param indices the indices of the items to select * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -3182,7 +3174,8 @@ */ public void setSelection (int [] indices) { checkWidget (); - if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (indices is null) error (DWT.ERROR_NULL_ARGUMENT); deselectAll (); int length = indices.length; if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return; @@ -3233,7 +3226,6 @@ * @param items the array of items * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li> * <li>ERROR_INVALID_ARGUMENT - if one of the items has been disposed</li> * </ul> * @exception DWTException <ul> @@ -3247,7 +3239,8 @@ */ public void setSelection (TableItem [] items) { checkWidget (); - if (items is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); bool fixColumn = showFirstColumn (); deselectAll (); int length = items.length;
--- a/dwt/widgets/TableColumn.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/TableColumn.d Sun Jun 15 22:32:20 2008 +0200 @@ -610,7 +610,8 @@ public override void setText (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); super.setText (string); char [] chars = fixMnemonic (string); OS.gtk_label_set_text_with_mnemonic (labelHandle, chars.toStringzValidPtr() );
--- a/dwt/widgets/TableItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/TableItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -204,7 +204,7 @@ int modelIndex = parent.columnCount is 0 ? Table.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_tree_model_get1 (parent.modelHandle, handle, modelIndex + Table.CELL_TEXT, &ptr); if (ptr is null) return ""; - char[] buffer = tango.stdc.stringz.fromStringz( cast(char*)ptr).dup; + char[] buffer = fromStringz( cast(char*)ptr).dup; OS.g_free (ptr); return buffer; } @@ -1287,7 +1287,7 @@ if (_getText (index).equals (string)) return; int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count - 1) return; - char* buffer = tango.stdc.stringz.toStringz( string ); + char* buffer = toStringz( string ); int modelIndex = parent.columnCount is 0 ? Table.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_list_store_set1 (parent.modelHandle, handle, modelIndex + Table.CELL_TEXT, buffer); /*
--- a/dwt/widgets/Text.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Text.d Sun Jun 15 22:32:20 2008 +0200 @@ -28,7 +28,6 @@ import dwt.widgets.Composite; import Math = tango.math.Math; -import tango.stdc.stringz; static import tango.stdc.string; /** @@ -291,9 +290,6 @@ * * @param string the string to be appended * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -301,7 +297,8 @@ */ public void append (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SINGLE) !is 0) { int dummy = -1; OS.gtk_editable_insert_text (cast(GtkEditable*)handle, string.ptr, string.length, &dummy ); @@ -1395,9 +1392,6 @@ * * @param string the string * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is <code>null</code></li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1405,7 +1399,8 @@ */ public void insert (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SINGLE) !is 0) { int start, end; OS.gtk_editable_get_selection_bounds (cast(GtkEditable*)handle, &start, &end); @@ -1695,7 +1690,8 @@ */ public void setMessage (String message) { checkWidget (); - if (message is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (message is null) error (DWT.ERROR_NULL_ARGUMENT); this.message = message; } @@ -1871,9 +1867,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the string is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1881,7 +1874,8 @@ */ public void setText (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); /* * Feature in gtk. When text is set in gtk, separate events are fired for the deletion and * insertion of the text. This is not wrong, but is inconsistent with other platforms. The
--- a/dwt/widgets/ToolItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/ToolItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -31,8 +31,6 @@ import dwt.widgets.Event; import dwt.widgets.ImageList; -import tango.stdc.stringz; - /** * Instances of this class represent a selectable user interface object * that represents a button in a tool bar. @@ -976,9 +974,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -986,7 +981,8 @@ */ public override void setText (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if ((style & DWT.SEPARATOR) !is 0) return; super.setText (string); if (labelHandle is null) return;
--- a/dwt/widgets/ToolTip.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/ToolTip.d Sun Jun 15 22:32:20 2008 +0200 @@ -28,8 +28,6 @@ import dwt.widgets.Event; import dwt.widgets.Display; -import tango.stdc.stringz; - /** * Instances of this class represent popup windows that are used * to inform or warn the user. @@ -175,9 +173,9 @@ 0, 5+t]; if ((parent.style & DWT.MIRRORED) !is 0) { x -= w - 36; - polyline[12] = w-36; - polyline[14] = w-16; - polyline[16] = w-15; + polyline[12] = w-36; + polyline[14] = w-16; + polyline[16] = w-15; borderPolygon[12] = w-35; borderPolygon[14] = borderPolygon[16] = w-16; } @@ -691,9 +689,6 @@ * * @param string the new message * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -701,13 +696,14 @@ */ public void setMessage (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); message = string; if ((style & DWT.BALLOON) is 0) return; if (layoutMessage !is null) OS.g_object_unref (layoutMessage); layoutMessage = null; if (message.length !is 0) { - layoutMessage = OS.gtk_widget_create_pango_layout (handle, toStringz( message )); + layoutMessage = OS.gtk_widget_create_pango_layout (handle, message.toStringzValidPtr()); if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { OS.pango_layout_set_auto_dir (layoutMessage, false); } @@ -721,9 +717,6 @@ * * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -731,13 +724,14 @@ */ public void setText (String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); text = string; if ((style & DWT.BALLOON) is 0) return; if (layoutText !is null) OS.g_object_unref (layoutText); layoutText = null; if (text.length !is 0) { - layoutText = OS.gtk_widget_create_pango_layout (handle, toStringz(text)); + layoutText = OS.gtk_widget_create_pango_layout (handle, text.toStringzValidPtr()); if (OS.GTK_VERSION >= OS.buildVERSION (2, 4, 0)) { OS.pango_layout_set_auto_dir (layoutText, false); }
--- a/dwt/widgets/Tracker.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Tracker.d Sun Jun 15 22:32:20 2008 +0200 @@ -955,7 +955,7 @@ * @param rectangles the bounds of the rectangles to be drawn * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the set of rectangles is null or contains a null rectangle</li> + * <li>ERROR_NULL_ARGUMENT - if the set of rectangles contains a null rectangle</li> * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> @@ -964,7 +964,8 @@ */ public void setRectangles (Rectangle [] rectangles) { checkWidget(); - if (rectangles is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (rectangles is null) error (DWT.ERROR_NULL_ARGUMENT); int length = rectangles.length; this.rectangles = new Rectangle [length]; for (int i = 0; i < length; i++) {
--- a/dwt/widgets/TrayItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/TrayItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -29,7 +29,6 @@ import dwt.internal.gtk.OS; import Math = tango.math.Math; -import tango.stdc.stringz; import tango.util.Convert; /**
--- a/dwt/widgets/Tree.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Tree.d Sun Jun 15 22:32:20 2008 +0200 @@ -2820,7 +2820,6 @@ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the item order is null</li> * <li>ERROR_INVALID_ARGUMENT - if the item order is not the same length as the number of items</li> * </ul> * @@ -2833,7 +2832,8 @@ */ public void setColumnOrder (int [] order) { checkWidget (); - if (order is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (order is null) error (DWT.ERROR_NULL_ARGUMENT); if (columnCount is 0) { if (order.length > 0) error (DWT.ERROR_INVALID_ARGUMENT); return; @@ -2973,7 +2973,6 @@ * @param items the array of items * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of items is null</li> * <li>ERROR_INVALID_ARGUMENT - if one of the items has been disposed</li> * </ul> * @exception DWTException <ul> @@ -2985,7 +2984,8 @@ */ public void setSelection (TreeItem [] items) { checkWidget (); - if (items is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (items is null) error (DWT.ERROR_NULL_ARGUMENT); deselectAll (); int length = items.length; if (length is 0 || ((style & DWT.SINGLE) !is 0 && length > 1)) return;
--- a/dwt/widgets/TreeColumn.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/TreeColumn.d Sun Jun 15 22:32:20 2008 +0200 @@ -30,7 +30,6 @@ import dwt.widgets.TypedListener; import Math = tango.math.Math; -static import tango.stdc.stringz; /** * Instances of this class represent a column in a tree widget. @@ -605,7 +604,8 @@ public override void setText (String string) { checkWidget(); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); super.setText (string); char [] chars = fixMnemonic (string); OS.gtk_label_set_text_with_mnemonic (labelHandle, chars.toStringzValidPtr());
--- a/dwt/widgets/TreeItem.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/TreeItem.d Sun Jun 15 22:32:20 2008 +0200 @@ -27,7 +27,6 @@ import dwt.widgets.Tree; import dwt.widgets.ImageList; -static import tango.stdc.stringz; import Math = tango.math.Math; /** @@ -289,7 +288,7 @@ int modelIndex = parent.columnCount is 0 ? Tree.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_tree_model_get1 (parent.modelHandle, handle, modelIndex + Tree.CELL_TEXT, &ptr); if (ptr is null) return ""; //$NON-NLS-1$ - char[] buffer = tango.stdc.stringz.fromStringz( cast(char*)ptr).dup; + char[] buffer = fromStringz( cast(char*)ptr).dup; OS.g_free (ptr); return buffer; } @@ -1657,7 +1656,6 @@ * @param images the array of new images * * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the array of images is null</li> * <li>ERROR_INVALID_ARGUMENT - if one of the images has been disposed</li> * </ul> * @exception DWTException <ul> @@ -1669,7 +1667,8 @@ */ public void setImage (Image [] images) { checkWidget (); - if (images is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (images is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; i<images.length; i++) { setImage (i, images [i]); } @@ -1699,9 +1698,6 @@ * @param index the column index * @param string the new text * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1711,11 +1707,12 @@ */ public void setText (int index, String string) { checkWidget (); - if (string is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (string is null) error (DWT.ERROR_NULL_ARGUMENT); if (_getText (index).equals (string)) return; int count = Math.max (1, parent.getColumnCount ()); if (0 > index || index > count - 1) return; - char* buffer = tango.stdc.stringz.toStringz(string); + char* buffer = toStringz(string); int modelIndex = parent.columnCount is 0 ? Tree.FIRST_COLUMN : parent.columns [index].modelIndex; OS.gtk_tree_store_set1 (parent.modelHandle, cast(GtkTreeIter*)handle, modelIndex + Tree.CELL_TEXT, buffer); /* @@ -1741,9 +1738,6 @@ * * @param strings the array of new strings * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the text is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1753,7 +1747,8 @@ */ public void setText (String [] strings) { checkWidget (); - if (strings is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (strings is null) error (DWT.ERROR_NULL_ARGUMENT); for (int i=0; i<strings.length; i++) { String string = strings [i]; if (string !is null) setText (i, string);
--- a/dwt/widgets/Widget.d Sun Jun 08 15:11:48 2008 +0200 +++ b/dwt/widgets/Widget.d Sun Jun 15 22:32:20 2008 +0200 @@ -25,7 +25,6 @@ import dwt.widgets.Listener; import dwt.widgets.TypedListener; -import tango.stdc.stringz; import tango.stdc.string; import tango.core.Thread; @@ -575,9 +574,6 @@ * @param key the name of the property * @return the value of the property or null if it has not been set * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the key is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -587,7 +583,8 @@ */ public Object getData (String key) { checkWidget(); - if (key is null) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (key is null) error (DWT.ERROR_NULL_ARGUMENT); if ((state & KEYED_DATA) !is 0) { Object[] table = (cast(ArrayWrapperObject) data).array; for (int i=1; i<table.length; i+=2) { @@ -1423,9 +1420,6 @@ * @param key the name of the property * @param value the new value for the property * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the key is null</li> - * </ul> * @exception DWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> @@ -1435,14 +1429,15 @@ */ public void setData (String key, Object value) { checkWidget(); - if (key.length is 0) error (DWT.ERROR_NULL_ARGUMENT); + // DWT extension: allow null for zero length string + //if (key is null) error (DWT.ERROR_NULL_ARGUMENT); int index = 1; Object [] table = null; if ((state & KEYED_DATA) !is 0) { table = (cast(ArrayWrapperObject) data).array; while (index < table.length) { String tablekey = (cast(ArrayWrapperString)table[index]).array; - if (key ==/*eq*/ tablekey ) break; + if (key.equals (tablekey) ) break; index += 2; } }