aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/common/os/elf/IOUtils.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-02-01 05:21:39 +0100
committerSven Gothel <[email protected]>2015-02-01 05:21:39 +0100
commita3f2d08801c5a54048faca52f422bcededf81b2a (patch)
tree96e83956b62ae3e25043ccc67f4cb1c2c1f232a1 /src/java/jogamp/common/os/elf/IOUtils.java
parent0deceee37d943faa7c34971388863a27f395d6a5 (diff)
Bug 1125 - Make ELF Reader 'jogamp.common.os.elf' Stateless
ELF Reader 'jogamp.common.os.elf' currently uses Platform's pre-determined OS_TYPE and CPUType. It also uses the host platforms MachineDescription, hence can not read ELF files from other machines. This also forbids Platform to determine CPUType etc w/o having a valid 'os.arch' property. +++ ElfHeader should be split in - ElfHeaderPart1 (CPUType independent) - ElfHeaderPart2 (CPUType dependent) Fix shall make the ELF Reader self containing by only using ELF CPUType data, etc. This requires customization of struct parsing, where MachineDescription.Static index shall be - defined in ElfHeaderPart1 using e_Ident's CPUType. - used in ElfHeaderPart2 and all its struct types.
Diffstat (limited to 'src/java/jogamp/common/os/elf/IOUtils.java')
-rw-r--r--src/java/jogamp/common/os/elf/IOUtils.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/java/jogamp/common/os/elf/IOUtils.java b/src/java/jogamp/common/os/elf/IOUtils.java
index 62b47db..454a325 100644
--- a/src/java/jogamp/common/os/elf/IOUtils.java
+++ b/src/java/jogamp/common/os/elf/IOUtils.java
@@ -30,7 +30,6 @@ package jogamp.common.os.elf;
import java.io.IOException;
import java.io.RandomAccessFile;
-import com.jogamp.common.os.Platform;
import com.jogamp.common.util.Bitstream;
class IOUtils {
@@ -61,17 +60,12 @@ class IOUtils {
in.seek(newPos);
}
- static int readUInt32(final byte[] in, final int offset) {
- final int v = Bitstream.uint32LongToInt(Bitstream.readUInt32(!Platform.isLittleEndian(), in, offset));
+ static int readUInt32(final boolean isBigEndian, final byte[] in, final int offset) {
+ final int v = Bitstream.uint32LongToInt(Bitstream.readUInt32(isBigEndian, in, offset));
if( 0 > v ) {
throw new IllegalArgumentException("Read uint32 value "+toHexString(v)+" > int32-max "+toHexString(MAX_INT_VALUE));
}
return v;
- /** Need to fix endian for below path ..
- checkBounds(in, offset, 4);
- final byte[] uint = new byte[] { 0, 0, 0, 0, in[offset+0], in[offset+1], in[offset+2], in[offset+3] };
- final ByteBuffer b = ByteBuffer.wrap(uint, 0, 8).order(ByteOrder.nativeOrder());
- return b.asLongBuffer().get(0); */
}
/**