[apktool] 05/08: Add LittleEndianDataInputStream.java.patch

Markus Koschany apo-guest at moszumanska.debian.org
Thu Mar 24 20:01:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

apo-guest pushed a commit to branch master
in repository apktool.

commit 18f09569a72f5b21d0f883996771a3fb631f107e
Author: Markus Koschany <apo at debian.org>
Date:   Thu Mar 24 20:24:29 2016 +0100

    Add LittleEndianDataInputStream.java.patch
    
    Replace defunct Little Endian implementation by cherry-picking
    https://github.com/iBotPeaches/Apktool/commit/ecb46ec5e750e58c159ab557f7e21f2d27c7a6b9
    
    and using the new public domain class LittleEndianDataInputStream
    
    Closes: #819191
---
 .../patches/LittleEndianDataInputStream.java.patch | 207 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 208 insertions(+)

diff --git a/debian/patches/LittleEndianDataInputStream.java.patch b/debian/patches/LittleEndianDataInputStream.java.patch
new file mode 100644
index 0000000..3118fdf
--- /dev/null
+++ b/debian/patches/LittleEndianDataInputStream.java.patch
@@ -0,0 +1,207 @@
+From: Markus Koschany <apo at debian.org>
+Date: Thu, 24 Mar 2016 20:24:10 +0100
+Subject: LittleEndianDataInputStream.java
+
+---
+ .../brut/androlib/res/decoder/ARSCDecoder.java     |   4 +-
+ .../androlib/res/decoder/AXmlResourceParser.java   |   6 +-
+ .../peterfranza/LittleEndianDataInputStream.java   | 139 +++++++++++++++++++++
+ 3 files changed, 144 insertions(+), 5 deletions(-)
+ create mode 100644 brut.apktool/apktool-lib/src/main/java/com/peterfranza/LittleEndianDataInputStream.java
+
+diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java
+index bb8fbf5..035e245 100644
+--- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java
++++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java
+@@ -23,7 +23,7 @@ import brut.androlib.res.data.value.*;
+ import brut.util.Duo;
+ import brut.androlib.res.data.ResTable;
+ import brut.util.ExtDataInput;
+-import com.mindprod.ledatastream.LEDataInputStream;
++import com.peterfranza.LittleEndianDataInputStream;
+ import java.io.*;
+ import java.math.BigInteger;
+ import java.util.*;
+@@ -61,7 +61,7 @@ public class ARSCDecoder {
+             mCountIn = null;
+             mFlagsOffsets = null;
+         }
+-        mIn = new ExtDataInput(new LEDataInputStream(arscStream));
++        mIn = new ExtDataInput(new LittleEndianDataInputStream(arscStream));
+         mResTable = resTable;
+         mKeepBroken = keepBroken;
+     }
+diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/AXmlResourceParser.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/AXmlResourceParser.java
+index 1c768a9..6b2e71d 100644
+--- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/AXmlResourceParser.java
++++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/AXmlResourceParser.java
+@@ -20,7 +20,7 @@ import android.util.TypedValue;
+ import brut.androlib.AndrolibException;
+ import brut.androlib.res.xml.ResXmlEncoders;
+ import brut.util.ExtDataInput;
+-import com.mindprod.ledatastream.LEDataInputStream;
++import com.peterfranza.LittleEndianDataInputStream;
+ import java.io.IOException;
+ import java.io.InputStream;
+ import java.io.Reader;
+@@ -69,7 +69,7 @@ public class AXmlResourceParser implements XmlResourceParser {
+     public void open(InputStream stream) {
+         close();
+         if (stream != null) {
+-            m_reader = new ExtDataInput(new LEDataInputStream(stream));
++            m_reader = new ExtDataInput(new LittleEndianDataInputStream(stream));
+         }
+     }
+ 
+@@ -994,4 +994,4 @@ public class AXmlResourceParser implements XmlResourceParser {
+             CHUNK_XML_END_NAMESPACE = 0x00100101,
+             CHUNK_XML_START_TAG = 0x00100102, CHUNK_XML_END_TAG = 0x00100103,
+             CHUNK_XML_TEXT = 0x00100104, CHUNK_XML_LAST = 0x00100104;
+-}
+\ No newline at end of file
++}
+diff --git a/brut.apktool/apktool-lib/src/main/java/com/peterfranza/LittleEndianDataInputStream.java b/brut.apktool/apktool-lib/src/main/java/com/peterfranza/LittleEndianDataInputStream.java
+new file mode 100644
+index 0000000..8777b9b
+--- /dev/null
++++ b/brut.apktool/apktool-lib/src/main/java/com/peterfranza/LittleEndianDataInputStream.java
+@@ -0,0 +1,139 @@
++package com.peterfranza;
++
++import java.io.DataInput;
++import java.io.DataInputStream;
++import java.io.IOException;
++import java.io.InputStream;
++
++public class LittleEndianDataInputStream implements DataInput {
++
++	public LittleEndianDataInputStream(InputStream in) {
++		this.in = in;
++		this.d = new DataInputStream(in);
++		w = new byte[8];
++	}
++
++	public int available() throws IOException {
++		return d.available();
++	}
++
++
++	public final short readShort() throws IOException
++	{
++		d.readFully(w, 0, 2);
++		return (short)(
++				(w[1]&0xff) << 8 |
++				(w[0]&0xff));
++	}
++
++	/**
++	 * Note, returns int even though it reads a short.
++	 */
++	 public final int readUnsignedShort() throws IOException
++	 {
++		 d.readFully(w, 0, 2);
++		 return (
++				 (w[1]&0xff) << 8 |
++				 (w[0]&0xff));
++	 }
++
++	 /**
++	  * like DataInputStream.readChar except little endian.
++	  */
++	 public final char readChar() throws IOException
++	 {
++		 d.readFully(w, 0, 2);
++		 return (char) (
++				 (w[1]&0xff) << 8 |
++				 (w[0]&0xff));
++	 }
++
++	 /**
++	  * like DataInputStream.readInt except little endian.
++	  */
++	 public final int readInt() throws IOException
++	 {
++		 d.readFully(w, 0, 4);
++		 return
++		 (w[3])      << 24 |
++		 (w[2]&0xff) << 16 |
++		 (w[1]&0xff) <<  8 |
++		 (w[0]&0xff);
++	 }
++
++	 /**
++	  * like DataInputStream.readLong except little endian.
++	  */
++	 public final long readLong() throws IOException
++	 {
++		 d.readFully(w, 0, 8);
++		 return
++		 (long)(w[7])      << 56 | 
++		 (long)(w[6]&0xff) << 48 |
++		 (long)(w[5]&0xff) << 40 |
++		 (long)(w[4]&0xff) << 32 |
++		 (long)(w[3]&0xff) << 24 |
++		 (long)(w[2]&0xff) << 16 |
++		 (long)(w[1]&0xff) <<  8 |
++		 (long)(w[0]&0xff);
++	 }
++
++	 public final float readFloat() throws IOException {
++		 return Float.intBitsToFloat(readInt());
++	 }
++
++	 public final double readDouble() throws IOException {
++		 return Double.longBitsToDouble(readLong());
++	 }
++
++	 public final int read(byte b[], int off, int len) throws IOException {
++		 return in.read(b, off, len);
++	 }
++
++	 public final void readFully(byte b[]) throws IOException {
++		 d.readFully(b, 0, b.length);
++	 }
++
++	 public final void readFully(byte b[], int off, int len) throws IOException {
++		 d.readFully(b, off, len);
++	 }
++
++	 public final int skipBytes(int n) throws IOException {
++		 return d.skipBytes(n);
++	 }
++
++	 public final boolean readBoolean() throws IOException {
++		 return d.readBoolean();
++	 }
++
++	 public final byte readByte() throws IOException {
++		 return d.readByte();
++	 }
++
++	 public int read() throws IOException {
++		 return in.read();
++	 }
++
++	 public final int readUnsignedByte() throws IOException {
++		 return d.readUnsignedByte();
++	 }
++
++	 @Deprecated
++	 public final String readLine() throws IOException {
++		 return d.readLine();
++	 }
++
++	 public final String readUTF() throws IOException {
++		 return d.readUTF();
++	 }
++
++	 public final void close() throws IOException {
++		 d.close();
++	 }
++
++	 private DataInputStream d; // to get at high level readFully methods of
++	 // DataInputStream
++	 private InputStream in; // to get at the low-level read methods of
++	 // InputStream
++	 private byte w[]; // work array for buffering input
++}
diff --git a/debian/patches/series b/debian/patches/series
index 0f1d6c2..b0d5fe2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 use_system_aapt.patch
 build.patch
+LittleEndianDataInputStream.java.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/apktool.git



More information about the pkg-java-commits mailing list