]> source.dussan.org Git - poi.git/commitdiff
Bug fixed in writing Unicode strings.
authorRainer Klute <klute@apache.org>
Mon, 1 Sep 2003 05:45:36 +0000 (05:45 +0000)
committerRainer Klute <klute@apache.org>
Mon, 1 Sep 2003 05:45:36 +0000 (05:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353328 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hpsf/VariantSupport.java

index 4bb9f5ee978d5d015986bcf2f5aad76af33d1b23..6e9d96c60abb974fcf81e527958148384038701a 100644 (file)
@@ -348,7 +348,7 @@ public class VariantSupport extends Variant
             case Variant.VT_LPWSTR:
             {
                 final int nrOfChars = ((String) value).length() + 1; 
-                TypeWriter.writeUIntToStream(out, nrOfChars);
+                length += TypeWriter.writeUIntToStream(out, nrOfChars);
                 char[] s = Util.pad4((String) value);
                 for (int i = 0; i < s.length; i++)
                 {
@@ -358,8 +358,8 @@ public class VariantSupport extends Variant
                     final byte lowb = (byte) low;
                     out.write(lowb);
                     out.write(highb);
+                    length += 2;
                 }
-                length = nrOfChars * 2;
                 out.write(0x00);
                 out.write(0x00);
                 length += 2;
@@ -386,8 +386,7 @@ public class VariantSupport extends Variant
             }
             case Variant.VT_I4:
             {
-                TypeWriter.writeToStream(out, ((Long) value).intValue());
-                length = LittleEndianConsts.INT_SIZE;
+                length += TypeWriter.writeToStream(out, ((Long) value).intValue());
                 break;
             }
             case Variant.VT_FILETIME: