tdf#148251 Use std::swap instead of using temporary values
Change-Id: I7629d86b8f85a493bd3ad6b9c465a81c746b1dab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165802 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
This commit is contained in:
parent
bb89fe7ab6
commit
ccebd10bc4
2 changed files with 11 additions and 32 deletions
|
@ -201,17 +201,10 @@ void winwrap::TransformRect(LPRECT rect,HWND pWnd,HWND pWndClipTo)
|
|||
|
||||
static void NormalizeRect(LPRECT rp)
|
||||
{
|
||||
if(rp->left > rp->right) {
|
||||
UINT tmp = rp->left;
|
||||
rp->left = rp->right;
|
||||
rp->right = tmp;
|
||||
}
|
||||
|
||||
if(rp->top > rp->bottom) {
|
||||
UINT tmp = rp->top;
|
||||
rp->top = rp->bottom;
|
||||
rp->bottom = tmp;
|
||||
}
|
||||
if(rp->left > rp->right)
|
||||
std::swap(rp->left, rp->right);
|
||||
if(rp->top > rp->bottom)
|
||||
std::swap(rp->top, rp->bottom);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -116,34 +116,26 @@ STDMETHODIMP CBasic::inObject(IDispatch *val)
|
|||
|
||||
STDMETHODIMP CBasic::inoutBool(VARIANT_BOOL* val)
|
||||
{
|
||||
VARIANT_BOOL aBool = *val;
|
||||
*val = m_bool;
|
||||
m_bool = aBool;
|
||||
std::swap(*val, m_bool);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CBasic::inoutByte(unsigned char* val)
|
||||
{
|
||||
unsigned char aByte = *val;
|
||||
*val = m_byte;
|
||||
m_byte = aByte;
|
||||
std::swap(*val, m_byte);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CBasic::inoutShort(short *val)
|
||||
{
|
||||
short aShort = *val;
|
||||
*val = m_short;
|
||||
m_short = aShort;
|
||||
std::swap(*val, m_short);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CBasic::inoutLong(long *val)
|
||||
{
|
||||
long aLong = *val;
|
||||
*val = m_long;
|
||||
m_long = aLong;
|
||||
std::swap(*val, m_long);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -159,17 +151,13 @@ STDMETHODIMP CBasic::inoutString(BSTR *val)
|
|||
|
||||
STDMETHODIMP CBasic::inoutFloat(float *val)
|
||||
{
|
||||
float aFloat = *val;
|
||||
*val = m_float;
|
||||
m_float = aFloat;
|
||||
std::swap(*val, m_float);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CBasic::inoutDouble(double *val)
|
||||
{
|
||||
double aDouble = *val;
|
||||
*val = m_double;
|
||||
m_double = aDouble;
|
||||
std::swap(*val, m_double);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -1033,9 +1021,7 @@ STDMETHODIMP CBasic::outCurrency(CY* val)
|
|||
|
||||
STDMETHODIMP CBasic::inoutCurrency(CY* val)
|
||||
{
|
||||
CY tmp = *val;
|
||||
*val = m_cy;
|
||||
m_cy = tmp;
|
||||
std::swap(*val, m_cy);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue