You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2019/11/18 08:56:06 UTC

svn commit: r1869962 [1/3] - in /poi/trunk/src: java/org/apache/poi/hssf/record/HyperlinkRecord.java java/org/apache/poi/hssf/usermodel/HSSFChart.java scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java

Author: fanningpj
Date: Mon Nov 18 08:56:06 2019
New Revision: 1869962

URL: http://svn.apache.org/viewvc?rev=1869962&view=rev
Log:
convert tabs to spaces

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFChart.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java?rev=1869962&r1=1869961&r2=1869962&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/HyperlinkRecord.java Mon Nov 18 08:56:06 2019
@@ -42,52 +42,52 @@ public final class HyperlinkRecord exten
 
 
     static final class GUID {
-		/*
-		 * this class is currently only used here, but could be moved to a
-		 * common package if needed
-		 */
-		private static final int TEXT_FORMAT_LENGTH = 36;
-
-		public static final int ENCODED_SIZE = 16;
-
-		/** 4 bytes - little endian */
-		private final int _d1;
-		/** 2 bytes - little endian */
-		private final int _d2;
-		/** 2 bytes - little endian */
-		private final int _d3;
-		/**
-		 * 8 bytes - serialized as big endian,  stored with inverted endianness here
-		 */
-		private final long _d4;
-
-		public GUID(LittleEndianInput in) {
-			this(in.readInt(), in.readUShort(), in.readUShort(), in.readLong());
-		}
-
-		public GUID(int d1, int d2, int d3, long d4) {
-			_d1 = d1;
-			_d2 = d2;
-			_d3 = d3;
-			_d4 = d4;
-		}
-
-		public void serialize(LittleEndianOutput out) {
-			out.writeInt(_d1);
-			out.writeShort(_d2);
-			out.writeShort(_d3);
-			out.writeLong(_d4);
-		}
+        /*
+         * this class is currently only used here, but could be moved to a
+         * common package if needed
+         */
+        private static final int TEXT_FORMAT_LENGTH = 36;
+
+        public static final int ENCODED_SIZE = 16;
+
+        /** 4 bytes - little endian */
+        private final int _d1;
+        /** 2 bytes - little endian */
+        private final int _d2;
+        /** 2 bytes - little endian */
+        private final int _d3;
+        /**
+         * 8 bytes - serialized as big endian,  stored with inverted endianness here
+         */
+        private final long _d4;
+
+        public GUID(LittleEndianInput in) {
+            this(in.readInt(), in.readUShort(), in.readUShort(), in.readLong());
+        }
+
+        public GUID(int d1, int d2, int d3, long d4) {
+            _d1 = d1;
+            _d2 = d2;
+            _d3 = d3;
+            _d4 = d4;
+        }
+
+        public void serialize(LittleEndianOutput out) {
+            out.writeInt(_d1);
+            out.writeShort(_d2);
+            out.writeShort(_d3);
+            out.writeLong(_d4);
+        }
 
-		@Override
-		public boolean equals(Object obj) {
+        @Override
+        public boolean equals(Object obj) {
             if (!(obj instanceof GUID)) {
                 return false;
             }
-			GUID other = (GUID) obj;
-			return _d1 == other._d1 && _d2 == other._d2
-			    && _d3 == other._d3 && _d4 == other._d4;
-		}
+            GUID other = (GUID) obj;
+            return _d1 == other._d1 && _d2 == other._d2
+                && _d3 == other._d3 && _d4 == other._d4;
+        }
 
        @Override
        public int hashCode() {
@@ -96,108 +96,108 @@ public final class HyperlinkRecord exten
        }
 
        public int getD1() {
-			return _d1;
-		}
+            return _d1;
+        }
+
+        public int getD2() {
+            return _d2;
+        }
+
+        public int getD3() {
+            return _d3;
+        }
+
+        public long getD4() {
+            byte[] result = new byte[Long.SIZE/Byte.SIZE];
+            long l = _d4;
+            for (int i = result.length-1; i >= 0; i--) {
+                result[i] = (byte)(l & 0xFF);
+                l >>= 8;
+            }
+
+            return LittleEndian.getLong(result, 0);
+        }
+
+        public String formatAsString() {
+
+            StringBuilder sb = new StringBuilder(36);
+
+            int PREFIX_LEN = "0x".length();
+            sb.append(HexDump.intToHex(_d1).substring(PREFIX_LEN));
+            sb.append("-");
+            sb.append(HexDump.shortToHex(_d2).substring(PREFIX_LEN));
+            sb.append("-");
+            sb.append(HexDump.shortToHex(_d3).substring(PREFIX_LEN));
+            sb.append("-");
+            String d4Chars = HexDump.longToHex(getD4());
+            sb.append(d4Chars, PREFIX_LEN, PREFIX_LEN+4);
+            sb.append("-");
+            sb.append(d4Chars.substring(PREFIX_LEN+4));
+            return sb.toString();
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder(64);
+            sb.append(getClass().getName()).append(" [");
+            sb.append(formatAsString());
+            sb.append("]");
+            return sb.toString();
+        }
 
