Author: atsushi
Date: 2006-01-17 07:09:08 -0500 (Tue, 17 Jan 2006)
New Revision: 55677
Modified:
trunk/mcs/class/I18N/CJK/CP51932.cs
trunk/mcs/class/I18N/CJK/CP932.cs
trunk/mcs/class/I18N/CJK/CP936.cs
trunk/mcs/class/I18N/CJK/CP949.cs
trunk/mcs/class/I18N/CJK/CP950.cs
trunk/mcs/class/I18N/CJK/ChangeLog
trunk/mcs/class/I18N/CJK/DbcsEncoding.cs
Log:
2006-01-17 Atsushi Enomoto <[EMAIL PROTECTED]>
* DbcsEncoding.cs CP950.cs CP932.cs CP936.cs CP51932.cs CP949.cs :
Made all as really serializable. Removed references to DbcsConvert
and added GetConvert() methods instead.
Modified: trunk/mcs/class/I18N/CJK/CP51932.cs
===================================================================
--- trunk/mcs/class/I18N/CJK/CP51932.cs 2006-01-17 12:05:49 UTC (rev 55676)
+++ trunk/mcs/class/I18N/CJK/CP51932.cs 2006-01-17 12:09:08 UTC (rev 55677)
@@ -64,14 +64,9 @@
// Magic number used by Windows for the EUC-JP code page.
private const int EUC_JP_CODE_PAGE = 51932;
- // Internal state.
- private JISConvert convert;
-
// Constructor.
public CP51932 () : base (EUC_JP_CODE_PAGE)
{
- // Load the JIS conversion tables.
- convert = JISConvert.Convert;
}
// Get the number of bytes needed to encode a character buffer.
@@ -92,8 +87,8 @@
// Determine the length of the final output.
int length = 0;
int ch, value;
- byte [] cjkToJis = convert.cjkToJis;
- byte [] extraToJis = convert.extraToJis;
+ byte [] cjkToJis = JISConvert.Convert.cjkToJis;
+ byte [] extraToJis = JISConvert.Convert.extraToJis;
while (count > 0) {
ch = chars [index++];
@@ -152,9 +147,9 @@
int byteLength = byteCount;
int ch, value;
- byte[] cjkToJis = convert.cjkToJis;
- byte[] greekToJis = convert.greekToJis;
- byte[] extraToJis = convert.extraToJis;
+ byte[] cjkToJis = JISConvert.Convert.cjkToJis;
+ byte[] greekToJis = JISConvert.Convert.greekToJis;
+ byte[] extraToJis = JISConvert.Convert.extraToJis;
for (; charCount > 0; charIndex++, --charCount) {
ch = chars [charIndex];
@@ -240,8 +235,8 @@
// Determine the total length of the converted string.
int value = 0;
- byte[] table0208 = convert.jisx0208ToUnicode;
- byte[] table0212 = convert.jisx0212ToUnicode;
+ byte[] table0208 = JISConvert.Convert.jisx0208ToUnicode;
+ byte[] table0212 = JISConvert.Convert.jisx0212ToUnicode;
int length = 0;
int byteval = 0;
int last = 0;
@@ -363,8 +358,8 @@
int charLength = chars.Length;
int byteval, value;
int last = 0;
- byte[] table0208 = convert.jisx0208ToUnicode;
- byte[] table0212 = convert.jisx0212ToUnicode;
+ byte[] table0208 = JISConvert.Convert.jisx0208ToUnicode;
+ byte[] table0212 = JISConvert.Convert.jisx0212ToUnicode;
while (byteCount > 0) {
byteval = bytes [byteIndex++];
Modified: trunk/mcs/class/I18N/CJK/CP932.cs
===================================================================
--- trunk/mcs/class/I18N/CJK/CP932.cs 2006-01-17 12:05:49 UTC (rev 55676)
+++ trunk/mcs/class/I18N/CJK/CP932.cs 2006-01-17 12:09:08 UTC (rev 55677)
@@ -35,15 +35,10 @@
// Magic number used by Windows for the Shift-JIS code page.
private const int SHIFTJIS_CODE_PAGE = 932;
- // Internal state.
- private JISConvert convert;
-
// Constructor.
public CP932() : base(SHIFTJIS_CODE_PAGE)
- {
- // Load the JIS conversion tables.
- convert = JISConvert.Convert;
- }
+ {
+ }
// Get the number of bytes needed to encode a character buffer.
public override int GetByteCount(char[] chars, int index, int count)
@@ -68,11 +63,11 @@
int length = 0;
int ch, value;
#if __PNET__
- byte *cjkToJis = convert.cjkToJis;
- byte *extraToJis = convert.extraToJis;
+ byte *cjkToJis = JISConvert.Convert.cjkToJis;
+ byte *extraToJis =
JISConvert.Convert.extraToJis;
#else
- byte[] cjkToJis = convert.cjkToJis;
- byte[] extraToJis = convert.extraToJis;
+ byte[] cjkToJis = JISConvert.Convert.cjkToJis;
+ byte[] extraToJis =
JISConvert.Convert.extraToJis;
#endif
while(count > 0)
{
@@ -148,13 +143,13 @@
int byteLength = byteCount;
int ch, value;
#if __PNET__
- byte *cjkToJis = convert.cjkToJis;
- byte *greekToJis = convert.greekToJis;
- byte *extraToJis = convert.extraToJis;
+ byte *cjkToJis = JISConvert.Convert.cjkToJis;
+ byte *greekToJis =
JISConvert.Convert.greekToJis;
+ byte *extraToJis =
JISConvert.Convert.extraToJis;
#else
- byte[] cjkToJis = convert.cjkToJis;
- byte[] greekToJis = convert.greekToJis;
- byte[] extraToJis = convert.extraToJis;
+ byte[] cjkToJis = JISConvert.Convert.cjkToJis;
+ byte[] greekToJis =
JISConvert.Convert.greekToJis;
+ byte[] extraToJis =
JISConvert.Convert.extraToJis;
#endif
while(charCount > 0)
{
@@ -454,9 +449,9 @@
int length = 0;
int byteval, value;
#if __PNET__
- byte *table = convert.jisx0208ToUnicode;
+ byte *table =
JISConvert.Convert.jisx0208ToUnicode;
#else
- byte[] table = convert.jisx0208ToUnicode;
+ byte[] table =
JISConvert.Convert.jisx0208ToUnicode;
#endif
while(byteCount > 0)
{
@@ -563,7 +558,7 @@
// Get a decoder that handles a rolling Shift-JIS state.
public override Decoder GetDecoder()
{
- return new CP932Decoder(convert);
+ return new CP932Decoder(JISConvert.Convert);
}
#if !ECMA_COMPAT
Modified: trunk/mcs/class/I18N/CJK/CP936.cs
===================================================================
--- trunk/mcs/class/I18N/CJK/CP936.cs 2006-01-17 12:05:49 UTC (rev 55676)
+++ trunk/mcs/class/I18N/CJK/CP936.cs 2006-01-17 12:09:08 UTC (rev 55677)
@@ -16,19 +16,23 @@
[Serializable]
internal class CP936 : DbcsEncoding
{
- static DbcsConvert gb2312 = DbcsConvert.Gb2312;
-
// Magic number used by Windows for the Gb2312 code page.
private const int GB2312_CODE_PAGE = 936;
// Constructor.
public CP936() : base(GB2312_CODE_PAGE) {
}
-
+
+ internal override DbcsConvert GetConvert ()
+ {
+ return DbcsConvert.Gb2312;
+ }
+
// Get the bytes that result from encoding a character buffer.
public unsafe override int GetBytesImpl (char* chars, int
charCount,
byte* bytes, int byteCount)
{
+ DbcsConvert gb2312 = GetConvert ();
int charIndex = 0;
int byteIndex = 0;
#if NET_2_0
@@ -99,6 +103,7 @@
public override int GetChars(byte[] bytes, int byteIndex, int
byteCount,
char[] chars, int charIndex)
{
+ DbcsConvert gb2312 = GetConvert ();
// A1 40 - FA FF
base.GetChars(bytes, byteIndex, byteCount, chars,
charIndex);
int origIndex = charIndex;
@@ -129,7 +134,7 @@
// Get a decoder that handles a rolling Gb2312 state.
public override Decoder GetDecoder()
{
- return new CP936Decoder(gb2312);
+ return new CP936Decoder(GetConvert ());
}
// Get the mail body name for this encoding.
Modified: trunk/mcs/class/I18N/CJK/CP949.cs
===================================================================
--- trunk/mcs/class/I18N/CJK/CP949.cs 2006-01-17 12:05:49 UTC (rev 55676)
+++ trunk/mcs/class/I18N/CJK/CP949.cs 2006-01-17 12:09:08 UTC (rev 55677)
@@ -105,10 +105,14 @@
{
// Constructor.
public KoreanEncoding (int codepage, bool useUHC) : base (codepage) {
- convert = KSConvert.Convert;
this.useUHC = useUHC;
}
+ internal override DbcsConvert GetConvert ()
+ {
+ return KSConvert.Convert;
+ }
+
bool useUHC;
// Get the bytes that result from encoding a character buffer.
@@ -117,6 +121,7 @@
{
int charIndex = 0;
int byteIndex = 0;
+ DbcsConvert convert = GetConvert ();
#if NET_2_0
EncoderFallbackBuffer buffer = null;
#endif
@@ -150,6 +155,7 @@
public override int GetChars(byte[] bytes, int byteIndex, int
byteCount,
char[] chars, int charIndex)
{
+ DbcsConvert convert = GetConvert ();
base.GetChars(bytes, byteIndex, byteCount, chars, charIndex);
int origIndex = charIndex;
int lastByte = 0;
@@ -221,7 +227,7 @@
// Get a decoder that handles a rolling UHC state.
public override Decoder GetDecoder()
{
- return new KoreanDecoder (convert, useUHC);
+ return new KoreanDecoder (GetConvert (), useUHC);
}
// Decoder that handles a rolling UHC state.
Modified: trunk/mcs/class/I18N/CJK/CP950.cs
===================================================================
--- trunk/mcs/class/I18N/CJK/CP950.cs 2006-01-17 12:05:49 UTC (rev 55676)
+++ trunk/mcs/class/I18N/CJK/CP950.cs 2006-01-17 12:09:08 UTC (rev 55677)
@@ -19,13 +19,18 @@
// Constructor.
public CP950() : base(BIG5_CODE_PAGE) {
- convert = Big5Convert.Convert;
}
-
+
+ internal override DbcsConvert GetConvert ()
+ {
+ return Big5Convert.Convert;
+ }
+
// Get the bytes that result from encoding a character buffer.
public unsafe override int GetBytesImpl (char* chars, int
charCount,
byte* bytes, int byteCount)
{
+ DbcsConvert convert = GetConvert ();
int charIndex = 0;
int byteIndex = 0;
#if NET_2_0
@@ -61,6 +66,7 @@
public override int GetChars(byte[] bytes, int byteIndex, int
byteCount,
char[] chars, int charIndex)
{
+ DbcsConvert convert = GetConvert ();
// A1 40 - FA FF
base.GetChars(bytes, byteIndex, byteCount, chars,
charIndex);
int origIndex = charIndex;
@@ -92,7 +98,7 @@
// Get a decoder that handles a rolling Big5 state.
public override Decoder GetDecoder()
{
- return new CP950Decoder(convert);
+ return new CP950Decoder(GetConvert ());
}
// Get the mail body name for this encoding.
Modified: trunk/mcs/class/I18N/CJK/ChangeLog
===================================================================
--- trunk/mcs/class/I18N/CJK/ChangeLog 2006-01-17 12:05:49 UTC (rev 55676)
+++ trunk/mcs/class/I18N/CJK/ChangeLog 2006-01-17 12:09:08 UTC (rev 55677)
@@ -1,5 +1,11 @@
2006-01-17 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * DbcsEncoding.cs CP950.cs CP932.cs CP936.cs CP51932.cs CP949.cs :
+ Made all as really serializable. Removed references to DbcsConvert
+ and added GetConvert() methods instead.
+
+2006-01-17 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* DbcsEncoding.cs ISO2022JP.cs GB18030Encoding.cs CP950.cs
CP932.cs CP936.cs CP51932.cs CP949.cs (All) :
Marked as [Serializable].
Modified: trunk/mcs/class/I18N/CJK/DbcsEncoding.cs
===================================================================
--- trunk/mcs/class/I18N/CJK/DbcsEncoding.cs 2006-01-17 12:05:49 UTC (rev
55676)
+++ trunk/mcs/class/I18N/CJK/DbcsEncoding.cs 2006-01-17 12:09:08 UTC (rev
55677)
@@ -14,10 +14,10 @@
[Serializable]
internal abstract class DbcsEncoding : MonoEncoding
{
- internal DbcsConvert convert;
-
public DbcsEncoding(int codePage) : base(codePage) {}
-
+
+ internal abstract DbcsConvert GetConvert ();
+
// Get the number of bytes needed to encode a character buffer.
public override int GetByteCount(char[] chars, int index, int
count)
{
@@ -102,7 +102,7 @@
// Get a decoder that handles a rolling state.
public override Decoder GetDecoder()
{
- return new DbcsDecoder(convert);
+ return new DbcsDecoder(GetConvert ());
}
// Determine if this encoding can be displayed in a Web browser.
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches