mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-22 01:37:34 +01:00
fix regression of lang qualifiers
- values-xx was improperly decoded as values-b+xx - added unit test
This commit is contained in:
parent
1bb8ec02b2
commit
bb6cd98dfa
@ -74,8 +74,8 @@ public class ResConfigFlags {
|
|||||||
smallestScreenWidthDp = 0;
|
smallestScreenWidthDp = 0;
|
||||||
screenWidthDp = 0;
|
screenWidthDp = 0;
|
||||||
screenHeightDp = 0;
|
screenHeightDp = 0;
|
||||||
localeScript = new char[] { '\00', '\00', '\00', '\00' };
|
localeScript = null;
|
||||||
localeVariant = new char[] { '\00', '\00', '\00', '\00', '\00', '\00', '\00', '\00' };
|
localeVariant = null;
|
||||||
isInvalid = false;
|
isInvalid = false;
|
||||||
mQualifiers = "";
|
mQualifiers = "";
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ public class ResConfigFlags {
|
|||||||
isInvalid = true;
|
isInvalid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localeScript.length != 0) {
|
if (localeScript != null && localeScript.length != 0) {
|
||||||
if (localeScript[0] == '\00') {
|
if (localeScript[0] == '\00') {
|
||||||
localeScript = null;
|
localeScript = null;
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ public class ResConfigFlags {
|
|||||||
localeScript = null;
|
localeScript = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localeVariant.length != 0) {
|
if (localeVariant != null && localeVariant.length != 0) {
|
||||||
if (localeVariant[0] == '\00') {
|
if (localeVariant[0] == '\00') {
|
||||||
localeVariant = null;
|
localeVariant = null;
|
||||||
}
|
}
|
||||||
|
@ -292,11 +292,11 @@ public class ARSCDecoder {
|
|||||||
screenHeightDp = mIn.readShort();
|
screenHeightDp = mIn.readShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
char[] localeScript = {'\00'};
|
char[] localeScript = null;
|
||||||
char[] localeVariant = {'\00'};
|
char[] localeVariant = null;
|
||||||
if (size >= 48) {
|
if (size >= 48) {
|
||||||
localeScript = this.readScriptOrVariantChar(4).toCharArray();
|
localeScript = readScriptOrVariantChar(4).toCharArray();
|
||||||
localeVariant = this.readScriptOrVariantChar(8).toCharArray();
|
localeVariant = readScriptOrVariantChar(8).toCharArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
int exceedingSize = size - KNOWN_CONFIG_BYTES;
|
int exceedingSize = size - KNOWN_CONFIG_BYTES;
|
||||||
|
@ -207,6 +207,11 @@ public class BuildAndDecodeTest {
|
|||||||
compareValuesFiles("values-ast/strings.xml");
|
compareValuesFiles("values-ast/strings.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void twoLetterNotHandledAsBcpTest() throws BrutException, IOException {
|
||||||
|
checkFolderExists("res/values-fr");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void twoLetterLangBcp47Test() throws BrutException, IOException {
|
public void twoLetterLangBcp47Test() throws BrutException, IOException {
|
||||||
compareValuesFiles("values-en-rUS/strings.xml");
|
compareValuesFiles("values-en-rUS/strings.xml");
|
||||||
@ -361,6 +366,12 @@ public class BuildAndDecodeTest {
|
|||||||
compareXmlFiles(path, null);
|
compareXmlFiles(path, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkFolderExists(String path) throws BrutException {
|
||||||
|
File f = new File(sTestNewDir, path);
|
||||||
|
|
||||||
|
assertTrue(f.isDirectory());
|
||||||
|
}
|
||||||
|
|
||||||
private void compareXmlFiles(String path, ElementQualifier qualifier)
|
private void compareXmlFiles(String path, ElementQualifier qualifier)
|
||||||
throws BrutException {
|
throws BrutException {
|
||||||
DetailedDiff diff;
|
DetailedDiff diff;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user