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:
parent
df1727e1e6
commit
0b92810530
@ -505,19 +505,23 @@ public class VariantSupport extends Variant
|
|||||||
}
|
}
|
||||||
case Variant.VT_LPWSTR:
|
case Variant.VT_LPWSTR:
|
||||||
{
|
{
|
||||||
final int nrOfChars = ((String) value).length() + 1;
|
final int nrOfChars = ( (String) value ).length() + 1;
|
||||||
length += TypeWriter.writeUIntToStream(out, nrOfChars);
|
length += TypeWriter.writeUIntToStream( out, nrOfChars );
|
||||||
char[] s = Util.pad4((String) value);
|
char[] s = ( (String) value ).toCharArray();
|
||||||
for (int i = 0; i < s.length; i++)
|
for ( int i = 0; i < s.length; i++ )
|
||||||
{
|
{
|
||||||
final int high = ((s[i] & 0x0000ff00) >> 8);
|
final int high = ( ( s[i] & 0x0000ff00 ) >> 8 );
|
||||||
final int low = (s[i] & 0x000000ff);
|
final int low = ( s[i] & 0x000000ff );
|
||||||
final byte highb = (byte) high;
|
final byte highb = (byte) high;
|
||||||
final byte lowb = (byte) low;
|
final byte lowb = (byte) low;
|
||||||
out.write(lowb);
|
out.write( lowb );
|
||||||
out.write(highb);
|
out.write( highb );
|
||||||
length += 2;
|
length += 2;
|
||||||
}
|
}
|
||||||
|
// NullTerminator
|
||||||
|
out.write( 0x00 );
|
||||||
|
out.write( 0x00 );
|
||||||
|
length += 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Variant.VT_CF:
|
case Variant.VT_CF:
|
||||||
|
Loading…
Reference in New Issue
Block a user