[Scummvm-git-logs] scummvm master -> cdf19e63769842fa3669f4b60ca21865bd154b43

athrxx noreply at scummvm.org
Mon Jun 13 18:06:29 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
cdf19e6376 COMMON: fix CP950 encoding regression


Commit: cdf19e63769842fa3669f4b60ca21865bd154b43
    https://github.com/scummvm/scummvm/commit/cdf19e63769842fa3669f4b60ca21865bd154b43
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-13T20:06:12+02:00

Commit Message:
COMMON: fix CP950 encoding regression

(I somehow managed to mess up the CP950 encoder  with some wrong copy/pasting in b5079ca )

Changed paths:
    common/str-enc.cpp


diff --git a/common/str-enc.cpp b/common/str-enc.cpp
index 2d98005884d..5ff9bb8f8a9 100644
--- a/common/str-enc.cpp
+++ b/common/str-enc.cpp
@@ -551,18 +551,16 @@ void String::encodeWindows950(const U32String &src, bool transliterate) {
 	if (!windows950ReverseConversionTable && windows950ConversionTable) {
 		uint16 *rt = new uint16[0x10000]();
 
-		for (uint lowidx = 0; lowidx < 0xb2; lowidx++) {
+		for (uint lowidx = 0; lowidx < 157; lowidx++) {
 			uint8 low = 0;
-			if (lowidx < 0x1a)
-				low = 0x41 + lowidx;
-			else if (lowidx < 0x1a * 2)
-				low = 0x61 + lowidx - 0x1a;
+			if (lowidx < 0x3f)
+				low = 0x40 + lowidx;
 			else
-				low = 0x81 + lowidx - 0x1a * 2;
+				low = 0xa1 + lowidx - 0x3f;
 
-			for (uint highidx = 0; highidx < 0x7e; highidx++) {
-				uint8 high = highidx + 0x81;
-				uint16 unicode = windows949ConversionTable[highidx * 0xb2 + lowidx];
+			for (uint highidx = 0; highidx < 89; highidx++) {
+				uint8 high = highidx + 0xa1;
+				uint16 unicode = windows950ConversionTable[highidx * 157 + lowidx];
 
 				rt[unicode] = (high << 8) | low;
 			}




More information about the Scummvm-git-logs mailing list