summaryrefslogtreecommitdiff
path: root/vcl/source/control
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-07-28 08:13:58 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-08-01 19:33:21 +0200
commit297b109e220249bc81738144555c33bf22796bac (patch)
treefdd4af006c0b8dce3073372a410268b0c53ac029 /vcl/source/control
parent288f49440f304ef43b9b1c6983ce0ee2af62225f (diff)
sal_uInt16 to sal_Int32, constify and simplify
Change-Id: If97d75dbfb683191f4a30d796ca132cedec6c92e
Diffstat (limited to 'vcl/source/control')
-rw-r--r--vcl/source/control/edit.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 43ba36c26f1e..cb10b95deafc 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2131,22 +2131,20 @@ void Edit::Command( const CommandEvent& rCEvt )
maText.insert( mpIMEInfos->nPos, pData->GetText() );
if ( mpIMEInfos->bWasCursorOverwrite )
{
- sal_Int32 nOldIMETextLen = mpIMEInfos->nLen;
- sal_Int32 nNewIMETextLen = pData->GetText().getLength();
+ const sal_Int32 nOldIMETextLen = mpIMEInfos->nLen;
+ const sal_Int32 nNewIMETextLen = pData->GetText().getLength();
if ( ( nOldIMETextLen > nNewIMETextLen ) &&
( nNewIMETextLen < mpIMEInfos->aOldTextAfterStartPos.getLength() ) )
{
// restore old characters
- sal_Int32 nRestore = nOldIMETextLen - nNewIMETextLen;
+ const sal_Int32 nRestore = nOldIMETextLen - nNewIMETextLen;
maText.insert( mpIMEInfos->nPos + nNewIMETextLen, mpIMEInfos->aOldTextAfterStartPos.copy( nNewIMETextLen, nRestore ) );
}
else if ( ( nOldIMETextLen < nNewIMETextLen ) &&
( nOldIMETextLen < mpIMEInfos->aOldTextAfterStartPos.getLength() ) )
{
- // overwrite
- sal_uInt16 nOverwrite = nNewIMETextLen - nOldIMETextLen;
- if ( ( nOldIMETextLen + nOverwrite ) > mpIMEInfos->aOldTextAfterStartPos.getLength() )
- nOverwrite = mpIMEInfos->aOldTextAfterStartPos.getLength() - nOldIMETextLen;
+ const sal_Int32 nOverwrite = ( nNewIMETextLen > mpIMEInfos->aOldTextAfterStartPos.getLength()
+ ? mpIMEInfos->aOldTextAfterStartPos.getLength() : nNewIMETextLen ) - nOldIMETextLen;
maText.remove( mpIMEInfos->nPos + nNewIMETextLen, nOverwrite );
}
}