-		public int getD2() {
-			return _d2;
-		}
-
-		public int getD3() {
-			return _d3;
-		}
-
-		public long getD4() {
-		    byte[] result = new byte[Long.SIZE/Byte.SIZE];
-		    long l = _d4;
-		    for (int i = result.length-1; i >= 0; i--) {
-		        result[i] = (byte)(l & 0xFF);
-		        l >>= 8;
-		    }
-		    
-			return LittleEndian.getLong(result, 0);
-		}
-
-		public String formatAsString() {
-
-			StringBuilder sb = new StringBuilder(36);
-
-			int PREFIX_LEN = "0x".length();
-			sb.append(HexDump.intToHex(_d1).substring(PREFIX_LEN));
-			sb.append("-");
-			sb.append(HexDump.shortToHex(_d2).substring(PREFIX_LEN));
-			sb.append("-");
-			sb.append(HexDump.shortToHex(_d3).substring(PREFIX_LEN));
-			sb.append("-");
-			String d4Chars = HexDump.longToHex(getD4());
-			sb.append(d4Chars, PREFIX_LEN, PREFIX_LEN+4);
-			sb.append("-");
-			sb.append(d4Chars.substring(PREFIX_LEN+4));
-			return sb.toString();
-		}
-
-		@Override
-		public String toString() {
-			StringBuilder sb = new StringBuilder(64);
-			sb.append(getClass().getName()).append(" [");
-			sb.append(formatAsString());
-			sb.append("]");
-			return sb.toString();
-		}
-
-		/**
-		 * Read a GUID in standard text form e.g.<br>
-		 * 13579BDF-0246-8ACE-0123-456789ABCDEF 
-		 * <br> -&gt; <br>
-		 *  0x13579BDF, 0x0246, 0x8ACE 0x0123456789ABCDEF
-		 */
-		public static GUID parse(String rep) {
-			char[] cc = rep.toCharArray();
-			if (cc.length != TEXT_FORMAT_LENGTH) {
-				throw new RecordFormatException("supplied text is the wrong length for a GUID");
-			}
-			int d0 = (parseShort(cc, 0) << 16) + (parseShort(cc, 4) << 0);
-			int d1 = parseShort(cc, 9);
-			int d2 = parseShort(cc, 14);
+        /**
+         * Read a GUID in standard text form e.g.<br>
+         * 13579BDF-0246-8ACE-0123-456789ABCDEF
+         * <br> -&gt; <br>
+         *  0x13579BDF, 0x0246, 0x8ACE 0x0123456789ABCDEF
+         */
+        public static GUID parse(String rep) {
+            char[] cc = rep.toCharArray();
+            if (cc.length != TEXT_FORMAT_LENGTH) {
+                throw new RecordFormatException("supplied text is the wrong length for a GUID");
+            }
+            int d0 = (parseShort(cc, 0) << 16) + (parseShort(cc, 4) << 0);
+            int d1 = parseShort(cc, 9);
+            int d2 = parseShort(cc, 14);
             System.arraycopy(cc, 19, cc, 20, 4);
-			long d3 = parseLELong(cc, 20);
+            long d3 = parseLELong(cc, 20);
+
+            return new GUID(d0, d1, d2, d3);
+        }
 
-			return new GUID(d0, d1, d2, d3);
-		}
+        private static long parseLELong(char[] cc, int startIndex) {
+            long acc = 0;
+            for (int i = startIndex + 14; i >= startIndex; i -= 2) {
+                acc <<= 4;
+                acc += parseHexChar(cc[i + 0]);
+                acc <<= 4;
+                acc += parseHexChar(cc[i + 1]);
+            }
+            return acc;
+        }
+
+        private static int parseShort(char[] cc, int startIndex) {
+            int acc = 0;
+            for (int i = 0; i < 4; i++) {
+                acc <<= 4;
+                acc += parseHexChar(cc[startIndex + i]);
+            }
+            return acc;
+        }
 
-		private static long parseLELong(char[] cc, int startIndex) {
-			long acc = 0;
-			for (int i = startIndex + 14; i >= startIndex; i -= 2) {
-				acc <<= 4;
-				acc += parseHexChar(cc[i + 0]);
-				acc <<= 4;
-				acc += parseHexChar(cc[i + 1]);
-			}
-			return acc;
-		}
-
-		private static int parseShort(char[] cc, int startIndex) {
-			int acc = 0;
-			for (int i = 0; i < 4; i++) {
-				acc <<= 4;
-				acc += parseHexChar(cc[startIndex + i]);
-			}
-			return acc;
-		}
-
-		private static int parseHexChar(char c) {
-			if (c >= '0' && c <= '9') {
-				return c - '0';
-			}
-			if (c >= 'A' && c <= 'F') {
-				return c - 'A' + 10;
-			}
-			if (c >= 'a' && c <= 'f') {
-				return c - 'a' + 10;
-			}
-			throw new RecordFormatException("Bad hex char '" + c + "'");
-		}
-	}
+        private static int parseHexChar(char c) {
+            if (c >= '0' && c <= '9') {
+                return c - '0';
+            }
+            if (c >= 'A' && c <= 'F') {
+                return c - 'A' + 10;
+            }
+            if (c >= 'a' && c <= 'f') {
+                return c - 'a' + 10;
+            }
+            throw new RecordFormatException("Bad hex char '" + c + "'");
+        }
+    }
 
     /**
      * Link flags
@@ -628,7 +628,7 @@ public final class HyperlinkRecord exten
                 size += 4;  //address length
                 size += _address.length()*2;
                 if (_uninterpretedTail != null) {
-                	size += TAIL_SIZE;
+                    size += TAIL_SIZE;
                 }
             } else if (FILE_MONIKER.equals(_moniker)){
                 size += 2;  //file_opts
@@ -652,8 +652,8 @@ public final class HyperlinkRecord exten
 
 
     private static byte[] readTail(byte[] expectedTail, LittleEndianInput in) {
-    	byte[] result = new byte[TAIL_SIZE];
-    	in.readFully(result);
+        byte[] result = new byte[TAIL_SIZE];
+        in.readFully(result);
 //    	if (false) { // Quite a few examples in the unit tests which don't have the exact expected tail
 //            for (int i = 0; i < expectedTail.length; i++) {
 //                if (expectedTail[i] != result[i]) {



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