correctly add padding to 16-bit integers
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1178111 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
04a9868e95
commit
46e1c019cc
@ -478,10 +478,11 @@ public class VariantSupport extends Variant
|
|||||||
{
|
{
|
||||||
int trueOrFalse;
|
int trueOrFalse;
|
||||||
if ( ( (Boolean) value ).booleanValue() )
|
if ( ( (Boolean) value ).booleanValue() )
|
||||||
trueOrFalse = 1;
|
trueOrFalse = 0xFFFF;
|
||||||
else
|
else
|
||||||
trueOrFalse = 0;
|
trueOrFalse = 0x0000;
|
||||||
length = TypeWriter.writeUIntToStream(out, trueOrFalse);
|
TypeWriter.writeUShortToStream( out, trueOrFalse );
|
||||||
|
length += 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Variant.VT_LPSTR:
|
case Variant.VT_LPSTR:
|
||||||
@ -534,7 +535,13 @@ public class VariantSupport extends Variant
|
|||||||
case Variant.VT_I2:
|
case Variant.VT_I2:
|
||||||
{
|
{
|
||||||
TypeWriter.writeToStream(out, ((Integer) value).shortValue());
|
TypeWriter.writeToStream(out, ((Integer) value).shortValue());
|
||||||
length = LittleEndianConsts.SHORT_SIZE;
|
// length = LittleEndianConsts.SHORT_SIZE;
|
||||||
|
TypeWriter.writeToStream( out, (short) 0x0000 );
|
||||||
|
/*
|
||||||
|
* MUST be a 16-bit signed integer, followed by zero padding to 4
|
||||||
|
* bytes -- http://msdn.microsoft.com/en-us/library/dd942532(v=PROT.13).aspx
|
||||||
|
*/
|
||||||
|
length = LittleEndianConsts.INT_SIZE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Variant.VT_I4:
|
case Variant.VT_I4:
|
||||||
|
Loading…
Reference in New Issue
Block a user