Author: krasnov
Date: 2007-05-17 08:19:28 -0400 (Thu, 17 May 2007)
New Revision: 77545
Modified:
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI/ChangeLog
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI/TemplateControl.jvm.cs
Log:
merge -r77543:77544
Modified: branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI/ChangeLog
2007-05-17 12:15:54 UTC (rev 77544)
+++ branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI/ChangeLog
2007-05-17 12:19:28 UTC (rev 77545)
@@ -1,3 +1,7 @@
+2007-05-17 Vladimir Krasnov <[EMAIL PROTECTED]>
+
+ * TemplateControl.jvm.cs: refactored key for CachedString method
+
2007-05-16 Vladimir Krasnov <[EMAIL PROTECTED]>
* HtmlTextWriter.cs: refactoring, created hashtables for tags, styles
Modified:
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI/TemplateControl.jvm.cs
===================================================================
---
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI/TemplateControl.jvm.cs
2007-05-17 12:15:54 UTC (rev 77544)
+++
branches/mainsoft/gh20/mcs/class/System.Web/System.Web.UI/TemplateControl.jvm.cs
2007-05-17 12:19:28 UTC (rev 77545)
@@ -101,9 +101,9 @@
}
}
- private string CachedString (string filename, int offset, int
size)
+ private string CachedString (Type type, int offset, int size)
{
- string key = filename + offset + size;
+ CacheKey key = new CacheKey (type, offset, size);
string strObj = (string) ResourceHash [key];
if (strObj == null) {
@@ -156,7 +156,7 @@
int size,
bool fAsciiOnly)
{
- string str = CachedString (this.GetType ().FullName,
offset, size);
+ string str = CachedString (this.GetType (), offset,
size);
return new LiteralControl (str);
}
@@ -421,7 +421,7 @@
protected void WriteUTF8ResourceString (HtmlTextWriter output,
int offset,
int size, bool
fAsciiOnly)
{
- string str = CachedString (this.GetType ().FullName,
offset, size);
+ string str = CachedString (this.GetType (), offset,
size);
output.Write (str);
}
@@ -469,6 +469,34 @@
}
}
+ sealed private class CacheKey
+ {
+ readonly Type _type;
+ readonly int _offset;
+ readonly int _size;
+
+ public CacheKey (Type type, int offset, int size)
+ {
+ _type = type;
+ _offset = offset;
+ _size = size;
+ }
+
+ public override int GetHashCode ()
+ {
+ return _type.GetHashCode () ^ _offset ^ _size;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj == null || !(obj is CacheKey))
+ return false;
+
+ CacheKey key = (CacheKey) obj;
+ return key._type == _type && key._offset ==
_offset && key._size == _size;
+ }
+ }
+
#if NET_2_0
string _appRelativeVirtualPath = null;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches