Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2017-10-16 15:11:08 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2017-10-17 15:12:24 +0300
commit73eed5d415f994cff80d8e7c0a2444c5c4113dfb (patch)
tree6739bd9d0239f1be4f63c230420c30dcabb79564 /mcs/class/I18N/Other
parent8593149b0be0f58a98d798b42aef10c58cdc8069 (diff)
[I18N] Fix wrong charIndex in encoder fallback
We need to modify charIndex/charCount _after_ we called the fallback encoder otherwise it'll get the wrong index. Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=45893
Diffstat (limited to 'mcs/class/I18N/Other')
-rw-r--r--mcs/class/I18N/Other/CP1251.cs6
-rw-r--r--mcs/class/I18N/Other/CP1257.cs6
-rw-r--r--mcs/class/I18N/Other/CP1258.cs6
-rw-r--r--mcs/class/I18N/Other/CP20866.cs6
-rw-r--r--mcs/class/I18N/Other/CP21866.cs6
-rw-r--r--mcs/class/I18N/Other/CP28594.cs6
-rw-r--r--mcs/class/I18N/Other/CP28595.cs6
-rw-r--r--mcs/class/I18N/Other/CP874.cs6
8 files changed, 32 insertions, 16 deletions
diff --git a/mcs/class/I18N/Other/CP1251.cs b/mcs/class/I18N/Other/CP1251.cs
index 34283c29344..6b7be218bbd 100644
--- a/mcs/class/I18N/Other/CP1251.cs
+++ b/mcs/class/I18N/Other/CP1251.cs
@@ -144,8 +144,6 @@ public class CP1251 : ByteEncoding
while (charCount > 0)
{
ch = (int)(chars[charIndex]);
- charIndex++;
- charCount--;
if(ch >= 128) switch(ch)
{
case 0x0098:
@@ -288,6 +286,8 @@ public class CP1251 : ByteEncoding
else
{
HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
+ charIndex++;
+ charCount--;
continue;
}
}
@@ -298,6 +298,8 @@ public class CP1251 : ByteEncoding
bytes[byteIndex] = (byte)ch;
byteIndex++;
byteCount--;
+ charIndex++;
+ charCount--;
}
return byteIndex;
}
diff --git a/mcs/class/I18N/Other/CP1257.cs b/mcs/class/I18N/Other/CP1257.cs
index 2c12ebc618e..e97f82d75d3 100644
--- a/mcs/class/I18N/Other/CP1257.cs
+++ b/mcs/class/I18N/Other/CP1257.cs
@@ -144,8 +144,6 @@ public class CP1257 : ByteEncoding
while (charCount > 0)
{
ch = (int)(chars[charIndex]);
- charIndex++;
- charCount--;
if(ch >= 128) switch(ch)
{
case 0x0081:
@@ -284,6 +282,8 @@ public class CP1257 : ByteEncoding
else
{
HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
+ charIndex++;
+ charCount--;
continue;
}
}
@@ -294,6 +294,8 @@ public class CP1257 : ByteEncoding
bytes[byteIndex] = (byte)ch;
byteIndex++;
byteCount--;
+ charIndex++;
+ charCount--;
}
return byteIndex;
}
diff --git a/mcs/class/I18N/Other/CP1258.cs b/mcs/class/I18N/Other/CP1258.cs
index e56c4673314..2f02f0763ed 100644
--- a/mcs/class/I18N/Other/CP1258.cs
+++ b/mcs/class/I18N/Other/CP1258.cs
@@ -144,8 +144,6 @@ public class CP1258 : ByteEncoding
while (charCount > 0)
{
ch = (int)(chars[charIndex]);
- charIndex++;
- charCount--;
if(ch >= 128) switch(ch)
{
case 0x0081:
@@ -286,6 +284,8 @@ public class CP1258 : ByteEncoding
else
{
HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
+ charIndex++;
+ charCount--;
continue;
}
}
@@ -296,6 +296,8 @@ public class CP1258 : ByteEncoding
bytes[byteIndex] = (byte)ch;
byteIndex++;
byteCount--;
+ charIndex++;
+ charCount--;
}
return byteIndex;
}
diff --git a/mcs/class/I18N/Other/CP20866.cs b/mcs/class/I18N/Other/CP20866.cs
index c34f861c618..55ff10b9105 100644
--- a/mcs/class/I18N/Other/CP20866.cs
+++ b/mcs/class/I18N/Other/CP20866.cs
@@ -144,8 +144,6 @@ public class CP20866 : ByteEncoding
while (charCount > 0)
{
ch = (int)(chars[charIndex]);
- charIndex++;
- charCount--;
if(ch >= 128) switch(ch)
{
case 0x00A0: ch = 0x9A; break;
@@ -301,6 +299,8 @@ public class CP20866 : ByteEncoding
else
{
HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
+ charIndex++;
+ charCount--;
continue;
}
}
@@ -311,6 +311,8 @@ public class CP20866 : ByteEncoding
bytes[byteIndex] = (byte)ch;
byteIndex++;
byteCount--;
+ charIndex++;
+ charCount--;
}
return byteIndex;
}
diff --git a/mcs/class/I18N/Other/CP21866.cs b/mcs/class/I18N/Other/CP21866.cs
index 6346494f201..1074083c46f 100644
--- a/mcs/class/I18N/Other/CP21866.cs
+++ b/mcs/class/I18N/Other/CP21866.cs
@@ -144,8 +144,6 @@ public class CP21866 : ByteEncoding
while (charCount > 0)
{
ch = (int)(chars[charIndex]);
- charIndex++;
- charCount--;
if(ch >= 128) switch(ch)
{
case 0x00A0: ch = 0x9A; break;
@@ -301,6 +299,8 @@ public class CP21866 : ByteEncoding
else
{
HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
+ charIndex++;
+ charCount--;
continue;
}
}
@@ -311,6 +311,8 @@ public class CP21866 : ByteEncoding
bytes[byteIndex] = (byte)ch;
byteIndex++;
byteCount--;
+ charIndex++;
+ charCount--;
}
return byteIndex;
}
diff --git a/mcs/class/I18N/Other/CP28594.cs b/mcs/class/I18N/Other/CP28594.cs
index efda54f32bd..e96d8975016 100644
--- a/mcs/class/I18N/Other/CP28594.cs
+++ b/mcs/class/I18N/Other/CP28594.cs
@@ -144,8 +144,6 @@ public class CP28594 : ByteEncoding
while (charCount > 0)
{
ch = (int)(chars[charIndex]);
- charIndex++;
- charCount--;
if(ch >= 161) switch(ch)
{
case 0x00A4:
@@ -253,6 +251,8 @@ public class CP28594 : ByteEncoding
else
{
HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
+ charIndex++;
+ charCount--;
continue;
}
}
@@ -263,6 +263,8 @@ public class CP28594 : ByteEncoding
bytes[byteIndex] = (byte)ch;
byteIndex++;
byteCount--;
+ charIndex++;
+ charCount--;
}
return byteIndex;
}
diff --git a/mcs/class/I18N/Other/CP28595.cs b/mcs/class/I18N/Other/CP28595.cs
index 296b0b2cc05..ee6af994705 100644
--- a/mcs/class/I18N/Other/CP28595.cs
+++ b/mcs/class/I18N/Other/CP28595.cs
@@ -144,8 +144,6 @@ public class CP28595 : ByteEncoding
while (charCount > 0)
{
ch = (int)(chars[charIndex]);
- charIndex++;
- charCount--;
if(ch >= 161) switch(ch)
{
case 0x00AD:
@@ -259,6 +257,8 @@ public class CP28595 : ByteEncoding
else
{
HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
+ charIndex++;
+ charCount--;
continue;
}
}
@@ -269,6 +269,8 @@ public class CP28595 : ByteEncoding
bytes[byteIndex] = (byte)ch;
byteIndex++;
byteCount--;
+ charIndex++;
+ charCount--;
}
return byteIndex;
}
diff --git a/mcs/class/I18N/Other/CP874.cs b/mcs/class/I18N/Other/CP874.cs
index 59c12a277f6..99acce956f7 100644
--- a/mcs/class/I18N/Other/CP874.cs
+++ b/mcs/class/I18N/Other/CP874.cs
@@ -144,8 +144,6 @@ public class CP874 : ByteEncoding
while (charCount > 0)
{
ch = (int)(chars[charIndex]);
- charIndex++;
- charCount--;
if(ch >= 26) switch(ch)
{
case 0x001B:
@@ -355,6 +353,8 @@ public class CP874 : ByteEncoding
else
{
HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount);
+ charIndex++;
+ charCount--;
continue;
}
}
@@ -365,6 +365,8 @@ public class CP874 : ByteEncoding
bytes[byteIndex] = (byte)ch;
byteIndex++;
byteCount--;
+ charIndex++;
+ charCount--;
}
return byteIndex;
}