You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2016/10/25 09:35:28 UTC

svn commit: r1766493 - in /poi/trunk/src/scratchpad: src/org/apache/poi/hdgf/pointers/ testcases/org/apache/poi/hdgf/streams/

Author: nick
Date: Tue Oct 25 09:35:28 2016
New Revision: 1766493

URL: http://svn.apache.org/viewvc?rev=1766493&view=rev
Log:
Inconsistent whitespace

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/Pointer.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerFactory.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerV5.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerV6.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/StreamTest.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/Pointer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/Pointer.java?rev=1766493&r1=1766492&r2=1766493&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/Pointer.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/Pointer.java Tue Oct 25 09:35:28 2016
@@ -22,35 +22,35 @@ package org.apache.poi.hdgf.pointers;
  *  blocks elsewhere in the file
  */
 public abstract class Pointer {
-	protected int type;
-	protected int address;
-	protected int offset;
-	protected int length;
-	protected short format;
+    protected int type;
+    protected int address;
+    protected int offset;
+    protected int length;
+    protected short format;
 
-	public int getAddress() {
-		return address;
-	}
-	public short getFormat() {
-		return format;
-	}
-	public int getLength() {
-		return length;
-	}
-	public int getOffset() {
-		return offset;
-	}
-	public int getType() {
-		return type;
-	}
+    public int getAddress() {
+        return address;
+    }
+    public short getFormat() {
+        return format;
+    }
+    public int getLength() {
+        return length;
+    }
+    public int getOffset() {
+        return offset;
+    }
+    public int getType() {
+        return type;
+    }
 
-	public abstract int getSizeInBytes();
-	public abstract int getNumPointersOffset(byte[] data);
-	public abstract int getNumPointers(int offset, byte[] data);
-	public abstract int getPostNumPointersSkip();
-	
-	public abstract boolean destinationHasStrings();
-	public abstract boolean destinationHasPointers();
-	public abstract boolean destinationHasChunks();
-	public abstract boolean destinationCompressed();
+    public abstract int getSizeInBytes();
+    public abstract int getNumPointersOffset(byte[] data);
+    public abstract int getNumPointers(int offset, byte[] data);
+    public abstract int getPostNumPointersSkip();
+
+    public abstract boolean destinationHasStrings();
+    public abstract boolean destinationHasPointers();
+    public abstract boolean destinationHasChunks();
+    public abstract boolean destinationCompressed();
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerFactory.java?rev=1766493&r1=1766492&r2=1766493&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerFactory.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerFactory.java Tue Oct 25 09:35:28 2016
@@ -25,27 +25,27 @@ import org.apache.poi.util.LittleEndian;
  *  of the file
  */
 public final class PointerFactory {
-	private int version;
-	public PointerFactory(int version) {
-		this.version = version;
-	}
-	public int getVersion() { return version; }
-
-	/**
-	 * Creates a single Pointer from the data at the given offset
-	 */
-	public Pointer createPointer(byte[] data, int offset) {
-		Pointer p;
-		if(version >= 6) {
-			p = new PointerV6();
-			p.type = LittleEndian.getInt(data, offset+0);
-			p.address = (int)LittleEndian.getUInt(data, offset+4);
-			p.offset = (int)LittleEndian.getUInt(data, offset+8);
-			p.length = (int)LittleEndian.getUInt(data, offset+12);
-			p.format = LittleEndian.getShort(data, offset+16);
+    private int version;
+    public PointerFactory(int version) {
+        this.version = version;
+    }
+    public int getVersion() { return version; }
 
-			return p;
-		} else if(version == 5) {
+    /**
+     * Creates a single Pointer from the data at the given offset
+     */
+    public Pointer createPointer(byte[] data, int offset) {
+        Pointer p;
+        if(version >= 6) {
+            p = new PointerV6();
+            p.type = LittleEndian.getInt(data, offset+0);
+            p.address = (int)LittleEndian.getUInt(data, offset+4);
+            p.offset = (int)LittleEndian.getUInt(data, offset+8);
+            p.length = (int)LittleEndian.getUInt(data, offset+12);
+            p.format = LittleEndian.getShort(data, offset+16);
+
+            return p;
+        } else if(version == 5) {
             p = new PointerV5();
             p.type = LittleEndian.getShort(data, offset+0);
             p.format = LittleEndian.getShort(data, offset+2);
@@ -54,31 +54,31 @@ public final class PointerFactory {
             p.length = (int)LittleEndian.getUInt(data, offset+12);
 
             return p;
-		} else {
-			throw new IllegalArgumentException("Visio files with versions below 5 are not supported, yours was " + version);
-		}
-	}
-	
-	/**
-	 * Parsers the {@link PointerContainingStream} contents and
-	 *  creates all the child Pointers for it
-	 */
-	public Pointer[] createContainerPointers(Pointer parent, byte[] data) {
-	    // Where in the stream does the "number of pointers" offset live?
-	    int numPointersOffset = parent.getNumPointersOffset(data);
-	    // How many do we have?
-	    int numPointers = parent.getNumPointers(numPointersOffset, data);
-	    // How much to skip for the num pointers + any extra data?
-	    int skip = parent.getPostNumPointersSkip();
-	    
-	    // Create
-	    int pos = numPointersOffset + skip;
-	    Pointer[] childPointers = new Pointer[numPointers];
+        } else {
+            throw new IllegalArgumentException("Visio files with versions below 5 are not supported, yours was " + version);
+        }
+    }
+
+    /**
+     * Parsers the {@link PointerContainingStream} contents and
+     *  creates all the child Pointers for it
+     */
+    public Pointer[] createContainerPointers(Pointer parent, byte[] data) {
+        // Where in the stream does the "number of pointers" offset live?
+        int numPointersOffset = parent.getNumPointersOffset(data);
+        // How many do we have?
+        int numPointers = parent.getNumPointers(numPointersOffset, data);
+        // How much to skip for the num pointers + any extra data?
+        int skip = parent.getPostNumPointersSkip();
+
+        // Create
+        int pos = numPointersOffset + skip;
+        Pointer[] childPointers = new Pointer[numPointers];
         for(int i=0; i<numPointers; i++) {
             childPointers[i] = this.createPointer(data, pos);
             pos += childPointers[i].getSizeInBytes();
         }
-        
+
         return childPointers;
-	}
+    }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerV5.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerV5.java?rev=1766493&r1=1766492&r2=1766493&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerV5.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerV5.java Tue Oct 25 09:35:28 2016
@@ -24,42 +24,42 @@ import org.apache.poi.util.LittleEndian;
  */
 public final class PointerV5 extends Pointer {
     // TODO Are these getters correct?
-	public boolean destinationHasStrings() {
-		return (0x40 <= format && format < 0x50);
-	}
-	public boolean destinationHasPointers() {
-		if(type == 20) return true;
-		if(format == 0x1d || format == 0x1e) return true;
-		return (0x50 <= format && format < 0x60);
-	}
-	public boolean destinationHasChunks() {
-		return (0xd0 <= format && format < 0xdf);
-	}
+    public boolean destinationHasStrings() {
+        return (0x40 <= format && format < 0x50);
+    }
+    public boolean destinationHasPointers() {
+        if(type == 20) return true;
+        if(format == 0x1d || format == 0x1e) return true;
+        return (0x50 <= format && format < 0x60);
+    }
+    public boolean destinationHasChunks() {
+        return (0xd0 <= format && format < 0xdf);
+    }
 
-	public boolean destinationCompressed() {
-		// Apparently, it's the second least significant bit
-		return (format & 2) > 0;
-	}
+    public boolean destinationCompressed() {
+        // Apparently, it's the second least significant bit
+        return (format & 2) > 0;
+    }
 
-	/**
-	 * With v6 pointers, the on-disk size is 16 bytes
-	 */
-	public int getSizeInBytes() { return 16; }
-	
-	/**
-	 * Depends on the type only, not stored
-	 */
+    /**
+     * With v6 pointers, the on-disk size is 16 bytes
+     */
+    public int getSizeInBytes() { return 16; }
+
+    /**
+     * Depends on the type only, not stored
+     */
     public int getNumPointersOffset(byte[] data) {
         switch (type) {
             case 0x1d:
             case 0x4e:
-               return 0x24-6;
+                return 30;
             case 0x1e:
-               return 0x3c-6;
+                return 54;
             case 0x14:
-                return 0x88-6;
-       }
-       return 10;
+                return 130;
+        }
+        return 10;
     }
     /**
      * 16 bit int at the given offset

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerV6.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerV6.java?rev=1766493&r1=1766492&r2=1766493&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerV6.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/pointers/PointerV6.java Tue Oct 25 09:35:28 2016
@@ -23,31 +23,31 @@ import org.apache.poi.util.LittleEndian;
  * A Pointer from v6+
  */
 public final class PointerV6 extends Pointer {
-	public boolean destinationHasStrings() {
-		return (0x40 <= format && format < 0x50);
-	}
-	public boolean destinationHasPointers() {
-		if(type == 20) return true;
-		if(format == 0x1d || format == 0x1e) return true;
-		return (0x50 <= format && format < 0x60);
-	}
-	public boolean destinationHasChunks() {
-		return (0xd0 <= format && format < 0xdf);
-	}
+    public boolean destinationHasStrings() {
+        return (0x40 <= format && format < 0x50);
+    }
+    public boolean destinationHasPointers() {
+        if(type == 20) return true;
+        if(format == 0x1d || format == 0x1e) return true;
+        return (0x50 <= format && format < 0x60);
+    }
+    public boolean destinationHasChunks() {
+        return (0xd0 <= format && format < 0xdf);
+    }
+
+    public boolean destinationCompressed() {
+        // Apparently, it's the second least significant bit
+        return (format & 2) > 0;
+    }
 
-	public boolean destinationCompressed() {
-		// Apparently, it's the second least significant bit
-		return (format & 2) > 0;
-	}
+    /**
+     * With v6 pointers, the on-disk size is 18 bytes
+     */
+    public int getSizeInBytes() { return 18; }
 
-	/**
-	 * With v6 pointers, the on-disk size is 18 bytes
-	 */
-	public int getSizeInBytes() { return 18; }
-	
-	/**
-	 * Stored within the data
-	 */
+    /**
+     * Stored within the data
+     */
     public int getNumPointersOffset(byte[] data) {
         return getNumPointersOffsetV6(data);
     }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/StreamTest.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/StreamTest.java?rev=1766493&r1=1766492&r2=1766493&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/StreamTest.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hdgf/streams/StreamTest.java Tue Oct 25 09:35:28 2016
@@ -23,32 +23,32 @@ import static org.apache.poi.hdgf.pointe
 import junit.framework.TestCase;
 
 public abstract class StreamTest extends TestCase {
-	public static class TestPointer extends Pointer {
-		private final boolean compressed;
-		protected boolean hasPointers = false;
-		public TestPointer(boolean compressed, int offset, int length, int type, short format) {
-			this.compressed = compressed;
-			this.offset = offset;
-			this.length = length;
-			this.type = type;
-			this.format = format;
-		}
+    public static class TestPointer extends Pointer {
+        private final boolean compressed;
+        protected boolean hasPointers = false;
+        public TestPointer(boolean compressed, int offset, int length, int type, short format) {
+            this.compressed = compressed;
+            this.offset = offset;
+            this.length = length;
+            this.type = type;
+            this.format = format;
+        }
 
-		@Override
+        @Override
         public boolean destinationCompressed() { return compressed; }
-		@Override
+        @Override
         public boolean destinationHasChunks() { return false; }
-		@Override
+        @Override
         public boolean destinationHasPointers() { return hasPointers; }
-		@Override
+        @Override
         public boolean destinationHasStrings() { return false; }
-		
-		@Override
+
+        @Override
         public int getSizeInBytes() { return -1; }
-		@Override
+        @Override
         public int getNumPointersOffset(byte[] data) { 
-		    return getNumPointersOffsetV6(data); 
-		}
+            return getNumPointersOffsetV6(data); 
+        }
         @Override
         public int getNumPointers(int offset, byte[] data) { 
             return getNumPointersV6(offset, data);
@@ -57,5 +57,5 @@ public abstract class StreamTest extends
         public int getPostNumPointersSkip() {
             return getPostNumPointersSkipV6();
         }
-	}
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org