]> source.dussan.org Git - poi.git/commitdiff
Fixed some bad string length handling.
authorGlen Stampoultzis <glens@apache.org>
Fri, 1 Mar 2002 13:27:10 +0000 (13:27 +0000)
committerGlen Stampoultzis <glens@apache.org>
Fri, 1 Mar 2002 13:27:10 +0000 (13:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352125 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/record/BoundSheetRecord.java
src/java/org/apache/poi/hssf/record/FontRecord.java
src/java/org/apache/poi/hssf/record/FormatRecord.java
src/java/org/apache/poi/hssf/record/StyleRecord.java

index ee5db7229f0c20a0be96851b0cba4a6e35fb9db1..a897ee4acf9fbde5ce1374eb396285fc2d5bd925 100644 (file)
@@ -126,7 +126,7 @@ public class BoundSheetRecord
         field_3_sheetname_length        = data[ 6 + offset ];
         field_4_compressed_unicode_flag = data[ 7 + offset ];
         field_5_sheetname               = new String(data, 8 + offset,
-                ( int ) field_3_sheetname_length);
+                LittleEndian.ubyteToInt( field_3_sheetname_length));
     }
 
     /**
index e38676aadfee6f958620b89c7be8c204463374ba..e07222913ff578dc9de8bd75f94c8d218aee2b5f 100644 (file)
@@ -165,7 +165,7 @@ public class FontRecord
             if (data[ 15 ] == 0)
             {   // is compressed unicode
                 field_11_font_name = new String(data, 16,
-                                                field_10_font_name_len);
+                                                LittleEndian.ubyteToInt(field_10_font_name_len));
             }
             else
             {   // is not compressed unicode
index 36075606d83f993c12d4d3c943011110fa41da6f..d541c3bc538a3d599957ddb9a3e6c3c5b0d7a5df 100644 (file)
@@ -121,7 +121,7 @@ public class FormatRecord
         field_2_formatstring_len = data[ 2 + offset ];
         field_3_zero             = LittleEndian.getShort(data, 3 + offset);
         field_4_formatstring     = new String(data, 5 + offset,
-                                              field_2_formatstring_len);
+                                              LittleEndian.ubyteToInt(field_2_formatstring_len));
     }
 
     /**
index 2ed737d3bce02a9f4f4b897017ac0a6ef69b9505..3ce8c4ea9184560c509b510c5d8556a49d240dd1 100644 (file)
@@ -135,7 +135,7 @@ public class StyleRecord
         {
             field_2_name_length = data[ 2 + offset ];
             field_3_name        = new String(data, 3 + offset,
-                                             field_2_name_length);
+                                             LittleEndian.ubyteToInt(field_2_name_length));
         }
 
         // todo sanity check exception to make sure we're one or the other