2007-08-05 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Sun, 5 Aug 2007 16:49:09 +0000 (16:49 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Sun, 5 Aug 2007 16:49:09 +0000 (16:49 -0000)
* data/Makefile.am (pkgconfig_DATA): Move the pc.in files to the
data directory to keep the toplevel directory clean.

svn path=/trunk/mono/; revision=83507

109 files changed:
Makefile.am
configure.in
data/Makefile.am
data/cecil.pc.in [new file with mode: 0644]
data/dotnet.pc.in [new file with mode: 0644]
data/mint.pc.in [new file with mode: 0644]
data/mono-cairo.pc.in [new file with mode: 0644]
data/mono.pc.in [new file with mode: 0644]
dotnet.pc.in [deleted file]
mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ChangeLog
mcs/class/Mainsoft.Web/Mainsoft.Web.Hosting/ServletWorkerRequest.jvm.cs
mcs/class/Managed.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiControlStrip.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiWindowManager.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDownMenu.cs
mcs/class/Mono.Cecil/CodeGen/cecil-gen-attributes.rb
mcs/class/Mono.Cecil/Mono.Cecil/FieldDefinition.cs
mcs/class/Mono.Cecil/Mono.Cecil/GenericParameter.cs
mcs/class/Mono.Cecil/Mono.Cecil/MethodDefinition.cs
mcs/class/Mono.Cecil/Mono.Cecil/PInvokeInfo.cs
mcs/class/Mono.Cecil/Mono.Cecil/Resource.cs
mcs/class/Mono.Cecil/Mono.Cecil/TypeDefinition.cs
mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlHead.cs
mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs
mcs/class/System.Web/System.Web.UI.WebControls/BulletedList.cs
mcs/class/System.Web/System.Web.UI.WebControls/Button.cs
mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs
mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs
mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
mcs/class/System.Web/System.Web.UI.WebControls/DataControlFieldHeaderCell.cs
mcs/class/System.Web/System.Web.UI.WebControls/FileUpload.cs
mcs/class/System.Web/System.Web.UI.WebControls/HiddenField.cs
mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs
mcs/class/System.Web/System.Web.UI.WebControls/ImageMap.cs
mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs
mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs
mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs
mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs
mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs
mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs
mcs/class/System.Web/System.Web.UI.WebControls/Table.cs
mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs
mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs
mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs
mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs
mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
mcs/class/System.Web/System.Web.UI/ChangeLog
mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HttpUtility.cs
mcs/class/System.Web/System.Web/SiteMapNode.cs
mcs/class/System.XML/System.Xml/ChangeLog
mcs/class/System.XML/System.Xml/DTDObjectModel.cs
mcs/class/System.XML/System.Xml/XmlConvert.cs
mcs/class/System.XML/System.Xml/XmlReaderBinarySupport.cs
mcs/class/System.XML/System.Xml/XmlTextReader.cs
mcs/class/System.XML/System.Xml/XmlUrlResolver.cs
mcs/class/System/System.ComponentModel/ChangeLog
mcs/class/System/System.ComponentModel/ComponentCollection.cs
mcs/class/System/System.Diagnostics/ChangeLog
mcs/class/System/System.Diagnostics/FileVersionInfo.cs
mcs/class/System/System.Diagnostics/Process.cs
mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs
mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs
mcs/class/System/System.Net/ChangeLog
mcs/class/System/System.Net/Dns.cs
mcs/class/corlib/Test/System.Reflection/ChangeLog
mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
mcs/class/corlib/Test/System/AppDomainTest.cs
mcs/class/corlib/Test/System/ChangeLog
mcs/class/corlib/Test/System/TypeTest.cs
mcs/mcs/ChangeLog
mcs/mcs/anonymous.cs
mcs/mcs/expression.cs
mcs/tests/gtest-336.cs [new file with mode: 0644]
mcs/tools/linker/ChangeLog
mcs/tools/linker/Descriptors/mscorlib.xml
mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs
mcs/tools/tuner/ChangeLog
mcs/tools/tuner/Descriptors/smcs.xml [new file with mode: 0644]
mcs/tools/tuner/Makefile
mcs/tools/tuner/Mono.Tuner.csproj [new file with mode: 0644]
mcs/tools/tuner/Mono.Tuner/CheckVisibility.cs
mcs/tools/tuner/Mono.Tuner/PrintStatus.cs
mcs/tools/tuner/Mono.Tuner/RemoveSerialization.cs
mint.pc.in [deleted file]
mono-cairo.pc.in [deleted file]
mono.pc.in [deleted file]
mono/metadata/ChangeLog
mono/metadata/class.c
mono/metadata/domain.c
mono/metadata/icall-def.h
mono/metadata/icall.c
mono/metadata/image.c
mono/metadata/object.c
mono/metadata/threads-types.h
mono/metadata/threads.c
mono/mini/ChangeLog
mono/mini/mini-s390.c

index 05fe9b9ea4f8c92298e568fd50a2a33aef4167cb..12af7d609bc94bdbd6019e72e12a830f269360d2 100644 (file)
@@ -7,7 +7,7 @@ SUBDIRS = $(libgc_dir) mono $(ikvm_native_dir) support docs data runtime scripts
 ## 'tools' is not normally built
 DIST_SUBDIRS = libgc mono ikvm-native support docs data runtime scripts man samples web tools msvc
 
-EXTRA_DIST= mono.pc.in mint.pc.in mono-uninstalled.pc.in dotnet.pc.in mono-cairo.pc.in LICENSE
+EXTRA_DIST= mono-uninstalled.pc.in LICENSE
 
 DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
 
@@ -17,17 +17,8 @@ dist-hook:
        d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) PROFILE=default distdir=$$d dist-recursive
 
 pkgconfigdir = $(libdir)/pkgconfig
-if JIT_SUPPORTED
-if INTERP_SUPPORTED
-pkgconfig_DATA= mono.pc mint.pc dotnet.pc mono-cairo.pc
-else
-pkgconfig_DATA= mono.pc dotnet.pc mono-cairo.pc
-endif
-else
-pkgconfig_DATA= mint.pc mono-cairo.pc
-endif
 noinst_DATA = mono-uninstalled.pc
-DISTCLEANFILES= mono.pc mint.pc mono-uninstalled.pc dotnet.pc mono-cairo.pc
+DISTCLEANFILES= mono-uninstalled.pc
 
 .PHONY: get-monolite-latest mcs-do-compiler-tests compiler-tests bootstrap-world
 
