From 4c2b298afc84be7558b3d7025c5c80e82c49b0ef Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 18 Mar 2017 13:00:52 +0100 Subject: Use char instead of unsigned char to avoid some reinterpret_cast + prepare to replace some alloca calls + replace C cast by using plain char assignment Change-Id: Iff65b9a324ca1cc936c9effd2b3b71596d6e9b0f Reviewed-on: https://gerrit.libreoffice.org/35398 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/inc/unx/saldisp.hxx | 2 +- vcl/unx/generic/app/saldisp.cxx | 8 ++++---- vcl/unx/generic/window/salframe.cxx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index de4e93cf3950..44e851a8b981 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -327,7 +327,7 @@ public: OUString GetKeyName( sal_uInt16 nKeyCode ) const; sal_uInt16 GetKeyCode( KeySym keysym, char*pcPrintable ) const; KeySym GetKeySym( XKeyEvent *pEvent, - unsigned char *pPrintable, + char *pPrintable, int *pLen, KeySym *pUnmodifiedKeySym, Status *pStatus, diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index c694096b549b..cc119eccd0f4 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -1421,7 +1421,7 @@ sal_uInt16 SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const } KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent, - unsigned char *pPrintable, + char *pPrintable, int *pLen, KeySym *pUnmodifiedKeySym, Status *pStatusReturn, @@ -1442,17 +1442,17 @@ KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent, { // XmbLookupString must not be called for KeyRelease events // Cannot enter space in c locale problem #89616# #88978# btraq #4478197 - *pLen = XLookupString( pEvent, reinterpret_cast(pPrintable), 1, &nKeySym, nullptr ); + *pLen = XLookupString( pEvent, pPrintable, 1, &nKeySym, nullptr ); } else { *pLen = XmbLookupString( aInputContext, - pEvent, reinterpret_cast(pPrintable), *pLen - 1, &nKeySym, pStatusReturn ); + pEvent, pPrintable, *pLen - 1, &nKeySym, pStatusReturn ); // Lookup the string again, now with appropriate size if ( *pStatusReturn == XBufferOverflow ) { - pPrintable[ 0 ] = (char)0; + pPrintable[ 0 ] = '\0'; return 0; } diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index ea6271946b1f..869ce6a1b729 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2993,7 +2993,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) KeySym nKeySym; KeySym nUnmodifiedKeySym; int nLen = 2048; - unsigned char *pPrintable = static_cast(alloca( nLen )); + char *pPrintable = static_cast(alloca( nLen )); // singlebyte code composed by input method, the new default if (mpInputContext != nullptr && mpInputContext->UseContext()) @@ -3007,7 +3007,7 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent ) if ( nStatus == XBufferOverflow ) { nLen *= 2; - pPrintable = static_cast(alloca( nLen )); + pPrintable = static_cast(alloca( nLen )); nKeySym = pDisplay_->GetKeySym( pEvent, pPrintable, &nLen, &nUnmodifiedKeySym, &nStatus, mpInputContext->GetContext() ); -- cgit