293 lines
10 KiB
Java
293 lines
10 KiB
Java
package c.i.e.s.b;
|
|
|
|
import c.i.e.n.c;
|
|
import c.i.e.n.j;
|
|
import com.google.zxing.FormatException;
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.util.Collection;
|
|
import java.util.Map;
|
|
/* compiled from: DecodedBitStreamParser */
|
|
public final class d {
|
|
public static final char[] a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".toCharArray();
|
|
|
|
public static void a(c cVar, StringBuilder sb, int i, boolean z2) throws FormatException {
|
|
while (i > 1) {
|
|
if (cVar.a() >= 11) {
|
|
int b = cVar.b(11);
|
|
sb.append(f(b / 45));
|
|
sb.append(f(b % 45));
|
|
i -= 2;
|
|
} else {
|
|
throw FormatException.a();
|
|
}
|
|
}
|
|
if (i == 1) {
|
|
if (cVar.a() >= 6) {
|
|
sb.append(f(cVar.b(6)));
|
|
} else {
|
|
throw FormatException.a();
|
|
}
|
|
}
|
|
if (z2) {
|
|
for (int length = sb.length(); length < sb.length(); length++) {
|
|
if (sb.charAt(length) == '%') {
|
|
if (length < sb.length() - 1) {
|
|
int i2 = length + 1;
|
|
if (sb.charAt(i2) == '%') {
|
|
sb.deleteCharAt(i2);
|
|
}
|
|
}
|
|
sb.setCharAt(length, 29);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:117:0x0143, code lost:
|
|
if (r1 == 2) goto L_0x0151;
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:119:0x0147, code lost:
|
|
if ((r17 * 10) >= r23) goto L_0x0151;
|
|
*/
|
|
public static void b(c cVar, StringBuilder sb, int i, c.i.e.n.d dVar, Collection<byte[]> collection, Map<c.i.e.d, ?> map) throws FormatException {
|
|
byte[] bArr;
|
|
String str;
|
|
byte[] bArr2;
|
|
if ((i << 3) <= cVar.a()) {
|
|
byte[] bArr3 = new byte[i];
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < i; i3++) {
|
|
bArr3[i3] = (byte) cVar.b(8);
|
|
}
|
|
if (dVar == null) {
|
|
String str2 = j.a;
|
|
if (map != null) {
|
|
c.i.e.d dVar2 = c.i.e.d.CHARACTER_SET;
|
|
if (map.containsKey(dVar2)) {
|
|
str = map.get(dVar2).toString();
|
|
bArr = bArr3;
|
|
}
|
|
}
|
|
boolean z2 = true;
|
|
boolean z3 = i > 3 && bArr3[0] == -17 && bArr3[1] == -69 && bArr3[2] == -65;
|
|
int i4 = 0;
|
|
boolean z4 = true;
|
|
boolean z5 = true;
|
|
int i5 = 0;
|
|
int i6 = 0;
|
|
int i7 = 0;
|
|
int i8 = 0;
|
|
int i9 = 0;
|
|
int i10 = 0;
|
|
int i11 = 0;
|
|
int i12 = 0;
|
|
int i13 = 0;
|
|
int i14 = 0;
|
|
while (i5 < i && (z2 || z4 || z5)) {
|
|
int i15 = bArr3[i5] & 255;
|
|
if (z5) {
|
|
if (i6 > 0) {
|
|
bArr2 = bArr3;
|
|
if ((i15 & 128) != 0) {
|
|
i6--;
|
|
}
|
|
} else {
|
|
bArr2 = bArr3;
|
|
if ((i15 & 128) != 0) {
|
|
if ((i15 & 64) != 0) {
|
|
i6++;
|
|
if ((i15 & 32) == 0) {
|
|
i8++;
|
|
} else {
|
|
i6++;
|
|
if ((i15 & 16) == 0) {
|
|
i9++;
|
|
} else {
|
|
i6++;
|
|
if ((i15 & 8) == 0) {
|
|
i10++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
z5 = false;
|
|
} else {
|
|
bArr2 = bArr3;
|
|
}
|
|
if (z2) {
|
|
if (i15 > 127 && i15 < 160) {
|
|
z2 = false;
|
|
} else if (i15 > 159 && (i15 < 192 || i15 == 215 || i15 == 247)) {
|
|
i12++;
|
|
}
|
|
}
|
|
if (z4) {
|
|
if (i7 > 0) {
|
|
if (i15 >= 64 && i15 != 127 && i15 <= 252) {
|
|
i7--;
|
|
}
|
|
} else if (!(i15 == 128 || i15 == 160 || i15 > 239)) {
|
|
if (i15 <= 160 || i15 >= 224) {
|
|
if (i15 > 127) {
|
|
i7++;
|
|
int i16 = i13 + 1;
|
|
if (i16 > i2) {
|
|
i2 = i16;
|
|
i13 = i2;
|
|
} else {
|
|
i13 = i16;
|
|
}
|
|
} else {
|
|
i13 = 0;
|
|
}
|
|
i14 = 0;
|
|
} else {
|
|
i4++;
|
|
int i17 = i14 + 1;
|
|
if (i17 > i11) {
|
|
i11 = i17;
|
|
}
|
|
i14 = i17;
|
|
i13 = 0;
|
|
}
|
|
}
|
|
z4 = false;
|
|
}
|
|
i5++;
|
|
bArr3 = bArr2;
|
|
}
|
|
bArr = bArr3;
|
|
if (z5 && i6 > 0) {
|
|
z5 = false;
|
|
}
|
|
boolean z6 = (!z4 || i7 <= 0) ? z4 : false;
|
|
if (!z5 || (!z3 && i8 + i9 + i10 <= 0)) {
|
|
if (!z6 || (!j.b && i11 < 3 && i2 < 3)) {
|
|
if (!z2 || !z6) {
|
|
if (!z2) {
|
|
if (!z6) {
|
|
if (!z5) {
|
|
str = j.a;
|
|
}
|
|
}
|
|
}
|
|
} else if (i11 == 2) {
|
|
}
|
|
str = "ISO8859_1";
|
|
}
|
|
str = "SJIS";
|
|
}
|
|
str = "UTF8";
|
|
} else {
|
|
bArr = bArr3;
|
|
str = dVar.name();
|
|
}
|
|
try {
|
|
sb.append(new String(bArr, str));
|
|
collection.add(bArr);
|
|
} catch (UnsupportedEncodingException unused) {
|
|
throw FormatException.a();
|
|
}
|
|
} else {
|
|
throw FormatException.a();
|
|
}
|
|
}
|
|
|
|
public static void c(c cVar, StringBuilder sb, int i) throws FormatException {
|
|
if (i * 13 <= cVar.a()) {
|
|
byte[] bArr = new byte[(i * 2)];
|
|
int i2 = 0;
|
|
while (i > 0) {
|
|
int b = cVar.b(13);
|
|
int i3 = (b % 96) | ((b / 96) << 8);
|
|
int i4 = i3 + (i3 < 959 ? 41377 : 42657);
|
|
bArr[i2] = (byte) (i4 >> 8);
|
|
bArr[i2 + 1] = (byte) i4;
|
|
i2 += 2;
|
|
i--;
|
|
}
|
|
try {
|
|
sb.append(new String(bArr, "GB2312"));
|
|
} catch (UnsupportedEncodingException unused) {
|
|
throw FormatException.a();
|
|
}
|
|
} else {
|
|
throw FormatException.a();
|
|
}
|
|
}
|
|
|
|
public static void d(c cVar, StringBuilder sb, int i) throws FormatException {
|
|
if (i * 13 <= cVar.a()) {
|
|
byte[] bArr = new byte[(i * 2)];
|
|
int i2 = 0;
|
|
while (i > 0) {
|
|
int b = cVar.b(13);
|
|
int i3 = (b % 192) | ((b / 192) << 8);
|
|
int i4 = i3 + (i3 < 7936 ? 33088 : 49472);
|
|
bArr[i2] = (byte) (i4 >> 8);
|
|
bArr[i2 + 1] = (byte) i4;
|
|
i2 += 2;
|
|
i--;
|
|
}
|
|
try {
|
|
sb.append(new String(bArr, "SJIS"));
|
|
} catch (UnsupportedEncodingException unused) {
|
|
throw FormatException.a();
|
|
}
|
|
} else {
|
|
throw FormatException.a();
|
|
}
|
|
}
|
|
|
|
public static void e(c cVar, StringBuilder sb, int i) throws FormatException {
|
|
while (i >= 3) {
|
|
if (cVar.a() >= 10) {
|
|
int b = cVar.b(10);
|
|
if (b < 1000) {
|
|
sb.append(f(b / 100));
|
|
sb.append(f((b / 10) % 10));
|
|
sb.append(f(b % 10));
|
|
i -= 3;
|
|
} else {
|
|
throw FormatException.a();
|
|
}
|
|
} else {
|
|
throw FormatException.a();
|
|
}
|
|
}
|
|
if (i == 2) {
|
|
if (cVar.a() >= 7) {
|
|
int b2 = cVar.b(7);
|
|
if (b2 < 100) {
|
|
sb.append(f(b2 / 10));
|
|
sb.append(f(b2 % 10));
|
|
return;
|
|
}
|
|
throw FormatException.a();
|
|
}
|
|
throw FormatException.a();
|
|
} else if (i != 1) {
|
|
} else {
|
|
if (cVar.a() >= 4) {
|
|
int b3 = cVar.b(4);
|
|
if (b3 < 10) {
|
|
sb.append(f(b3));
|
|
return;
|
|
}
|
|
throw FormatException.a();
|
|
}
|
|
throw FormatException.a();
|
|
}
|
|
}
|
|
|
|
public static char f(int i) throws FormatException {
|
|
char[] cArr = a;
|
|
if (i < cArr.length) {
|
|
return cArr[i];
|
|
}
|
|
throw FormatException.a();
|
|
}
|
|
}
|