index 9a79bb93227c9fdd5c011e00ba68f63379d0ddf0..838fbf8edcd5a0ab33f19767c00cdc151dba1a14 100644 (file)
@@ -2051,10 +2051,6 @@ AC_CONFIG_COMMANDS([runtime/etc/mono/browscap.ini],
 
 AC_OUTPUT([
 Makefile
-mint.pc
-mono.pc
-mono-cairo.pc
-dotnet.pc
 mono-uninstalled.pc
 scripts/mono-nunit.pc
 scripts/mono-find-provides
@@ -2100,6 +2096,11 @@ docs/Makefile
 data/Makefile
 data/net_1_1/Makefile
 data/net_2_0/Makefile
+data/mint.pc
+data/mono.pc
+data/mono-cairo.pc
+data/dotnet.pc
+data/cecil.pc
 samples/Makefile
 support/Makefile
 data/config
index d80780ee0f2d99d637d4dcfd59f4925f74912e95..d4eb32a3d51938d25ce0466e130e51e685e75060 100644 (file)
@@ -2,8 +2,24 @@ SUBDIRS = net_1_1 net_2_0
 
 monodir = $(sysconfdir)/mono
 
-EXTRA_DIST =  config.in \
-            browscap.ini mono.supp README
+EXTRA_DIST =   \
+       config.in \
+       browscap.ini mono.supp README \
+       mono.pc.in mint.pc.in dotnet.pc.in mono-cairo.pc.in cecil.pc.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+
+if JIT_SUPPORTED
+if INTERP_SUPPORTED
+pkgconfig_DATA= mono.pc mint.pc dotnet.pc mono-cairo.pc cecil.pc
+else
+pkgconfig_DATA= mono.pc dotnet.pc mono-cairo.pc cecil.pc
+endif
+else
+pkgconfig_DATA= mint.pc mono-cairo.pc cecil.pc
+endif
+
+DISTCLEANFILES= mono.pc mint.pc dotnet.pc mono-cairo.pc cecil.pc
 
 mono_DATA =  config \
             browscap.ini
diff --git a/data/cecil.pc.in b/data/cecil.pc.in
new file mode 100644 (file)
index 0000000..0e4cf5e
--- /dev/null
@@ -0,0 +1,7 @@
+assemblies_dir=@prefix@/lib/mono
+Libraries=${assemblies_dir}/gac/Mono.Cecil/0.5.0.1__0738eb9f132ed756/Mono.Cecil.dll
+
+Name: Mono Internal -- Do not use.
+Description: Mono Internal Libraries -- Do not use 
+Version: @VERSION@
+Libs: -r:Mono.Cecil.dll
diff --git a/data/dotnet.pc.in b/data/dotnet.pc.in
new file mode 100644 (file)
index 0000000..e9b2b76
--- /dev/null
@@ -0,0 +1,5 @@
+
+Name: Standard libraries in a .NET setup
+Description: References all the standard .NET libraries for compilation
+Version: @VERSION@
+Libs: -r:Accessibility.dll -r:cscompmgd.dll -r:Microsoft.JScript.dll -r:Microsoft.VisualC.dll -r:Microsoft.Vsa.dll -r:System.Configuration.Install.dll -r:System.Data.dll -r:System.Data.OracleClient.dll -r:System.Design.dll -r:System.DirectoryServices.dll -r:System.dll -r:System.Drawing.Design.dll -r:System.Drawing.dll -r:System.EnterpriseServices.dll -r:System.Management.dll -r:System.Messaging.dll -r:System.Runtime.Remoting.dll -r:System.Runtime.Serialization.Formatters.Soap.dll -r:System.Security.dll -r:System.ServiceProcess.dll -r:System.Web.dll -r:System.Web.Services.dll -r:System.Windows.Forms.dll -r:System.Xml.dll
diff --git a/data/mint.pc.in b/data/mint.pc.in
new file mode 100644 (file)
index 0000000..0b91a2c
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=${pcfiledir}/../..
+exec_prefix=${pcfiledir}/../..
+libdir=${prefix}/lib
+includedir=${prefix}/include/mono-@API_VER@
+
+
+Name: Mono Interpreter
+Description: Mono Interpreter Runtime
+Version: @VERSION@
+Requires: glib-2.0 gthread-2.0
+Libs: -L${libdir} @export_ldflags@ -lmint @libmono_ldflags@
+Cflags: -I${includedir} @libmono_cflags@
diff --git a/data/mono-cairo.pc.in b/data/mono-cairo.pc.in
new file mode 100644 (file)
index 0000000..2a5c07f
--- /dev/null
@@ -0,0 +1,9 @@
+prefix=${pcfiledir}/../..
+exec_prefix=${pcfiledir}/../..
+libdir=${prefix}/@reloc_libdir@
+includedir=${prefix}/include
+
+Name: Mono.Cairo
+Description: Cairo bindings for Mono
+Version: @VERSION@
+Libs: -r:${prefix}/lib/mono/1.0/Mono.Cairo.dll
diff --git a/data/mono.pc.in b/data/mono.pc.in
new file mode 100644 (file)
index 0000000..9374c19
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=${pcfiledir}/../..
+exec_prefix=${pcfiledir}/../..
+libdir=${prefix}/@reloc_libdir@
+includedir=${prefix}/include/mono-@API_VER@
+
+Name: Mono
+Description: Mono Runtime
+Version: @VERSION@
+Requires: glib-2.0 gthread-2.0
+Libs: -L${libdir} @export_ldflags@ -lmono @libmono_ldflags@
+Cflags: -I${includedir} @libmono_cflags@
diff --git a/dotnet.pc.in b/dotnet.pc.in
deleted file mode 100644 (file)
index e9b2b76..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-
-Name: Standard libraries in a .NET setup
-Description: References all the standard .NET libraries for compilation
-Version: @VERSION@
-Libs: -r:Accessibility.dll -r:cscompmgd.dll -r:Microsoft.JScript.dll -r:Microsoft.VisualC.dll -r:Microsoft.Vsa.dll -r:System.Configuration.Install.dll -r:System.Data.dll -r:System.Data.OracleClient.dll -r:System.Design.dll -r:System.DirectoryServices.dll -r:System.dll -r:System.Drawing.Design.dll -r:System.Drawing.dll -r:System.EnterpriseServices.dll -r:System.Management.dll -r:System.Messaging.dll -r:System.Runtime.Remoting.dll -r:System.Runtime.Serialization.Formatters.Soap.dll -r:System.Security.dll -r:System.ServiceProcess.dll -r:System.Web.dll -r:System.Web.Services.dll -r:System.Windows.Forms.dll -r:System.Xml.dll
index 4fb3271a8bb34c442e8a4fd309fe7caf2435d2ee..8cfacad859814adb6e0daa87e9af91808cd236f7 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-05  Vladimir Krasnov  <vladimirk@mainsoft.com>\r
+\r
+       * ServletWorkerRequest.jvm.cs: fixed _OutputStream in\r
+       ServletWorkerRequest ctor\r
+\r
 2007-06-28  Vladimir Krasnov  <vladimirk@mainsoft.com>\r
 \r
        * BaseHttpServlet.cs: fixed service(), it does not creates output\r
index 427f9bb683364f349c154b30800ef35949a36360..d0005ede0456b0a1335e1cb7d15b909733d41acb 100644 (file)
@@ -102,7 +102,7 @@ namespace Mainsoft.Web.Hosting {
                        _HttpServletResponse = resp;
 
                        if (alwaysUsePrintWriter)
-                               _OutputStream = new OutputStreamWrapper (resp.getWriter ());
+                               _OutputStream = CreateOutputStream (false);
 
                        string contextPath = req.getContextPath();
                        string servletPath = req.getServletPath ();
index bafe368c6446af746c0b58064e0d7035915a0452..2794e488dea1ef1d1e1f61f0dd8d295717168e76 100644 (file)
@@ -1,3 +1,7 @@
+2007-08-02  Jonathan Pobst  <monkey@jpobst.com>
+
+       * System.Windows.Forms.dll.sources: Add MdiControlStrip.cs.
+
 2007-07-31  Rolf Bjarne Kvinge <RKvinge@novell.com> 
 
        * build-csproj2k5-tests: Add ONLY_1_1, __MONO_CS__ and DEBUG where
index a15e8f763057b472b338c5491c9fd748e4659246..c0ad66e141d28798b25b1a929114fe7b6bb3c049 100644 (file)
@@ -455,6 +455,7 @@ System.Windows.Forms/MaskInputRejectedEventArgs.cs
 System.Windows.Forms/MaskInputRejectedEventHandler.cs
 System.Windows.Forms/MaskedTextBox.cs
 System.Windows.Forms/MdiClient.cs
+System.Windows.Forms/MdiControlStrip.cs
 System.Windows.Forms/MdiLayout.cs
 System.Windows.Forms/MdiWindowManager.cs
 System.Windows.Forms/MeasureItemEventArgs.cs
index 48ab005b3aa342a02e3290917735ddc26613879e..da43df7720f8dbb71ba0033876cc28754f18526f 100644 (file)
@@ -1,3 +1,14 @@
+2007-08-02  Jonathan Pobst  <monkey@jpobst.com>
+
+       * MdiClient.cs, MdiWindowManager.cs: Support 2.0 Mdi MenuStrip
+       folding.
+       * MdiControlStrip.cs: Added.  These are the menu items used in mdi
+       folding.
+       * ToolStrip.cs: Add a null check to mnemonics.
+       * ToolStripDropDownMenu.cs: When using a SystemMenuItem, there is
+       no ConnectedArea.
+       [Fixes most of bug #81689]
+
 2007-08-02  Rolf Bjarne Kvinge <RKvinge@novell.com> 
 
        * PropertyGrid.cs: Add a null-check. Fixes #82289/SVGPad.
index 4a57b97fbf6a4edf0996778b6fd6ca9b83c003c3..54cd72c088189cff2e76e46fccece74e89908802 100644 (file)
@@ -832,6 +832,15 @@ namespace System.Windows.Forms {
                                        if (c is MenuStrip)
                                                child_menu = (MenuStrip)c;
 
+                               RemoveControlMenuItems (wm);
+                               
+                               if (form.WindowState == FormWindowState.Maximized) {
+                                       parent_menu.Items.Insert (0, new MdiControlStrip.SystemMenuItem (form));
+                                       parent_menu.Items.Add (new MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Close));
+                                       parent_menu.Items.Add (new MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Max));
+                                       parent_menu.Items.Add (new MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Min));
+                               }
+                               
                                if (child_menu != null)
                                        ToolStripManager.Merge (child_menu, parent_menu);
                        }
@@ -840,6 +849,18 @@ namespace System.Windows.Forms {
                        return maximize_this;
                }
 
+#if NET_2_0
+               internal void RemoveControlMenuItems (MdiWindowManager wm)
+               {
+                       Form form = wm.form;
+                       MenuStrip parent_menu = form.MdiParent.MainMenuStrip;
+                       
+                       for (int i = parent_menu.Items.Count - 1; i >= 0; i--)
+                               if (parent_menu.Items[i] is MdiControlStrip.SystemMenuItem || parent_menu.Items[i] is MdiControlStrip.ControlBoxMenuItem)
+                                       parent_menu.Items.RemoveAt (i);
+               }
+#endif
+
                internal void SetWindowState (Form form, FormWindowState old_window_state, FormWindowState new_window_state, bool is_activating_child)
                {
                        bool mdiclient_layout;
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiControlStrip.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiControlStrip.cs
new file mode 100644 (file)
index 0000000..beda67f
--- /dev/null
@@ -0,0 +1,199 @@
+//\r
+// MdiControlStrip.cs\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+// Copyright (c) 2006 Novell, Inc.\r
+//\r
+// Authors:\r
+//     Jonathan Pobst (monkey@jpobst.com)\r
+//\r
+\r
+#if NET_2_0\r
+using System;\r
+using System.Runtime.InteropServices;\r
+using System.ComponentModel;\r
+using System.Drawing;\r
+using System.Windows.Forms.Layout;\r
+using System.Collections.Generic;\r
+using System.ComponentModel.Design.Serialization;\r
+\r
+namespace System.Windows.Forms\r
+{\r
+       internal class MdiControlStrip\r
+       {\r
+               public class SystemMenuItem : ToolStripMenuItem\r
+               {\r
+                       private Form form;\r
+                       \r
+                       public SystemMenuItem (Form ownerForm)\r
+                       {\r
+                               form = ownerForm;\r
+                               \r
+                               base.AutoSize = false;\r
+                               base.Size = new Size (20, 20);\r
+                               base.Image = ownerForm.Icon.ToBitmap ();\r
+                               base.MergeIndex = int.MinValue;\r
+                               base.DisplayStyle = ToolStripItemDisplayStyle.Image;\r
+\r
+                               DropDownItems.Add ("&Restore", null, RestoreItemHandler);\r
+                               ToolStripMenuItem tsiMove = (ToolStripMenuItem)DropDownItems.Add ("&Move");\r
+                               tsiMove.Enabled = false;\r
+                               ToolStripMenuItem tsiSize = (ToolStripMenuItem)DropDownItems.Add ("&Size");\r
+                               tsiSize.Enabled = false;\r
+                               DropDownItems.Add ("Mi&nimize", null, MinimizeItemHandler);\r
+                               ToolStripMenuItem tsiMaximize = (ToolStripMenuItem)DropDownItems.Add ("Ma&ximize");\r
+                               tsiMaximize.Enabled = false;\r
+                               DropDownItems.Add ("-");\r
+                               ToolStripMenuItem tsiClose = (ToolStripMenuItem)DropDownItems.Add ("&Close", null, CloseItemHandler);\r
+                               tsiClose.ShortcutKeys = Keys.Control | Keys.F4;\r
+                               DropDownItems.Add ("-");\r
+                               ToolStripMenuItem tsiNext = (ToolStripMenuItem)DropDownItems.Add ("Nex&t", null, NextItemHandler);\r
+                               tsiNext.ShortcutKeys = Keys.Control | Keys.F6;\r
+                       }\r
+\r
+                       protected override void OnPaint (PaintEventArgs e)\r
+                       {\r
+                               // Can't render without an owner\r
+                               if (this.Owner == null)\r
+                                       return;\r
+\r
+                               // If DropDown.ShowImageMargin is false, we don't display the image\r
+                               Image draw_image = this.Image;\r
+\r
+                               // Figure out where our text and image go\r
+                               Rectangle text_layout_rect;\r
+                               Rectangle image_layout_rect;\r
+\r
+                               this.CalculateTextAndImageRectangles (out text_layout_rect, out image_layout_rect);\r
+\r
+                               if (image_layout_rect != Rectangle.Empty)\r
+                                       this.Owner.Renderer.DrawItemImage (new ToolStripItemImageRenderEventArgs (e.Graphics, this, draw_image, image_layout_rect));\r
+\r
+                               return;\r
+                       }\r
+\r
+                       private void RestoreItemHandler (object sender, EventArgs e)\r
+                       {\r
+                               form.WindowState = FormWindowState.Normal;\r
+                       }\r
+\r
+                       private void MinimizeItemHandler (object sender, EventArgs e)\r
+                       {\r
+                               form.WindowState = FormWindowState.Minimized;\r
+                       }\r
+\r
+                       private void CloseItemHandler (object sender, EventArgs e)\r
+                       {\r
+                               form.Close ();\r
+                       }\r
+\r
+                       private void NextItemHandler (object sender, EventArgs e)\r
+                       {\r
+                               form.MdiParent.MdiContainer.ActivateNextChild ();\r
+                       }\r
+               }\r
+               \r
+               public class ControlBoxMenuItem : ToolStripMenuItem\r
+               {\r
+                       private Form form;\r
+                       private ControlBoxType type;\r
+                       \r
+                       public ControlBoxMenuItem (Form ownerForm, ControlBoxType type)\r
+                       {\r
+                               form = ownerForm;\r
+                               this.type = type;\r
+                               \r
+                               base.AutoSize = false;\r
+                               base.Alignment = ToolStripItemAlignment.Right;\r
+                               base.Size = new Size (20, 20);\r
+                               base.MergeIndex = int.MaxValue;\r
+                               base.DisplayStyle = ToolStripItemDisplayStyle.None;\r
+\r
+                               switch (type) {\r
+                                       case ControlBoxType.Close:\r
+                                               this.Click += new EventHandler(CloseItemHandler);\r
+                                               break;\r
+                                       case ControlBoxType.Min:\r
+                                               this.Click += new EventHandler (MinimizeItemHandler);\r
+                                               break;\r
+                                       case ControlBoxType.Max:\r
+                                               this.Click += new EventHandler (RestoreItemHandler);\r
+                                               break;\r
+                               }\r
+                       }\r
+\r
+                       protected override void OnPaint (PaintEventArgs e)\r
+                       {\r
+                               base.OnPaint (e);\r
+                               Graphics g = e.Graphics;\r
+                               \r
+                               switch (type) {\r
+                                       case ControlBoxType.Close:\r
+                                               g.FillRectangle (Brushes.Black, 8, 8, 4, 4);\r
+                                               g.FillRectangle (Brushes.Black, 6, 6, 2, 2);\r
+                                               g.FillRectangle (Brushes.Black, 6, 12, 2, 2);\r
+                                               g.FillRectangle (Brushes.Black, 12, 6, 2, 2);\r
+                                               g.FillRectangle (Brushes.Black, 12, 12, 2, 2);\r
+                                               g.DrawLine (Pens.Black, 8, 7, 8, 12);\r
+                                               g.DrawLine (Pens.Black, 7, 8, 12, 8);\r
+                                               g.DrawLine (Pens.Black, 11, 7, 11, 12);\r
+                                               g.DrawLine (Pens.Black, 7, 11, 12, 11);\r
+                                               break;\r
+                                       case ControlBoxType.Min:\r
+                                               g.DrawLine (Pens.Black, 6, 12, 11, 12);\r
+                                               g.DrawLine (Pens.Black, 6, 13, 11, 13);\r
+                                               break;\r
+                                       case ControlBoxType.Max:\r
+                                               g.DrawLines (Pens.Black, new Point[] {new Point (7, 8), new Point (7, 5), new Point (13, 5), new Point (13, 10), new Point (11, 10)});\r
+                                               g.DrawLine (Pens.Black, 7, 6, 12, 6);\r
+                                               \r
+                                               g.DrawRectangle (Pens.Black, new Rectangle (5, 8, 6, 5));\r
+                                               g.DrawLine (Pens.Black, 5, 9, 11, 9);\r
+                                               \r
+                                               break;\r
+                               }\r
+                       }\r
+\r
+                       private void RestoreItemHandler (object sender, EventArgs e)\r
+                       {\r
+                               form.WindowState = FormWindowState.Normal;\r
+                       }\r
+\r
+                       private void MinimizeItemHandler (object sender, EventArgs e)\r
+                       {\r
+                               form.WindowState = FormWindowState.Minimized;\r
+                       }\r
+\r
+                       private void CloseItemHandler (object sender, EventArgs e)\r
+                       {\r
+                               form.Close ();\r
+                       }\r
+               }\r
+               \r
+               public enum ControlBoxType\r
+               {\r
+                       Close,\r
+                       Min,\r
+                       Max\r
+               }\r
+       }\r
+}\r
+#endif
\ No newline at end of file
index 423e2fee373a85e77dd86e37afbb6529e6fa4f86..4c8d12e5342d49d76cdc82307d0f4f2dbb45ac4f 100644 (file)
@@ -385,6 +385,8 @@ namespace System.Windows.Forms {
 #if NET_2_0
                        if (form.MdiParent.MainMenuStrip != null)
                                form.MdiParent.MainMenuStrip.RefreshMdiItems ();
+
+                       mdi_container.RemoveControlMenuItems (this);
 #endif
                }
 
index c5d591c01914b6341e84a7a1069bf5b52ce62b52..30631078c19574438e67abc31b23f569efa17a7b 100644 (file)
@@ -1108,7 +1108,7 @@ namespace System.Windows.Forms
                {
                        // If any item has an explicit mnemonic, it gets the message
                        foreach (ToolStripItem tsi in this.Items)
-                               if (tsi.Enabled && tsi.Visible && Control.IsMnemonic (charCode, tsi.Text))
+                               if (tsi.Enabled && tsi.Visible && !string.IsNullOrEmpty (tsi.Text) && Control.IsMnemonic (charCode, tsi.Text))
                                        return tsi.ProcessMnemonic (charCode);
 
                        string code = Char.ToUpper (charCode).ToString ();
index aff388e17c93e241a1054e4b01143770d022f217..9d71ab42cdbf65f526bd6068829321c9f613d59c 100644 (file)
@@ -168,7 +168,7 @@ namespace System.Windows.Forms
                #region Internal Methods
                internal override Rectangle CalculateConnectedArea ()
                {
-                       if (this.OwnerItem != null && !this.OwnerItem.IsOnDropDown)
+                       if (this.OwnerItem != null && !this.OwnerItem.IsOnDropDown && !(this.OwnerItem is MdiControlStrip.SystemMenuItem))
                                return new Rectangle (1, 0, this.OwnerItem.Width - 2, 2);
 
                        return base.CalculateConnectedArea ();
index 1ddd203a8881027ca51559219fd54b7931cbe42b..b336275585ed89e590993f61de200ded28ae3e51 100755 (executable)
@@ -85,6 +85,11 @@ class MaskedAttribute < Attribute
        end
 
        protected
+       def getter
+"""                    get { return (m_attributes & #{mask_full_name()}) == #{full_name()}; }
+"""
+       end
+
        def setter
 """                    set {
                                #{type} masked = (#{mask_full_name()} & #{full_name()});
index 38ff65f4f00ec202cf7c6470f99a0170309757a8..b115df0a96540b7a56a1f6401b46e9d4108205d5 100644 (file)
@@ -105,7 +105,7 @@ namespace Mono.Cecil {
                #region FieldAttributes
 
                public bool IsCompilerControlled {
-                       get { return (m_attributes & FieldAttributes.Compilercontrolled) != 0; }
+                       get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Compilercontrolled; }
                        set {
                                FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.Compilercontrolled);
                                if (value)
@@ -116,7 +116,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsPrivate {
-                       get { return (m_attributes & FieldAttributes.Private) != 0; }
+                       get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private; }
                        set {
                                FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.Private);
                                if (value)
@@ -127,7 +127,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsFamilyAndAssembly {
-                       get { return (m_attributes & FieldAttributes.FamANDAssem) != 0; }
+                       get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem; }
                        set {
                                FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.FamANDAssem);
                                if (value)
@@ -138,7 +138,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsAssembly {
-                       get { return (m_attributes & FieldAttributes.Assembly) != 0; }
+                       get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly; }
                        set {
                                FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.Assembly);
                                if (value)
@@ -149,7 +149,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsFamily {
-                       get { return (m_attributes & FieldAttributes.Family) != 0; }
+                       get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family; }
                        set {
                                FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.Family);
                                if (value)
@@ -160,7 +160,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsFamilyOrAssembly {
-                       get { return (m_attributes & FieldAttributes.FamORAssem) != 0; }
+                       get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem; }
                        set {
                                FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.FamORAssem);
                                if (value)
@@ -171,7 +171,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsPublic {
-                       get { return (m_attributes & FieldAttributes.Public) != 0; }
+                       get { return (m_attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public; }
                        set {
                                FieldAttributes masked = (FieldAttributes.FieldAccessMask & FieldAttributes.Public);
                                if (value)
index d5a9c812a5c6b12a773bd45f93fb02464c40282a..05aeb01134e4bc3d3e49fe36f2e3ceca3dae358d 100644 (file)
@@ -88,7 +88,7 @@ namespace Mono.Cecil {
                #region GenericParameterAttributes
 
                public bool IsNonVariant {
-                       get { return (m_attributes & GenericParameterAttributes.NonVariant) != 0; }
+                       get { return (m_attributes & GenericParameterAttributes.VarianceMask) == GenericParameterAttributes.NonVariant; }
                        set {
                                GenericParameterAttributes masked = (GenericParameterAttributes.VarianceMask & GenericParameterAttributes.NonVariant);
                                if (value)
@@ -99,7 +99,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsCovariant {
-                       get { return (m_attributes & GenericParameterAttributes.Covariant) != 0; }
+                       get { return (m_attributes & GenericParameterAttributes.VarianceMask) == GenericParameterAttributes.Covariant; }
                        set {
                                GenericParameterAttributes masked = (GenericParameterAttributes.VarianceMask & GenericParameterAttributes.Covariant);
                                if (value)
@@ -110,7 +110,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsContravariant {
-                       get { return (m_attributes & GenericParameterAttributes.Contravariant) != 0; }
+                       get { return (m_attributes & GenericParameterAttributes.VarianceMask) == GenericParameterAttributes.Contravariant; }
                        set {
                                GenericParameterAttributes masked = (GenericParameterAttributes.VarianceMask & GenericParameterAttributes.Contravariant);
                                if (value)
@@ -121,7 +121,7 @@ namespace Mono.Cecil {
                }
 
                public bool HasReferenceTypeConstraint {
-                       get { return (m_attributes & GenericParameterAttributes.ReferenceTypeConstraint) != 0; }
+                       get { return (m_attributes & GenericParameterAttributes.SpecialConstraintMask) == GenericParameterAttributes.ReferenceTypeConstraint; }
                        set {
                                GenericParameterAttributes masked = (GenericParameterAttributes.SpecialConstraintMask & GenericParameterAttributes.ReferenceTypeConstraint);
                                if (value)
@@ -132,7 +132,7 @@ namespace Mono.Cecil {
                }
 
                public bool HasNotNullableValueTypeConstraint {
-                       get { return (m_attributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0; }
+                       get { return (m_attributes & GenericParameterAttributes.SpecialConstraintMask) == GenericParameterAttributes.NotNullableValueTypeConstraint; }
                        set {
                                GenericParameterAttributes masked = (GenericParameterAttributes.SpecialConstraintMask & GenericParameterAttributes.NotNullableValueTypeConstraint);
                                if (value)
@@ -143,7 +143,7 @@ namespace Mono.Cecil {
                }
 
                public bool HasDefaultConstructorConstraint {
-                       get { return (m_attributes & GenericParameterAttributes.DefaultConstructorConstraint) != 0; }
+                       get { return (m_attributes & GenericParameterAttributes.SpecialConstraintMask) == GenericParameterAttributes.DefaultConstructorConstraint; }
                        set {
                                GenericParameterAttributes masked = (GenericParameterAttributes.SpecialConstraintMask & GenericParameterAttributes.DefaultConstructorConstraint);
                                if (value)
index 93063fd95a1a8f936a23abc1d1759bd8264b0ad8..dcf1e96311e45f9ca636acf1c66c9af281476892 100644 (file)
@@ -128,7 +128,7 @@ namespace Mono.Cecil {
                #region MethodAttributes
 
                public bool IsCompilerControlled {
-                       get { return (m_attributes & MethodAttributes.Compilercontrolled) != 0; }
+                       get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Compilercontrolled; }
                        set {
                                MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.Compilercontrolled);
                                if (value)
@@ -139,7 +139,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsPrivate {
-                       get { return (m_attributes & MethodAttributes.Private) != 0; }
+                       get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private; }
                        set {
                                MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.Private);
                                if (value)
@@ -150,7 +150,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsFamilyAndAssembly {
-                       get { return (m_attributes & MethodAttributes.FamANDAssem) != 0; }
+                       get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamANDAssem; }
                        set {
                                MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.FamANDAssem);
                                if (value)
@@ -161,7 +161,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsAssembly {
-                       get { return (m_attributes & MethodAttributes.Assem) != 0; }
+                       get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assem; }
                        set {
                                MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.Assem);
                                if (value)
@@ -172,7 +172,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsFamily {
-                       get { return (m_attributes & MethodAttributes.Family) != 0; }
+                       get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Family; }
                        set {
                                MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.Family);
                                if (value)
@@ -183,7 +183,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsFamilyOrAssembly {
-                       get { return (m_attributes & MethodAttributes.FamORAssem) != 0; }
+                       get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem; }
                        set {
                                MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.FamORAssem);
                                if (value)
@@ -194,7 +194,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsPublic {
-                       get { return (m_attributes & MethodAttributes.Public) != 0; }
+                       get { return (m_attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public; }
                        set {
                                MethodAttributes masked = (MethodAttributes.MemberAccessMask & MethodAttributes.Public);
                                if (value)
@@ -245,7 +245,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsReuseSlot {
-                       get { return (m_attributes & MethodAttributes.ReuseSlot) != 0; }
+                       get { return (m_attributes & MethodAttributes.VtableLayoutMask) == MethodAttributes.ReuseSlot; }
                        set {
                                MethodAttributes masked = (MethodAttributes.VtableLayoutMask & MethodAttributes.ReuseSlot);
                                if (value)
@@ -256,7 +256,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsNewSlot {
-                       get { return (m_attributes & MethodAttributes.NewSlot) != 0; }
+                       get { return (m_attributes & MethodAttributes.VtableLayoutMask) == MethodAttributes.NewSlot; }
                        set {
                                MethodAttributes masked = (MethodAttributes.VtableLayoutMask & MethodAttributes.NewSlot);
                                if (value)
index 7d45ca320462c2197a00b3b9d20167035bff8d04..b4223939c7726eace19db3b47c0b8e166535762d 100644 (file)
@@ -68,7 +68,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsCharSetNotSpec {
-                       get { return (m_attributes & PInvokeAttributes.CharSetNotSpec) != 0; }
+                       get { return (m_attributes & PInvokeAttributes.CharSetMask) == PInvokeAttributes.CharSetNotSpec; }
                        set {
                                PInvokeAttributes masked = (PInvokeAttributes.CharSetMask & PInvokeAttributes.CharSetNotSpec);
                                if (value)
@@ -79,7 +79,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsCharSetAnsi {
-                       get { return (m_attributes & PInvokeAttributes.CharSetAnsi) != 0; }
+                       get { return (m_attributes & PInvokeAttributes.CharSetMask) == PInvokeAttributes.CharSetAnsi; }
                        set {
                                PInvokeAttributes masked = (PInvokeAttributes.CharSetMask & PInvokeAttributes.CharSetAnsi);
                                if (value)
@@ -90,7 +90,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsCharSetUnicode {
-                       get { return (m_attributes & PInvokeAttributes.CharSetUnicode) != 0; }
+                       get { return (m_attributes & PInvokeAttributes.CharSetMask) == PInvokeAttributes.CharSetUnicode; }
                        set {
                                PInvokeAttributes masked = (PInvokeAttributes.CharSetMask & PInvokeAttributes.CharSetUnicode);
                                if (value)
@@ -101,7 +101,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsCharSetAuto {
-                       get { return (m_attributes & PInvokeAttributes.CharSetAuto) != 0; }
+                       get { return (m_attributes & PInvokeAttributes.CharSetMask) == PInvokeAttributes.CharSetAuto; }
                        set {
                                PInvokeAttributes masked = (PInvokeAttributes.CharSetMask & PInvokeAttributes.CharSetAuto);
                                if (value)
@@ -112,7 +112,7 @@ namespace Mono.Cecil {
                }
 
                public bool SupportsLastError {
-                       get { return (m_attributes & PInvokeAttributes.SupportsLastError) != 0; }
+                       get { return (m_attributes & PInvokeAttributes.CharSetMask) == PInvokeAttributes.SupportsLastError; }
                        set {
                                PInvokeAttributes masked = (PInvokeAttributes.CharSetMask & PInvokeAttributes.SupportsLastError);
                                if (value)
@@ -123,7 +123,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsCallConvWinapi {
-                       get { return (m_attributes & PInvokeAttributes.CallConvWinapi) != 0; }
+                       get { return (m_attributes & PInvokeAttributes.CallConvMask) == PInvokeAttributes.CallConvWinapi; }
                        set {
                                PInvokeAttributes masked = (PInvokeAttributes.CallConvMask & PInvokeAttributes.CallConvWinapi);
                                if (value)
@@ -134,7 +134,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsCallConvCdecl {
-                       get { return (m_attributes & PInvokeAttributes.CallConvCdecl) != 0; }
+                       get { return (m_attributes & PInvokeAttributes.CallConvMask) == PInvokeAttributes.CallConvCdecl; }
                        set {
                                PInvokeAttributes masked = (PInvokeAttributes.CallConvMask & PInvokeAttributes.CallConvCdecl);
                                if (value)
@@ -145,7 +145,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsCallConvStdCall {
-                       get { return (m_attributes & PInvokeAttributes.CallConvStdCall) != 0; }
+                       get { return (m_attributes & PInvokeAttributes.CallConvMask) == PInvokeAttributes.CallConvStdCall; }
                        set {
                                PInvokeAttributes masked = (PInvokeAttributes.CallConvMask & PInvokeAttributes.CallConvStdCall);
                                if (value)
@@ -156,7 +156,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsCallConvThiscall {
-                       get { return (m_attributes & PInvokeAttributes.CallConvThiscall) != 0; }
+                       get { return (m_attributes & PInvokeAttributes.CallConvMask) == PInvokeAttributes.CallConvThiscall; }
                        set {
                                PInvokeAttributes masked = (PInvokeAttributes.CallConvMask & PInvokeAttributes.CallConvThiscall);
                                if (value)
@@ -167,7 +167,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsCallConvFastcall {
-                       get { return (m_attributes & PInvokeAttributes.CallConvFastcall) != 0; }
+                       get { return (m_attributes & PInvokeAttributes.CallConvMask) == PInvokeAttributes.CallConvFastcall; }
                        set {
                                PInvokeAttributes masked = (PInvokeAttributes.CallConvMask & PInvokeAttributes.CallConvFastcall);
                                if (value)
index 548aee1270eff6668c7846e30bc75b840c4ea141..a429ca5b3e8d7fa26a7a7bdc6856ccd878bd770d 100644 (file)
@@ -57,7 +57,7 @@ namespace Mono.Cecil {
                #region ManifestResourceAttributes
 
                public bool IsPublic {
-                       get { return (m_attributes & ManifestResourceAttributes.Public) != 0; }
+                       get { return (m_attributes & ManifestResourceAttributes.VisibilityMask) == ManifestResourceAttributes.Public; }
                        set {
                                ManifestResourceAttributes masked = (ManifestResourceAttributes.VisibilityMask & ManifestResourceAttributes.Public);
                                if (value)
@@ -68,7 +68,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsPrivate {
-                       get { return (m_attributes & ManifestResourceAttributes.Private) != 0; }
+                       get { return (m_attributes & ManifestResourceAttributes.VisibilityMask) == ManifestResourceAttributes.Private; }
                        set {
                                ManifestResourceAttributes masked = (ManifestResourceAttributes.VisibilityMask & ManifestResourceAttributes.Private);
                                if (value)
index 13c0132dcef0edacecd10fbbed08f8e4717bb21c..2e3350b4841f53e07f1f0fa2a51afc0f2f8135ce 100644 (file)
@@ -151,7 +151,7 @@ namespace Mono.Cecil {
                #region TypeAttributes
 
                public bool IsNotPublic {
-                       get { return (m_attributes & TypeAttributes.NotPublic) != 0; }
+                       get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NotPublic; }
                        set {
                                TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NotPublic);
                                if (value)
@@ -162,7 +162,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsPublic {
-                       get { return (m_attributes & TypeAttributes.Public) != 0; }
+                       get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.Public; }
                        set {
                                TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.Public);
                                if (value)
@@ -173,7 +173,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsNestedPublic {
-                       get { return (m_attributes & TypeAttributes.NestedPublic) != 0; }
+                       get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic; }
                        set {
                                TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedPublic);
                                if (value)
@@ -184,7 +184,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsNestedPrivate {
-                       get { return (m_attributes & TypeAttributes.NestedPrivate) != 0; }
+                       get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate; }
                        set {
                                TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedPrivate);
                                if (value)
@@ -195,7 +195,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsNestedFamily {
-                       get { return (m_attributes & TypeAttributes.NestedFamily) != 0; }
+                       get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily; }
                        set {
                                TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedFamily);
                                if (value)
@@ -206,7 +206,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsNestedAssembly {
-                       get { return (m_attributes & TypeAttributes.NestedAssembly) != 0; }
+                       get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedAssembly; }
                        set {
                                TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedAssembly);
                                if (value)
@@ -217,7 +217,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsNestedFamilyAndAssembly {
-                       get { return (m_attributes & TypeAttributes.NestedFamANDAssem) != 0; }
+                       get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamANDAssem; }
                        set {
                                TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedFamANDAssem);
                                if (value)
@@ -228,7 +228,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsNestedFamilyOrAssembly {
-                       get { return (m_attributes & TypeAttributes.NestedFamORAssem) != 0; }
+                       get { return (m_attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamORAssem; }
                        set {
                                TypeAttributes masked = (TypeAttributes.VisibilityMask & TypeAttributes.NestedFamORAssem);
                                if (value)
@@ -239,7 +239,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsAutoLayout {
-                       get { return (m_attributes & TypeAttributes.AutoLayout) != 0; }
+                       get { return (m_attributes & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout; }
                        set {
                                TypeAttributes masked = (TypeAttributes.LayoutMask & TypeAttributes.AutoLayout);
                                if (value)
@@ -250,7 +250,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsSequentialLayout {
-                       get { return (m_attributes & TypeAttributes.SequentialLayout) != 0; }
+                       get { return (m_attributes & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout; }
                        set {
                                TypeAttributes masked = (TypeAttributes.LayoutMask & TypeAttributes.SequentialLayout);
                                if (value)
@@ -261,7 +261,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsExplicitLayout {
-                       get { return (m_attributes & TypeAttributes.ExplicitLayout) != 0; }
+                       get { return (m_attributes & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout; }
                        set {
                                TypeAttributes masked = (TypeAttributes.LayoutMask & TypeAttributes.ExplicitLayout);
                                if (value)
@@ -272,7 +272,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsClass {
-                       get { return (m_attributes & TypeAttributes.Class) != 0; }
+                       get { return (m_attributes & TypeAttributes.ClassSemanticMask) == TypeAttributes.Class; }
                        set {
                                TypeAttributes masked = (TypeAttributes.ClassSemanticMask & TypeAttributes.Class);
                                if (value)
@@ -283,7 +283,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsInterface {
-                       get { return (m_attributes & TypeAttributes.Interface) != 0; }
+                       get { return (m_attributes & TypeAttributes.ClassSemanticMask) == TypeAttributes.Interface; }
                        set {
                                TypeAttributes masked = (TypeAttributes.ClassSemanticMask & TypeAttributes.Interface);
                                if (value)
@@ -344,7 +344,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsAnsiClass {
-                       get { return (m_attributes & TypeAttributes.AnsiClass) != 0; }
+                       get { return (m_attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AnsiClass; }
                        set {
                                TypeAttributes masked = (TypeAttributes.StringFormatMask & TypeAttributes.AnsiClass);
                                if (value)
@@ -355,7 +355,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsUnicodeClass {
-                       get { return (m_attributes & TypeAttributes.UnicodeClass) != 0; }
+                       get { return (m_attributes & TypeAttributes.StringFormatMask) == TypeAttributes.UnicodeClass; }
                        set {
                                TypeAttributes masked = (TypeAttributes.StringFormatMask & TypeAttributes.UnicodeClass);
                                if (value)
@@ -366,7 +366,7 @@ namespace Mono.Cecil {
                }
 
                public bool IsAutoClass {
-                       get { return (m_attributes & TypeAttributes.AutoClass) != 0; }
+                       get { return (m_attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AutoClass; }
                        set {
                                TypeAttributes masked = (TypeAttributes.StringFormatMask & TypeAttributes.AutoClass);
                                if (value)
index 39f67e35265fb1f8eb7b8518bc43538c882129db..4b44e36f78e3709f13142a57de5a4ac562311bf3 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-05  Vladimir Krasnov  <vladimirk@mainsoft.com>
+
+       * HtmlHead.cs: refactoring, used AddAttribute overload without encoding
+       on known attribute values
+
 2007-07-31  Vladimir Krasnov  <vladimirk@mainsoft.com>
 
        * HtmlControl.cs: fixed PreProcessRelativeReference, should be used
index 9c4a1175c9eecff27b26311c21bb43191f2b1881..5c70c6b11c363c379587d05761f9ed3870d20506 100644 (file)
@@ -183,7 +183,7 @@ namespace System.Web.UI.HtmlControls
                
                public void Render (HtmlTextWriter writer)
                {
-                       writer.AddAttribute ("type", "text/css");
+                       writer.AddAttribute ("type", "text/css", false);
                        writer.RenderBeginTag (HtmlTextWriterTag.Style);
 
                        foreach (StyleEntry entry in entries) {
index 068598230240f6c910488b1c745d176e9db4e986..ea504d18d0d657d29b2d3a3da587f156b39ca7dd 100644 (file)
@@ -124,7 +124,7 @@ namespace System.Web.UI.WebControls {
                                w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveAdUrl (e.ImageUrl));
 
                        w.AddAttribute (HtmlTextWriterAttribute.Alt, e.AlternateText == null ? "" : e.AlternateText);
-                       w.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+                       w.AddAttribute (HtmlTextWriterAttribute.Border, "0", false);
                        w.RenderBeginTag (HtmlTextWriterTag.Img);
                        w.RenderEndTag (); // img
                        w.RenderEndTag (); // a
index f5f130eadbdd4fb6780a6ac46cd16be4383edd53..4b57fed75a42d65395d3c695ce567c831a59d895 100644 (file)
@@ -228,14 +228,14 @@ namespace System.Web.UI.WebControls {
                                        Page.ClientScript.RegisterExpandoAttribute (ClientID, "focusOnError", "t");
 #endif
                                if (!Enabled)
-                                       writer.AddAttribute ("enabled", "false");
+                                       writer.AddAttribute ("enabled", "false", false);
 
 #if NET_2_0
                                if (Enabled && !IsValid) {
 #else
                                if (!IsValid) {
 #endif
-                                       writer.AddAttribute ("isvalid", "false");
+                                       writer.AddAttribute ("isvalid", "false", false);
                                }
                                else {
                                        if (Display == ValidatorDisplay.Static)
index 9893ca0ea3c0408d6cbada53961551e1ad029e67..dbfb2121de4fd1c7d259d394ade2be366b4440c0 100644 (file)
@@ -116,7 +116,7 @@ namespace System.Web.UI.WebControls {
                        switch (DisplayMode) {
                                case BulletedListDisplayMode.Text:
                                        if (!item.Enabled) {
-                                               writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+                                               writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
                                                writer.RenderBeginTag (HtmlTextWriterTag.Span);
                                        }
                                        
@@ -135,7 +135,7 @@ namespace System.Web.UI.WebControls {
                                                
                                        }
                                        else
-                                               writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+                                               writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
                                        
                                        writer.RenderBeginTag (HtmlTextWriterTag.A);
                                        writer.Write (item.Text);
@@ -146,7 +146,7 @@ namespace System.Web.UI.WebControls {
                                        if (Enabled && item.Enabled)
                                                writer.AddAttribute (HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackEventReference (GetPostBackOptions (index.ToString (CultureInfo.InvariantCulture))));
                                        else
-                                               writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+                                               writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
                                        writer.RenderBeginTag (HtmlTextWriterTag.A);
                                        writer.Write (item.Text);
                                        writer.RenderEndTag ();
index 9cab6b54df9cbb128b6c163b1ec3d6d6110128a3..7bd85473a910b90378f9a0689210f46c3acb6736 100644 (file)
@@ -168,7 +168,7 @@ namespace System.Web.UI.WebControls {
                                Page.VerifyRenderingInServerForm (this);
                        
 #if NET_2_0
-                       writer.AddAttribute (HtmlTextWriterAttribute.Type, UseSubmitBehavior ? "submit" : "button");
+                       writer.AddAttribute (HtmlTextWriterAttribute.Type, UseSubmitBehavior ? "submit" : "button", false);
                        writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
                        writer.AddAttribute (HtmlTextWriterAttribute.Value, Text);
 
index 38f85761a6492e60f8f39a240df7894d7fc209c6..023a438c62130fbf9f8e91594f6e5b69766a98f3 100644 (file)
@@ -940,7 +940,7 @@ namespace System.Web.UI.WebControls {
 #if NET_2_0
                                if (UseAccessibleHeader) {
                                        writer.AddAttribute (HtmlTextWriterAttribute.Abbr, dayName);
-                                       writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col");
+                                       writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col", false);
                                        cell = new TableHeaderCell();
                                }
                                else
index c2165361b04159d6d35188595a9fa030196e4599..de6197cf7b587bc438a9471857fb0dd73897a99f 100644 (file)
@@ -1,3 +1,16 @@
+2007-08-05  Vladimir Krasnov  <vladimirk@mainsoft.com>
+
+       * Button.cs, 
+       DataControlFieldHeaderCell.cs, FileUpload.cs, Table.cs, 
+       RegularExpressionValidator.cs, CheckBox.cs, HiddenField.cs, 
+       TableStyle.cs, Image.cs, BulletedList.cs, RangeValidator.cs, 
+       BaseValidator.cs, CustomValidator.cs, RepeatInfo.cs, TextBox.cs, 
+       RequiredFieldValidator.cs, AdRotator.cs, TableHeaderCell.cs, 
+       ImageMap.cs, Panel.cs, CompareValidator.cs, Calendar.cs, ListBox.cs, 
+       TableCell.cs, WebControl.cs, ImageButton.cs, TableItemStyle.cs: 
+       refactoring, used AddAttribute overload without encoding on known attribute 
+       values
+
 2007-08-01 Igor Zelmanovich <igorz@mainsoft.com>
 
        * DropDownList.cs: fixed onchange attibute.
index b430062a5d550001907ca3a3989d04e0d6254bf8..a55a64c0be3c020f75cf397e7861c5d079052611 100644 (file)
@@ -381,7 +381,7 @@ namespace System.Web.UI.WebControls {
                        }
 
                        if (!Enabled) {
-                               w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+                               w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
                                need_span = true;
                        }
 
@@ -430,7 +430,7 @@ namespace System.Web.UI.WebControls {
                                inputAttributes.AddAttributes (w);
 #endif
                        if (Checked)
-                               w.AddAttribute (HtmlTextWriterAttribute.Checked, "checked");
+                               w.AddAttribute (HtmlTextWriterAttribute.Checked, "checked", false);
 
                        if (AutoPostBack) {
 #if NET_2_0
@@ -439,7 +439,7 @@ namespace System.Web.UI.WebControls {
                                        w.AddAttribute (HtmlTextWriterAttribute.Onclick,
                                                        Page.ClientScript.GetPostBackEventReference (this, String.Empty));
 #endif
-                               w.AddAttribute ("language", "javascript");
+                               w.AddAttribute ("language", "javascript", false);
                        }
 
                        if (AccessKey.Length > 0)
@@ -534,7 +534,7 @@ namespace System.Web.UI.WebControls {
                internal virtual void InternalAddAttributesToRender (HtmlTextWriter w)
                {
                        if (!Enabled)
-                               w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+                               w.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
                }
        }
 }
index 4153e6cce62965d8e93f0743247b05f6fea76f22..b922d244630216e5aa91756cccff01eb82fd027d 100644 (file)
@@ -54,7 +54,7 @@ namespace System.Web.UI.WebControls {
                                if (ValueToCompare != "")
                                        w.AddAttribute ("valuetocompare", ValueToCompare);
                                w.AddAttribute ("operator", Operator.ToString());
-                               w.AddAttribute("evaluationfunction", "CompareValidatorEvaluateIsValid");
+                               w.AddAttribute ("evaluationfunction", "CompareValidatorEvaluateIsValid", false);
                        }
 
                        base.AddAttributesToRender (w);
index 5b1e5efdb0d087f8a5bc04411cc6a90305215494..444994d7beaf1196ebe2036b04a747a4373dc9ea 100644 (file)
@@ -73,7 +73,7 @@ namespace System.Web.UI.WebControls {
                        if (base.RenderUplevel) {
                                string s;
 
-                               writer.AddAttribute("evaluationfunction", "CustomValidatorEvaluateIsValid");
+                               writer.AddAttribute ("evaluationfunction", "CustomValidatorEvaluateIsValid", false);
 
                                s = ClientValidationFunction;
                                if (s != string.Empty) {
index 5a90177ffa4c706f6606f2819a7756855e77f646..e66718f5863b71b3e4d08e7476f86a188f9a7c25 100644 (file)
@@ -73,10 +73,10 @@ namespace System.Web.UI.WebControls
                        base.AddAttributesToRender (writer);
                        switch (scope) {
                                case TableHeaderScope.Column:
-                                       writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col");
+                                       writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col", false);
                                        break;
                                case TableHeaderScope.Row:
-                                       writer.AddAttribute (HtmlTextWriterAttribute.Scope, "row");
+                                       writer.AddAttribute (HtmlTextWriterAttribute.Scope, "row", false);
                                        break;
                        }
                        if (AbbreviatedText.Length > 0)
index 878ed5af85ed616efdef44e681935d3a3cbb6176..aa81f5f049a4bc3dd5627b738c687c9c762eaa7d 100644 (file)
@@ -106,7 +106,7 @@ namespace System.Web.UI.WebControls
 
                protected override void AddAttributesToRender (HtmlTextWriter writer)
                {
-                       writer.AddAttribute (HtmlTextWriterAttribute.Type, "file");
+                       writer.AddAttribute (HtmlTextWriterAttribute.Type, "file", false);
                        if (!string.IsNullOrEmpty (UniqueID))
                                writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
                        base.AddAttributesToRender (writer);
index b43ffc417ce5af3f0a199a07e125b3405c0c8a45..79de7dc2fe834fcd00d4688e8062c25796a3ee5a 100644 (file)
@@ -111,7 +111,7 @@ namespace System.Web.UI.WebControls
 
                protected internal override void Render (HtmlTextWriter writer)
                {
-                       writer.AddAttribute (HtmlTextWriterAttribute.Type, "hidden");
+                       writer.AddAttribute (HtmlTextWriterAttribute.Type, "hidden", false);
 
                        if (!String.IsNullOrEmpty (ClientID))
                                writer.AddAttribute (HtmlTextWriterAttribute.Id, ClientID);
index cb17e4be6d9acb4ee2a82ed283f2a31823b51fa9..50065fa14a9cd861428943eab47e0ca437d5a22d 100644 (file)
@@ -193,35 +193,35 @@ namespace System.Web.UI.WebControls {
                                writer.AddAttribute ("longdesc", s);
 #endif
                        if (!enabled)
-                               writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
                        // avoid reflection
                        switch (ImageAlign) {
                        case ImageAlign.Left:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "left");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "left", false);
                                break;
                        case ImageAlign.Right:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "right");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "right", false);
                                break;
                        case ImageAlign.Baseline:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "baseline");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "baseline", false);
                                break;
                        case ImageAlign.Top:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "top");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "top", false);
                                break;
                        case ImageAlign.Middle:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "middle");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "middle", false);
                                break;
                        case ImageAlign.Bottom:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "bottom");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "bottom", false);
                                break;
                        case ImageAlign.AbsBottom:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "absbottom");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "absbottom", false);
                                break;
                        case ImageAlign.AbsMiddle:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "absmiddle");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "absmiddle", false);
                                break;
                        case ImageAlign.TextTop:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "texttop");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "texttop", false);
                                break;
                        }
 #if NET_2_0
index 5e16dcf944d870696f434efb812d9a9d785480ed..15ca2e8d6d2f399167ab6aece86c296a071dfc55 100644 (file)
@@ -203,7 +203,7 @@ namespace System.Web.UI.WebControls {
                        if (Page != null)
                                Page.VerifyRenderingInServerForm (this);
                        
-                       writer.AddAttribute (HtmlTextWriterAttribute.Type, "image");
+                       writer.AddAttribute (HtmlTextWriterAttribute.Type, "image", false);
                        writer.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
 #if NET_2_0
                        string onclick = OnClientClick;
index 8d68a623d799d8915888480a57a2e8cb8a46ce6c..87690783799f911b6718bf42eb9c1b9bdef8bb85 100644 (file)
@@ -160,13 +160,13 @@ namespace System.Web.UI.WebControls
                                        HotSpotMode mode = spot.HotSpotMode != HotSpotMode.NotSet ? spot.HotSpotMode : HotSpotMode;
                                        switch (mode) {
                                                case HotSpotMode.Inactive:
-                                                       writer.AddAttribute ("nohref", "true");
+                                                       writer.AddAttribute ("nohref", "true", false);
                                                        break;
                                                case HotSpotMode.Navigate:
                                                        string target = spot.Target.Length > 0 ? spot.Target : Target;
                                                        if (!String.IsNullOrEmpty (target))
                                                                writer.AddAttribute (HtmlTextWriterAttribute.Target, target);
-#if TARGET_J2EE\r
+#if TARGET_J2EE
                                                        string navUrl = ResolveClientUrl (spot.NavigateUrl, String.Compare (target, "_blank", StringComparison.InvariantCultureIgnoreCase) != 0);
 #else
                                                        string navUrl = ResolveClientUrl (spot.NavigateUrl);
index a67f30e7c185980856ca5ccba65f0af62ece86a6..061981d93eceb52151a07ce6e3b3601087eefebd 100644 (file)
@@ -155,7 +155,7 @@ namespace System.Web.UI.WebControls {
 
                        if (SelectionMode == ListSelectionMode.Multiple)
                                writer.AddAttribute (HtmlTextWriterAttribute.Multiple,
-                                               "multiple");
+                                               "multiple", false);
                        writer.AddAttribute (HtmlTextWriterAttribute.Size,
                                         Rows.ToString (CultureInfo.InvariantCulture));
                }
index 52e62c27947f5455c42d0d1654e1516d5f899147..99d907231015a1bfb1dfa96add04148c26f7acf7 100644 (file)
@@ -72,7 +72,7 @@ namespace System.Web.UI.WebControls {
                        }
 
                        if (Direction != ContentDirection.NotSet) {
-                               w.AddAttribute (HtmlTextWriterAttribute.Dir, Direction == ContentDirection.RightToLeft ? "rtl" : "ltr");
+                               w.AddAttribute (HtmlTextWriterAttribute.Dir, Direction == ContentDirection.RightToLeft ? "rtl" : "ltr", false);
                        }
 
                        switch (ScrollBars) {
index 841d33760f972bb7af2efb9433d2e30c83c8698b..dc6af32a0c46a5ffb9a614cadf7a2f9a7fa2a102 100644 (file)
@@ -90,7 +90,7 @@ namespace System.Web.UI.WebControls {
                        base.AddAttributesToRender (writer);
 
                        if (RenderUplevel) {
-                               writer.AddAttribute("evaluationfunction", "RangeValidatorEvaluateIsValid"); // FIXME - we need to define this in client code
+                               writer.AddAttribute("evaluationfunction", "RangeValidatorEvaluateIsValid", false); // FIXME - we need to define this in client code
                                writer.AddAttribute("minimumValue", MinimumValue.ToString(CultureInfo.InvariantCulture));
                                writer.AddAttribute("maximumValue", MaximumValue.ToString(CultureInfo.InvariantCulture));
                        }
index 0786027d3079fe62aecdfc8e5ef958bbd3fda489..6dd206ab68abf0fcdfaf18271a8962b6ea5ecfeb 100644 (file)
@@ -53,7 +53,7 @@ namespace System.Web.UI.WebControls {
                protected override void AddAttributesToRender (HtmlTextWriter w)
                {
                        if (RenderUplevel) {
-                               w.AddAttribute ("evaluationfunction", "RegularExpressionValidatorEvaluateIsValid");
+                               w.AddAttribute ("evaluationfunction", "RegularExpressionValidatorEvaluateIsValid", false);
                                if (ValidationExpression != "")
                                        w.AddAttribute ("validationexpression", ValidationExpression);
                        }
index d0d784643770f7271ccc58bf026f71051885a7bc..468e5c59625324d6da4030ca396fb5a2620d2f17 100644 (file)
@@ -104,7 +104,7 @@ namespace System.Web.UI.WebControls {
                                        // columns per item if we are using separators, otherwise
                                        // one per item.
                                        if (hdr_span != 1)
-                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);
 
                                        if (UseAccessibleHeader)
                                                w.AddAttribute ("scope", "col", false);
@@ -214,7 +214,7 @@ namespace System.Web.UI.WebControls {
                                else if (table) {
                                        w.RenderBeginTag (HtmlTextWriterTag.Tr);
                                        if (hdr_span != 1)
-                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);
 
                                        Style s = user.GetItemStyle (ListItemType.Footer, -1);
                                        if (s != null)
@@ -277,7 +277,7 @@ namespace System.Web.UI.WebControls {
                                        // columns per item if we are using separators, otherwise
                                        // one per item.
                                        if (hdr_span != 1)
-                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);
 
                                        if (UseAccessibleHeader)
                                                w.AddAttribute ("scope", "col", false);
@@ -363,7 +363,7 @@ namespace System.Web.UI.WebControls {
                                if (table) {
                                        w.RenderBeginTag (HtmlTextWriterTag.Tr);
                                        if (hdr_span != 1)
-                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString ());
+                                               w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);
 
                                        Style s = user.GetItemStyle (ListItemType.Footer, -1);
                                        if (s != null)
index 607c742d5def22463ebcdc507787c6e910902ca5..3a12329cc5e3168448462ed9dbae5ead2d5bc7f2 100644 (file)
@@ -43,7 +43,7 @@ namespace System.Web.UI.WebControls {
                protected override void AddAttributesToRender (HtmlTextWriter w)
                {
                        if (RenderUplevel) {
-                               w.AddAttribute ("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid");
+                               w.AddAttribute ("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid", false);
                                w.AddAttribute ("initialvalue", InitialValue);
                        }
 
index a8130589792a78277bf7c47c06740ceae0bb7497..c8371790e27e94ce4a5c0f77856697a116bc6f47 100644 (file)
@@ -190,7 +190,7 @@ namespace System.Web.UI.WebControls {
                        if (!ControlStyleCreated || TableStyle.IsEmpty) {
                                // for some reason border=X seems to be always present
                                // and isn't rendered as a style attribute
-                               writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Border, "0", false);
                        }
                }
 
index 126077fe1a25ffdb62878a84af87a1a31cf8b681..0d43137ce9c0e9f2b90f1b730fea6ea0d6a5926d 100644 (file)
@@ -202,11 +202,11 @@ namespace System.Web.UI.WebControls {
 
                        int i = ColumnSpan;
                        if (i > 0)
-                               writer.AddAttribute (HtmlTextWriterAttribute.Colspan, i.ToString (CultureInfo.InvariantCulture));
+                               writer.AddAttribute (HtmlTextWriterAttribute.Colspan, i.ToString (CultureInfo.InvariantCulture), false);
 
                        i = RowSpan;
                        if (i > 0)
-                               writer.AddAttribute (HtmlTextWriterAttribute.Rowspan, i.ToString (CultureInfo.InvariantCulture));
+                               writer.AddAttribute (HtmlTextWriterAttribute.Rowspan, i.ToString (CultureInfo.InvariantCulture), false);
 #if NET_2_0
                        string[] ahci = AssociatedHeaderCellID;
                        if (ahci.Length > 1) {
index b12fc13fff5a1e5fd2fc61c60807b786fe881c99..e6b0d9808fa535956c06cf653e4e0039cca57135 100644 (file)
@@ -89,10 +89,10 @@ namespace System.Web.UI.WebControls {
 
                                switch (Scope) {
                                case TableHeaderScope.Column:
-                                       writer.AddAttribute (HtmlTextWriterAttribute.Scope, "column");
+                                       writer.AddAttribute (HtmlTextWriterAttribute.Scope, "column", false);
                                        break;
                                case TableHeaderScope.Row:
-                                       writer.AddAttribute (HtmlTextWriterAttribute.Scope, "row");
+                                       writer.AddAttribute (HtmlTextWriterAttribute.Scope, "row", false);
                                        break;
                                }
 
index 7ba7c23bba269d83364570fccd9c31a98fa62b8c..40ae3f1778a618caad8db7f9a50b2b406ef1435a 100644 (file)
@@ -131,29 +131,29 @@ namespace System.Web.UI.WebControls {
                        // note: avoid ToString on the enum
                        switch (HorizontalAlign) {
                        case HorizontalAlign.Left:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "left");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "left", false);
                                break;
                        case HorizontalAlign.Center:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "center");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "center", false);
                                break;
                        case HorizontalAlign.Right:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "right");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "right", false);
                                break;
                        case HorizontalAlign.Justify:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "justify");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "justify", false);
                                break;
                        }
 
                        // note: avoid ToString on the enum
                        switch (VerticalAlign) {
                        case VerticalAlign.Top:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Valign, "top");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Valign, "top", false);
                                break;
                        case VerticalAlign.Middle:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Valign, "middle");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Valign, "middle", false);
                                break;
                        case VerticalAlign.Bottom:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Valign, "bottom");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Valign, "bottom", false);
                                break;
                        }
 
index fb51809f0874a60010b94c4c0911451f3f5fa8a3..201f30aaea6fac17d23d689ea86bfc29ce4c8b26 100644 (file)
@@ -185,11 +185,11 @@ namespace System.Web.UI.WebControls {
                        // note: avoid calling properties multiple times
                        int i = CellPadding;
                        if (i != -1)
-                               writer.AddAttribute (HtmlTextWriterAttribute.Cellpadding, i.ToString (CultureInfo.InvariantCulture));
+                               writer.AddAttribute (HtmlTextWriterAttribute.Cellpadding, i.ToString (CultureInfo.InvariantCulture), false);
                        
                        i = CellSpacing;
                        if (i != -1) {
-                               writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, i.ToString (CultureInfo.InvariantCulture));
+                               writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, i.ToString (CultureInfo.InvariantCulture), false);
                                if (i == 0) {
                                        writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
                                }
@@ -198,38 +198,38 @@ namespace System.Web.UI.WebControls {
                        GridLines g = GridLines;
                        switch (g) {
                        case GridLines.Horizontal:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Rules, "rows", false);
                                break;
                        case GridLines.Vertical:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Rules, "cols", false);
                                break;
                        case GridLines.Both:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Rules, "all", false);
                                break;
                        }
 
                        // note: avoid ToString on the enum
                        switch (HorizontalAlign) {
                        case HorizontalAlign.Left:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "Left");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "Left", false);
                                break;
                        case HorizontalAlign.Center:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "Center");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "Center", false);
                                break;
                        case HorizontalAlign.Right:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "Right");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "Right", false);
                                break;
                        case HorizontalAlign.Justify:
-                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "Justify");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Align, "Justify", false);
                                break;
                        }
 
                        // border (=0) is always present (and base class doesn't seems to add it)
                        // but border is "promoted" to 1 if gridlines are present (with BorderWidth == 0)
                        if (g == GridLines.None) {
-                               writer.AddAttribute (HtmlTextWriterAttribute.Border, "0");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Border, "0", false);
                        } else if (BorderWidth.IsEmpty) {
-                               writer.AddAttribute (HtmlTextWriterAttribute.Border, "1");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Border, "1", false);
                        } else {
                                writer.AddAttribute (HtmlTextWriterAttribute.Border, BorderWidth.Value.ToString (CultureInfo.InvariantCulture));
                        }
index bc27a5ff04fef7e2ddbc31ef4859d1e8e3e28e97..ddb5e3d22bb022ff2e4e55948b7e20e0bddf8b2e 100644 (file)
@@ -105,21 +105,21 @@ namespace System.Web.UI.WebControls {
                        switch (TextMode) {
                        case TextBoxMode.MultiLine:
                                if (Columns != 0)
-                                       w.AddAttribute (HtmlTextWriterAttribute.Cols, Columns.ToString ());
+                                       w.AddAttribute (HtmlTextWriterAttribute.Cols, Columns.ToString (), false);
 #if NET_2_0
                                else
-                                       w.AddAttribute (HtmlTextWriterAttribute.Cols, "20");
+                                       w.AddAttribute (HtmlTextWriterAttribute.Cols, "20", false);
 #endif
                                
                                if (Rows != 0)
-                                       w.AddAttribute (HtmlTextWriterAttribute.Rows, Rows.ToString ());
+                                       w.AddAttribute (HtmlTextWriterAttribute.Rows, Rows.ToString (), false);
 #if NET_2_0
                                else
-                                       w.AddAttribute (HtmlTextWriterAttribute.Rows, "2");
+                                       w.AddAttribute (HtmlTextWriterAttribute.Rows, "2", false);
 #endif
 
                                if (!Wrap)
-                                       w.AddAttribute (HtmlTextWriterAttribute.Wrap, "off");
+                                       w.AddAttribute (HtmlTextWriterAttribute.Wrap, "off", false);
                                
                                break;
                                
@@ -127,32 +127,32 @@ namespace System.Web.UI.WebControls {
                        case TextBoxMode.Password:
                                
                                if (TextMode == TextBoxMode.Password)
-                                       w.AddAttribute (HtmlTextWriterAttribute.Type, "password");
+                                       w.AddAttribute (HtmlTextWriterAttribute.Type, "password", false);
                                else {
-                                       w.AddAttribute (HtmlTextWriterAttribute.Type, "text");
+                                       w.AddAttribute (HtmlTextWriterAttribute.Type, "text", false);
                                        if (Text.Length > 0)
                                                w.AddAttribute (HtmlTextWriterAttribute.Value, Text);
                                }
                                
                                if (Columns != 0)
-                                       w.AddAttribute (HtmlTextWriterAttribute.Size, Columns.ToString ());
+                                       w.AddAttribute (HtmlTextWriterAttribute.Size, Columns.ToString (), false);
                
                                if (MaxLength != 0)
-                                       w.AddAttribute (HtmlTextWriterAttribute.Maxlength, MaxLength.ToString ());
+                                       w.AddAttribute (HtmlTextWriterAttribute.Maxlength, MaxLength.ToString (), false);
 
 #if NET_2_0
                                if (AutoCompleteType != AutoCompleteType.None && TextMode == TextBoxMode.SingleLine)
                                        if (AutoCompleteType != AutoCompleteType.Disabled)
                                                w.AddAttribute (HtmlTextWriterAttribute.VCardName, VCardValues [(int) AutoCompleteType]);
                                        else
-                                               w.AddAttribute (HtmlTextWriterAttribute.AutoComplete, "off");
+                                               w.AddAttribute (HtmlTextWriterAttribute.AutoComplete, "off", false);
 #endif
                                break;  
                        }
 
 #if NET_2_0
                        if (AutoPostBack) {
-                               w.AddAttribute ("onkeypress", "if (WebForm_TextBoxKeyHandler(event) == false) return false;");
+                               w.AddAttribute ("onkeypress", "if (WebForm_TextBoxKeyHandler(event) == false) return false;", false);
                                w.AddAttribute (HtmlTextWriterAttribute.Onchange, Page.ClientScript.GetPostBackEventReference (GetPostBackOptions (), true));
                        }
 #else          
@@ -161,7 +161,7 @@ namespace System.Web.UI.WebControls {
 #endif
 
                        if (ReadOnly)
-                               w.AddAttribute (HtmlTextWriterAttribute.ReadOnly, "ReadOnly");
+                               w.AddAttribute (HtmlTextWriterAttribute.ReadOnly, "ReadOnly", false);
 
                        w.AddAttribute (HtmlTextWriterAttribute.Name, UniqueID);
                }
index cfb3e4147250a07e328dd6a033115a7a99deea50..a2aaeb30c62da1311b137d471a8a2a561726f90a 100644 (file)
@@ -501,7 +501,7 @@ namespace System.Web.UI.WebControls {
                                writer.AddAttribute (HtmlTextWriterAttribute.Accesskey, AccessKey);
 
                        if (!enabled)
-                               writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled");
+                               writer.AddAttribute (HtmlTextWriterAttribute.Disabled, "disabled", false);
 
                        if (ToolTip != string.Empty)
                                writer.AddAttribute (HtmlTextWriterAttribute.Title, ToolTip);
index 1a256f1821a524c6de90442bd7dba691d1ef9da0..51fceae09d5dbb4ba11c667a74843698d1612e02 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-05  Vladimir Krasnov  <vladimirk@mainsoft.com>
+
+       * HtmlTextWriter.cs: performance refactoring, optimized AddAttribute
+       overloads, used StringComparer for tag, styles and attrs hashtables
+       fixed AddAttribute, id attr should not be encoded by default
+
 2007-07-31  Vladimir Krasnov  <vladimirk@mainsoft.com>
 
        * Control.cs: fixed AppRelativeTemplateSourceDirectory that should
index 76ef166f48cd1cfe2670e942c21132a0d845af63..724132646a101cdbfada9b739bba1f9a7b87c82d 100644 (file)
@@ -47,6 +47,11 @@ namespace System.Web.UI {
 
                static HtmlTextWriter ()
                {
+#if NET_2_0
+                       _tagTable = new Hashtable (tags.Length, StringComparer.OrdinalIgnoreCase);
+                       _attributeTable = new Hashtable (htmlattrs.Length, StringComparer.OrdinalIgnoreCase);
+                       _styleTable = new Hashtable (htmlstyles.Length, StringComparer.OrdinalIgnoreCase);
+#else
                        _tagTable = new Hashtable (tags.Length, 
                                CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
                        
@@ -55,7 +60,7 @@ namespace System.Web.UI {
                        
                        _styleTable = new Hashtable (htmlstyles.Length, 
                                CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
-
+#endif
                        foreach (HtmlTag tag in tags)
                                _tagTable.Add (tag.name, tag);
 
@@ -103,15 +108,18 @@ namespace System.Web.UI {
                public virtual void AddAttribute (HtmlTextWriterAttribute key, string value, bool fEncode)
                {
                        if (fEncode)
-                               value = EncodeAttributeValue (key, value);
+                               value = HttpUtility.HtmlAttributeEncode (value);
+
                        AddAttribute (GetAttributeName (key), value, key);
                }
 
 
                public virtual void AddAttribute (HtmlTextWriterAttribute key, string value)
                {
-                       bool fEncode = key != HtmlTextWriterAttribute.Name;
-                       AddAttribute (key, value, fEncode);
+                       if ((key != HtmlTextWriterAttribute.Name) && (key != HtmlTextWriterAttribute.Id))
+                               value = HttpUtility.HtmlAttributeEncode (value);
+
+                       AddAttribute (GetAttributeName (key), value, key);
                }
 
 
@@ -125,8 +133,12 @@ namespace System.Web.UI {
 
                public virtual void AddAttribute (string name, string value)
                {
-                       bool fEncode = String.Compare ("name", name, true, CultureInfo.InvariantCulture) != 0;
-                       AddAttribute (name, value, fEncode);
+                       HtmlTextWriterAttribute key = GetAttributeKey (name);
+
+                       if ((key != HtmlTextWriterAttribute.Name) && (key != HtmlTextWriterAttribute.Id))
+                               value = HttpUtility.HtmlAttributeEncode (value);
+
+                       AddAttribute (name, value, key);
                }
 
                protected virtual void AddAttribute (string name, string value, HtmlTextWriterAttribute key)
index 18c0c05a982a76429453c4eb9334367d5a17ed0e..aa392c62f6395ae4a8778fdaeac7ee17fb3d1a8e 100644 (file)
@@ -1,3 +1,12 @@
+2007-08-05  Vladimir Krasnov  <vladimirk@mainsoft.com>
+
+       * HttpUtility.cs: performance refactoring, optimized UrlEncode
+
+2007-08-05 Igor Zelmanovich <igorz@mainsoft.com>
+
+       * SiteMapNode.cs: refactoring + typo fix: 
+       variable is declared in scope where is used.
+
 2007-07-31  Vladimir Krasnov  <vladimirk@mainsoft.com>
 
        * VirtualPathUtility.cs: refactored GetDirectory, ToAbsolute, added
index 9ee7ae6030721463ae296779692c594fcc26532b..f90739f52c777e92bbd692c49c156cfc15256cf7 100644 (file)
@@ -627,8 +627,26 @@ namespace System.Web {
                        if (s == "")
                                return "";
 
-                       byte [] bytes = Enc.GetBytes (s);
-                       return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, 0, bytes.Length));
+                       bool needEncode = false;
+                       int len = s.Length;
+                       for (int i = 0; i < len; i++) {
+                               char c = s [i];
+                               if ((c < '0') || (c < 'A' && c > '9') || (c > 'Z' && c < 'a') || (c > 'z')) {
+                                       if (NotEncoded (c))
+                                               continue;
+
+                                       needEncode = true;
+                                       break;
+                               }
+                       }
+
+                       if (!needEncode)
+                               return s;
+
+                       // avoided GetByteCount call
+                       byte [] bytes = new byte[Enc.GetMaxByteCount(s.Length)];
+                       int realLen = Enc.GetBytes (s, 0, s.Length, bytes, 0);
+                       return Encoding.ASCII.GetString (UrlEncodeToBytes (bytes, 0, realLen));
                }
          
                public static string UrlEncode (byte [] bytes)
@@ -682,7 +700,11 @@ namespace System.Web {
                }
 
                static char [] hexChars = "0123456789abcdef".ToCharArray ();
-               const string notEncoded = "!'()*-._";
+
+               static bool NotEncoded (char c)
+               {
+                       return (c == '!' || c == '\'' || c == '(' || c == ')' || c == '*' || c == '-' || c == '.' || c == '_');
+               }
 
                static void UrlEncodeChar (char c, Stream result, bool isUnicode) {
                        if (c > 255) {
@@ -705,7 +727,7 @@ namespace System.Web {
                                return;
                        }
                        
-                       if (c>' ' && notEncoded.IndexOf (c)!=-1) {
+                       if (c > ' ' && NotEncoded (c)) {
                                result.WriteByte ((byte)c);
                                return;
                        }
index e63995dabe070a128dba9c67de79d76e40ee0692..9c159aea30b4772c899e78a9c8d236ce27d527a1 100644 (file)
@@ -247,13 +247,13 @@ namespace System.Web {
                public virtual string this [string key]
                {
                        get {
-                               string val = null;
                                if (provider.EnableLocalization) {
-                                       val = GetImplicitResourceString (key);
+                                       string val = GetImplicitResourceString (key);
                                        if (val == null)
                                                val = GetExplicitResourceString (key, null, true);
+                                       if (val != null)
+                                               return val;
                                }
-                               if (val != null) return null;
                                if (attributes != null) return attributes [key];
                                return null;
                        }
index 712843da4e8d63dd2c56a29478e0a097cc587cbd..1613f5c016656fb4a39b179129ed27ba80c3498e 100644 (file)
@@ -1,3 +1,19 @@
+2007-08-04  Jb Evain  <jbevain@novell.com>
+
+       * XmlUrlResolver.cs: remove code duplication in 2.1.
+
+2007-08-04  Jb Evain  <jbevain@novell.com>
+
+       * XmlTextReader.cs, XmlConvert.cs, XmlReaderBinarySupport.cs:
+       Use the available constructor for the 2.1 profile.
+
+2007-08-03  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DTDObjectModel.cs : in 2.0 and especially 2.1 profiles, use
+         our own DictionaryBase-like generic type. It is to reduce
+         dependency on DictionaryBase which does not exist in 2.1 mscorlib.
+         (included in 2.0 as well so that we do not skip NUnit tests so far)
+
 2007-08-03  Atsushi Enomoto  <atsushi@ximian.com>
 
        * XmlResolver.cs, XmlUrlResolver.cs, XmlSecureResolver.cs :
index 93b7b1f3eaa0ac26c73419e5534321313bc9944a..e7ba1e533514302ba7a8fde46f7f8dae375ce258 100644 (file)
@@ -34,6 +34,9 @@ using System.IO;
 using System.Text;
 using System.Xml;
 using System.Xml.Schema;
+#if NET_2_0
+using System.Collections.Generic;
+#endif
 #if NET_2_1
 using XmlSchemaException = System.Xml.XmlException;
 #else
@@ -280,6 +283,17 @@ namespace Mono.Xml
                }
        }
 
+#if NET_2_0
+       class DictionaryBase : List<KeyValuePair<string,DTDNode>>
+       {
+               public IEnumerable<DTDNode> Values {
+                       get {
+                               foreach (KeyValuePair<string,DTDNode> p in this)
+                                       yield return p.Value;
+                       }
+               }
+       }
+#endif
        internal class DTDCollectionBase : DictionaryBase
        {
                DTDObjectModel root;
@@ -293,6 +307,32 @@ namespace Mono.Xml
                        get { return root; }
                }
 
+#if NET_2_0
+               public DictionaryBase InnerHashtable {
+                       get { return this; }
+               }
+
+               protected void BaseAdd (string name, DTDNode value)
+               {
+                       base.Add (new KeyValuePair<string,DTDNode> (name, value));
+               }
+
+               public bool Contains (string key)
+               {
+                       foreach (KeyValuePair<string,DTDNode> p in this)
+                               if (p.Key == key)
+                                       return true;
+                       return false;
+               }
+
+               protected object BaseGet (string name)
+               {
+                       foreach (KeyValuePair<string,DTDNode> p in this)
+                               if (p.Key == name)
+                                       return p.Value;
+                       return null;
+               }
+#else
                public ICollection Keys {
                        get { return InnerHashtable.Keys; }
                }
@@ -300,6 +340,22 @@ namespace Mono.Xml
                public ICollection Values {
                        get { return InnerHashtable.Values; }
                }
+
+               protected void BaseAdd (string name, object value)
+               {
+                       InnerHashtable.Add (name, value);
+               }
+
+               public bool Contains (string key)
+               {
+                       return InnerHashtable.Contains (key);
+               }
+
+               protected object BaseGet (string name)
+               {
+                       return InnerHashtable [name];
+               }
+#endif
        }
 
        internal class DTDElementDeclarationCollection : DTDCollectionBase
@@ -313,19 +369,19 @@ namespace Mono.Xml
 
                public DTDElementDeclaration Get (string name)
                {
-                       return InnerHashtable [name] as DTDElementDeclaration;
+                       return BaseGet (name) as DTDElementDeclaration;
                }
 
                public void Add (string name, DTDElementDeclaration decl)
                {
-                       if (InnerHashtable.Contains (name)) {
+                       if (Contains (name)) {
                                Root.AddError (new XmlSchemaException (String.Format (
                                        "Element declaration for {0} was already added.",
                                        name), null));
                                return;
                        }
                        decl.SetRoot (Root);
-                       InnerHashtable.Add (name, decl);
+                       BaseAdd (name, decl);
                }
        }
 
@@ -334,7 +390,7 @@ namespace Mono.Xml
                public DTDAttListDeclarationCollection (DTDObjectModel root) : base (root) {}
 
                public DTDAttListDeclaration this [string name] {
-                       get { return InnerHashtable [name] as DTDAttListDeclaration; }
+                       get { return BaseGet (name) as DTDAttListDeclaration; }
                }
 
                public void Add (string name, DTDAttListDeclaration decl)
@@ -347,7 +403,7 @@ namespace Mono.Xml
                                                existing.Add (def);
                        } else {
                                decl.SetRoot (Root);
-                               InnerHashtable.Add (name, decl);
+                               BaseAdd (name, decl);
                        }
                }
        }
@@ -357,17 +413,17 @@ namespace Mono.Xml
                public DTDEntityDeclarationCollection (DTDObjectModel root) : base (root) {}
 
                public DTDEntityDeclaration this [string name] {
-                       get { return InnerHashtable [name] as DTDEntityDeclaration; }
+                       get { return BaseGet (name) as DTDEntityDeclaration; }
                }
 
                public void Add (string name, DTDEntityDeclaration decl)
                {
-                       if (InnerHashtable [name] != null)
+                       if (Contains (name))
                                throw new InvalidOperationException (String.Format (
                                        "Entity declaration for {0} was already added.",
                                        name));
                        decl.SetRoot (Root);
-                       InnerHashtable.Add (name, decl);
+                       BaseAdd (name, decl);
                }
        }
 
@@ -376,17 +432,17 @@ namespace Mono.Xml
                public DTDNotationDeclarationCollection (DTDObjectModel root) : base (root) {}
 
                public DTDNotationDeclaration this [string name] {
-                       get { return InnerHashtable [name] as DTDNotationDeclaration; }
+                       get { return BaseGet (name) as DTDNotationDeclaration; }
                }
 
                public void Add (string name, DTDNotationDeclaration decl)
                {
-                       if (InnerHashtable [name] != null)
+                       if (Contains (name))
                                throw new InvalidOperationException (String.Format (
                                        "Notation declaration for {0} was already added.",
                                        name));
                        decl.SetRoot (Root);
-                       InnerHashtable.Add (name, decl);
+                       BaseAdd (name, decl);
                }
        }
 
index ec1e2f04815e2a33ad30d8f9ccda26a3dd8dcf3e..ced282869553aec160098ac7fa56ac749446445a 100644 (file)
@@ -239,10 +239,20 @@ namespace System.Xml {
                {
                        if (buffer == null)
                                throw new ArgumentNullException ("buffer");
-                       if (index < 0)
-                               throw new ArgumentOutOfRangeException ("index", index, "index must be non negative integer.");
-                       if (count < 0)
-                               throw new ArgumentOutOfRangeException ("count", count, "count must be non negative integer.");
+                       if (index < 0) {
+                               throw new ArgumentOutOfRangeException (
+#if !NET_2_1
+                                       "index", index,
+#endif
+                                       "index must be non negative integer.");
+                       }
+                       if (count < 0) {
+                               throw new ArgumentOutOfRangeException (
+#if !NET_2_1
+                                       "count", count,
+#endif
+                                       "count must be non negative integer.");
+                       }
                        if (buffer.Length < index + count)
                                throw new ArgumentOutOfRangeException ("index and count must be smaller than the length of the buffer.");
 
index d4089d03897d138dfa992e53568770f1dfda66f2..95894daed81067776ab9101321bfa3d8bb4c1ef8 100644 (file)
@@ -163,9 +163,9 @@ namespace System.Xml
                public int ReadBase64 (byte [] buffer, int offset, int length)
                {
                        if (offset < 0)
-                               throw new ArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
+                               throw CreateArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
                        else if (length < 0)
-                               throw new ArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
+                               throw CreateArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
                        else if (buffer.Length < offset + length)
                                throw new ArgumentOutOfRangeException ("buffer length is smaller than the sum of offset and length.");
 
@@ -304,12 +304,21 @@ namespace System.Xml
                        return i;
                }
 
+               static Exception CreateArgumentOutOfRangeException (string name, object value, string message)
+               {
+                       return new ArgumentOutOfRangeException (
+#if !NET_2_1
+                               name, value,
+#endif
+                               message);
+               }
+
                public int ReadBinHex (byte [] buffer, int offset, int length)
                {
                        if (offset < 0)
-                               throw new ArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
+                               throw CreateArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
                        else if (length < 0)
-                               throw new ArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
+                               throw CreateArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
                        else if (buffer.Length < offset + length)
                                throw new ArgumentOutOfRangeException ("buffer length is smaller than the sum of offset and length.");
 
@@ -331,9 +340,9 @@ namespace System.Xml
                                CheckState (false, CommandState.None);
 
                        if (offset < 0)
-                               throw new ArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
+                               throw CreateArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
                        else if (length < 0)
-                               throw new ArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
+                               throw CreateArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
                        else if (buffer.Length < offset + length)
                                throw new ArgumentOutOfRangeException ("buffer length is smaller than the sum of offset and length.");
 
index 9cec09abdefd2be0493bcac90beb908c3ca03dce..96c812cb0ff8bb4e91673ee28a67ed6aaa7c5f8b 100644 (file)
@@ -657,11 +657,21 @@ namespace System.Xml
 
                public int ReadChars (char [] buffer, int offset, int length)
                {
-                       if (offset < 0)
-                               throw new ArgumentOutOfRangeException ("offset", offset, "Offset must be non-negative integer.");
-                       else if (length < 0)
-                               throw new ArgumentOutOfRangeException ("length", length, "Length must be non-negative integer.");
-                       else if (buffer.Length < offset + length)
+                       if (offset < 0) {
+                               throw new ArgumentOutOfRangeException (
+#if !NET_2_1
+                                       "offset", offset,
+#endif
+                                       "Offset must be non-negative integer.");
+
+                       } else if (length < 0) {
+                               throw new ArgumentOutOfRangeException (
+#if !NET_2_1
+                                       "length", length,
+#endif
+                                       "Length must be non-negative integer.");
+
+                       } else if (buffer.Length < offset + length)
                                throw new ArgumentOutOfRangeException ("buffer length is smaller than the sum of offset and length.");
 
                        if (IsEmptyElement) {
index 75849d9e957645f0141d4cc258a5887574eb4c3b..cabee1eb47f340b8506913f75551295c5237745f 100644 (file)
@@ -72,12 +72,8 @@ namespace System.Xml
                        }
 
 #if NET_2_1
-                       // there is no WebRequest in 2.1 System.dll.
-                       if (absoluteUri.IsFile)
-                               return File.OpenRead (absoluteUri.LocalPath);
-                       else
-                               // So, what can I do here? HttpWebRequest cannot be instantiated within System.dll
-                               throw new NotImplementedException ();
+                       // So, what can I do here? HttpWebRequest cannot be instantiated within System.dll
+                       throw new NotImplementedException ();
 #else
                        // (MS documentation says) parameter role isn't used yet.
                        WebRequest req = WebRequest.Create (absoluteUri);
index 81b99c0ea526df4ab22c44ffc1cf36e99968cbe4..6bd46073a20264bb30b1266efe8368dc95af046d 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-03  Jb Evain  <jbevain@novell.com>
+
+       * ComponentCollection.cs: use our own collection base
+         for the 2.1 profile, as ReadOnlyCollectionBase does not exist
+         in 2.1, and they are internalized by the linker.
+
 2007-08-01  Atsushi Enomoto  <atsushi@ximian.com>
 
        * BackgroundWorker.cs : remove extra MonoTODOs.
index 45c686d3b6c9cad08d38929d3a328eca332a1068..fddf04c6847eff1435c181a9660f90a5e9834e78 100644 (file)
@@ -37,9 +37,24 @@ using System.Runtime.InteropServices;
 using System.Reflection;
 
 namespace System.ComponentModel {
-       [ComVisible (true)]
-       public class ComponentCollection : ReadOnlyCollectionBase {
 
+#if NET_2_1
+       public class ComponentCollectionBase : System.Collections.Generic.List<IComponent>
+       {
+               protected ComponentCollectionBase InnerList {
+                       get { return this; }
+               }
+       }
+#endif
+
+       [ComVisible (true)]
+       public class ComponentCollection :
+#if !NET_2_1
+               ReadOnlyCollectionBase
+#else
+               ComponentCollectionBase
+#endif
+       {
                #region Constructors
 
                public ComponentCollection (IComponent[] components)
index 818ebb6a2b6d2190be3da03b799586044470e480..898216feaffbfe56b83c20934ab9bf28e52b2932 100644 (file)
@@ -1,3 +1,24 @@
+2007-08-03  Jb Evain  <jbevain@novell.com>
+
+       * FileVersionInfo.cs: force the use of the params
+       AppendFormat method of StringBuilder as it is the only
+       one accessible in 2.1 and in the previous versions.
+
+2007-08-03  Jb Evain  <jbevain@novell.com>
+
+       * FileVersionInfo.cs: remove CAS checks for 2.1.
+
+2007-08-03  Jb Evain  <jbevain@novell.com>
+
+       * Process.cs: disable StartExistCallbackIfNeeded in 2.1.
+
+2007-08-03  Jb Evain  <jbevain@novell.com>
+
+       * ProcessThreadCollection.cs
+         ProcessModuleCollection.cs: use our own collection base
+         for the 2.1 profile, as ReadOnlyCollectionBase does not exist
+         in 2.1, and they are internalized by the linker.
+
 2007-08-02  Atsushi Enomoto  <atsushi@ximian.com>
 
        * EventLogTraceListener.cs : fixed wrong 2.0 dependency in 1.x.
index 8b26a1c155aae5bfaf6c2ca11f49f5f26f15e2fc..cc52a317f4a969802f58245b4e0f693e2b4b670f 100644 (file)
@@ -142,9 +142,11 @@ namespace System.Diagnostics {
 
                public string FileName {
                        get {
+#if !NET_2_1
                                if (SecurityManager.SecurityEnabled) {
                                        new FileIOPermission (FileIOPermissionAccess.PathDiscovery, filename).Demand ();
                                }
+#endif
                                return filename;
                        }
                }
@@ -274,34 +276,41 @@ namespace System.Diagnostics {
                
                public static FileVersionInfo GetVersionInfo (string fileName)
                {
+#if !NET_2_1
                        if (SecurityManager.SecurityEnabled) {
                                new FileIOPermission (FileIOPermissionAccess.Read, fileName).Demand ();
                        }
-
+#endif
                        FileVersionInfo fvi = new FileVersionInfo ();
                        fvi.GetVersionInfo_internal (fileName);
                        return fvi;
                }
-               
+
+               // use our own AppendFormat because NET_2_1 have only this overload
+               static void AppendFormat (StringBuilder sb, string format, params object [] args)
+               {
+                       sb.AppendFormat (format, args);
+               }
+
                public override string ToString ()
                {
                        StringBuilder sb = new StringBuilder ();
 
                        // we use the FileName property so we don't skip the security check
-                       sb.AppendFormat ("File:             {0}{1}", FileName, Environment.NewLine);
+                       AppendFormat (sb, "File:             {0}{1}", FileName, Environment.NewLine);
                        // the other informations aren't protected so we can use the members directly
-                       sb.AppendFormat ("InternalName:     {0}{1}", internalname, Environment.NewLine);
-                       sb.AppendFormat ("OriginalFilename: {0}{1}", originalfilename, Environment.NewLine);
-                       sb.AppendFormat ("FileVersion:      {0}{1}", fileversion, Environment.NewLine);
-                       sb.AppendFormat ("FileDescription:  {0}{1}", filedescription, Environment.NewLine);
-                       sb.AppendFormat ("Product:          {0}{1}", productname, Environment.NewLine);
-                       sb.AppendFormat ("ProductVersion:   {0}{1}", productversion, Environment.NewLine);
-                       sb.AppendFormat ("Debug:            {0}{1}", isdebug, Environment.NewLine);
-                       sb.AppendFormat ("Patched:          {0}{1}", ispatched, Environment.NewLine);
-                       sb.AppendFormat ("PreRelease:       {0}{1}", isprerelease, Environment.NewLine);
-                       sb.AppendFormat ("PrivateBuild:     {0}{1}", isprivatebuild, Environment.NewLine);
-                       sb.AppendFormat ("SpecialBuild:     {0}{1}", isspecialbuild, Environment.NewLine);
-                       sb.AppendFormat ("Language          {0}{1}", language, Environment.NewLine);
+                       AppendFormat (sb, "InternalName:     {0}{1}", internalname, Environment.NewLine);
+                       AppendFormat (sb, "OriginalFilename: {0}{1}", originalfilename, Environment.NewLine);
+                       AppendFormat (sb, "FileVersion:      {0}{1}", fileversion, Environment.NewLine);
+                       AppendFormat (sb, "FileDescription:  {0}{1}", filedescription, Environment.NewLine);
+                       AppendFormat (sb, "Product:          {0}{1}", productname, Environment.NewLine);
+                       AppendFormat (sb, "ProductVersion:   {0}{1}", productversion, Environment.NewLine);
+                       AppendFormat (sb, "Debug:            {0}{1}", isdebug, Environment.NewLine);
+                       AppendFormat (sb, "Patched:          {0}{1}", ispatched, Environment.NewLine);
+                       AppendFormat (sb, "PreRelease:       {0}{1}", isprerelease, Environment.NewLine);
+                       AppendFormat (sb, "PrivateBuild:     {0}{1}", isprivatebuild, Environment.NewLine);
+                       AppendFormat (sb, "SpecialBuild:     {0}{1}", isspecialbuild, Environment.NewLine);
+                       AppendFormat (sb, "Language          {0}{1}", language, Environment.NewLine);
 
                        return sb.ToString ();
                }
index a5f79f60b711b3fb8a3971f0fca97ac0bc57817b..c857d251104cb65081644e3f6ede5f026419d70a 100644 (file)
@@ -96,6 +96,7 @@ namespace System.Diagnostics {
 
                void StartExitCallbackIfNeeded ()
                {
+#if !NET_2_1
                        bool start = (!already_waiting && enableRaisingEvents && exited_event != null);
                        if (start && process_handle != IntPtr.Zero && !HasExited) {
                                WaitOrTimerCallback cb = new WaitOrTimerCallback (CBOnExit);
@@ -103,6 +104,7 @@ namespace System.Diagnostics {
                                ThreadPool.RegisterWaitForSingleObject (h, cb, this, -1, true);
                                already_waiting = true;
                        }
+#endif
                }
 
                [DefaultValue (false), Browsable (false)]
index db11deedd4679b3069774510d95d66b4adb4a660..7a29e8f83e3241b6d242f88239a5ca806f30fa87 100644 (file)
@@ -33,9 +33,22 @@ using System.Collections;
 
 namespace System.Diagnostics 
 {
-       public class ProcessModuleCollection : ReadOnlyCollectionBase 
+#if NET_2_1
+       public class ProcessModuleCollectionBase : System.Collections.Generic.List<ProcessModule>
+       {
+               protected ProcessModuleCollectionBase InnerList {
+                       get { return this; }
+               }
+       }
+#endif
+
+       public class ProcessModuleCollection :
+#if !NET_2_1   
+               ReadOnlyCollectionBase
+#else
+               ProcessModuleCollectionBase
+#endif
        {
-               
                protected ProcessModuleCollection() 
                {
                }
index 64a3161d6426fa6ea97fc5a40b768c56c154250e..4e24ecc29e89189f97dfe287359ee4d5105bed02 100644 (file)
@@ -33,7 +33,27 @@ using System.Collections;
 
 namespace System.Diagnostics 
 {
-       public class ProcessThreadCollection : ReadOnlyCollectionBase 
+#if NET_2_1
+       public class ProcessThreadCollectionBase : System.Collections.Generic.List<ProcessThread>
+       {
+               protected ProcessThreadCollectionBase InnerList {
+                       get { return this; }
+               }
+
+               public new int Add (ProcessThread thread)
+               {
+                       base.Add (thread);
+                       return Count - 1;
+               }
+       }
+#endif
+
+       public class ProcessThreadCollection :
+#if !NET_2_1
+               ReadOnlyCollectionBase
+#else
+               ProcessThreadCollectionBase
+#endif
        {
                protected ProcessThreadCollection() 
                {
index 67ed76564e04cc6575a36c606c27ff5bd95a5ae3..4395f4af81df086828dd027eeb82e609050173e7 100644 (file)
@@ -1,3 +1,7 @@
+2007-08-03  Jb Evain  <jbevain@novell.com>
+
+       * Dns.cs: remove async methods for the 2.1 profile.
+
 2007-07-17  Rodrigo Kumpera  <rkumpera@novell.com>
 
        * HttpListenerRequest.cs: Support for Cookie decoding.
index 0ef74b1db930e8b4905e349eab4ca3b46fddacad..f83909c47757dd2eb87c6a9c9b65bc6b6a78e8b9 100644 (file)
@@ -48,6 +48,8 @@ namespace System.Net {
                        System.Net.Sockets.Socket.CheckProtocolSupport();
                }
 
+#if !NET_2_1 // global remove of async methods
+
                private delegate IPHostEntry GetHostByNameCallback (string hostName);
                private delegate IPHostEntry ResolveCallback (string hostName);
 #if NET_2_0
@@ -164,6 +166,8 @@ namespace System.Net {
                        return cb.EndInvoke(asyncResult);
                }
 #endif
+               
+#endif // !NET_2_1: global remove of async methods
 
 #if !TARGET_JVM
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
index 65ca5e0254751cbb93e9617efac3cce2895c8c1d..2f7fa2b859a707db0e00a7b2f673f82a2f423fa9 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-03  Zoltan Varga  <vargaz@gmail.com>
+
+       * MethodInfoTest.cs: Add another test.
+       
+       * MethodInfoTest.cs: Add test for Invoking methods with a nullable type receiver.
+
 2007-07-20  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * MethodInfoTest.cs: Added GetMethodFromHandle test for generic type.
index 35253b22c2a9f9b96c6114f52b3bab4b66b3b86b..3b20924b38858aef51d9abc9f782d8e1613643c6 100644 (file)
@@ -389,6 +389,12 @@ namespace MonoTests.System.Reflection
                        MethodInfo mi = typeof (MethodInfoTest).GetMethod ("pass_nullable");
                        Assert.AreEqual (102, mi.Invoke (null, new object [] { 102 }), "#1");
                        Assert.AreEqual (null, mi.Invoke (null, new object [] { null }), "#2");
+
+                       // Test conversion of vtype to a nullable type for the this argument
+                       PropertyInfo pi = typeof (Nullable <int>).GetProperty ("HasValue");
+                   Assert.AreEqual (true, pi.GetGetMethod ().Invoke (10, null));
+                       PropertyInfo pi2 = typeof (Nullable <int>).GetProperty ("Value");
+                   Assert.AreEqual (10, pi2.GetGetMethod ().Invoke (10, null));
                }
 
                public static void foo_generic<T> ()
index 2286493ec1766944689b5457cf2b08a9eb60fd46..b91da55068a4c89dd6a68b9ce734a75a1db13003 100644 (file)
@@ -45,11 +45,13 @@ namespace MonoTests.System
        {
                private AppDomain ad;
                private ArrayList files = new ArrayList ();
-               private string tempDir = Path.Combine (Path.GetTempPath (), "MonoTests.System.AppDomainTest");
+               private string tempDir;
 
                [SetUp]
                public void SetUp ()
                {
+                       tempDir = Path.Combine (Path.GetTempPath (), Environment.UserName);
+                       tempDir = Path.Combine (tempDir, "MonoTests.System.AppDomainTest");
                        if (!Directory.Exists (tempDir)) {
                                Directory.CreateDirectory (tempDir);
                        }
index b8938bd416c907219f2e338fc280cf7a2d6bbddf..fb1f97b0a116efa1fb738a50e9b9977478071a61 100644 (file)
@@ -1,3 +1,16 @@
+2007-08-04  William Holmes  <billholmes54@gmail.com>
+
+       * AppDomainTest.cs: Adding username to tempDir to avoid file access 
+        permissions.
+
+2007-08-04  William Holmes  <billholmes54@gmail.com>
+
+       * TypeTest.cs: Removing generic method for net_1_1 profile.
+
+2007-08-03  Zoltan Varga  <vargaz@gmail.com>
+
+       * TypeTest.cs: Add test for IsAssignableFrom and generic parameters.
+
 2007-07-31  Gert Driesen  <drieseng@users.sourceforge.net>
 
        * TypeTest.cs: Added test for bug #82211.
index 9559b52d393e44bb1d0064bc440502c0e5e2e6ef..783502ab3ae2244bee0abb1062d48780d430cf39 100644 (file)
@@ -138,7 +138,10 @@ namespace MonoTests.System
 
                private void ByrefMethod (ref int i, ref Derived1 j, ref Base1 k) {
                }
-
+#if NET_2_0
+               private void GenericMethod<Q> (Q q) {
+               }
+#endif
                [Test]
                public void TestIsAssignableFrom () {
                        // Simple tests for inheritance
@@ -202,6 +205,13 @@ namespace MonoTests.System
                        MethodInfo mi = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic);
                        Assert.IsTrue (mi.GetParameters ()[2].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
                        Assert.IsTrue (mi.GetParameters ()[1].ParameterType.IsAssignableFrom (mi.GetParameters ()[1].ParameterType));
+
+                       // Tests for type parameters
+#if NET_2_0
+                       mi = typeof (TypeTest).GetMethod ("GenericMethod", BindingFlags.Instance|BindingFlags.NonPublic);
+                       Assert.IsTrue (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (mi.GetParameters ()[0].ParameterType));
+                       Assert.IsFalse (mi.GetParameters ()[0].ParameterType.IsAssignableFrom (typeof (int)));
+#endif
                }
 
                [Test]
index 2ea3ffe646c49448eb6e217bb4f164bba71ae7f1..a48bf512ddf38646cb8347d69a22e420bb99bb0d 100644 (file)
@@ -1,3 +1,16 @@
+2007-08-03  Marek Safar  <marek.safar@gmail.com>
+
+       A fix for bug #81979
+       * expression.cs (TypeOf.GetAttributableValue): Check for type arguments
+       only.
+
+2007-08-03  Marek Safar  <marek.safar@gmail.com>
+
+       A fix for bug #82300
+
+       * anonymous.cs (AnonymousContainer.Define): Don't define anything when
+       we are in probing scope.
+
 2007-08-03  Marek Safar  <marek.safar@gmail.com>
 
        A fix for bug #82301
index 2eb1a5d9a849a1270ae741d9162f9065a3e8536b..2892bc994d9c7ac605e480ecd9f2eb5d0cacfc38 100644 (file)
@@ -1547,6 +1547,10 @@ namespace Mono.CSharp {
                        if (aec == null && !Compatible (ec))
                                return false;
 
+                       // Don't define anything when we are in probing scope (nested anonymous methods)
+                       if (ec.IsInProbingMode)
+                               return true;
+
                        method = DoCreateMethodHost (ec);
 
                        if (Scope != null)
index 84ddfc5821f9b862a2609e429f80385e6a74d28f..70d87a0a31424bd11ae21066adcc4248a21fe05a 100644 (file)
@@ -6514,10 +6514,11 @@ namespace Mono.CSharp {
 
                public override bool GetAttributableValue (Type valueType, out object value)
                {
-                       if (TypeManager.ContainsGenericParameters (typearg)) {
-                               Report.SymbolRelatedToPreviousError(typearg);
-                               Report.Error(416, loc, "`{0}': an attribute argument cannot use type parameters",
-                                            TypeManager.CSharpName(typearg));
+                       if (TypeManager.ContainsGenericParameters (typearg) &&
+                               !TypeManager.IsGenericTypeDefinition (typearg)) {
+                               Report.SymbolRelatedToPreviousError (typearg);
+                               Report.Error (416, loc, "`{0}': an attribute argument cannot use type parameters",
+                                            TypeManager.CSharpName (typearg));
                                value = null;
                                return false;
                        }
diff --git a/mcs/tests/gtest-336.cs b/mcs/tests/gtest-336.cs
new file mode 100644 (file)
index 0000000..0ab6d35
--- /dev/null
@@ -0,0 +1,41 @@
+using System;
+
+public class TestAttribute : Attribute
+{
+       object type;
+       public object Type
+       {
+               get { return type; }
+               set { type = value; }
+       }
+       public TestAttribute() { }
+       public TestAttribute(Type type)
+       {
+               this.type = type;
+       }
+}
+
+namespace N
+{
+       class C<T>
+       {
+               [Test(Type = typeof(C<>))] //this shouldn't fail
+               public void Bar() { }
+
+               [Test(typeof(C<>))]     // this shouldn't fail
+               public void Bar2() { }
+               
+               [Test(typeof(C<int>))]     // this shouldn't fail
+               public void Bar3() { }
+
+               [Test(typeof(C<CC>))]     // this shouldn't fail
+               public void Bar4() { }
+       }
+
+       class CC
+       {
+               public static void Main()
+               {
+               }
+       }
+}
\ No newline at end of file
index 2164a9cf729fb104311408a6d604fcd576e72656..36c3bd14f878c6da208f28c984706655cd05f241 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-05  Jb Evain  <jbevain@novell.com>
+
+       * Mono.Linker.Steps/ResolveFromXmlStep.cs:
+               Now the resolver deals only with assembly names
+               instead of fullnames.
+
 2007-07-25  Jb Evain  <jbevain@novell.com>
 
        * Mono.Linker.Steps/ResolveFromAssemblyStep.cs:
index 9f68cbd8e4acb723450cea7b5fce5864bbd8d6dd..67244b0b17684c386b6ba3e78b788b9f369819b9 100644 (file)
@@ -90,7 +90,7 @@
                <type fullname="System.Nullable`1" />
                <type fullname="System.Object" preserve="fields" />
                <type fullname="System.OutOfMemoryException" />
-               <type fullname="System.Reflection.Assembly" preserve="fields" />
+               <type fullname="System.Reflection.Assembly" preserve="all" />
                <type fullname="System.Reflection.AssemblyName" preserve="fields" />
                <type fullname="System.Reflection.ConstructorInfo" preserve="fields" />
                <type fullname="System.Reflection.CustomAttributeData" preserve="fields" />
                <type fullname="System.Reflection.Emit.GenericTypeParameterBuilder" preserve="fields" />
                <type fullname="System.Reflection.Emit.ILExceptionBlock" preserve="fields" />
                <type fullname="System.Reflection.Emit.ILExceptionInfo" preserve="fields" />
-               <type fullname="System.Reflection.Emit.ILGenerator" preserve="fields" />
-               <type fullname="System.Reflection.Emit.LocalBuilder" preserve="fields" />
+               <type fullname="System.Reflection.Emit.ILGenerator" preserve="all" />
+               <type fullname="System.Reflection.Emit.LocalBuilder" preserve="all" />
                <type fullname="System.Reflection.Emit.MethodBuilder" preserve="fields" />
-               <type fullname="System.Reflection.Emit.ModuleBuilder" preserve="fields" />
+               <type fullname="System.Reflection.Emit.ModuleBuilder" preserve="all" />
                <type fullname="System.Reflection.Emit.MonoResource" preserve="fields" />
                <type fullname="System.Reflection.Emit.MonoWin32Resource" preserve="fields" />
                <type fullname="System.Reflection.Emit.ParameterBuilder" preserve="fields" />
                <type fullname="System.Reflection.MethodBase" preserve="fields" />
                <type fullname="System.Reflection.MethodBody" preserve="fields" />
                <type fullname="System.Reflection.MethodInfo" preserve="fields" />
-               <type fullname="System.Reflection.Module" preserve="fields" />
+               <type fullname="System.Reflection.Module" preserve="all" />
                <type fullname="System.Reflection.MonoArrayMethod" preserve="fields" />
                <type fullname="System.Reflection.MonoCMethod" preserve="fields" />
                <type fullname="System.Reflection.MonoEvent" preserve="fields" />
index 39c77f42e6103b7f47520ae9782e47ac2b7bab0f..ac806fb0a67f96069aa1b7d8f7df05a72b28b87d 100644 (file)
@@ -226,47 +226,18 @@ namespace Mono.Linker.Steps {
                        AssemblyNameReference reference = AssemblyNameReference.Parse (assemblyName);
                        AssemblyDefinition assembly;
 
-                       if (IsSimpleName (assemblyName)) {
-                               assembly = SearchAssemblyInContext (context, assemblyName);
-                               if (assembly != null)
-                                       return assembly;
-                       }
-
                        assembly = context.Resolve (reference);
 
-                       if (IsSimpleName (assemblyName))
-                               UpdateReferenceInCache (context, reference, assembly);
-
                        ProcessReferences (assembly, context);
                        return assembly;
                }
 
-               static void UpdateReferenceInCache (LinkContext context, AssemblyNameReference reference, AssemblyDefinition assembly)
-               {
-                       context.Resolver.AssemblyCache.Remove (reference.FullName);
-                       context.Resolver.AssemblyCache.Add (assembly.Name.FullName, assembly);
-               }
-
-               static AssemblyDefinition SearchAssemblyInContext (LinkContext context, string name)
-               {
-                       foreach (AssemblyDefinition assembly in context.GetAssemblies ())
-                               if (assembly.Name.Name == name)
-                                       return assembly;
-
-                       return null;
-               }
-
                static void ProcessReferences (AssemblyDefinition assembly, LinkContext context)
                {
                        foreach (AssemblyNameReference name in assembly.MainModule.AssemblyReferences)
                                context.Resolve (name);
                }
 
-               static bool IsSimpleName (string assemblyName)
-               {
-                       return assemblyName.IndexOf (",") == -1;
-               }
-
                static bool IsRequired (XPathNavigator nav)
                {
                        string attribute = GetAttribute (nav, _required);
index e357a29206fd4f99a10848f3fbffb37b6ba405b9..3df71bb221da77fde246ad5410a5c57b3a680341 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-05  Jb Evain  <jbevain@novell.com>
+
+       * Descriptors/smcs.xml, Makefile: add a descriptor
+       to protect some classes in smcs.
+
 2007-08-03  Atsushi Enomoto  <atsushi@ximian.com>
 
        * Makefile : a bit win32 friendly fix.
diff --git a/mcs/tools/tuner/Descriptors/smcs.xml b/mcs/tools/tuner/Descriptors/smcs.xml
new file mode 100644 (file)
index 0000000..21906d5
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<linker>
+       <assembly fullname="smcs">
+               <type fullname="Mono.CompilerServices.SymbolWriter.MonoDebuggerSupport" />
+       </assembly>
+</linker>
index aa640e1f5b6af7d82866756ff733c5dce5e0c653..dd2b27542d11c49c89da44fc1ddd4e741223d385 100644 (file)
@@ -11,11 +11,14 @@ LINKER_PLUGINS = \
        Mono.Tuner/CheckVisibility.dll  \
 #      Mono.Tuner/InjectAttributes.dll \
 
+LINKER_DESCS = \
+       Descriptors/smcs.xml    \
+
 LOCAL_MCS_FLAGS = -r:$(LINKER) -r:Mono.Cecil.dll
 
 LINKER_SOURCES = $(LINKER_PLUGINS:.dll=.cs)
 
-DISTFILES = README $(LINKER_SOURCES)
+DISTFILES = README $(LINKER_SOURCES) $(LINKER_DESCS)
 
 ifneq (net_2_1, $(PROFILE))
 all-local: $(LINKER_PLUGINS)
@@ -63,7 +66,7 @@ LINKER_STEPS = \
        Mono.Tuner.CheckVisibility,CheckVisibility      \
 
 tune: masterinfos/silverlight.infos
-       MONO_PATH="Mono.Tuner$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(LINKER) $(LINKER_FLAGS) $(LINKER_STEPS:%=-s %) $(MCS_MASTER_INFOS:%=-i %)
+       MONO_PATH="Mono.Tuner$(PLATFORM_PATH_SEPARATOR)$(topdir)/class/lib/net_2_0$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(LINKER) $(LINKER_FLAGS) $(LINKER_DESCS:%=-x %) $(LINKER_STEPS:%=-s %) $(MCS_MASTER_INFOS:%=-i %)
 
 %.dll: %.cs
        $(CSCOMPILE) /t:library $^
diff --git a/mcs/tools/tuner/Mono.Tuner.csproj b/mcs/tools/tuner/Mono.Tuner.csproj
new file mode 100644 (file)
index 0000000..3267b35
--- /dev/null
@@ -0,0 +1,60 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{E97429BA-279A-4C1D-AE8A-8BD878C661D1}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Mono.Tuner</RootNamespace>
+    <AssemblyName>Mono.Tuner</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Mono.Tuner\CheckVisibility.cs" />
+    <Compile Include="Mono.Tuner\PrintStatus.cs" />
+    <Compile Include="Mono.Tuner\RemoveSerialization.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\class\Mono.Cecil\Mono.Cecil.csproj">
+      <Project>{D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}</Project>
+      <Name>Mono.Cecil</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\linker\Mono.Linker.csproj">
+      <Project>{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}</Project>
+      <Name>Mono.Linker</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Properties\" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file
index 5b3780197e13d47dfdfed5f153dbe2cd77556f0e..cc92dfded45a1f3f81aa8d0bf427617a8cfebf5f 100644 (file)
@@ -77,27 +77,7 @@ namespace Mono.Tuner {
 
                static bool IsPublic (TypeDefinition type)
                {
-                       return (type.DeclaringType == null && (type.Attributes & TypeAttributes.Public) != 0) || (type.Attributes & TypeAttributes.NestedPublic) != 0;
-               }
-
-               static bool IsPublic (FieldDefinition field)
-               {
-                       return (field.Attributes & FieldAttributes.Public) != 0;
-               }
-
-               static bool IsAssembly (FieldDefinition field)
-               {
-                       return (field.Attributes & FieldAttributes.Assembly) != 0;
-               }
-
-               static bool IsPublic (MethodDefinition meth)
-               {
-                       return (meth.Attributes & MethodAttributes.Public) != 0;
-               }
-
-               static bool IsAssembly (MethodDefinition meth)
-               {
-                       return (meth.Attributes & MethodAttributes.Assem) != 0;
+                       return (type.DeclaringType == null && type.IsPublic) || type.IsNestedPublic;
                }
 
                static bool AreInDifferentAssemblies (TypeDefinition lhs, TypeDefinition rhs)
@@ -112,7 +92,7 @@ namespace Mono.Tuner {
 
                        if (reference is GenericParameter || reference.GetOriginalType () is GenericParameter)
                                return true;
-       
+
                        TypeDefinition other = Context.Resolver.Resolve (reference);
                        if (other == null)
                                return true;
@@ -122,7 +102,7 @@ namespace Mono.Tuner {
 
                        if (IsPublic (other))
                                return true;
-                       
+
                        return false;
                }
 
@@ -134,7 +114,7 @@ namespace Mono.Tuner {
                        MethodDefinition meth = null;
                        try {
                                meth = Context.Resolver.Resolve (reference);
-                       } catch {}
+                       } catch (ResolutionException) {}
 
                        if (meth == null)
                                return true;
@@ -143,10 +123,16 @@ namespace Mono.Tuner {
                        if (!IsVisibleFrom (type, dec))
                                return false;
 
-                       if (IsPublic (meth))
+                       if (meth.IsPublic)
+                               return true;
+
+                       if (type == dec || type.DeclaringType == dec)
+                               return true;
+
+                       if (meth.IsFamily && InHierarchy (type, dec))
                                return true;
 
-                       if (!AreInDifferentAssemblies (type, dec) && IsAssembly (meth))
+                       if (!AreInDifferentAssemblies (type, dec) && meth.IsAssembly)
                                return true;
 
                        return false;
@@ -160,7 +146,7 @@ namespace Mono.Tuner {
                        FieldDefinition field = null;
                        try {
                                field = Context.Resolver.Resolve (reference);
-                       } catch {}
+                       } catch (ResolutionException) {}
 
                        if (field == null)
                                return true;
@@ -169,16 +155,35 @@ namespace Mono.Tuner {
                        if (!IsVisibleFrom (type, dec))
                                return false;
 
-                       if (IsPublic (field))
+                       if (field.IsPublic)
+                               return true;
+
+                       if (type == dec || type.DeclaringType == dec)
+                               return true;
+
+                       if (field.IsFamily && InHierarchy (type, dec))
                                return true;
 
-                       if (!AreInDifferentAssemblies (type, dec) && IsAssembly (field))
+                       if (!AreInDifferentAssemblies (type, dec) && field.IsAssembly)
                                return true;
 
                        return false;
                }
 
-               void Report (string pattern, params object [] parameters)
+               bool InHierarchy (TypeDefinition type, TypeDefinition other)
+               {
+                       if (type.BaseType == null)
+                               return false;
+
+                       TypeDefinition baseType = Context.Resolver.Resolve (type.BaseType);
+
+                       if (baseType == other)
+                               return true;
+
+                       return InHierarchy (baseType, other);
+               }
+
+               static void Report (string pattern, params object [] parameters)
                {
                        Console.WriteLine ("[check] " + pattern, parameters);
                }
index 00ed5e5117d6f199e49aaf7bf496fa1fe38269fc..124ab090633ff5a7bd15bdfbaac7bb1215b5595f 100644 (file)
@@ -34,7 +34,7 @@ using Mono.Linker.Steps;
 using Mono.Cecil;
 
 namespace Mono.Tuner {
-       
+
        public class PrintStatus : BaseStep {
 
                protected override void ProcessAssembly (AssemblyDefinition assembly)
index 3c81b6d82401945d84c3aa1a46d15274093045a4..9b56a866a25b3a3e13283c6188459bbed84c9661 100644 (file)
@@ -35,7 +35,7 @@ using Mono.Linker.Steps;
 using Mono.Cecil;
 
 namespace Mono.Tuner {
-       
+
        public class RemoveSerialization : BaseStep {
 
                static readonly string _Serialization = "System.Runtime.Serialization";
@@ -75,7 +75,7 @@ namespace Mono.Tuner {
 
                static void RemoveSerializableFlag (TypeDefinition type)
                {
-                       type.Attributes &= ~TypeAttributes.Serializable; 
+                       type.Attributes &= ~TypeAttributes.Serializable;
                }
 
                static void ProcessType (TypeDefinition type)
diff --git a/mint.pc.in b/mint.pc.in
deleted file mode 100644 (file)
index 0b91a2c..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=${pcfiledir}/../..
-exec_prefix=${pcfiledir}/../..
-libdir=${prefix}/lib
-includedir=${prefix}/include/mono-@API_VER@
-
-
-Name: Mono Interpreter
-Description: Mono Interpreter Runtime
-Version: @VERSION@
-Requires: glib-2.0 gthread-2.0
-Libs: -L${libdir} @export_ldflags@ -lmint @libmono_ldflags@
-Cflags: -I${includedir} @libmono_cflags@
diff --git a/mono-cairo.pc.in b/mono-cairo.pc.in
deleted file mode 100644 (file)
index 2a5c07f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-prefix=${pcfiledir}/../..
-exec_prefix=${pcfiledir}/../..
-libdir=${prefix}/@reloc_libdir@
-includedir=${prefix}/include
-
-Name: Mono.Cairo
-Description: Cairo bindings for Mono
-Version: @VERSION@
-Libs: -r:${prefix}/lib/mono/1.0/Mono.Cairo.dll
diff --git a/mono.pc.in b/mono.pc.in
deleted file mode 100644 (file)
index 9374c19..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=${pcfiledir}/../..
-exec_prefix=${pcfiledir}/../..
-libdir=${prefix}/@reloc_libdir@
-includedir=${prefix}/include/mono-@API_VER@
-
-Name: Mono
-Description: Mono Runtime
-Version: @VERSION@
-Requires: glib-2.0 gthread-2.0
-Libs: -L${libdir} @export_ldflags@ -lmono @libmono_ldflags@
-Cflags: -I${includedir} @libmono_cflags@
index 47e1f289f8385f16643274b73972971ae02c1876..4ad3c57a8151e52acc6f84361ed8672c33bfaacd 100644 (file)
@@ -1,3 +1,30 @@
+2007-08-03  Zoltan Varga  <vargaz@gmail.com>
+
+       * image.c (mono_image_close): Fix a leak.
+
+       * object.c (mono_runtime_invoke_array): Avoid using alloca.
+
+       * icall.c (ves_icall_FieldInfo_SetValueInternal): Ditto.        
+
+Fri Aug 3 19:54:23 CEST 2007 Paolo Molaro <lupus@ximian.com>
+
+       * domain.c, threads.c, threads-types.h: fix memory retention issue
+       with thread static variables not being cleared on domain unload.
+       Reuse thread static slots after domain unload.
+
+2007-08-03  Zoltan Varga  <vargaz@gmail.com>
+
+       * object.c (mono_runtime_invoke_array): Handle the case when the receiver is a
+       nullable type.
+
+       * marshal.c (mono_marshal_get_runtime_invoke): Revert the previous change, it is
+       now done in mono_runtime_invoke_array.
+
+       * marshal.c (mono_marshal_get_runtime_invoke): Handle the case when the 
+       receiver is a nullable type.
+
+       * class.c (mono_class_is_assignable_from): Handle the case when klass is a 
+       generic parameter.
 
 2007-07-03  Jonathan Chambers  <joncham@gmail.com>
 
index 85ea5d9812745abc20d30dc87a33bff315eef2ce..5951daa6b6c5f05a3ea19249439cdf99bf3ecd50 100644 (file)
@@ -4435,6 +4435,9 @@ mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass)
        if (!oklass->inited)
                mono_class_init (oklass);
 
+       if ((klass->byval_arg.type == MONO_TYPE_VAR) || (klass->byval_arg.type == MONO_TYPE_MVAR))
+               return klass == oklass;
+
        if (MONO_CLASS_IS_INTERFACE (klass)) {
                if ((oklass->byval_arg.type == MONO_TYPE_VAR) || (oklass->byval_arg.type == MONO_TYPE_MVAR))
                        return FALSE;
index 78b83cd0cb486bf1678aa4633d65d907111ba6f7..fbd77a178238c2a7f37af8c8b4d2a6664a221f02 100644 (file)
@@ -1119,6 +1119,12 @@ mono_domain_free (MonoDomain *domain, gboolean force)
        domain->null_reference_ex = NULL;
        domain->stack_overflow_ex = NULL;
        domain->entry_assembly = NULL;
+       /* must do this early as it accesses fields and types */
+       if (domain->special_static_fields) {
+               mono_alloc_special_static_data_free (domain->special_static_fields);
+               g_hash_table_destroy (domain->special_static_fields);
+               domain->special_static_fields = NULL;
+       }
        for (tmp = domain->domain_assemblies; tmp; tmp = tmp->next) {
                MonoAssembly *ass = tmp->data;
                mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Unloading domain %s %p, assembly %s %p, refcount=%d\n", domain->friendly_name, domain, ass->aname.name, ass, ass->ref_count);
@@ -1193,10 +1199,6 @@ mono_domain_free (MonoDomain *domain, gboolean force)
                g_hash_table_destroy (domain->delegate_invoke_impl_no_target_hash);
                domain->delegate_invoke_impl_no_target_hash = NULL;
        }
-       if (domain->special_static_fields) {
-               g_hash_table_destroy (domain->special_static_fields);
-               domain->special_static_fields = NULL;
-       }
        DeleteCriticalSection (&domain->assemblies_lock);
        DeleteCriticalSection (&domain->lock);
        domain->setup = NULL;
index cb3fbc9224ef9b87d85761f2306a578e63adb6d1..6ee8ef90f10261d23d663bf405ac630093e7a6de 100644 (file)
@@ -466,9 +466,10 @@ ICALL(TYPEB_6, "setup_generic_class", mono_reflection_setup_generic_class)
 ICALL(TYPEB_7, "setup_internal_class", mono_reflection_setup_internal_class)
 
 ICALL_TYPE(FIELDI, "System.Reflection.FieldInfo", FILEDI_1)
-ICALL(FILEDI_1, "GetUnmanagedMarshal", ves_icall_System_Reflection_FieldInfo_GetUnmanagedMarshal)
-ICALL(FILEDI_2, "internal_from_handle", ves_icall_System_Reflection_FieldInfo_internal_from_handle)
-ICALL(FILEDI_3, "internal_from_handle_type", ves_icall_System_Reflection_FieldInfo_internal_from_handle_type)
+ICALL(FILEDI_1, "GetTypeModifiers", ves_icall_System_Reflection_FieldInfo_GetTypeModifiers)
+ICALL(FILEDI_2, "GetUnmanagedMarshal", ves_icall_System_Reflection_FieldInfo_GetUnmanagedMarshal)
+ICALL(FILEDI_3, "internal_from_handle", ves_icall_System_Reflection_FieldInfo_internal_from_handle)
+ICALL(FILEDI_4, "internal_from_handle_type", ves_icall_System_Reflection_FieldInfo_internal_from_handle_type)
 
 ICALL_TYPE(MEMBERI, "System.Reflection.MemberInfo", MEMBERI_1)
 ICALL(MEMBERI_1, "get_MetadataToken", mono_reflection_get_token)
@@ -489,9 +490,10 @@ ICALL(MODULE_6, "InternalGetTypes", ves_icall_System_Reflection_Module_InternalG
 ICALL(MODULE_7, "ResolveFieldToken", ves_icall_System_Reflection_Module_ResolveFieldToken)
 ICALL(MODULE_8, "ResolveMemberToken", ves_icall_System_Reflection_Module_ResolveMemberToken)
 ICALL(MODULE_9, "ResolveMethodToken", ves_icall_System_Reflection_Module_ResolveMethodToken)
-ICALL(MODULE_10, "ResolveStringToken", ves_icall_System_Reflection_Module_ResolveStringToken)
-ICALL(MODULE_11, "ResolveTypeToken", ves_icall_System_Reflection_Module_ResolveTypeToken)
-ICALL(MODULE_12, "get_MetadataToken", mono_reflection_get_token)
+ICALL(MODULE_10, "ResolveSignature", ves_icall_System_Reflection_Module_ResolveSignature)
+ICALL(MODULE_11, "ResolveStringToken", ves_icall_System_Reflection_Module_ResolveStringToken)
+ICALL(MODULE_12, "ResolveTypeToken", ves_icall_System_Reflection_Module_ResolveTypeToken)
+ICALL(MODULE_13, "get_MetadataToken", mono_reflection_get_token)
 
 ICALL_TYPE(MCMETH, "System.Reflection.MonoCMethod", MCMETH_1)
 ICALL(MCMETH_1, "GetGenericMethodDefinition_impl", ves_icall_MonoMethod_GetGenericMethodDefinition)
index 2216b431ceb5bb94cc79fdcd816a7c879fc1050f..d583b74ca9ba76dc238c84d365fa53c226d465c8 100644 (file)
@@ -1580,19 +1580,18 @@ ves_icall_FieldInfo_SetValueInternal (MonoReflectionField *field, MonoObject *ob
 
                        if (mono_class_is_nullable (mono_class_from_mono_type (cf->type))) {
                                MonoClass *nklass = mono_class_from_mono_type (cf->type);
-                               guint8 *buf;
+                               MonoObject *nullable;
 
                                /* 
                                 * Convert the boxed vtype into a Nullable structure.
                                 * This is complicated by the fact that Nullables have
                                 * a variable structure.
                                 */
-                               /* Allocate using alloca so it gets GC tracking */
-                               buf = alloca (nklass->instance_size);
+                               nullable = mono_object_new (mono_domain_get (), nklass);
 
-                               mono_nullable_init (buf, value, nklass);
+                               mono_nullable_init (mono_object_unbox (nullable), value, nklass);
 
-                               v = (gchar*)buf;
+                               v = mono_object_unbox (nullable);
                        }
                        else 
                                if (gclass->container_class->valuetype && (v != NULL))
index 896bf1f6bb3605ff344fd3ba7731ac3a6683d104..5b7911f6894042bb94304741c12c204bbba61048 100644 (file)
@@ -1215,6 +1215,8 @@ mono_image_close (MonoImage *image)
        }
        if (image->modules)
                g_free (image->modules);
+       if (image->modules_loaded)
+               g_free (image->modules_loaded);
        if (image->references)
                g_free (image->references);
        /*g_print ("destroy image %p (dynamic: %d)\n", image, image->dynamic);*/
index 76cd8443bb52e2e03d0a08792df7dbe321b7ac17..069938ac98e443d1d802b05ee5ce441d4736368f 100644 (file)
@@ -2952,6 +2952,16 @@ mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params,
                mono_runtime_invoke (method, o, pa, exc);
                return obj;
        } else {
+               if (mono_class_is_nullable (method->klass)) {
+                       MonoObject *nullable;
+
+                       /* Convert the unboxed vtype into a Nullable structure */
+                       nullable = mono_object_new (mono_domain_get (), method->klass);
+
+                       mono_nullable_init (mono_object_unbox (nullable), mono_value_box (mono_domain_get (), method->klass->cast_class, obj), method->klass);
+                       obj = mono_object_unbox (nullable);
+               }
+
                /* obj must be already unboxed if needed */
                return mono_runtime_invoke (method, obj, pa, exc);
        }
index 7a8ae67bd676060cf7520c2ec8987e4dc1f4e858..c934f734cf17dcbfe5ec0c7fbb5ac4169ffcf669 100644 (file)
@@ -126,6 +126,7 @@ void ves_icall_System_Threading_Thread_MemoryBarrier (void) MONO_INTERNAL;
 extern void ves_icall_System_Threading_Thread_Interrupt_internal (MonoThread *this_obj) MONO_INTERNAL;
 extern void ves_icall_System_Threading_Thread_SpinWait_internal (gint32) MONO_INTERNAL;
 
+void mono_alloc_special_static_data_free (GHashTable *special_static_fields) MONO_INTERNAL;
 void mono_thread_free_local_slot_values (int slot, MonoBoolean thread_local) MONO_INTERNAL;
 extern void mono_thread_current_check_pending_interrupt (void) MONO_INTERNAL;
 
index c3a2e220a5c0465070d736001f56752ee7bd912f..e0bfa34419d28cb224d0ad6f1afe100207a6ccf9 100644 (file)
@@ -73,9 +73,17 @@ typedef union {
        gdouble fval;
 } LongDoubleUnion;
  
+typedef struct _MonoThreadDomainTls MonoThreadDomainTls;
+struct _MonoThreadDomainTls {
+       MonoThreadDomainTls *next;
+       guint32 offset;
+       guint32 size;
+};
+
 typedef struct {
        int idx;
        int offset;
+       MonoThreadDomainTls *freelist;
 } StaticDataInfo;
 
 typedef struct {
@@ -2774,6 +2782,7 @@ static void mono_init_static_data_info (StaticDataInfo *static_data)
 {
        static_data->idx = 0;
        static_data->offset = 0;
+       static_data->freelist = NULL;
 }
 
 /*
@@ -2799,15 +2808,6 @@ mono_alloc_static_data_slot (StaticDataInfo *static_data, guint32 size, guint32
        if (static_data->offset + size >= static_data_size [static_data->idx]) {
                static_data->idx ++;
                g_assert (size <= static_data_size [static_data->idx]);
-               /* 
-                * massive unloading and reloading of domains with thread-static
-                * data may eventually exceed the allocated storage...
-                * Need to check what the MS runtime does in that case.
-                * Note that for each appdomain, we need to allocate a separate
-                * thread data slot for security reasons. We could keep track
-                * of the slots per-domain and when the domain is unloaded
-                * out the slots on a sort of free list.
-                */
                g_assert (static_data->idx < NUM_STATIC_DATA_IDX);
                static_data->offset = 0;
        }
@@ -2843,6 +2843,24 @@ alloc_thread_static_data_helper (gpointer key, gpointer value, gpointer user)
        mono_alloc_static_data (&(thread->static_data), offset);
 }
 
+static MonoThreadDomainTls*
+search_tls_slot_in_freelist (StaticDataInfo *static_data, guint32 size, guint32 align)
+{
+       MonoThreadDomainTls* prev = NULL;
+       MonoThreadDomainTls* tmp = static_data->freelist;
+       while (tmp) {
+               if (tmp->size == size) {
+                       if (prev)
+                               prev->next = tmp->next;
+                       else
+                               static_data->freelist = tmp->next;
+                       return tmp;
+               }
+               tmp = tmp->next;
+       }
+       return NULL;
+}
+
 /*
  * The offset for a special static variable is composed of three parts:
  * a bit that indicates the type of static data (0:thread, 1:context),
@@ -2857,8 +2875,16 @@ mono_alloc_special_static_data (guint32 static_type, guint32 size, guint32 align
        guint32 offset;
        if (static_type == SPECIAL_STATIC_THREAD)
        {
+               MonoThreadDomainTls *item;
                mono_threads_lock ();
-               offset = mono_alloc_static_data_slot (&thread_static_info, size, align);
+               item = search_tls_slot_in_freelist (&thread_static_info, size, align);
+               /*g_print ("TLS alloc: %d in domain %p (total: %d), cached: %p\n", size, mono_domain_get (), thread_static_info.offset, item);*/
+               if (item) {
+                       offset = item->offset;
+                       g_free (item);
+               } else {
+                       offset = mono_alloc_static_data_slot (&thread_static_info, size, align);
+               }
                /* This can be called during startup */
                if (threads != NULL)
                        mono_g_hash_table_foreach (threads, alloc_thread_static_data_helper, GUINT_TO_POINTER (offset));
@@ -2906,6 +2932,59 @@ mono_get_special_static_data (guint32 offset)
        }
 }
 
+typedef struct {
+       guint32 offset;
+       guint32 size;
+} TlsOffsetSize;
+
+static void 
+free_thread_static_data_helper (gpointer key, gpointer value, gpointer user)
+{
+       MonoThread *thread = value;
+       TlsOffsetSize *data = user;
+       int idx = (data->offset >> 24) - 1;
+       char *ptr;
+
+       if (!thread->static_data [idx])
+               return;
+       ptr = ((char*) thread->static_data [idx]) + (data->offset & 0xffffff);
+       memset (ptr, 0, data->size);
+}
+
+static void
+do_free_special (gpointer key, gpointer value, gpointer data)
+{
+       MonoClassField *field = key;
+       guint32 offset = GPOINTER_TO_UINT (value);
+       guint32 static_type = (offset & 0x80000000);
+       gint32 align;
+       guint32 size;
+       size = mono_type_size (field->type, &align);
+       /*g_print ("free %s , size: %d, offset: %x\n", field->name, size, offset);*/
+       if (static_type == 0) {
+               TlsOffsetSize data;
+               MonoThreadDomainTls *item = g_new0 (MonoThreadDomainTls, 1);
+               data.offset = offset & 0x7fffffff;
+               data.size = size;
+               if (threads != NULL)
+                       mono_g_hash_table_foreach (threads, free_thread_static_data_helper, &data);
+               item->offset = offset;
+               item->size = size;
+               item->next = thread_static_info.freelist;
+               thread_static_info.freelist = item;
+       } else {
+               /* FIXME: free context static data as well */
+       }
+}
+
+void
+mono_alloc_special_static_data_free (GHashTable *special_static_fields)
+{
+       mono_threads_lock ();
+       g_hash_table_foreach (special_static_fields, do_free_special, NULL);
+       mono_threads_unlock ();
+}
+
 static MonoClassField *local_slots = NULL;
 
 typedef struct {
index 644e8146181c8b8e03975c6d663a4f7056187c03..ea99c0940a49620f0ebd53bb18ac129fce8bfb6a 100644 (file)
@@ -1,3 +1,7 @@
+2007-08-03  Neale Ferguson <neale@sinenomine.net>
+
+       * mini-s390.c (add_general): Adjust offset calculation to take into account of rounding up
+       due to alignment.
 
 Thu Aug 2 17:36:22 CEST 2007 Paolo Molaro <lupus@ximian.com>
 
index 4728a071e798121a6f9b1df4676561d91c66c88a..15469e18b77f8610675a02b764e312952c5c30d1 100644 (file)
@@ -1146,6 +1146,8 @@ mono_arch_flush_icache (guint8 *code, gint size)
 static void inline
 add_general (guint *gr, size_data *sz, ArgInfo *ainfo, gboolean simple)
 {
+       int disp;
+
        if (simple) {
                if (*gr > S390_LAST_ARG_REG) {
                        sz->stack_size  = S390_ALIGN(sz->stack_size, sizeof(long));
@@ -1162,13 +1164,15 @@ add_general (guint *gr, size_data *sz, ArgInfo *ainfo, gboolean simple)
                }
        } else {
                if (*gr > S390_LAST_ARG_REG - 1) {
+                       disp            = sz->stack_size;
                        sz->stack_size  = S390_ALIGN(sz->stack_size, S390_STACK_ALIGNMENT);
+                       disp            = sz->stack_size - disp;
                        ainfo->offset   = sz->stack_size;
                        ainfo->reg      = STK_BASE;
                        ainfo->regtype  = RegTypeBase;
                        sz->stack_size += sizeof(long long);
-                       sz->local_size += sizeof(long long);
-                       sz->offStruct  += sizeof(long long);
+                       sz->local_size += (sizeof(long long) + disp);
+                       sz->offStruct  += (sizeof(long long) + disp);
                        sz->code_size  += 10;   
                } else {
                        ainfo->reg      = *gr;
@@ -1493,7 +1497,7 @@ enum_retvalue:
                                        cinfo->args[nParm].size    = sizeof(long long);
                                        cinfo->args[nParm].regtype = RegTypeStructByVal; 
                                        nParm++;
-                                       sz->local_size            += sizeof(long);
+                                       sz->local_size            += sizeof(long long);
                                        break;
                                default:
                                        add_stackParm(&gr, sz, cinfo->args+nParm, size);
@@ -1528,7 +1532,7 @@ enum_retvalue:
                                        cinfo->args[nParm].size    = sizeof(long long);
                                        cinfo->args[nParm].regtype = RegTypeStructByVal; 
                                        nParm++;
-                                       sz->local_size            += sizeof(long);
+                                       sz->local_size            += sizeof(long long);
                                        break;
                                default:
                                        add_stackParm(&gr, sz, cinfo->args+nParm, size);