mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 11:21:39 -10:00
Compare commits
49
Commits
master
...
mono-1-2-5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bb489774f | ||
|
|
a448b3d726 | ||
|
|
c0e91b7704 | ||
|
|
49c9dba9a5 | ||
|
|
9751298295 | ||
|
|
89e6d7516b | ||
|
|
ef21dfa4f1 | ||
|
|
0b4d212b60 | ||
|
|
5842e7d93c | ||
|
|
4089e93808 | ||
|
|
9bb84661b0 | ||
|
|
e762c8fb25 | ||
|
|
9de72f46d5 | ||
|
|
ec017f2133 | ||
|
|
405164a422 | ||
|
|
c091a18112 | ||
|
|
4e287b2d28 | ||
|
|
d0b80da664 | ||
|
|
14f69f6c90 | ||
|
|
e659f8968d | ||
|
|
daba380372 | ||
|
|
efba67629a | ||
|
|
0b3deddb98 | ||
|
|
413a57758b | ||
|
|
922d8fa333 | ||
|
|
130c0468fc | ||
|
|
424e12a4d4 | ||
|
|
36399aae9d | ||
|
|
f29c7daae4 | ||
|
|
f8a2ea72d4 | ||
|
|
58f15b3bf0 | ||
|
|
6e04ed5ef2 | ||
|
|
04c3bba8aa | ||
|
|
4b79231f02 | ||
|
|
4ca325a98d | ||
|
|
1e80ae5c42 | ||
|
|
62575a1cf5 | ||
|
|
465057f629 | ||
|
|
0133b608dc | ||
|
|
f673245a98 | ||
|
|
830553f2ef | ||
|
|
b2999323d1 | ||
|
|
e46be16aa7 | ||
|
|
2a1aaf378c | ||
|
|
d15dcda71f | ||
|
|
56d4026ed0 | ||
|
|
476120edff | ||
|
|
8882ebfa9f | ||
|
|
6344e9a9b3 |
No files matched your search
@@ -1,3 +1,11 @@
|
||||
2007-10-17 Wade Berrier <[email protected]>
|
||||
|
||||
* configure.in: version bump -> 1.2.5.2
|
||||
|
||||
2007-09-19 Wade Berrier <[email protected]>
|
||||
|
||||
* configure.in: version bump -> 1.2.5.1
|
||||
|
||||
2007-07-24 Wade Berrier <[email protected]>
|
||||
|
||||
* configure.in: version bump -> 1.2.5
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM
|
||||
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE(mono,1.2.5)
|
||||
AM_INIT_AUTOMAKE(mono,1.2.5.2)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
API_VER=1.0
|
||||
|
||||
@@ -1,3 +1,91 @@
|
||||
2007-08-20 Jonathan Pobst <[email protected]>
|
||||
[Backport of r84479]
|
||||
* StatusStrip.cs: Make sure the item's parent gets set in SetDisplayedItems.
|
||||
[Fixes bug #82481]
|
||||
|
||||
2007-08-14 Rolf Bjarne Kvinge <[email protected]>
|
||||
|
||||
* Control.cs: [Backport of r83588, fixes bug #82433] CreateControl: create
|
||||
implicit children as well. Fixes #82344. Don't create the child if it
|
||||
has been disposed already (may happen if the user closes the form the
|
||||
Load event).
|
||||
* MdiClient.cs: [Backport selected parts of r83065] Add a null-check.
|
||||
|
||||
2007-08-13 Rolf Bjarne Kvinge <[email protected]>
|
||||
|
||||
[Backport of r83935]
|
||||
|
||||
* PictureBox.cs: OnAnimateImage/UpdateAnimateImage: Check if handle is still
|
||||
created, it might have gotten destroyed since we last checked. Fixes
|
||||
#82405.
|
||||
|
||||
2007-08-13 Rolf Bjarne Kvinge <[email protected]>
|
||||
|
||||
[Backport selected parts of r83065. Fixes #82406]
|
||||
|
||||
* Control.cs: We need to reset the is_created flags when the handle is
|
||||
destroyed. Fixes #82187.
|
||||
* Form.cs: Don't raise OnLoad if the form has been disposed.
|
||||
|
||||
2007-08-10 Jonathan Pobst <[email protected]>
|
||||
[Backport of r83821]
|
||||
* ToolTip.cs: Hide the tooltip if the control is clicked to match MS behavior.
|
||||
[Fixes bug #82348]
|
||||
|
||||
2007-08-02 Rolf Bjarne Kvinge <[email protected]>
|
||||
|
||||
[ Backport selected parts of r82743, fixes #82234]
|
||||
|
||||
* DataGridViewRow.cs: SetValues: Don't blindly add cells to the row,
|
||||
the row may already have cells. SetDataGridView: set the DGV of all
|
||||
the contained cells as well.
|
||||
|
||||
2007-08-02 Rolf Bjarne Kvinge <[email protected]>
|
||||
|
||||
[ Backport of r83273]
|
||||
|
||||
* PropertyGrid.cs: PropertyGrid.cs: Add a null-check. Fixes
|
||||
#82289/SVGPad.
|
||||
|
||||
2007-08-02 Rolf Bjarne Kvinge <[email protected]>
|
||||
|
||||
[ Backport of r83268]
|
||||
|
||||
* ToolTip.cs: Use InitialDelay if ReshowDelay is zero. Fixes #82288.
|
||||
|
||||
2007-07-31 Carlos Alberto Cortez <[email protected]>
|
||||
[Backport to 1-2-5]
|
||||
* ListView.cs: Take into account the region used by header
|
||||
control when doing the vertical scroll (this way we invalidate
|
||||
the precise area, and don't get any dirty one).
|
||||
|
||||
2007-07-31 Carlos Alberto Cortez <[email protected]>
|
||||
[Backport to 1-2-5]
|
||||
* ListView.cs: Update some layout calculations in details view
|
||||
and clean the code in a pair of assignations.
|
||||
|
||||
2007-07-31 Carlos Alberto Cortez <[email protected]>
|
||||
[Backport to 1-2-5]
|
||||
* ListView.cs: When calculating layout, don't scrollbars before
|
||||
handle is created. This is unnecessary and also calculating them
|
||||
before handle creation time causes some random bugs.
|
||||
|
||||
2007-07-27 Everaldo Canuto <[email protected]>
|
||||
[Backport to 1-2-5]
|
||||
* FileDialog.cs: Check for valid filterIndex on button open/save.
|
||||
Fixes #82184.
|
||||
|
||||
2007-07-26 Rolf Bjarne Kvinge <[email protected]>
|
||||
[Backport to 1-2-5]
|
||||
* Form.cs: ShowDialog: don't destroy handles if the dialog is a common
|
||||
dialog. Fixes #82187.
|
||||
|
||||
2007-07-25 Jonathan Pobst <[email protected]>
|
||||
[Backport to 1-2-5]
|
||||
* UpDownBase.cs: We cannot override SetBoundsCore for 2.0, which was relayout-ing
|
||||
the children controls. Instead, we will just set up the proper docking for the
|
||||
children controls so we don't have to worry about it. [Fixes bug #82188]
|
||||
|
||||
2007-07-24 Jonathan Pobst <[email protected]>
|
||||
|
||||
* Menu.cs: Add some missing methods to MenuItemCollection.
|
||||
|
||||
@@ -3559,12 +3559,12 @@ namespace System.Windows.Forms
|
||||
if (!is_created) {
|
||||
is_created = true;
|
||||
|
||||
// Create all of our children when we are created.
|
||||
// Create all of our children (implicit ones as well) when we are created.
|
||||
// The child should fire it's OnLoad before the parents, however
|
||||
// if the child checks Parent.Created in it's OnCreateControl, the
|
||||
// parent is already created.
|
||||
foreach (Control c in Controls)
|
||||
if (!c.Created)
|
||||
foreach (Control c in Controls.GetAllControls ())
|
||||
if (!c.Created && !c.IsDisposed)
|
||||
c.CreateControl ();
|
||||
|
||||
#if ONLY_1_1
|
||||
@@ -5115,6 +5115,7 @@ namespace System.Windows.Forms
|
||||
#endif
|
||||
window.InvalidateHandle();
|
||||
|
||||
is_created = false;
|
||||
if (is_recreating) {
|
||||
#if DebugRecreate
|
||||
Console.WriteLine ("Creating handle for {0:X}", handle.ToInt32());
|
||||
|
||||
@@ -354,9 +354,14 @@ namespace System.Windows.Forms {
|
||||
}
|
||||
/////// COLUMNAS //////////
|
||||
for (int i = 0; i < values.Length; i++) {
|
||||
DataGridViewCell cell = new DataGridViewTextBoxCell();
|
||||
DataGridViewCell cell;
|
||||
if (cells.Count > i) {
|
||||
cell = cells [i];
|
||||
} else {
|
||||
cell = new DataGridViewTextBoxCell();
|
||||
cells.Add(cell);
|
||||
}
|
||||
cell.Value = values[i];
|
||||
cells.Add(cell);
|
||||
}
|
||||
|
||||
// XXX
|
||||
@@ -403,6 +408,8 @@ namespace System.Windows.Forms {
|
||||
{
|
||||
base.SetDataGridView(dataGridView);
|
||||
headerCell.SetDataGridView(dataGridView);
|
||||
foreach (DataGridViewCell cell in cells)
|
||||
cell.SetDataGridView (dataGridView);
|
||||
}
|
||||
|
||||
internal override void SetState (DataGridViewElementStates state)
|
||||
|
||||
@@ -921,6 +921,9 @@ namespace System.Windows.Forms
|
||||
string filter_exentsion = String.Empty;
|
||||
|
||||
if (fileFilter != null) {
|
||||
if (filterIndex > fileFilter.FilterArrayList.Count)
|
||||
filterIndex = fileTypeComboBox.SelectedIndex + 1;
|
||||
|
||||
FilterStruct filterstruct = (FilterStruct) fileFilter.FilterArrayList [filterIndex - 1];
|
||||
|
||||
for (int i = 0; i < filterstruct.filters.Count; i++) {
|
||||
|
||||
@@ -1707,9 +1707,13 @@ namespace System.Windows.Forms {
|
||||
// Cannot use Activate(), it has a check for the current active window...
|
||||
XplatUI.Activate(owner.window.Handle);
|
||||
}
|
||||
|
||||
|
||||
if (IsHandleCreated) {
|
||||
DestroyHandle ();
|
||||
// All CommonDialogs assume the form is still alive after a ShowDialog,
|
||||
// so don't destroy the handle in this case. Fix for #82187.
|
||||
if (!(this is CommonDialog.DialogForm)) {
|
||||
DestroyHandle ();
|
||||
}
|
||||
}
|
||||
|
||||
if (DialogResult == DialogResult.None) {
|
||||
@@ -2817,8 +2821,10 @@ namespace System.Windows.Forms {
|
||||
AutoScale = false;
|
||||
}
|
||||
|
||||
OnLoad (e);
|
||||
|
||||
if (!IsDisposed) {
|
||||
OnLoad (e);
|
||||
}
|
||||
|
||||
if (!IsMdiChild && !IsDisposed) {
|
||||
switch (StartPosition) {
|
||||
case FormStartPosition.CenterScreen:
|
||||
|
||||
@@ -1170,15 +1170,17 @@ namespace System.Windows.Forms
|
||||
|
||||
private void CalculateScrollBars ()
|
||||
{
|
||||
if (!IsHandleCreated)
|
||||
return;
|
||||
|
||||
Rectangle client_area = ClientRectangle;
|
||||
|
||||
if (!scrollable) {
|
||||
h_scroll.Visible = false;
|
||||
v_scroll.Visible = false;
|
||||
item_control.Location = new Point (0, header_control.Height);
|
||||
item_control.Height = ClientRectangle.Width - header_control.Height;
|
||||
item_control.Width = ClientRectangle.Width;
|
||||
header_control.Width = ClientRectangle.Width;
|
||||
item_control.Height = client_area.Height;
|
||||
item_control.Width = client_area.Width;
|
||||
header_control.Width = client_area.Width;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1205,7 +1207,7 @@ namespace System.Windows.Forms
|
||||
v_scroll.Visible = false;
|
||||
}
|
||||
|
||||
item_control.Height = ClientRectangle.Height - header_control.Height;
|
||||
item_control.Height = client_area.Height;
|
||||
|
||||
if (h_scroll.is_visible) {
|
||||
h_scroll.Location = new Point (client_area.X, client_area.Bottom - h_scroll.Height);
|
||||
@@ -1228,8 +1230,8 @@ namespace System.Windows.Forms
|
||||
}
|
||||
|
||||
if (header_control.is_visible)
|
||||
header_control.Width = ClientRectangle.Width;
|
||||
item_control.Width = ClientRectangle.Width;
|
||||
header_control.Width = client_area.Width;
|
||||
item_control.Width = client_area.Width;
|
||||
|
||||
if (v_scroll.is_visible) {
|
||||
v_scroll.Location = new Point (client_area.Right - v_scroll.Width, client_area.Y);
|
||||
@@ -1550,12 +1552,15 @@ namespace System.Windows.Forms
|
||||
x += col.Wd;
|
||||
}
|
||||
|
||||
layout_wd = x;
|
||||
|
||||
if (x < ClientRectangle.Width)
|
||||
x = ClientRectangle.Width;
|
||||
|
||||
if (header_style == ColumnHeaderStyle.None) {
|
||||
header_control.Visible = false;
|
||||
header_control.Size = Size.Empty;
|
||||
layout_wd = ClientRectangle.Width;
|
||||
} else {
|
||||
header_control.Width = x;
|
||||
header_control.Height = columns.Count > 0 ? columns [0].Ht : Font.Height + 5;
|
||||
@@ -1598,8 +1603,7 @@ namespace System.Windows.Forms
|
||||
y += 2;
|
||||
}
|
||||
|
||||
layout_wd = Math.Max (header_control.Width, item_control.Width);
|
||||
layout_ht = y + header_control.Height;
|
||||
layout_ht = y;
|
||||
}
|
||||
|
||||
private void AdjustItemsPositionArray (int count)
|
||||
@@ -2808,6 +2812,11 @@ namespace System.Windows.Forms
|
||||
if (v_marker != v_scroll.Value) {
|
||||
int pixels = v_marker - v_scroll.Value;
|
||||
Rectangle area = item_control.ClientRectangle;
|
||||
if (header_control.Visible) {
|
||||
area.Y += header_control.Height;
|
||||
area.Height -= header_control.Height;
|
||||
}
|
||||
|
||||
v_marker = v_scroll.Value;
|
||||
XplatUI.ScrollWindow (item_control.Handle, area, 0, pixels, false);
|
||||
}
|
||||
|
||||
@@ -894,7 +894,7 @@ namespace System.Windows.Forms {
|
||||
internal Form ActiveMdiChild {
|
||||
get {
|
||||
#if NET_2_0
|
||||
if (!ParentForm.Visible)
|
||||
if (ParentForm != null && !ParentForm.Visible)
|
||||
return null;
|
||||
#endif
|
||||
if (Controls.Count < 1)
|
||||
|
||||
@@ -413,11 +413,22 @@ namespace System.Windows.Forms {
|
||||
{
|
||||
// This is called from a worker thread,BeginInvoke is used
|
||||
// so the control is updated from the correct thread
|
||||
|
||||
// Check if we have a handle again, since it may have gotten
|
||||
// destroyed since the last time we checked.
|
||||
if (!IsHandleCreated)
|
||||
return;
|
||||
|
||||
BeginInvoke (new EventHandler (UpdateAnimatedImage), new object [] { this, e });
|
||||
}
|
||||
|
||||
private void UpdateAnimatedImage (object sender, EventArgs e)
|
||||
{
|
||||
// Check if we have a handle again, since it may have gotten
|
||||
// destroyed since the last time we checked.
|
||||
if (!IsHandleCreated)
|
||||
return;
|
||||
|
||||
ImageAnimator.UpdateFrames (image);
|
||||
Refresh ();
|
||||
}
|
||||
|
||||
@@ -1447,7 +1447,7 @@ namespace System.Windows.Forms {
|
||||
|
||||
PropertyDescriptor property = grid_entry.PropertyDescriptor;
|
||||
|
||||
if (property.Converter == null || !property.Converter.GetPropertiesSupported ())
|
||||
if (property == null || property.Converter == null || !property.Converter.GetPropertiesSupported ())
|
||||
return;
|
||||
|
||||
object [] objs = grid_entry.SelectedObjects;
|
||||
|
||||
@@ -247,12 +247,15 @@ namespace System.Windows.Forms
|
||||
{
|
||||
this.displayed_items.Clear ();
|
||||
|
||||
foreach (ToolStripItem tsi in this.Items)
|
||||
foreach (ToolStripItem tsi in this.Items) {
|
||||
tsi.Parent = this;
|
||||
|
||||
if (tsi.Placement == ToolStripItemPlacement.Main) {
|
||||
this.displayed_items.AddNoOwnerOrLayout (tsi);
|
||||
tsi.InternalVisible = true;
|
||||
} else
|
||||
tsi.InternalVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void WndProc (ref Message m)
|
||||
|
||||
@@ -390,6 +390,7 @@ namespace System.Windows.Forms {
|
||||
control.MouseEnter += new EventHandler(control_MouseEnter);
|
||||
control.MouseMove += new MouseEventHandler(control_MouseMove);
|
||||
control.MouseLeave += new EventHandler(control_MouseLeave);
|
||||
control.MouseDown += new MouseEventHandler (control_MouseDown);
|
||||
controls.Add(control);
|
||||
}
|
||||
|
||||
@@ -486,7 +487,7 @@ namespace System.Windows.Forms {
|
||||
string text = (string)tooltip_strings[control];
|
||||
if (text != null && text.Length > 0) {
|
||||
|
||||
if (active_control == null) {
|
||||
if (active_control == null || re_show_delay == 0) {
|
||||
timer.Interval = initial_delay;
|
||||
} else {
|
||||
timer.Interval = re_show_delay;
|
||||
@@ -549,6 +550,18 @@ namespace System.Windows.Forms {
|
||||
Hide (sender as Control);
|
||||
}
|
||||
|
||||
|
||||
void control_MouseDown (object sender, MouseEventArgs e)
|
||||
{
|
||||
timer.Stop();
|
||||
|
||||
active_control = null;
|
||||
tooltip_window.Visible = false;
|
||||
|
||||
if (last_control == sender)
|
||||
last_control = null;
|
||||
}
|
||||
|
||||
private void Hide (Control sender)
|
||||
{
|
||||
timer.Stop();
|
||||
|
||||
@@ -316,9 +316,14 @@ namespace System.Windows.Forms
|
||||
txtView.Location = new System.Drawing.Point(17, 17);
|
||||
txtView.TabIndex = TabIndex;
|
||||
|
||||
spnSpinner.Width = 16;
|
||||
spnSpinner.Dock = DockStyle.Right;
|
||||
|
||||
txtView.Dock = DockStyle.Fill;
|
||||
|
||||
SuspendLayout ();
|
||||
Controls.Add (spnSpinner);
|
||||
Controls.Add (txtView);
|
||||
Controls.Add (spnSpinner);
|
||||
ResumeLayout ();
|
||||
|
||||
Height = PreferredHeight;
|
||||
@@ -332,8 +337,6 @@ namespace System.Windows.Forms
|
||||
txtView.Resize += new EventHandler(OnTextBoxResize);
|
||||
txtView.TextChanged += new EventHandler(OnTextBoxTextChanged);
|
||||
|
||||
txtView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
|
||||
// So the child controls don't get auto selected when the updown is selected
|
||||
auto_select_child = false;
|
||||
SetStyle(ControlStyles.FixedHeight, true);
|
||||
@@ -346,27 +349,6 @@ namespace System.Windows.Forms
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
void reseat_controls()
|
||||
{
|
||||
int text_displacement = 0;
|
||||
|
||||
int spinner_width = 16;
|
||||
//int spinner_width = ClientSize.Height;
|
||||
|
||||
if (_UpDownAlign == LeftRightAlignment.Left) {
|
||||
spnSpinner.Bounds = new Rectangle(0, 0, spinner_width, ClientSize.Height);
|
||||
text_displacement = spnSpinner.Width;
|
||||
|
||||
spnSpinner.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
} else {
|
||||
spnSpinner.Bounds = new Rectangle(ClientSize.Width - spinner_width, 0, spinner_width, ClientSize.Height);
|
||||
|
||||
spnSpinner.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
}
|
||||
|
||||
txtView.Bounds = new Rectangle(text_displacement, 0, ClientSize.Width - spinner_width, Height);
|
||||
}
|
||||
|
||||
private void TabIndexChangedHandler (object sender, EventArgs e)
|
||||
{
|
||||
txtView.TabIndex = TabIndex;
|
||||
@@ -599,9 +581,14 @@ namespace System.Windows.Forms
|
||||
return _UpDownAlign;
|
||||
}
|
||||
set {
|
||||
_UpDownAlign = value;
|
||||
|
||||
reseat_controls();
|
||||
if (_UpDownAlign != value) {
|
||||
_UpDownAlign = value;
|
||||
|
||||
if (value == LeftRightAlignment.Left)
|
||||
spnSpinner.Dock = DockStyle.Left;
|
||||
else
|
||||
spnSpinner.Dock = DockStyle.Right;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion // Public Instance Properties
|
||||
@@ -771,9 +758,6 @@ namespace System.Windows.Forms
|
||||
protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified)
|
||||
{
|
||||
base.SetBoundsCore(x, y, width, height, specified);
|
||||
|
||||
if ((specified & BoundsSpecified.Size) != BoundsSpecified.None)
|
||||
reseat_controls();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
2007-08-14 Rolf Bjarne Kvinge <[email protected]>
|
||||
|
||||
[Backport of r83650]
|
||||
|
||||
* UserControlTest.cs, PanelTest.cs, DefaultLayoutTest.cs,
|
||||
TableLayoutTest.cs, ControlTest.cs, ContainerControlTest.cs,
|
||||
FormTest.cs: Dispose of forms when they're no longer used.
|
||||
* ListViewCollectionsTest.cs: Dispose of listviews when they're no longer
|
||||
used.
|
||||
|
||||
2007-07-24 Rolf Bjarne Kvinge <[email protected]>
|
||||
|
||||
* DataGridViewColumnCollectionTest.cs,
|
||||
|
||||
@@ -269,6 +269,7 @@ namespace MonoTests.System.Windows.Forms {
|
||||
f.PublicProcessMnemonic ('b');
|
||||
|
||||
Assert.AreEqual (true, c.mnemonic_called, "A2");
|
||||
f.Dispose ();
|
||||
}
|
||||
|
||||
private class MyForm : Form
|
||||
|
||||
@@ -107,6 +107,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
c.AutoSize = true;
|
||||
f.PerformLayout();
|
||||
Assert.AreEqual (s, c.Size, "#S9");
|
||||
f.Close ();
|
||||
}
|
||||
|
||||
public class ControlAutoSizeTester : Control {
|
||||
@@ -2375,6 +2376,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
f.ResumeLayout ();
|
||||
|
||||
Assert.AreEqual (new Point (225, 287), button1.Location, "A3");
|
||||
f.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -542,6 +542,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
f.Show ();
|
||||
|
||||
Assert.AreEqual (new Size (600, 600), c.lv.Size, "I1");
|
||||
f.Close ();
|
||||
}
|
||||
|
||||
private class MyUserControl : UserControl
|
||||
|
||||
@@ -1873,6 +1873,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
f.AutoSize = false;
|
||||
Assert.AreEqual (start_size, f.ClientSize, "A2");
|
||||
f.Close ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1895,6 +1896,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
f.Controls.Add (b);
|
||||
|
||||
Assert.AreEqual (new Size (203, 203), f.ClientSize, "A2");
|
||||
f.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -404,6 +404,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (1, n, "SelectedIndexCollectionTest_AddTest#5");
|
||||
Assert.AreEqual (1, listview.SelectedIndices.Count, "SelectedIndexCollectionTest_AddTest#6");
|
||||
Assert.AreEqual (true, listview.Items [0].Selected, "SelectedIndexCollectionTest_AddTest#7");
|
||||
listview.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -448,6 +449,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
n = listview.SelectedIndices.Add (0);
|
||||
Assert.AreEqual (3, n, "SelectedIndexCollectionTest_AddTest#17");
|
||||
Assert.AreEqual (3, listview.SelectedIndices.Count, "SelectedIndexCollectionTest_AddTest#18");
|
||||
listview.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -478,6 +480,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (false, listview.Items [0].Selected, "SelectedIndexCollectionTest_ClearTest#6");
|
||||
Assert.AreEqual (false, listview.Items [1].Selected, "SelectedIndexCollectionTest_ClearTest#7");
|
||||
Assert.AreEqual (false, listview.Items [2].Selected, "SelectedIndexCollectionTest_ClearTest#8");
|
||||
listview.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -507,6 +510,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (false, listview.Items [0].Selected, "SelectedIndexCollectionTest_ClearTest#6");
|
||||
Assert.AreEqual (false, listview.Items [1].Selected, "SelectedIndexCollectionTest_ClearTest#7");
|
||||
Assert.AreEqual (false, listview.Items [2].Selected, "SelectedIndexCollectionTest_ClearTest#8");
|
||||
listview.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -536,6 +540,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (1, listview.SelectedIndices.IndexOf (item3.Index), "SelectedIndexCollectionTest_IndexOfTest#8");
|
||||
Assert.AreEqual (2, listview.SelectedIndices.IndexOf (item4.Index), "SelectedIndexCollectionTest_IndexOfTest#9");
|
||||
Assert.AreEqual (-1, listview.SelectedIndices.IndexOf (item2.Index), "SelectedIndexCollectionTest_IndexOfTest#10");
|
||||
listview.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -561,6 +566,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (-1, listview.SelectedIndices.IndexOf (1), "SelectedIndexCollectionTest_IndexOfTest#5");
|
||||
Assert.AreEqual (-1, listview.SelectedIndices.IndexOf (99), "SelectedIndexCollectionTest_IndexOfTest#6");
|
||||
Assert.AreEqual (-1, listview.SelectedIndices.IndexOf (-1), "SelectedIndexCollectionTest_IndexOfTest#7");
|
||||
listview.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -581,6 +587,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
listview.SelectedIndices.Remove (0);
|
||||
Assert.AreEqual (0, listview.SelectedIndices.Count, "SelectedIndexCollectionTest_RemoveTest#3");
|
||||
Assert.AreEqual (false, listview.Items [0].Selected, "SelectedIndexCollectionTest_RemoveTest#4");
|
||||
listview.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -626,6 +633,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
listview.SelectedIndices.Remove (0);
|
||||
Assert.AreEqual (0, listview.SelectedIndices.Count, "SelectedIndexCollectionTest_RemoveTest#17");
|
||||
Assert.AreEqual (false, listview.Items [0].Selected, "SelectedIndexCollectionTest_RemoveTest#18");
|
||||
listview.Dispose ();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -961,6 +969,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
Assert.AreEqual (4, lvw.SelectedItems.Count, "#B1");
|
||||
Assert.AreEqual (3, lvw.SelectedItems.IndexOfKey ("F name"), "#B2");
|
||||
lvw.Dispose ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1002,6 +1011,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
Assert.AreEqual (4, lvw.SelectedItems.Count, "#B1");
|
||||
Assert.AreEqual (lvi6, lvw.SelectedItems ["F name"], "#B2");
|
||||
lvw.Dispose ();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
p.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
Assert.AreEqual (new Size (0, 0), p.ClientSize, "A3");
|
||||
f.Dispose ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1037,6 +1037,8 @@ namespace MonoTests.System.Windows.Forms
|
||||
Assert.AreEqual (new Rectangle (6, 101, 95, 96), _labelD.Bounds, "A40");
|
||||
Assert.AreEqual (new Rectangle (110, 101, 95, 96), _labelE.Bounds, "A41");
|
||||
Assert.AreEqual (new Rectangle (214, 101, 95, 96), _labelF.Bounds, "A42");
|
||||
|
||||
f.Close ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -109,6 +109,8 @@ namespace MonoTests.System.Windows.Forms
|
||||
|
||||
p.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
Assert.AreEqual (new Size (0, 0), p.ClientSize, "A3");
|
||||
|
||||
f.Close ();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
2007-08-16 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* RecordProtocol.cs, SslStreamBase.cs: Ensure nothing (even the same
|
||||
thread) can confuse the record decoding code. Fix bug #82145 (LDAP)
|
||||
which uses several thread over a single SslClientStream instance.
|
||||
|
||||
2007-05-23 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Context.cs: fix the calculation of the unix time.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Transport Security Layer (TLS)
|
||||
// Copyright (c) 2003-2004 Carlos Guzman Alvarez
|
||||
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
|
||||
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
@@ -35,6 +35,8 @@ namespace Mono.Security.Protocol.Tls
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private static ManualResetEvent record_processing = new ManualResetEvent (true);
|
||||
|
||||
protected Stream innerStream;
|
||||
protected Context context;
|
||||
|
||||
@@ -316,6 +318,7 @@ namespace Mono.Security.Protocol.Tls
|
||||
"The session is finished and it's no longer valid.");
|
||||
}
|
||||
|
||||
record_processing.Reset ();
|
||||
byte[] recordTypeBuffer = new byte[1];
|
||||
|
||||
ReceiveRecordAsyncResult internalResult = new ReceiveRecordAsyncResult(callback, state, recordTypeBuffer, record);
|
||||
@@ -426,8 +429,10 @@ namespace Mono.Security.Protocol.Tls
|
||||
|
||||
if (internalResult.CompletedWithError)
|
||||
throw internalResult.AsyncException;
|
||||
else
|
||||
return internalResult.ResultingBuffer;
|
||||
|
||||
byte[] result = internalResult.ResultingBuffer;
|
||||
record_processing.Set ();
|
||||
return result;
|
||||
}
|
||||
|
||||
public byte[] ReceiveRecord(Stream record)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Transport Security Layer (TLS)
|
||||
// Copyright (c) 2003-2004 Carlos Guzman Alvarez
|
||||
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
|
||||
// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
@@ -39,6 +39,8 @@ namespace Mono.Security.Protocol.Tls
|
||||
|
||||
#region Fields
|
||||
|
||||
static ManualResetEvent record_processing = new ManualResetEvent (true);
|
||||
|
||||
private const int WaitTimeOut = 5 * 60 * 1000;
|
||||
|
||||
internal Stream innerStream;
|
||||
@@ -950,6 +952,7 @@ namespace Mono.Security.Protocol.Tls
|
||||
|
||||
lock (this.read) {
|
||||
try {
|
||||
record_processing.Reset ();
|
||||
// do we already have some decrypted data ?
|
||||
if (this.inputBuffer.Position > 0) {
|
||||
// or maybe we used all the buffer before ?
|
||||
@@ -957,8 +960,10 @@ namespace Mono.Security.Protocol.Tls
|
||||
this.inputBuffer.SetLength (0);
|
||||
} else {
|
||||
int n = this.inputBuffer.Read (buffer, offset, count);
|
||||
if (n > 0)
|
||||
if (n > 0) {
|
||||
record_processing.Set ();
|
||||
return n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,7 +974,16 @@ namespace Mono.Security.Protocol.Tls
|
||||
needMoreData = false;
|
||||
// if we loop, then it either means we need more data
|
||||
byte[] recbuf = new byte[16384];
|
||||
int n = innerStream.Read (recbuf, 0, recbuf.Length);
|
||||
int n = 0;
|
||||
if (count == 1) {
|
||||
int value = innerStream.ReadByte ();
|
||||
if (value >= 0) {
|
||||
recbuf[0] = (byte) value;
|
||||
n = 1;
|
||||
}
|
||||
} else {
|
||||
n = innerStream.Read (recbuf, 0, recbuf.Length);
|
||||
}
|
||||
if (n > 0) {
|
||||
// Add the new received data to the waiting data
|
||||
if ((recordStream.Length > 0) && (recordStream.Position != recordStream.Length))
|
||||
@@ -977,6 +991,7 @@ namespace Mono.Security.Protocol.Tls
|
||||
recordStream.Write (recbuf, 0, n);
|
||||
} else {
|
||||
// or that the read operation is done (lost connection in the case of a network stream).
|
||||
record_processing.Set ();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1025,7 +1040,9 @@ namespace Mono.Security.Protocol.Tls
|
||||
if (dataToReturn) {
|
||||
// we have record(s) to return -or- no more available to read from network
|
||||
// reset position for further reading
|
||||
return this.inputBuffer.Read (buffer, offset, count);
|
||||
int i = inputBuffer.Read (buffer, offset, count);
|
||||
record_processing.Set ();
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,17 +592,28 @@ namespace System.Security.Cryptography.Xml {
|
||||
return false;
|
||||
|
||||
byte[] actual = macAlg.ComputeHash (s);
|
||||
// HMAC signature may be partial
|
||||
// HMAC signature may be partial and specified by <HMACOutputLength>
|
||||
if (m_signature.SignedInfo.SignatureLength != null) {
|
||||
int length = actual.Length;
|
||||
try {
|
||||
// SignatureLength is in bits
|
||||
length = (Int32.Parse (m_signature.SignedInfo.SignatureLength) >> 3);
|
||||
}
|
||||
catch {
|
||||
}
|
||||
int length = Int32.Parse (m_signature.SignedInfo.SignatureLength);
|
||||
// we only support signatures with a multiple of 8 bits
|
||||
// and the value must match the signature length
|
||||
if ((length & 7) != 0)
|
||||
throw new CryptographicException ("Signature length must be a multiple of 8 bits.");
|
||||
|
||||
if (length != actual.Length) {
|
||||
// SignatureLength is in bits (and we works on bytes, only in multiple of 8 bits)
|
||||
// and both values must match for a signature to be valid
|
||||
length >>= 3;
|
||||
if (length != m_signature.SignatureValue.Length)
|
||||
throw new CryptographicException ("Invalid signature length.");
|
||||
|
||||
// is the length "big" enough to make the signature meaningful ?
|
||||
// we use a minimum of 80 bits (10 bytes) or half the HMAC normal output length
|
||||
// e.g. HMACMD5 output 128 bits but our minimum is 80 bits (not 64 bits)
|
||||
int minimum = Math.Max (10, actual.Length / 2);
|
||||
if (length < minimum)
|
||||
throw new CryptographicException ("HMAC signature is too small");
|
||||
|
||||
if (length < actual.Length) {
|
||||
byte[] trunked = new byte [length];
|
||||
Buffer.BlockCopy (actual, 0, trunked, 0, length);
|
||||
actual = trunked;
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
2008-08-20 Marek Habersack <[email protected]>
|
||||
|
||||
* HttpRuntimeConfig.cs: implemented the undocumented (but
|
||||
supported in .NET 1.1) option EnableHeaderChecking to support fix
|
||||
for bug #416620
|
||||
|
||||
2007-08-10 Gert Driesen <[email protected]>
|
||||
|
||||
* PagesConfigurationHandler.cs: Use enum for EnableSessionState.
|
||||
* PagesConfiguration.cs: Use enum for EnableSessionState.
|
||||
|
||||
2007-05-01 Marek Habersack <[email protected]>
|
||||
|
||||
* HttpCapabilitiesBase.cs: move the User-Agent code to a separate
|
||||
|
||||
@@ -55,7 +55,8 @@ namespace System.Web.Configuration
|
||||
public int IdleTimeout = 20; // minutes
|
||||
public bool Enable = true;
|
||||
public string VersionHeader;
|
||||
|
||||
public bool EnableHeaderChecking = true;
|
||||
|
||||
/* Only the config. handler should create instances of this. Use GetInstance (context) */
|
||||
public HttpRuntimeConfig (object p)
|
||||
{
|
||||
@@ -92,6 +93,7 @@ namespace System.Web.Configuration
|
||||
RequireRootSaveAsPath = parent.RequireRootSaveAsPath;
|
||||
IdleTimeout = parent.IdleTimeout;
|
||||
Enable = parent.Enable;
|
||||
EnableHeaderChecking = parent.EnableHeaderChecking;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace System.Web.Configuration
|
||||
class PagesConfiguration
|
||||
{
|
||||
internal bool Buffer = true;
|
||||
internal string EnableSessionState = "true";
|
||||
internal PagesEnableSessionState EnableSessionState = PagesEnableSessionState.True;
|
||||
internal bool EnableViewState = true;
|
||||
internal bool EnableViewStateMac = false;
|
||||
internal bool SmartNavigation = false;
|
||||
|
||||
@@ -48,11 +48,22 @@ namespace System.Web.Configuration
|
||||
|
||||
attvalue = AttValue ("enableSessionState", section);
|
||||
if (attvalue != null) {
|
||||
if (attvalue != "true" && attvalue != "false" && attvalue != "ReadOnly")
|
||||
switch (attvalue) {
|
||||
case "true":
|
||||
config.EnableSessionState = PagesEnableSessionState.True;
|
||||
break;
|
||||
case "ReadOnly":
|
||||
config.EnableSessionState = PagesEnableSessionState.ReadOnly;
|
||||
break;
|
||||
case "false":
|
||||
config.EnableSessionState = PagesEnableSessionState.False;
|
||||
break;
|
||||
default:
|
||||
HandlersUtil.ThrowException ("The 'enableSessionState' attribute"
|
||||
+ " is case sensitive and must be one of the following values:"
|
||||
+ " false, true, ReadOnly.", section);
|
||||
config.EnableSessionState = attvalue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
attvalue = AttValue ("enableViewState", section);
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2007-08-10 Gert Driesen <[email protected]>
|
||||
|
||||
* PagesEnableSessionState.cs: Marked internal on 1.0 profile.
|
||||
|
||||
2007-07-16 Vladimir Krasnov <[email protected]>
|
||||
|
||||
* ProfileGroupSettingsCollection.cs: added ResetInternal internal
|
||||
|
||||
@@ -28,14 +28,17 @@
|
||||
|
||||
using System.Resources;
|
||||
|
||||
#if NET_2_0
|
||||
namespace System.Web.Configuration
|
||||
{
|
||||
public enum PagesEnableSessionState
|
||||
{
|
||||
False = 0,
|
||||
ReadOnly = 1,
|
||||
True = 2
|
||||
}
|
||||
}
|
||||
#if NET_2_0
|
||||
public
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
enum PagesEnableSessionState
|
||||
{
|
||||
False = 0,
|
||||
ReadOnly = 1,
|
||||
True = 2
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,10 @@
|
||||
2007-07-31 Marek Habersack <[email protected]>
|
||||
|
||||
* SessionInProcHandler.cs: initialize the static session objects
|
||||
collection from the application state instead of using
|
||||
SessionStateUtility.GetSessionStaticObjects. Fixes bug #82193
|
||||
* SessionStateServerHandler.cs: as above
|
||||
|
||||
2007-06-20 Marek Habersack <[email protected]>
|
||||
|
||||
* SessionInProcHandler.cs: use HttpRuntime.InternalCache to keep
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace System.Web.SessionState
|
||||
public override SessionStateStoreData CreateNewStoreData (HttpContext context, int timeout)
|
||||
{
|
||||
return new SessionStateStoreData (new SessionStateItemCollection (),
|
||||
SessionStateUtility.GetSessionStaticObjects(context),
|
||||
HttpApplicationFactory.ApplicationState.SessionObjects,
|
||||
timeout);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace System.Web.SessionState
|
||||
item.items = new SessionStateItemCollection ();
|
||||
}
|
||||
return new SessionStateStoreData (item.items,
|
||||
SessionStateUtility.GetSessionStaticObjects(context),
|
||||
HttpApplicationFactory.ApplicationState.SessionObjects,
|
||||
item.timeout);
|
||||
} catch {
|
||||
// we want such errors to be passed to the application.
|
||||
@@ -344,7 +344,7 @@ namespace System.Web.SessionState
|
||||
expireCallback (key,
|
||||
new SessionStateStoreData (
|
||||
item.items,
|
||||
SessionStateUtility.GetSessionStaticObjects (HttpContext.Current),
|
||||
HttpApplicationFactory.ApplicationState.SessionObjects,
|
||||
item.timeout));
|
||||
} else
|
||||
expireCallback (key, null);
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace System.Web.SessionState
|
||||
public override SessionStateStoreData CreateNewStoreData (HttpContext context, int timeout)
|
||||
{
|
||||
return new SessionStateStoreData (new SessionStateItemCollection (),
|
||||
SessionStateUtility.GetSessionStaticObjects(context),
|
||||
HttpApplicationFactory.ApplicationState.SessionObjects,
|
||||
timeout);
|
||||
}
|
||||
|
||||
@@ -73,9 +73,11 @@ namespace System.Web.SessionState
|
||||
out SessionStateActions actions,
|
||||
bool exclusive)
|
||||
{
|
||||
#if TRACE
|
||||
Console.WriteLine ("SessionStateServerHandler.GetItemInternal");
|
||||
Console.WriteLine ("\tid == {0}", id);
|
||||
Console.WriteLine ("\tpath == {0}", context.Request.FilePath);
|
||||
#endif
|
||||
locked = false;
|
||||
lockAge = TimeSpan.MinValue;
|
||||
lockId = Int32.MinValue;
|
||||
@@ -92,11 +94,15 @@ namespace System.Web.SessionState
|
||||
exclusive);
|
||||
|
||||
if (item == null) {
|
||||
#if TRACE
|
||||
Console.WriteLine ("\titem is null (locked == {0}, actions == {1})", locked, actions);
|
||||
#endif
|
||||
return null;
|
||||
}
|
||||
if (actions == SessionStateActions.InitializeItem) {
|
||||
#if TRACE
|
||||
Console.WriteLine ("\titem needs initialization");
|
||||
#endif
|
||||
return CreateNewStoreData (context, item.Timeout);
|
||||
}
|
||||
SessionStateItemCollection items = null;
|
||||
@@ -150,7 +156,9 @@ namespace System.Web.SessionState
|
||||
|
||||
public override void Initialize (string name, NameValueCollection config)
|
||||
{
|
||||
#if TRACE
|
||||
Console.WriteLine ("SessionStateServerHandler.Initialize");
|
||||
#endif
|
||||
if (String.IsNullOrEmpty (name))
|
||||
name = "Session Server handler";
|
||||
privateConfig = config;
|
||||
|
||||
@@ -106,6 +106,16 @@
|
||||
* HtmlForm.cs: ignore user provided 'onsubmit' for HtmlForm. See
|
||||
bug #76974.
|
||||
|
||||
2008-07-25 Dean Brettle <[email protected]>
|
||||
|
||||
* HtmlControl.cs (PreProcessRelativeReference),
|
||||
HtmlForm.cs (RenderAttributes), HtmlInputButton (RenderAttributes),
|
||||
HtmlInputRadioButton (RenderAttributes), HtmlSelect (RenderChildren):
|
||||
Encode attributes that could contain HTML special chars.
|
||||
|
||||
* HtmlSelect (RenderChildren): HTML-encode option text.
|
||||
* Fix for CVE-2008-3422
|
||||
|
||||
2006-11-27 Igor Zelmanovich <[email protected]>
|
||||
|
||||
* HtmlForm.cs: refactoring: Registering of client scripts
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace System.Web.UI.HtmlControls{
|
||||
catch (Exception) {
|
||||
throw new HttpException(attribName + " property had malformed url");
|
||||
}
|
||||
writer.WriteAttribute(attribName, attr);
|
||||
writer.WriteAttribute(attribName, attr, true);
|
||||
Attributes.Remove(attribName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ namespace System.Web.UI.HtmlControls
|
||||
w.WriteAttribute ("name", Name);
|
||||
|
||||
w.WriteAttribute ("method", Method);
|
||||
w.WriteAttribute ("action", action);
|
||||
w.WriteAttribute ("action", action, true);
|
||||
|
||||
if (ID == null) {
|
||||
/* If ID != null then HtmlControl will
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace System.Web.UI.HtmlControls {
|
||||
}
|
||||
|
||||
if (onclick.Length > 0) {
|
||||
writer.WriteAttribute ("onclick", onclick);
|
||||
writer.WriteAttribute ("onclick", onclick, true);
|
||||
writer.WriteAttribute ("language", "javascript");
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ namespace System.Web.UI.HtmlControls {
|
||||
|
||||
if (oc != null) {
|
||||
writer.WriteAttribute ("language", "javascript");
|
||||
writer.WriteAttribute ("onclick", oc);
|
||||
writer.WriteAttribute ("onclick", oc, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace System.Web.UI.HtmlControls {
|
||||
if (Page != null)
|
||||
Page.ClientScript.RegisterForEventValidation (this.UniqueID, Value);
|
||||
#endif
|
||||
writer.WriteAttribute ("value", Value);
|
||||
writer.WriteAttribute ("value", Value, true);
|
||||
Attributes.Remove ("value");
|
||||
base.RenderAttributes (writer);
|
||||
}
|
||||
|
||||
@@ -668,10 +668,10 @@ namespace System.Web.UI.HtmlControls
|
||||
}
|
||||
}
|
||||
|
||||
w.WriteAttribute ("value", item.Value);
|
||||
w.WriteAttribute ("value", item.Value, true);
|
||||
w.Write (HtmlTextWriter.TagRightChar);
|
||||
|
||||
w.Write (item.Text);
|
||||
w.Write (HttpUtility.HtmlEncode(item.Text));
|
||||
w.WriteEndTag ("option");
|
||||
w.WriteLine ();
|
||||
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
2007-07-26 Vladimir Krasnov <vladimirk at mainsoft.com>
|
||||
|
||||
* ListItemCollection.cs: fixed LoadViewState, items restored from
|
||||
viewstate were not saved, fixes bug #82192
|
||||
|
||||
2007-08-30 Igor Zelmanovich <igorz at mainsoft.com>
|
||||
|
||||
* ListControl.cs: fixed selected items state management.
|
||||
|
||||
2007-07-24 Igor Zelmanovich <[email protected]>
|
||||
|
||||
* TreeView.cs: refactoring:
|
||||
|
||||
@@ -566,6 +566,8 @@ namespace System.Web.UI.WebControls {
|
||||
}
|
||||
|
||||
if (indices != null) {
|
||||
for (int i = 0; i < Items.Count; i++)
|
||||
Items [i].Selected = false;
|
||||
foreach (int index in indices)
|
||||
Items [index].Selected = true;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace System.Web.UI.WebControls {
|
||||
if (stateObj [i] != null)
|
||||
item.LoadViewState (stateObj [i]);
|
||||
|
||||
items.Add (item);
|
||||
Add (item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
2007-08-10 Gert Driesen <[email protected]>
|
||||
|
||||
* PageParser.cs: Replace enableSessionState and readOnlySessionState
|
||||
bools with enum backed field. Move 1.0 profile code for checking value
|
||||
of EnableSessionState pages config to PagesConfigurationHandler.
|
||||
Fixes bug #82392 for 1.0 profile.
|
||||
|
||||
2007-08-09 Marek Habersack <[email protected]>
|
||||
|
||||
* PageParser.cs: honor web.config enableSessionState
|
||||
ReadOnly setting instead of overwriting based on default value for
|
||||
page directive EnableSessionState. Patch from Joel Reed
|
||||
<[email protected]>, thanks! Fixes bug #82392
|
||||
|
||||
2007-07-24 Igor Zelmanovich <[email protected]>
|
||||
|
||||
* ClientScriptManager.cs: fixed: GetCallbackEventReference method.
|
||||
|
||||
|
||||
2007-07-23 Igor Zelmanovich <[email protected]>
|
||||
|
||||
* Page.cs: refactoring: __doPostBack client script
|
||||
|
||||
@@ -43,14 +43,13 @@ namespace System.Web.UI
|
||||
[AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
|
||||
public sealed class PageParser : TemplateControlParser
|
||||
{
|
||||
bool enableSessionState = true;
|
||||
PagesEnableSessionState enableSessionState = PagesEnableSessionState.True;
|
||||
bool enableViewStateMac = true;
|
||||
bool smartNavigation = false;
|
||||
bool smartNavigation;
|
||||
bool haveTrace;
|
||||
bool trace;
|
||||
bool notBuffer;
|
||||
TraceMode tracemode;
|
||||
bool readonlySessionState;
|
||||
string responseEncoding;
|
||||
string contentType;
|
||||
int codepage = -1;
|
||||
@@ -112,24 +111,7 @@ namespace System.Web.UI
|
||||
#endif
|
||||
|
||||
notBuffer = !ps.Buffer;
|
||||
#if NET_2_0
|
||||
switch (ps.EnableSessionState) {
|
||||
case PagesEnableSessionState.True:
|
||||
case PagesEnableSessionState.ReadOnly:
|
||||
enableSessionState = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
enableSessionState = false;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if (String.Compare (ps.EnableSessionState, "true", true, CultureInfo.InvariantCulture) == 0)
|
||||
enableSessionState = true;
|
||||
else
|
||||
enableSessionState = false;
|
||||
#endif
|
||||
|
||||
enableSessionState = ps.EnableSessionState;
|
||||
enableViewStateMac = ps.EnableViewStateMac;
|
||||
smartNavigation = ps.SmartNavigation;
|
||||
validateRequest = ps.ValidateRequest;
|
||||
@@ -165,23 +147,23 @@ namespace System.Web.UI
|
||||
// note: the 'enableSessionState' configuration property is
|
||||
// processed in a case-sensitive manner while the page-level
|
||||
// attribute is processed case-insensitive
|
||||
string enabless = GetString (atts, "EnableSessionState", enableSessionState.ToString ());
|
||||
string enabless = GetString (atts, "EnableSessionState", null);
|
||||
if (enabless != null) {
|
||||
readonlySessionState = (String.Compare (enabless, "readonly", true) == 0);
|
||||
if (readonlySessionState == true || String.Compare (enabless, "true", true) == 0) {
|
||||
enableSessionState = true;
|
||||
} else if (String.Compare (enabless, "false", true) == 0) {
|
||||
enableSessionState = false;
|
||||
} else {
|
||||
if (String.Compare (enabless, "readonly", true) == 0)
|
||||
enableSessionState = PagesEnableSessionState.ReadOnly;
|
||||
else if (String.Compare (enabless, "true", true) == 0)
|
||||
enableSessionState = PagesEnableSessionState.True;
|
||||
else if (String.Compare (enabless, "false", true) == 0)
|
||||
enableSessionState = PagesEnableSessionState.False;
|
||||
else
|
||||
ThrowParseException ("Invalid value for enableSessionState: " + enabless);
|
||||
}
|
||||
}
|
||||
|
||||
string cp = GetString (atts, "CodePage", null);
|
||||
if (cp != null) {
|
||||
if (responseEncoding != null)
|
||||
ThrowParseException ("CodePage and ResponseEncoding are " +
|
||||
"mutually exclusive.");
|
||||
"mutually exclusive.");
|
||||
|
||||
int codepage = 0;
|
||||
try {
|
||||
@@ -436,7 +418,10 @@ namespace System.Web.UI
|
||||
}
|
||||
|
||||
internal bool EnableSessionState {
|
||||
get { return enableSessionState; }
|
||||
get {
|
||||
return enableSessionState == PagesEnableSessionState.True ||
|
||||
ReadOnlySessionState;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool EnableViewStateMac {
|
||||
@@ -448,7 +433,9 @@ namespace System.Web.UI
|
||||
}
|
||||
|
||||
internal bool ReadOnlySessionState {
|
||||
get { return readonlySessionState; }
|
||||
get {
|
||||
return enableSessionState == PagesEnableSessionState.ReadOnly;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool HaveTrace {
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
2008-08-20 Marek Habersack <[email protected]>
|
||||
|
||||
* HttpResponseHeader.cs: encode header values if
|
||||
httpRuntime.enableHeaderChecking is true (default). Fixes bug
|
||||
#418620
|
||||
|
||||
2007-10-17 Marek Habersack <[email protected]>
|
||||
|
||||
* StaticFileHandler.cs: fixed an bug with Mono running under
|
||||
Windows operating systems which caused XSP to return source of the
|
||||
requested page if the file name used in the request ended in any
|
||||
number of spaces or dots. The problem lies in the way the Win32
|
||||
subsystem treats such file names - it ignores the trailing
|
||||
characters and allows the calling application to open a file on
|
||||
disk even when its name does not contain the trailing characters
|
||||
used in the open request. Such file names may be supported by the
|
||||
underlying filesystem (e.g. NTFS) but they are not supported by
|
||||
the I/O Win32 subsystem. The security issue is reported in
|
||||
CVE security report CVE-2007-5473. Fixes bug #332401
|
||||
|
||||
2007-07-22 Vladimir Krasnov <[email protected]>
|
||||
|
||||
* HttpServerUtility.cs: fixed Execute, SetCurrentExePath should be
|
||||
|
||||
@@ -30,17 +30,65 @@
|
||||
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using System.Web.Configuration;
|
||||
|
||||
namespace System.Web {
|
||||
|
||||
internal abstract class BaseResponseHeader {
|
||||
public string Value;
|
||||
string headerValue;
|
||||
|
||||
public string Value {
|
||||
get { return headerValue; }
|
||||
set { headerValue = EncodeHeader (value); }
|
||||
}
|
||||
|
||||
static bool headerCheckingEnabled;
|
||||
|
||||
static BaseResponseHeader () {
|
||||
#if NET_2_0
|
||||
HttpRuntimeSection section = WebConfigurationManager.GetSection ("system.web/httpRuntime") as HttpRuntimeSection;
|
||||
#else
|
||||
HttpRuntimeConfig section = HttpContext.GetAppConfig ("system.web/httpRuntime") as HttpRuntimeConfig;
|
||||
#endif
|
||||
headerCheckingEnabled = section == null || section.EnableHeaderChecking;
|
||||
}
|
||||
|
||||
|
||||
internal BaseResponseHeader (string val)
|
||||
{
|
||||
Value = val;
|
||||
}
|
||||
|
||||
string EncodeHeader (string value)
|
||||
{
|
||||
if (value == null || value.Length == 0)
|
||||
return value;
|
||||
|
||||
if (headerCheckingEnabled) {
|
||||
StringBuilder ret = new StringBuilder ();
|
||||
int len = value.Length;
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
switch (value [i]) {
|
||||
case '\r':
|
||||
ret.Append ("%0d");
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
ret.Append ("%0a");
|
||||
break;
|
||||
|
||||
default:
|
||||
ret.Append (value [i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret.ToString ();
|
||||
} else
|
||||
return value;
|
||||
}
|
||||
|
||||
internal abstract void SendContent (HttpWorkerRequest wr);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,18 +31,38 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Web.Util;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
class StaticFileHandler : IHttpHandler
|
||||
{
|
||||
static bool runningWindows = RunningOnWindows ();
|
||||
|
||||
static bool RunningOnWindows ()
|
||||
{
|
||||
int pid = (int)Environment.OSVersion.Platform;
|
||||
return (pid != 4 && pid != 128);
|
||||
}
|
||||
|
||||
static bool ValidFileName (string fileName)
|
||||
{
|
||||
if (!runningWindows)
|
||||
return true;
|
||||
|
||||
if (fileName == null || fileName.Length == 0)
|
||||
return false;
|
||||
|
||||
return (!StrUtils.EndsWith (fileName, " ") && !StrUtils.EndsWith (fileName, "."));
|
||||
}
|
||||
|
||||
public void ProcessRequest (HttpContext context)
|
||||
{
|
||||
HttpRequest request = context.Request;
|
||||
HttpResponse response = context.Response;
|
||||
string fileName = request.PhysicalPath;
|
||||
FileInfo fi = new FileInfo (fileName);
|
||||
if (!fi.Exists)
|
||||
if (!fi.Exists || !ValidFileName (fileName))
|
||||
throw new HttpException (404, "File '" + request.FilePath + "' not found.");
|
||||
|
||||
if ((fi.Attributes & FileAttributes.Directory) != 0) {
|
||||
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
* HtmlSelectTest.cs: updated tests to use HtmlDiff
|
||||
|
||||
2008-07-27 Dean Brettle <[email protected]>
|
||||
|
||||
* HtmlInputButtonTest.cs, HtmlImageTest.cs, HtmlFormTest.cs,
|
||||
HtmlInputRadioButtonTest.cs, HtmlSelectTest.cs: Added tests
|
||||
for HTML-encoded of attributes.
|
||||
* Fix for CVE-2008-3422
|
||||
|
||||
2006-11-13 Igor Zelmanovich <[email protected]>
|
||||
|
||||
* HtmlContainerControlTest.cs: added new tests
|
||||
|
||||
@@ -118,13 +118,13 @@ namespace MonoTests.System.Web.UI.HtmlControls {
|
||||
img.Alt = "*2*";
|
||||
img.Border = 3;
|
||||
img.Height = 4;
|
||||
img.Src = "*5*";
|
||||
img.Src = "*5<&*";
|
||||
img.Width = 6;
|
||||
|
||||
Assert.AreEqual (6, img.Attributes.Count, "Attributes.Count");
|
||||
|
||||
HtmlTextWriter writer = img.GetWriter ();
|
||||
Assert.AreEqual (" src=\"*5*\" align=\"*1*\" alt=\"*2*\" border=\"3\" height=\"4\" width=\"6\" /", writer.InnerWriter.ToString ());
|
||||
Assert.AreEqual (" src=\"*5<&*\" align=\"*1*\" alt=\"*2*\" border=\"3\" height=\"4\" width=\"6\" /", writer.InnerWriter.ToString ());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,6 +164,28 @@ namespace MonoTests.System.Web.UI.HtmlControls {
|
||||
Assert.IsTrue (found >= 0, "#02");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnClickAttributeWithSpecials ()
|
||||
{
|
||||
StringWriter sw = new StringWriter ();
|
||||
HtmlTextWriter tw = new HtmlTextWriter (sw);
|
||||
|
||||
HtmlInputButtonPoker p = new HtmlInputButtonPoker ();
|
||||
p.Page = new Page ();
|
||||
p.Attributes["onclick"] = "alert('<&');";
|
||||
p.DoRenderAttributes (tw);
|
||||
string str = sw.ToString ();
|
||||
int found = str.IndexOf ("alert('<&');");
|
||||
Assert.IsTrue (found >= 0, "#01");
|
||||
p.ServerClick += new EventHandler (EmptyHandler);
|
||||
sw = new StringWriter ();
|
||||
tw = new HtmlTextWriter (sw);
|
||||
p.DoRenderAttributes (tw);
|
||||
str = sw.ToString ();
|
||||
found = str.IndexOf ("alert('<&');");
|
||||
Assert.IsTrue (found >= 0, "#02" + str);
|
||||
}
|
||||
|
||||
private static void EmptyHandler (object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -236,9 +236,9 @@ namespace MonoTests.System.Web.UI.HtmlControls {
|
||||
rb.ID = "id";
|
||||
string attrs = rb.RenderAttributes ();
|
||||
Assert.IsTrue (attrs.IndexOf ("value=\"id\"") >= 0);
|
||||
rb.Value = "hola";
|
||||
rb.Value = "hola<&";
|
||||
attrs = rb.RenderAttributes ();
|
||||
Assert.IsTrue (attrs.IndexOf ("value=\"hola\"") >= 0);
|
||||
Assert.IsTrue (attrs.IndexOf ("value=\"hola<&\"") >= 0);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
|
||||
@@ -479,5 +479,17 @@ namespace MonoTests.System.Web.UI.HtmlControls {
|
||||
HtmlDiff.AssertAreEqual (exp, s.Render (), "DataBindDoubleCall");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void HtmlEncodeValues ()
|
||||
{
|
||||
TestHtmlSelect s = new TestHtmlSelect ();
|
||||
s.DataSource = new string [] { "&", "<" };
|
||||
s.DataBind ();
|
||||
string exp = @"<select name>
|
||||
<option value=""&"">&</option>
|
||||
<option value=""<""><</option>
|
||||
</select>";
|
||||
HtmlDiff.AssertAreEqual (exp, s.Render (), "HtmlEncodeValues");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ namespace System.Collections.Specialized
|
||||
|
||||
protected virtual void OnDeserialization (object sender)
|
||||
{
|
||||
OnDeserialization (sender);
|
||||
((IDeserializationCallback) this).OnDeserialization (sender);
|
||||
}
|
||||
|
||||
void IDeserializationCallback.OnDeserialization (object sender)
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2007-07-26 Jonathan Chambers <[email protected]>
|
||||
|
||||
* ComInteropProxy.cs: Call Marshal.Release after Marshal.QI
|
||||
since it AddRef's the object. Fixes COM leak. Also fix eol-style.
|
||||
|
||||
2007-05-25 Jonathan Chambers <[email protected]>
|
||||
|
||||
* ComInteropProxy.cs: Call __ComObject.GetInterface overload
|
||||
|
||||
@@ -42,16 +42,16 @@ namespace Mono.Interop
|
||||
{
|
||||
internal class ComInteropProxy : RealProxy, IRemotingTypeInfo
|
||||
{
|
||||
#region Sync with object-internals.h
|
||||
private __ComObject com_object;
|
||||
#region Sync with object-internals.h
|
||||
private __ComObject com_object;
|
||||
int ref_count = 1; // wrapper ref count
|
||||
#endregion
|
||||
private string type_name;
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern static void AddProxy (IntPtr pItf, ComInteropProxy proxy);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private string type_name;
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern static void AddProxy (IntPtr pItf, ComInteropProxy proxy);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
internal extern static ComInteropProxy FindProxy (IntPtr pItf);
|
||||
|
||||
public ComInteropProxy (Type t)
|
||||
@@ -65,7 +65,7 @@ namespace Mono.Interop
|
||||
internal void CacheProxy ()
|
||||
{
|
||||
// called from unmanaged code after .ctor is invoked
|
||||
// we need .ctor to create unmanaged object and thus IUnknown property value
|
||||
// we need .ctor to create unmanaged object and thus IUnknown property value
|
||||
AddProxy (com_object.IUnknown, this);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Mono.Interop
|
||||
internal ComInteropProxy (IntPtr pUnk, Type t)
|
||||
: base (t)
|
||||
{
|
||||
com_object = new __ComObject (pUnk);
|
||||
com_object = new __ComObject (pUnk);
|
||||
CacheProxy ();
|
||||
}
|
||||
|
||||
@@ -86,13 +86,15 @@ namespace Mono.Interop
|
||||
IntPtr ppv;
|
||||
Guid iid = __ComObject.IID_IUnknown;
|
||||
int hr = Marshal.QueryInterface (pItf, ref iid, out ppv);
|
||||
Marshal.ThrowExceptionForHR (hr);
|
||||
Marshal.ThrowExceptionForHR (hr);
|
||||
ComInteropProxy obj = FindProxy (ppv);
|
||||
if (obj == null) {
|
||||
Marshal.Release (pItf);
|
||||
return new ComInteropProxy (ppv);
|
||||
}
|
||||
else {
|
||||
System.Threading.Interlocked.Increment (ref obj.ref_count);
|
||||
else {
|
||||
Marshal.Release (pItf);
|
||||
System.Threading.Interlocked.Increment (ref obj.ref_count);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2007-09-12 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* NextPrimeFinder.cs, PrimeGeneratorBase.cs: Updated to match
|
||||
Mono.Security sources.
|
||||
|
||||
2004-09-16 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* SequentialSearchPrimeGeneratorBase.cs: Fixed warning (l4) for unused
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
// Copyright (c) 2003 Ben Maurer. All rights reserved
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
// Copyright (c) 2003 Ben Maurer. All rights reserved
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2007-09-12 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* ConfidenceFactor.cs, PrimalityTests.cs: Updated to match
|
||||
Mono.Security sources.
|
||||
|
||||
2004-05-07 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* PrimalityTests.cs: In sync with Mono.Security.dll version.
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
// Copyright (c) 2003 Ben Maurer. All rights reserved
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
// Copyright (c) 2003 Ben Maurer. All rights reserved
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
@@ -94,10 +92,19 @@ namespace Mono.Math.Prime {
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Test (BigInteger n, ConfidenceFactor confidence)
|
||||
{
|
||||
// Rabin-Miller fails with smaller primes (at least with our BigInteger code)
|
||||
if (n.BitCount () < 33)
|
||||
return SmallPrimeSppTest (n, confidence);
|
||||
else
|
||||
return RabinMillerTest (n, confidence);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Probabilistic prime test based on Rabin-Miller's test
|
||||
/// </summary>
|
||||
/// <param name="bi" type="BigInteger.BigInteger">
|
||||
/// <param name="n" type="BigInteger.BigInteger">
|
||||
/// <para>
|
||||
/// The number to test.
|
||||
/// </para>
|
||||
@@ -116,67 +123,51 @@ namespace Mono.Math.Prime {
|
||||
/// False if "this" is definitely NOT prime.
|
||||
/// </para>
|
||||
/// </returns>
|
||||
public static bool RabinMillerTest (BigInteger bi, ConfidenceFactor confidence)
|
||||
public static bool RabinMillerTest (BigInteger n, ConfidenceFactor confidence)
|
||||
{
|
||||
int Rounds = GetSPPRounds (bi, confidence);
|
||||
int bits = n.BitCount ();
|
||||
int t = GetSPPRounds (bits, confidence);
|
||||
|
||||
// calculate values of s and t
|
||||
BigInteger p_sub1 = bi - 1;
|
||||
int s = p_sub1.LowestSetBit ();
|
||||
// n - 1 == 2^s * r, r is odd
|
||||
BigInteger n_minus_1 = n - 1;
|
||||
int s = n_minus_1.LowestSetBit ();
|
||||
BigInteger r = n_minus_1 >> s;
|
||||
|
||||
BigInteger t = p_sub1 >> s;
|
||||
|
||||
int bits = bi.BitCount ();
|
||||
BigInteger a = null;
|
||||
BigInteger.ModulusRing mr = new BigInteger.ModulusRing (bi);
|
||||
BigInteger.ModulusRing mr = new BigInteger.ModulusRing (n);
|
||||
|
||||
// Applying optimization from HAC section 4.50 (base == 2)
|
||||
// not a really random base but an interesting (and speedy) one
|
||||
BigInteger b = mr.Pow (2, t);
|
||||
if (b != 1) {
|
||||
bool result = false;
|
||||
for (int j=0; j < s; j++) {
|
||||
if (b == p_sub1) { // a^((2^j)*t) mod p = p-1 for some 0 <= j <= s-1
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
b = (b * b) % bi;
|
||||
}
|
||||
if (!result)
|
||||
return false;
|
||||
}
|
||||
BigInteger y = null;
|
||||
// FIXME - optimization disable for small primes due to bug #81857
|
||||
if (n.BitCount () > 100)
|
||||
y = mr.Pow (2, r);
|
||||
|
||||
// still here ? start at round 1 (round 0 was a == 2)
|
||||
for (int round = 1; round < Rounds; round++) {
|
||||
while (true) { // generate a < n
|
||||
a = BigInteger.GenerateRandom (bits);
|
||||
for (int round = 0; round < t; round++) {
|
||||
|
||||
// make sure "a" is not 0 (and not 2 as we have already tested that)
|
||||
if (a > 2 && a < bi)
|
||||
break;
|
||||
if ((round > 0) || (y == null)) {
|
||||
BigInteger a = null;
|
||||
|
||||
// check for 2 <= a <= n - 2
|
||||
// ...but we already did a == 2 previously as an optimization
|
||||
do {
|
||||
a = BigInteger.GenerateRandom (bits);
|
||||
} while ((a <= 2) && (a >= n_minus_1));
|
||||
|
||||
y = mr.Pow (a, r);
|
||||
}
|
||||
|
||||
if (a.GCD (bi) != 1)
|
||||
return false;
|
||||
if (y == 1)
|
||||
continue;
|
||||
|
||||
b = mr.Pow (a, t);
|
||||
for (int j = 0; ((j < s) && (y != n_minus_1)); j++) {
|
||||
|
||||
if (b == 1)
|
||||
continue; // a^t mod p = 1
|
||||
|
||||
bool result = false;
|
||||
for (int j = 0; j < s; j++) {
|
||||
|
||||
if (b == p_sub1) { // a^((2^j)*t) mod p = p-1 for some 0 <= j <= s-1
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
b = (b * b) % bi;
|
||||
y = mr.Pow (y, 2);
|
||||
if (y == 1)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!result)
|
||||
if (y != n_minus_1)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// Copyright (c) 2002 Chew Keong TAN
|
||||
// All rights reserved.
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
@@ -862,10 +862,16 @@ namespace Mono.Math {
|
||||
|
||||
public override bool Equals (object o)
|
||||
{
|
||||
if (o == null) return false;
|
||||
if (o is int) return (int)o >= 0 && this == (uint)o;
|
||||
if (o == null)
|
||||
return false;
|
||||
if (o is int)
|
||||
return (int)o >= 0 && this == (uint)o;
|
||||
|
||||
return Kernel.Compare (this, (BigInteger)o) == 0;
|
||||
BigInteger bi = o as BigInteger;
|
||||
if (bi == null)
|
||||
return false;
|
||||
|
||||
return Kernel.Compare (this, bi) == 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -894,19 +900,23 @@ namespace Mono.Math {
|
||||
|
||||
public bool IsProbablePrime ()
|
||||
{
|
||||
if (this < smallPrimes [smallPrimes.Length - 1]) {
|
||||
// can we use our small-prime table ?
|
||||
if (this <= smallPrimes[smallPrimes.Length - 1]) {
|
||||
for (int p = 0; p < smallPrimes.Length; p++) {
|
||||
if (this == smallPrimes [p])
|
||||
if (this == smallPrimes[p])
|
||||
return true;
|
||||
}
|
||||
// the list is complete, so it's not a prime
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
for (int p = 0; p < smallPrimes.Length; p++) {
|
||||
if (this % smallPrimes [p] == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise check if we can divide by one of the small primes
|
||||
for (int p = 0; p < smallPrimes.Length; p++) {
|
||||
if (this % smallPrimes[p] == 0)
|
||||
return false;
|
||||
}
|
||||
return PrimalityTests.RabinMillerTest (this, Prime.ConfidenceFactor.Medium);
|
||||
// the last step is to confirm the "large" prime with the SPP or Miller-Rabin test
|
||||
return PrimalityTests.Test (this, Prime.ConfidenceFactor.Medium);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1038,18 +1048,12 @@ namespace Mono.Math {
|
||||
{
|
||||
if (a == 0 || b == 0) return 0;
|
||||
|
||||
if (a.length >= mod.length << 1)
|
||||
if (a > mod)
|
||||
a %= mod;
|
||||
|
||||
if (b.length >= mod.length << 1)
|
||||
if (b > mod)
|
||||
b %= mod;
|
||||
|
||||
if (a.length >= mod.length)
|
||||
BarrettReduction (a);
|
||||
|
||||
if (b.length >= mod.length)
|
||||
BarrettReduction (b);
|
||||
|
||||
BigInteger ret = new BigInteger (a * b);
|
||||
BarrettReduction (ret);
|
||||
|
||||
@@ -1082,7 +1086,25 @@ namespace Mono.Math {
|
||||
diff = mod - diff;
|
||||
return diff;
|
||||
}
|
||||
#if true
|
||||
public BigInteger Pow (BigInteger a, BigInteger k)
|
||||
{
|
||||
BigInteger b = new BigInteger (1);
|
||||
if (k == 0)
|
||||
return b;
|
||||
|
||||
BigInteger A = a;
|
||||
if (k.TestBit (0))
|
||||
b = a;
|
||||
|
||||
for (int i = 1; i < k.BitCount (); i++) {
|
||||
A = Multiply (A, A);
|
||||
if (k.TestBit (i))
|
||||
b = Multiply (A, b);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
#else
|
||||
public BigInteger Pow (BigInteger b, BigInteger exp)
|
||||
{
|
||||
if ((mod.data [0] & 1) == 1) return OddPow (b, exp);
|
||||
@@ -1146,14 +1168,17 @@ namespace Mono.Math {
|
||||
Montgomery.Reduce (resultNum, mod, mPrime);
|
||||
}
|
||||
|
||||
Kernel.SquarePositive (tempNum, ref wkspace);
|
||||
Montgomery.Reduce (tempNum, mod, mPrime);
|
||||
// the value of tempNum is required in the last loop
|
||||
if (pos < totalBits - 1) {
|
||||
Kernel.SquarePositive (tempNum, ref wkspace);
|
||||
Montgomery.Reduce (tempNum, mod, mPrime);
|
||||
}
|
||||
}
|
||||
|
||||
Montgomery.Reduce (resultNum, mod, mPrime);
|
||||
return resultNum;
|
||||
}
|
||||
|
||||
#endif
|
||||
#region Pow Small Base
|
||||
|
||||
// TODO: Make tests for this, not really needed b/c prime stuff
|
||||
@@ -1161,6 +1186,12 @@ namespace Mono.Math {
|
||||
#if !INSIDE_CORLIB
|
||||
[CLSCompliant (false)]
|
||||
#endif
|
||||
#if true
|
||||
public BigInteger Pow (uint b, BigInteger exp)
|
||||
{
|
||||
return Pow (new BigInteger (b), exp);
|
||||
}
|
||||
#else
|
||||
public BigInteger Pow (uint b, BigInteger exp)
|
||||
{
|
||||
// if (b != 2) {
|
||||
@@ -1168,7 +1199,7 @@ namespace Mono.Math {
|
||||
return OddPow (b, exp);
|
||||
else
|
||||
return EvenPow (b, exp);
|
||||
/* buggy in some cases (like the well tested primes)
|
||||
/* buggy in some cases (like the well tested primes)
|
||||
} else {
|
||||
if ((mod.data [0] & 1) == 1)
|
||||
return OddModTwoPow (exp);
|
||||
@@ -1187,7 +1218,8 @@ namespace Mono.Math {
|
||||
|
||||
uint mPrime = Montgomery.Inverse (mod.data [0]);
|
||||
|
||||
uint pos = (uint)exp.BitCount () - 2;
|
||||
int bc = exp.BitCount () - 2;
|
||||
uint pos = (bc > 1 ? (uint) bc : 1);
|
||||
|
||||
//
|
||||
// We know that the first itr will make the val b
|
||||
@@ -1387,8 +1419,9 @@ namespace Mono.Math {
|
||||
|
||||
return resultNum;
|
||||
}
|
||||
|
||||
/* known to be buggy in some cases
|
||||
#endif
|
||||
/* known to be buggy in some cases */
|
||||
#if false
|
||||
private unsafe BigInteger EvenModTwoPow (BigInteger exp)
|
||||
{
|
||||
exp.Normalize ();
|
||||
@@ -1521,7 +1554,7 @@ namespace Mono.Math {
|
||||
resultNum = Montgomery.Reduce (resultNum, mod, mPrime);
|
||||
return resultNum;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
2007-09-12 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* BigInteger.cs: Updated to match Mono.Security sources.
|
||||
|
||||
2007-07-28 Miguel de Icaza <[email protected]>
|
||||
|
||||
* BigInteger.cs: Do not cast inside Equals,instead use the as
|
||||
operator, as reported by Jesse Jones.
|
||||
|
||||
2004-12-03 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* BigInteger.cs: Fix issue #70169 in ModPow when modulus is a power of
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2007-09-02 Zoltan Varga <[email protected]>
|
||||
|
||||
* TypeBuilder.cs: Add a workaround for #82625 to make nemerle work again.
|
||||
|
||||
2007-07-11 Rodrigo Kumpera <[email protected]>
|
||||
|
||||
* TypeBuilder.cs (CreateType): method did not check for enum type with defined methods and fixed compatibility issue in case of calling CreateType again after the first one failed, it now returns null as well.
|
||||
|
||||
@@ -964,8 +964,15 @@ namespace System.Reflection.Emit
|
||||
|
||||
public override FieldInfo[] GetFields (BindingFlags bindingAttr)
|
||||
{
|
||||
#if NET_2_0 || BOOTSTRAP_NET_2_0
|
||||
// FIXME: In the generic case, this leads to a crash
|
||||
// http://bugzilla.ximian.com/show_bug.cgi?id=82625
|
||||
if (!ContainsGenericParameters && (created != null))
|
||||
return created.GetFields (bindingAttr);
|
||||
#else
|
||||
if (created != null)
|
||||
return created.GetFields (bindingAttr);
|
||||
#endif
|
||||
|
||||
if (fields == null)
|
||||
return new FieldInfo [0];
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
2007-07-30 Lluis Sanchez Gual <[email protected]>
|
||||
|
||||
* MethodCall.cs (ResolveMethod): If the method is implemented
|
||||
in an interface, look for the method implementation. Fix for bxc #82240
|
||||
|
||||
2007-02-05 Robert Jordan <[email protected]>
|
||||
|
||||
* MethodCall.cs (ResolveMethod): Actually use the type returned
|
||||
|
||||
@@ -317,8 +317,17 @@ namespace System.Runtime.Remoting.Messaging {
|
||||
Type requestType = CastTo (_typeName, type);
|
||||
|
||||
if (requestType != null) {
|
||||
// Look for the method in the requested type. The method signature is provided
|
||||
// only if the method is overloaded in the requested type.
|
||||
_methodBase = RemotingServices.GetMethodBaseFromName (requestType, _methodName, _methodSignature);
|
||||
if (_methodBase == null) throw new RemotingException ("Method " + _methodName + " not found in " + type);
|
||||
if (_methodBase == null)
|
||||
throw new RemotingException ("Method " + _methodName + " not found in " + type);
|
||||
|
||||
// If the method is implemented in an interface, look for the method implementation.
|
||||
// It can't be done in the previous GetMethodBaseFromName call because at that point we
|
||||
// may not yet have the method signature.
|
||||
if (requestType != type && requestType.IsInterface)
|
||||
_methodBase = RemotingServices.GetMethodBaseFromName (type, _methodName, (Type[]) MethodSignature);
|
||||
}
|
||||
else
|
||||
throw new RemotingException ("Cannot cast from client type '" + _typeName + "' to server type '" + type.FullName + "'");
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
2007-08-17 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* CryptoStream.cs: Write cannot depend on buffer.Length (fix #82428)
|
||||
|
||||
2007-05-16 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* CryptoStream.cs: Fix another problem that can occurs with WriteByte.
|
||||
|
||||
@@ -261,6 +261,8 @@ namespace System.Security.Cryptography {
|
||||
if (_stream == null)
|
||||
throw new ArgumentNullException ("inner stream was diposed");
|
||||
|
||||
int buffer_length = count;
|
||||
|
||||
// partial block (in progress)
|
||||
if ((_partialCount > 0) && (_partialCount != _transform.InputBlockSize)) {
|
||||
int remainder = _transform.InputBlockSize - _partialCount;
|
||||
@@ -297,7 +299,7 @@ namespace System.Security.Cryptography {
|
||||
}
|
||||
|
||||
if (rem > 0)
|
||||
Buffer.BlockCopy (buffer, buffer.Length - rem, _workingBlock, 0, rem);
|
||||
Buffer.BlockCopy (buffer, buffer_length - rem, _workingBlock, 0, rem);
|
||||
_partialCount = rem;
|
||||
count = 0; // the last block, if any, is in _workingBlock
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,67 @@
|
||||
2007-09-10 William Holmes <[email protected]>
|
||||
|
||||
Backport for r85021
|
||||
* marshal.c (cominterop_get_ccw): Walk up interface hierarchy
|
||||
if interface is marked with CoClassAttribute.
|
||||
|
||||
2007-09-10 William Holmes <[email protected]>
|
||||
|
||||
Backport for r84149
|
||||
* marshal.c (cominterop_get_ccw): Patch from
|
||||
Bill Holmes to no walk up interface hierarchy.
|
||||
All parent methods should be present in the interface for COM.
|
||||
|
||||
2007-09-10 William Holmes <[email protected]>
|
||||
|
||||
Backport for r84147
|
||||
* marshal.c (emit_marshal_com_interface): Patch from
|
||||
Bill Holmes to handle COM Interfaces as return values
|
||||
for native->managed calls.
|
||||
|
||||
2007-09-10 William Holmes <[email protected]>
|
||||
|
||||
Backport for r84130
|
||||
* marshal.c (cominterop_get_idispatch_for_object): Implement
|
||||
for runtime callable wrappers.
|
||||
|
||||
2007-09-10 William Holmes <[email protected]>
|
||||
|
||||
Backport for r83601
|
||||
* marshal.c: Use correct image when emitting
|
||||
native wrapper for COM calls.
|
||||
|
||||
2007-09-10 William Holmes <[email protected]>
|
||||
|
||||
Backport for r84161
|
||||
* marshal.c (emit_marshal_custom): Omit the call to
|
||||
marshal_native_to_managed when calling native to managed
|
||||
and the argument is specified as an out argument.
|
||||
|
||||
2007-08-23 Robert Jordan <[email protected]>
|
||||
|
||||
* marshal.c (Marshal_ReAllocHGlobal) : Fix GlobalReAlloc's flags.
|
||||
Fixes #82499.
|
||||
|
||||
2007-07-03 Jonathan Chambers <[email protected]>
|
||||
|
||||
* marshal.c: Implement COM Objects as return type for
|
||||
managed->unmanaged calls. Added Release calls for COM Object
|
||||
out/return values in managed->unmanaged calls.
|
||||
|
||||
Code is contributed under MIT/X11 license.
|
||||
|
||||
2007-07-31 William Holmes <[email protected]>
|
||||
|
||||
* metadata.c Changed mono_type_create_from_typespec to not insert
|
||||
the type into the has map until after
|
||||
do_mono_metadata_parse_type has completed.
|
||||
Fixes Bug #82194
|
||||
Code is contributed under MIT/X11 license.
|
||||
|
||||
Wed Jul 25 18:06:33 CEST 2007 Paolo Molaro <[email protected]>
|
||||
|
||||
* object.c: properly setup interface_bitmap in proxy vtables.
|
||||
|
||||
2007-07-24 Rodrigo Kumpera <[email protected]>
|
||||
|
||||
* class.c (mono_bounded_array_class_get): fixed memory leak when
|
||||
|
||||
+160
-71
@@ -3490,7 +3490,7 @@ cominterop_get_native_wrapper_adjusted (MonoMethod *method)
|
||||
mspecs[0] = NULL;
|
||||
}
|
||||
|
||||
mono_marshal_emit_native_wrapper(mono_defaults.corlib, mb_native, sig_native, piinfo, mspecs, piinfo->addr);
|
||||
mono_marshal_emit_native_wrapper(method->klass->image, mb_native, sig_native, piinfo, mspecs, piinfo->addr);
|
||||
|
||||
res = mono_mb_create_method (mb_native, sig_native, sig_native->param_count + 16);
|
||||
|
||||
@@ -5925,6 +5925,9 @@ emit_marshal_custom (EmitMarshalContext *m, int argnum, MonoType *t,
|
||||
mono_mb_emit_byte (mb, CEE_LDNULL);
|
||||
mono_mb_emit_stloc (mb, conv_arg);
|
||||
|
||||
if (t->byref && t->attrs & PARAM_ATTRIBUTE_OUT)
|
||||
break;
|
||||
|
||||
/* Check for null */
|
||||
mono_mb_emit_ldarg (mb, argnum);
|
||||
if (t->byref)
|
||||
@@ -7053,6 +7056,8 @@ emit_marshal_com_interface (EmitMarshalContext *m, int argnum, MonoType *t,
|
||||
static MonoMethod* get_iunknown_for_object_internal = NULL;
|
||||
static MonoMethod* get_com_interface_for_object_internal = NULL;
|
||||
static MonoMethod* get_idispatch_for_object_internal = NULL;
|
||||
static MonoMethod* marshal_release = NULL;
|
||||
static MonoMethod* AddRef = NULL;
|
||||
if (!get_object_for_iunknown)
|
||||
get_object_for_iunknown = mono_class_get_method_from_name (mono_defaults.marshal_class, "GetObjectForIUnknown", 1);
|
||||
if (!get_iunknown_for_object_internal)
|
||||
@@ -7061,6 +7066,8 @@ emit_marshal_com_interface (EmitMarshalContext *m, int argnum, MonoType *t,
|
||||
get_idispatch_for_object_internal = mono_class_get_method_from_name (mono_defaults.marshal_class, "GetIDispatchForObjectInternal", 1);
|
||||
if (!get_com_interface_for_object_internal)
|
||||
get_com_interface_for_object_internal = mono_class_get_method_from_name (mono_defaults.marshal_class, "GetComInterfaceForObjectInternal", 2);
|
||||
if (!marshal_release)
|
||||
marshal_release = mono_class_get_method_from_name (mono_defaults.marshal_class, "Release", 1);
|
||||
|
||||
/* COM types are initialized lazily */
|
||||
mono_init_com_types ();
|
||||
@@ -7134,6 +7141,7 @@ emit_marshal_com_interface (EmitMarshalContext *m, int argnum, MonoType *t,
|
||||
if (klass && klass != mono_defaults.object_class)
|
||||
mono_mb_emit_op (mb, CEE_CASTCLASS, klass);
|
||||
mono_mb_emit_byte (mb, CEE_STIND_REF);
|
||||
|
||||
pos_end = mono_mb_emit_short_branch (mb, CEE_BR_S);
|
||||
|
||||
/* is already managed object */
|
||||
@@ -7145,8 +7153,13 @@ emit_marshal_com_interface (EmitMarshalContext *m, int argnum, MonoType *t,
|
||||
mono_mb_emit_op (mb, CEE_CASTCLASS, klass);
|
||||
mono_mb_emit_byte (mb, CEE_STIND_REF);
|
||||
|
||||
|
||||
mono_mb_patch_short_branch (mb, pos_end);
|
||||
|
||||
/* need to call Release to follow COM rules of ownership */
|
||||
mono_mb_emit_ldloc (mb, conv_arg);
|
||||
mono_mb_emit_managed_call (mb, marshal_release, NULL);
|
||||
mono_mb_emit_byte (mb, CEE_POP);
|
||||
|
||||
/* case if null */
|
||||
mono_mb_patch_short_branch (mb, pos_null);
|
||||
}
|
||||
@@ -7160,8 +7173,50 @@ emit_marshal_com_interface (EmitMarshalContext *m, int argnum, MonoType *t,
|
||||
break;
|
||||
|
||||
case MARSHAL_ACTION_CONV_RESULT: {
|
||||
char *msg = g_strdup ("Marshalling of COM Objects is not yet implemented.");
|
||||
mono_mb_emit_exception_marshal_directive (mb, msg);
|
||||
int ccw_obj, ret_ptr;
|
||||
guint32 pos_null = 0, pos_ccw = 0, pos_end = 0;
|
||||
ccw_obj = mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
|
||||
ret_ptr = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
|
||||
|
||||
/* store return value */
|
||||
mono_mb_emit_stloc (mb, ret_ptr);
|
||||
|
||||
mono_mb_emit_ldloc (mb, ret_ptr);
|
||||
pos_null = mono_mb_emit_short_branch (mb, CEE_BRFALSE_S);
|
||||
|
||||
mono_mb_emit_ldloc (mb, ret_ptr);
|
||||
mono_mb_emit_icon (mb, TRUE);
|
||||
mono_mb_emit_icall (mb, cominterop_get_ccw_object);
|
||||
mono_mb_emit_stloc (mb, ccw_obj);
|
||||
mono_mb_emit_ldloc (mb, ccw_obj);
|
||||
pos_ccw = mono_mb_emit_short_branch (mb, CEE_BRTRUE_S);
|
||||
|
||||
mono_mb_emit_ldloc (mb, ret_ptr);
|
||||
mono_mb_emit_managed_call (mb, get_object_for_iunknown, NULL);
|
||||
|
||||
if (klass && klass != mono_defaults.object_class)
|
||||
mono_mb_emit_op (mb, CEE_CASTCLASS, klass);
|
||||
mono_mb_emit_stloc (mb, 3);
|
||||
|
||||
pos_end = mono_mb_emit_short_branch (mb, CEE_BR_S);
|
||||
|
||||
/* is already managed object */
|
||||
mono_mb_patch_short_branch (mb, pos_ccw);
|
||||
mono_mb_emit_ldloc (mb, ccw_obj);
|
||||
|
||||
if (klass && klass != mono_defaults.object_class)
|
||||
mono_mb_emit_op (mb, CEE_CASTCLASS, klass);
|
||||
mono_mb_emit_stloc (mb, 3);
|
||||
|
||||
mono_mb_patch_short_branch (mb, pos_end);
|
||||
|
||||
/* need to call Release to follow COM rules of ownership */
|
||||
mono_mb_emit_ldloc (mb, ret_ptr);
|
||||
mono_mb_emit_managed_call (mb, marshal_release, NULL);
|
||||
mono_mb_emit_byte (mb, CEE_POP);
|
||||
|
||||
/* case if null */
|
||||
mono_mb_patch_short_branch (mb, pos_null);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7219,7 +7274,6 @@ emit_marshal_com_interface (EmitMarshalContext *m, int argnum, MonoType *t,
|
||||
|
||||
case MARSHAL_ACTION_MANAGED_CONV_OUT: {
|
||||
if (t->byref && t->attrs & PARAM_ATTRIBUTE_OUT) {
|
||||
static MonoMethod* AddRef = NULL;
|
||||
guint32 pos_null = 0;
|
||||
|
||||
if (!AddRef)
|
||||
@@ -7258,8 +7312,43 @@ emit_marshal_com_interface (EmitMarshalContext *m, int argnum, MonoType *t,
|
||||
}
|
||||
|
||||
case MARSHAL_ACTION_MANAGED_CONV_RESULT: {
|
||||
char *msg = g_strdup ("Marshalling of COM Objects is not yet implemented.");
|
||||
mono_mb_emit_exception_marshal_directive (mb, msg);
|
||||
guint32 pos_null = 0;
|
||||
int ccw_obj;
|
||||
ccw_obj = mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
|
||||
|
||||
if (!AddRef)
|
||||
AddRef = mono_class_get_method_from_name (mono_defaults.marshal_class, "AddRef", 1);
|
||||
|
||||
/* store return value */
|
||||
mono_mb_emit_stloc (mb, ccw_obj);
|
||||
|
||||
mono_mb_emit_ldloc (mb, ccw_obj);
|
||||
|
||||
/* if null just break, conv arg was already inited to 0 */
|
||||
pos_null = mono_mb_emit_short_branch (mb, CEE_BRFALSE_S);
|
||||
|
||||
/* to store later */
|
||||
mono_mb_emit_ldloc (mb, ccw_obj);
|
||||
if (klass && klass != mono_defaults.object_class) {
|
||||
mono_mb_emit_ptr (mb, t);
|
||||
mono_mb_emit_icall (mb, type_from_handle);
|
||||
mono_mb_emit_managed_call (mb, get_com_interface_for_object_internal, NULL);
|
||||
}
|
||||
else if (spec->native == MONO_NATIVE_IUNKNOWN)
|
||||
mono_mb_emit_managed_call (mb, get_iunknown_for_object_internal, NULL);
|
||||
else if (spec->native == MONO_NATIVE_IDISPATCH)
|
||||
mono_mb_emit_managed_call (mb, get_idispatch_for_object_internal, NULL);
|
||||
else if (!klass && spec->native == MONO_NATIVE_INTERFACE)
|
||||
mono_mb_emit_managed_call (mb, get_iunknown_for_object_internal, NULL);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
mono_mb_emit_stloc (mb, 3);
|
||||
mono_mb_emit_ldloc (mb, 3);
|
||||
|
||||
mono_mb_emit_managed_call (mb, AddRef, NULL);
|
||||
mono_mb_emit_byte (mb, CEE_POP);
|
||||
|
||||
mono_mb_patch_short_branch (mb, pos_null);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -10211,9 +10300,8 @@ cominterop_get_idispatch_for_object (MonoObject* object)
|
||||
return NULL;
|
||||
|
||||
if (cominterop_object_is_rcw (object)) {
|
||||
/* FIXME: Implement this case */
|
||||
g_assert_not_reached ();
|
||||
return NULL;
|
||||
return cominterop_get_interface (((MonoComInteropProxy*)((MonoTransparentProxy*)object)->rp)->com_object,
|
||||
mono_defaults.idispatch_class, TRUE);
|
||||
}
|
||||
else {
|
||||
return cominterop_get_ccw (object, mono_defaults.idispatch_class);
|
||||
@@ -10623,7 +10711,7 @@ ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, i
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
res = GlobalReAlloc (ptr, (gulong)size, 0);
|
||||
res = GlobalReAlloc (ptr, (gulong)size, GMEM_MOVEABLE);
|
||||
#else
|
||||
res = g_try_realloc (ptr, (gulong)size);
|
||||
#endif
|
||||
@@ -11419,6 +11507,7 @@ cominterop_get_ccw (MonoObject* object, MonoClass* itf)
|
||||
int start_slot = 3;
|
||||
int method_count = 0;
|
||||
GList *ccw_list, *ccw_list_item;
|
||||
MonoCustomAttrInfo *cinfo = NULL;
|
||||
|
||||
if (!object)
|
||||
return NULL;
|
||||
@@ -11473,6 +11562,19 @@ cominterop_get_ccw (MonoObject* object, MonoClass* itf)
|
||||
mono_object_register_finalizer (object);
|
||||
}
|
||||
|
||||
cinfo = mono_custom_attrs_from_class (itf);
|
||||
if (cinfo) {
|
||||
static MonoClass* coclass_attribute = NULL;
|
||||
if (!coclass_attribute)
|
||||
coclass_attribute = mono_class_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "CoClassAttribute");
|
||||
if (mono_custom_attrs_has_attr (cinfo, coclass_attribute)) {
|
||||
g_assert(itf->interface_count && itf->interfaces[0]);
|
||||
itf = itf->interfaces[0];
|
||||
}
|
||||
if (!cinfo->cached)
|
||||
mono_custom_attrs_free (cinfo);
|
||||
}
|
||||
|
||||
iface = itf;
|
||||
if (iface == mono_defaults.iunknown_class) {
|
||||
start_slot = 3;
|
||||
@@ -11481,16 +11583,9 @@ cominterop_get_ccw (MonoObject* object, MonoClass* itf)
|
||||
start_slot = 7;
|
||||
}
|
||||
else {
|
||||
while (iface) {
|
||||
method_count += iface->method.count;
|
||||
if (iface->interface_count) {
|
||||
iface = iface->interfaces [0];
|
||||
}
|
||||
else {
|
||||
start_slot = cominterop_get_com_slot_begin (iface);
|
||||
iface = NULL;
|
||||
}
|
||||
}
|
||||
method_count += iface->method.count;
|
||||
start_slot = cominterop_get_com_slot_begin (iface);
|
||||
iface = NULL;
|
||||
}
|
||||
|
||||
ccw_entry = g_hash_table_lookup (ccw->vtable_hash, itf);
|
||||
@@ -11505,63 +11600,57 @@ cominterop_get_ccw (MonoObject* object, MonoClass* itf)
|
||||
memcpy (vtable+3, idispatch, sizeof (idispatch));
|
||||
|
||||
iface = itf;
|
||||
while (iface) {
|
||||
for (i = iface->method.count-1; i >= 0;i--) {
|
||||
int param_index = 0;
|
||||
MonoMethodBuilder *mb;
|
||||
MonoMarshalSpec ** mspecs;
|
||||
MonoMethod *wrapper_method, *adjust_method;
|
||||
MonoMethod *method = iface->methods [i];
|
||||
MonoMethodSignature* sig_adjusted;
|
||||
MonoMethodSignature* sig = mono_method_signature (method);
|
||||
gboolean preserve_sig = method->iflags & METHOD_IMPL_ATTRIBUTE_PRESERVE_SIG;
|
||||
for (i = iface->method.count-1; i >= 0;i--) {
|
||||
int param_index = 0;
|
||||
MonoMethodBuilder *mb;
|
||||
MonoMarshalSpec ** mspecs;
|
||||
MonoMethod *wrapper_method, *adjust_method;
|
||||
MonoMethod *method = iface->methods [i];
|
||||
MonoMethodSignature* sig_adjusted;
|
||||
MonoMethodSignature* sig = mono_method_signature (method);
|
||||
gboolean preserve_sig = method->iflags & METHOD_IMPL_ATTRIBUTE_PRESERVE_SIG;
|
||||
|
||||
|
||||
mb = mono_mb_new (iface, method->name, MONO_WRAPPER_NATIVE_TO_MANAGED);
|
||||
adjust_method = cominterop_get_managed_wrapper_adjusted (method);
|
||||
sig_adjusted = mono_method_signature (adjust_method);
|
||||
|
||||
mspecs = g_new (MonoMarshalSpec*, sig_adjusted->param_count + 1);
|
||||
mono_method_get_marshal_info (method, mspecs);
|
||||
mb = mono_mb_new (iface, method->name, MONO_WRAPPER_NATIVE_TO_MANAGED);
|
||||
adjust_method = cominterop_get_managed_wrapper_adjusted (method);
|
||||
sig_adjusted = mono_method_signature (adjust_method);
|
||||
|
||||
mspecs = g_new (MonoMarshalSpec*, sig_adjusted->param_count + 1);
|
||||
mono_method_get_marshal_info (method, mspecs);
|
||||
|
||||
|
||||
/* move managed args up one */
|
||||
for (param_index = sig->param_count; param_index >= 1; param_index--)
|
||||
mspecs [param_index+1] = mspecs [param_index];
|
||||
|
||||
/* move managed args up one */
|
||||
for (param_index = sig->param_count; param_index >= 1; param_index--)
|
||||
mspecs [param_index+1] = mspecs [param_index];
|
||||
|
||||
/* first arg is IntPtr for interface */
|
||||
mspecs [1] = NULL;
|
||||
|
||||
/* move return spec to last param */
|
||||
if (!preserve_sig && !MONO_TYPE_IS_VOID (sig->ret))
|
||||
mspecs [sig_adjusted->param_count] = mspecs [0];
|
||||
/* first arg is IntPtr for interface */
|
||||
mspecs [1] = NULL;
|
||||
|
||||
/* move return spec to last param */
|
||||
if (!preserve_sig && !MONO_TYPE_IS_VOID (sig->ret)) {
|
||||
mspecs [sig_adjusted->param_count] = mspecs [0];
|
||||
mspecs [0] = NULL;
|
||||
|
||||
cominterop_setup_marshal_context (&m, adjust_method);
|
||||
m.mb = mb;
|
||||
mono_marshal_emit_managed_wrapper (mb, sig_adjusted, mspecs, &m, adjust_method, NULL);
|
||||
mono_loader_lock ();
|
||||
mono_marshal_lock ();
|
||||
wrapper_method = mono_mb_create_method (mb, sig_adjusted, sig_adjusted->param_count + 16);
|
||||
mono_marshal_unlock ();
|
||||
mono_loader_unlock ();
|
||||
|
||||
/* skip visiblity since we call internal methods */
|
||||
wrapper_method->skip_visibility = TRUE;
|
||||
|
||||
vtable [vtable_index--] = mono_compile_method (wrapper_method);
|
||||
|
||||
|
||||
for (param_index = sig_adjusted->param_count; param_index >= 0; param_index--)
|
||||
if (mspecs [param_index])
|
||||
mono_metadata_free_marshal_spec (mspecs [param_index]);
|
||||
g_free (mspecs);
|
||||
}
|
||||
if (iface->interface_count)
|
||||
iface = iface->interfaces [0];
|
||||
else
|
||||
iface = NULL;
|
||||
|
||||
cominterop_setup_marshal_context (&m, adjust_method);
|
||||
m.mb = mb;
|
||||
mono_marshal_emit_managed_wrapper (mb, sig_adjusted, mspecs, &m, adjust_method, NULL);
|
||||
mono_loader_lock ();
|
||||
mono_marshal_lock ();
|
||||
wrapper_method = mono_mb_create_method (mb, sig_adjusted, sig_adjusted->param_count + 16);
|
||||
mono_marshal_unlock ();
|
||||
mono_loader_unlock ();
|
||||
|
||||
/* skip visiblity since we call internal methods */
|
||||
wrapper_method->skip_visibility = TRUE;
|
||||
|
||||
vtable [vtable_index--] = mono_compile_method (wrapper_method);
|
||||
|
||||
|
||||
for (param_index = sig_adjusted->param_count; param_index >= 0; param_index--)
|
||||
if (mspecs [param_index])
|
||||
mono_metadata_free_marshal_spec (mspecs [param_index]);
|
||||
g_free (mspecs);
|
||||
}
|
||||
|
||||
ccw_entry = g_new0 (MonoCCWInterface, 1);
|
||||
|
||||
@@ -4146,7 +4146,7 @@ mono_type_create_from_typespec (MonoImage *image, guint32 type_spec)
|
||||
guint32 cols [MONO_TYPESPEC_SIZE];
|
||||
const char *ptr;
|
||||
guint32 len;
|
||||
MonoType *type;
|
||||
MonoType *type, *type2;
|
||||
|
||||
mono_loader_lock ();
|
||||
|
||||
@@ -4164,20 +4164,27 @@ mono_type_create_from_typespec (MonoImage *image, guint32 type_spec)
|
||||
|
||||
type = g_new0 (MonoType, 1);
|
||||
|
||||
g_hash_table_insert (image->typespec_cache, GUINT_TO_POINTER (type_spec), type);
|
||||
|
||||
if (*ptr == MONO_TYPE_BYREF) {
|
||||
type->byref = 1;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (!do_mono_metadata_parse_type (type, image, NULL, ptr, &ptr)) {
|
||||
g_hash_table_remove (image->typespec_cache, GUINT_TO_POINTER (type_spec));
|
||||
g_free (type);
|
||||
mono_loader_unlock ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
type2 = g_hash_table_lookup (image->typespec_cache, GUINT_TO_POINTER (type_spec));
|
||||
|
||||
if (type2) {
|
||||
g_free (type);
|
||||
mono_loader_unlock ();
|
||||
return type2;
|
||||
}
|
||||
|
||||
g_hash_table_insert (image->typespec_cache, GUINT_TO_POINTER (type_spec), type);
|
||||
|
||||
mono_loader_unlock ();
|
||||
|
||||
return type;
|
||||
|
||||
@@ -1575,7 +1575,7 @@ mono_class_proxy_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mono
|
||||
}
|
||||
|
||||
pvt->max_interface_id = max_interface_id;
|
||||
pvt->interface_bitmap = class->interface_bitmap;
|
||||
pvt->interface_bitmap = mono_mempool_alloc0 (domain->mp, sizeof (guint8) * (max_interface_id/8 + 1 ));
|
||||
|
||||
if (! ARCH_USE_IMT) {
|
||||
/* initialize interface offsets */
|
||||
@@ -1585,6 +1585,10 @@ mono_class_proxy_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mono
|
||||
interface_offsets [class->max_interface_id - interface_id] = &(pvt->vtable [slot]);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < class->interface_offsets_count; ++i) {
|
||||
int interface_id = class->interfaces_packed [i]->interface_id;
|
||||
pvt->interface_bitmap [interface_id >> 3] |= (1 << (interface_id & 7));
|
||||
}
|
||||
|
||||
if (extra_interfaces) {
|
||||
int slot = class->vtable_size;
|
||||
@@ -1600,6 +1604,7 @@ mono_class_proxy_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mono
|
||||
if (! ARCH_USE_IMT) {
|
||||
interface_offsets [max_interface_id - interf->interface_id] = &pvt->vtable [slot];
|
||||
}
|
||||
pvt->interface_bitmap [interf->interface_id >> 3] |= (1 << (interf->interface_id & 7));
|
||||
|
||||
iter = NULL;
|
||||
j = 0;
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
2007-08-14 Zoltan Varga <[email protected]>
|
||||
|
||||
* tramp-amd64.c (mono_arch_nullify_class_init_trampoline): Fix
|
||||
detection of call <REG> instruction sequence. Fixes build on freebsd.
|
||||
|
||||
2007-08-10 Geoff Norton <[email protected]>
|
||||
|
||||
* tramp-x86.c: Remove some unneeded alignment changes on Apple. Fixes #82387.
|
||||
|
||||
2007-08-03 Zoltan Varga <[email protected]>
|
||||
|
||||
* mini-amd64.h (MONO_INIT_CONTEXT_FROM_FUNC): Avoid using
|
||||
__builtin_frame_address () since it is broken on older gcc versions.
|
||||
|
||||
Thu Aug 2 17:36:22 CEST 2007 Paolo Molaro <[email protected]>
|
||||
|
||||
* mini-ppc.c: avoid an invalid encoding of unsigned right shift by 0
|
||||
to be emitted (bug #82281).
|
||||
|
||||
Tue Jul 24 21:16:17 CEST 2007 Paolo Molaro <[email protected]>
|
||||
|
||||
|
||||
@@ -182,11 +182,17 @@ typedef struct {
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* __builtin_frame_address () is broken on some older gcc versions in the presence of
|
||||
* frame pointer elimination, see bug #82095.
|
||||
*/
|
||||
#define MONO_INIT_CONTEXT_FROM_FUNC(ctx,start_func) do { \
|
||||
int tmp; \
|
||||
guint64 stackptr = &tmp; \
|
||||
mono_arch_flush_register_windows (); \
|
||||
MONO_CONTEXT_SET_IP ((ctx), (start_func)); \
|
||||
MONO_CONTEXT_SET_BP ((ctx), __builtin_frame_address (0)); \
|
||||
MONO_CONTEXT_SET_SP ((ctx), __builtin_frame_address (0)); \
|
||||
MONO_CONTEXT_SET_BP ((ctx), stackptr); \
|
||||
MONO_CONTEXT_SET_SP ((ctx), stackptr); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2381,7 +2381,10 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
|
||||
ppc_srawi (code, ins->dreg, ins->sreg1, (ins->inst_imm & 0x1f));
|
||||
break;
|
||||
case OP_SHR_UN_IMM:
|
||||
ppc_rlwinm (code, ins->dreg, ins->sreg1, (32 - (ins->inst_imm & 0x1f)), (ins->inst_imm & 0x1f), 31);
|
||||
if (ins->inst_imm)
|
||||
ppc_rlwinm (code, ins->dreg, ins->sreg1, (32 - (ins->inst_imm & 0x1f)), (ins->inst_imm & 0x1f), 31);
|
||||
else
|
||||
ppc_mr (code, ins->dreg, ins->sreg1);
|
||||
break;
|
||||
case CEE_SHR_UN:
|
||||
ppc_srw (code, ins->dreg, ins->sreg1, ins->sreg2);
|
||||
|
||||
@@ -124,7 +124,7 @@ mono_arch_nullify_class_init_trampoline (guint8 *code, gssize *regs)
|
||||
buf [2] = 0x90;
|
||||
buf [3] = 0x66;
|
||||
buf [4] = 0x90;
|
||||
} else if ((code [0] == 0x49) && (code [1] == 0xff)) {
|
||||
} else if ((code [0] == 0x41) && (code [1] == 0xff)) {
|
||||
/* call <REG> */
|
||||
/* amd64_set_reg_template is 10 bytes long */
|
||||
guint8* buf = code - 10;
|
||||
|
||||
@@ -255,11 +255,6 @@ mono_arch_create_trampoline_code (MonoTrampolineType tramp_type)
|
||||
pushed_args += 2;
|
||||
|
||||
/* starting the call sequence */
|
||||
#ifdef __APPLE__
|
||||
/* changing esp to keep the stack aligned */
|
||||
x86_alu_reg_imm (buf, X86_SUB, X86_ESP, 8);
|
||||
pushed_args += 2;
|
||||
#endif
|
||||
|
||||
/* FIXME: Push the trampoline address */
|
||||
x86_push_imm (buf, 0);
|
||||
@@ -303,12 +298,7 @@ mono_arch_create_trampoline_code (MonoTrampolineType tramp_type)
|
||||
else
|
||||
x86_call_code (buf, mono_magic_trampoline);
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* account for the alignment above */
|
||||
x86_alu_reg_imm (buf, X86_ADD, X86_ESP, 6*4);
|
||||
#else
|
||||
x86_alu_reg_imm (buf, X86_ADD, X86_ESP, 4*4);
|
||||
#endif
|
||||
|
||||
/* restore LMF start */
|
||||
/* ebx = previous_lmf */
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
2007-09-10 Willaim Holmes <[email protected]>
|
||||
|
||||
Backport for r85589
|
||||
* marshal9.cs, libtest.c Adding test case for marshal.c r84161
|
||||
Calling native to managed should not call
|
||||
ICustomMarshaler.MarshalNativeToManaged for out params.
|
||||
|
||||
|
||||
2007-07-20 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile.am (bug-81691.exe): Create it in the builddir.
|
||||
|
||||
@@ -1597,6 +1597,21 @@ mono_test_marshal_pass_return_custom_null_in_delegate (PassReturnPtrDelegate del
|
||||
return (ptr == NULL) ? 15 : 0;
|
||||
}
|
||||
|
||||
typedef void (STDCALL *CustomOutParamDelegate) (void **pptr);
|
||||
|
||||
STDCALL int
|
||||
mono_test_marshal_custom_out_param_delegate (CustomOutParamDelegate del)
|
||||
{
|
||||
void* pptr = del;
|
||||
|
||||
del (&pptr);
|
||||
|
||||
if(pptr != NULL)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef int (STDCALL *ReturnEnumDelegate) (int e);
|
||||
|
||||
STDCALL int
|
||||
|
||||
@@ -371,4 +371,66 @@ public class Tests
|
||||
return 1;
|
||||
}
|
||||
|
||||
public class Marshal6 : ICustomMarshaler {
|
||||
public static int managed_to_native_count = 0;
|
||||
public static int native_to_managed_count = 0;
|
||||
|
||||
public static ICustomMarshaler GetInstance (string s)
|
||||
{
|
||||
return new Marshal6 ();
|
||||
}
|
||||
|
||||
public void CleanUpManagedData (object managedObj)
|
||||
{
|
||||
}
|
||||
|
||||
public void CleanUpNativeData (IntPtr pNativeData)
|
||||
{
|
||||
}
|
||||
|
||||
public int GetNativeDataSize ()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public IntPtr MarshalManagedToNative (object managedObj)
|
||||
{
|
||||
managed_to_native_count++;
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
public object MarshalNativeToManaged (IntPtr pNativeData)
|
||||
{
|
||||
native_to_managed_count++;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void custom_out_param_delegate ([MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof (Marshal6), MarshalCookie = "5")] out object o);
|
||||
|
||||
[DllImport ("libtest")]
|
||||
private static extern int mono_test_marshal_custom_out_param_delegate (custom_out_param_delegate del);
|
||||
|
||||
// ICustomMarshaler.MarshalNativeToManaged should not be called when the
|
||||
// parameter is marked as an out.
|
||||
public static int test_0_native_to_managed_custom_parameter ()
|
||||
{
|
||||
Marshal6.managed_to_native_count = 0;
|
||||
Marshal6.native_to_managed_count = 0;
|
||||
|
||||
int res = mono_test_marshal_custom_out_param_delegate (new custom_out_param_delegate (custom_out_param));
|
||||
|
||||
if (Marshal6.managed_to_native_count != 1)
|
||||
return 1;
|
||||
if (Marshal6.native_to_managed_count != 0)
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void custom_out_param (out object i)
|
||||
{
|
||||
i = new object();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -102,7 +102,6 @@ free_chunklist (CodeChunk *chunk)
|
||||
chunk = chunk->next;
|
||||
if (dead->flags == CODE_FLAG_MMAP) {
|
||||
mono_vfree (dead->data, dead->size);
|
||||
valgrind_unregister(dead->data);
|
||||
} else if (dead->flags == CODE_FLAG_MALLOC) {
|
||||
free (dead->data);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user