# HG changeset patch
# User Frank Benoit
# Date 1213561940 -7200
# Node ID 5a30aa9820f3a17d029b1c70bef455358c87c288
# Parent 8bca790583c33525f6196ef2a0eeb4879bc32370
removed tango.stdc.stringz imports and allow null for arrays and string arguments.
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/accessibility/AccessibleFactory.d
--- 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 {
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/accessibility/AccessibleObject.d
--- 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;
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/custom/CCombo.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)
*
* @exception DWTException
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
* - ERROR_INVALID_ARGUMENT - if the string is not found in the list
*
* @exception DWTException
@@ -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
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
- * - ERROR_NULL_ARGUMENT - if the string is null
*
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -1438,7 +1431,6 @@
* @param items the array of items
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the items array is null
* - ERROR_INVALID_ARGUMENT - if an item in the items array is null
*
* @exception DWTException
@@ -1530,9 +1522,6 @@
*
* @param string the new text
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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 ();
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/custom/CTabItem.d
--- 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 true
to indicate that the receiver's close button should be shown.
* Otherwise return false
. The initial value is defined by the style (DWT.CLOSE)
* that was used to create the receiver.
- *
+ *
* @return true
if the close button should be shown
*
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
- *
+ *
* @since 3.4
*/
public bool getShowClose() {
@@ -1021,14 +1021,14 @@
* Sets to true
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
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
- *
+ *
* @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;
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/custom/PopupList.d
--- 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
-* - ERROR_NULL_ARGUMENT - if the items array is null
* - ERROR_INVALID_ARGUMENT - if an item in the items array is null
*
* @exception DWTException
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/custom/StyledText.d
--- 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 @@
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT when listener is null
- *
*/
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 @@
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT when string is null
- *
*/
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 @@
*
* @exception IllegalArgumentException
* - ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())
- * - ERROR_NULL_ARGUMENT when ranges is null
*
*
* @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 @@
* - ERROR_INVALID_RANGE when either start or end is outside the valid range (0 <= offset <= getCharCount())
* - 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
- * - ERROR_NULL_ARGUMENT when string is null
*
*/
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 @@
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT when the list of ranges is null
* - ERROR_INVALID_RANGE when the last of the style ranges is outside the valid range (> getCharCount())
*
*
@@ -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 @@
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT when string is null
- *
*/
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();
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/custom/TableTree.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the array of items is null
+ * - ERROR_NULL_ARGUMENT - if one of the items is null
* - ERROR_INVALID_ARGUMENT - if one of the item has been disposed
*
* @exception DWTException
@@ -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();
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/custom/TableTreeItem.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
* - ERROR_WIDGET_DISPOSED when the widget has been disposed
@@ -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) {
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/dnd/Clipboard.d
--- 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;
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/dnd/FileTransfer.d
--- 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 );
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/dnd/TextTransfer.d
--- 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 TextTransfer
provides a platform specific mechanism
* for converting plain text represented as a java String
@@ -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 );
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/dnd/Transfer.d
--- 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;
/**
* Transfer
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);
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/dnd/URLTransfer.d
--- 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));
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/dwthelper/utils.d
--- 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,
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/graphics/Device.d
--- 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; inull
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT when extension is null
- *
*/
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);
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Button.d
--- 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 @@
*
* @param string the new text
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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);
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/ColorDialog.d
--- 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
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Combo.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)
*
* @exception DWTException
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -1426,9 +1420,6 @@
* @param start the zero-relative index at which to begin the search
* @return the index of the item
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
* - ERROR_INVALID_ARGUMENT - if the string is not found in the list
*
* @exception DWTException
@@ -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
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
- * - ERROR_NULL_ARGUMENT - if the string is null
*
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -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
- * - ERROR_NULL_ARGUMENT - if the items array is null
* - ERROR_INVALID_ARGUMENT - if an item in the items array is null
*
* @exception DWTException
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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);
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Control.d
--- 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);
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/CoolBar.d
--- 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 @@
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if item order or sizes is null
* - ERROR_INVALID_ARGUMENT - if item order or sizes is not the same length as the number of items
*
*/
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/CoolItem.d
--- 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;
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Decorations.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the array of images is null
* - ERROR_INVALID_ARGUMENT - if one of the images is null or has been disposed
*
* @exception DWTException
@@ -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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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;
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Dialog.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
*/
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;
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/DirectoryDialog.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
*/
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;
}
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Display.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the key is null
- *
* @exception DWTException
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
* - ERROR_DEVICE_DISPOSED - if the receiver has been disposed
@@ -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
- * - ERROR_NULL_ARGUMENT - if the key is null
- *
* @exception DWTException
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
* - ERROR_DEVICE_DISPOSED - if the receiver has been disposed
@@ -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;
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/ExpandItem.d
--- 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 ();
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/FileDialog.d
--- 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);
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/FontDialog.d
--- 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) {
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Group.d
--- 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 @@
*
* @param string the new text
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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());
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/IME.d
--- 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 );
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Item.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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;
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Label.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Link.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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));
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/List.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)
*
* @exception DWTException
@@ -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
- * - ERROR_NULL_ARGUMENT - if the set of indices is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -854,9 +846,6 @@
* @param start the zero-relative index at which to start the search
* @return the index of the item
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
* - ERROR_INVALID_ARGUMENT - if the string is not found in the list
*
* @exception DWTException
@@ -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
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
- * - ERROR_NULL_ARGUMENT - if the indices array is null
*
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -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
- * - ERROR_NULL_ARGUMENT - if the array of indices is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
- * - ERROR_NULL_ARGUMENT - if the string is null
*
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -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
- * - ERROR_NULL_ARGUMENT - if the items array is null
* - ERROR_INVALID_ARGUMENT - if an item in the items array is null
*
* @exception DWTException
@@ -1399,9 +1386,6 @@
*
* @param indices the indices of the items to select
*
- * @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the array of indices is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the array of items is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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;
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Menu.d
--- 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) {
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/MenuItem.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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);
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/MessageBox.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
*/
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;
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Scrollable.d
--- 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
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Shell.d
--- 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 ();
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Spinner.d
--- 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 () {
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/TabFolder.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the items array is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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 {
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/TabItem.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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() );
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Table.d
--- 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
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
- * - ERROR_NULL_ARGUMENT - if the indices array is null
*
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -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
- * - ERROR_NULL_ARGUMENT - if the set of indices is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
* - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
- * - ERROR_NULL_ARGUMENT - if the indices array is null
*
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -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
- * - ERROR_NULL_ARGUMENT - if the array of indices is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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 @@
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the item order is null
* - ERROR_INVALID_ARGUMENT - if the item order is not the same length as the number of items
*
*
@@ -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
- * - ERROR_NULL_ARGUMENT - if the array of indices is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the array of items is null
* - ERROR_INVALID_ARGUMENT - if one of the items has been disposed
*
* @exception DWTException
@@ -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;
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/TableColumn.d
--- 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() );
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/TableItem.d
--- 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);
/*
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Text.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is
null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the string is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/ToolItem.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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;
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/ToolTip.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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);
}
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Tracker.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the set of rectangles is null or contains a null rectangle
+ * - ERROR_NULL_ARGUMENT - if the set of rectangles contains a null rectangle
*
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
@@ -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++) {
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/TrayItem.d
--- 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;
/**
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/Tree.d
--- 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 @@
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
*
* @exception IllegalArgumentException
- * - ERROR_NULL_ARGUMENT - if the item order is null
* - ERROR_INVALID_ARGUMENT - if the item order is not the same length as the number of items
*
*
@@ -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
- * - ERROR_NULL_ARGUMENT - if the array of items is null
* - ERROR_INVALID_ARGUMENT - if one of the items has been disposed
*
* @exception DWTException
@@ -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;
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/TreeColumn.d
--- 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());
diff -r 8bca790583c3 -r 5a30aa9820f3 dwt/widgets/TreeItem.d
--- 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
- * - ERROR_NULL_ARGUMENT - if the array of images is null
* - ERROR_INVALID_ARGUMENT - if one of the images has been disposed
*
* @exception DWTException
@@ -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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the text is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the key is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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
- * - ERROR_NULL_ARGUMENT - if the key is null
- *
* @exception DWTException
* - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
* - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
@@ -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;
}
}