Kaydet (Commit) 556720fc authored tarafından Uray M. János's avatar Uray M. János Kaydeden (comit) Noel Power

fdo#42492: fixing Basic HEX command

Change-Id: I133590c9f2a34d8daab031da0c77bd049d275c29
üst ae126d43
......@@ -861,12 +861,13 @@ RTLFUNC(Hex)
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
char aBuffer[16];
char aBuffer[17];
SbxVariableRef pArg = rPar.Get( 1 );
if ( pArg->IsInteger() )
snprintf( aBuffer, sizeof(aBuffer), "%X", pArg->GetInteger() );
else
snprintf( aBuffer, sizeof(aBuffer), "%lX", static_cast<long unsigned int>(pArg->GetLong()) );
// converting value to unsigned
sal_uInt32 nVal = pArg->IsInteger() ?
static_cast<sal_uInt16>(pArg->GetInteger()) :
static_cast<sal_uInt32>(pArg->GetLong());
snprintf( aBuffer, sizeof(aBuffer), "%"SAL_PRIXUINT32, nVal );
rPar.Get(0)->PutString( rtl::OUString::createFromAscii( aBuffer ) );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment