fix VT_LPWSTR support

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1178149 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-10-02 08:44:05 +00:00
parent df1727e1e6
commit 0b92810530

View File

@ -505,19 +505,23 @@ public class VariantSupport extends Variant
}
case Variant.VT_LPWSTR:
{
final int nrOfChars = ((String) value).length() + 1;
length += TypeWriter.writeUIntToStream(out, nrOfChars);
char[] s = Util.pad4((String) value);
for (int i = 0; i < s.length; i++)
final int nrOfChars = ( (String) value ).length() + 1;
length += TypeWriter.writeUIntToStream( out, nrOfChars );
char[] s = ( (String) value ).toCharArray();
for ( int i = 0; i < s.length; i++ )
{
final int high = ((s[i] & 0x0000ff00) >> 8);
final int low = (s[i] & 0x000000ff);
final int high = ( ( s[i] & 0x0000ff00 ) >> 8 );
final int low = ( s[i] & 0x000000ff );
final byte highb = (byte) high;
final byte lowb = (byte) low;
out.write(lowb);
out.write(highb);
out.write( lowb );
out.write( highb );
length += 2;
}
// NullTerminator
out.write( 0x00 );
out.write( 0x00 );
length += 2;
break;
}
case Variant.VT_CF: