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) ...@@ -861,12 +861,13 @@ RTLFUNC(Hex)
StarBASIC::Error( SbERR_BAD_ARGUMENT ); StarBASIC::Error( SbERR_BAD_ARGUMENT );
else else
{ {
char aBuffer[16]; char aBuffer[17];
SbxVariableRef pArg = rPar.Get( 1 ); SbxVariableRef pArg = rPar.Get( 1 );
if ( pArg->IsInteger() ) // converting value to unsigned
snprintf( aBuffer, sizeof(aBuffer), "%X", pArg->GetInteger() ); sal_uInt32 nVal = pArg->IsInteger() ?
else static_cast<sal_uInt16>(pArg->GetInteger()) :
snprintf( aBuffer, sizeof(aBuffer), "%lX", static_cast<long unsigned int>(pArg->GetLong()) ); static_cast<sal_uInt32>(pArg->GetLong());
snprintf( aBuffer, sizeof(aBuffer), "%"SAL_PRIXUINT32, nVal );
rPar.Get(0)->PutString( rtl::OUString::createFromAscii( aBuffer ) ); 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