diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-10-03 12:44:07 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-10-03 16:30:36 +0200 |
commit | 532a4dcba6ec6fe1bd88f3c2db77f05868167886 (patch) | |
tree | 82857bab5b8914677e0d17a4b668dfcb97b0467e /winaccessibility | |
parent | 372d2d78906aac32ddaf7eaa3c2037ea3d5af1ae (diff) |
Replace more reinterpret_cast with SAL_W/SAL_U
Change-Id: Ia632e4083222ad9e7f17c2ad0d0825f189c700cc
Reviewed-on: https://gerrit.libreoffice.org/43071
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'winaccessibility')
-rw-r--r-- | winaccessibility/source/UAccCOM/AccActionBase.cxx | 5 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/AccImage.cxx | 2 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/AccTable.cxx | 4 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/AccTextBase.cxx | 12 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/MAccessible.cxx | 20 | ||||
-rw-r--r-- | winaccessibility/source/service/AccObject.cxx | 22 |
6 files changed, 28 insertions, 37 deletions
diff --git a/winaccessibility/source/UAccCOM/AccActionBase.cxx b/winaccessibility/source/UAccCOM/AccActionBase.cxx index c873b44115c4..8feee0227c83 100644 --- a/winaccessibility/source/UAccCOM/AccActionBase.cxx +++ b/winaccessibility/source/UAccCOM/AccActionBase.cxx @@ -117,7 +117,7 @@ STDMETHODIMP CAccActionBase::get_description(long actionIndex,BSTR __RPC_FAR *de // #CHECK# SAFE_SYSFREESTRING(*description); - *description = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr())); + *description = SysAllocString(SAL_W(ouStr.getStr())); return S_OK; @@ -176,8 +176,7 @@ STDMETHODIMP CAccActionBase::get_keyBinding( { auto const wString = GetkeyBindingStrByXkeyBinding( (binding.get())->getAccessibleKeyBinding(index) ); - (*keyBinding)[index] = SysAllocString( - reinterpret_cast<wchar_t const *>(wString.getStr())); + (*keyBinding)[index] = SysAllocString(SAL_W(wString.getStr())); } *nBinding = nCount; diff --git a/winaccessibility/source/UAccCOM/AccImage.cxx b/winaccessibility/source/UAccCOM/AccImage.cxx index 4435841ed457..5b0e88fd47d1 100644 --- a/winaccessibility/source/UAccCOM/AccImage.cxx +++ b/winaccessibility/source/UAccCOM/AccImage.cxx @@ -56,7 +56,7 @@ STDMETHODIMP CAccImage::get_description(BSTR * description) ::rtl::OUString ouStr = GetXInterface()->getAccessibleImageDescription(); SAFE_SYSFREESTRING(*description); - *description = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr())); + *description = SysAllocString(SAL_W(ouStr.getStr())); return S_OK; diff --git a/winaccessibility/source/UAccCOM/AccTable.cxx b/winaccessibility/source/UAccCOM/AccTable.cxx index f39fab74431d..6c6aebf32761 100644 --- a/winaccessibility/source/UAccCOM/AccTable.cxx +++ b/winaccessibility/source/UAccCOM/AccTable.cxx @@ -132,7 +132,7 @@ STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description) // #CHECK# SAFE_SYSFREESTRING(*description);//?? - *description = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr())); + *description = SysAllocString(SAL_W(ouStr.getStr())); if(description==nullptr) return E_FAIL; return S_OK; @@ -351,7 +351,7 @@ STDMETHODIMP CAccTable::get_rowDescription(long row, BSTR * description) // #CHECK# SAFE_SYSFREESTRING(*description); - *description = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr())); + *description = SysAllocString(SAL_W(ouStr.getStr())); if(description==nullptr) return E_FAIL; diff --git a/winaccessibility/source/UAccCOM/AccTextBase.cxx b/winaccessibility/source/UAccCOM/AccTextBase.cxx index 0c7a58dbdade..651a1abe5347 100644 --- a/winaccessibility/source/UAccCOM/AccTextBase.cxx +++ b/winaccessibility/source/UAccCOM/AccTextBase.cxx @@ -183,9 +183,7 @@ STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long // #CHECK# if(*textAttributes) SysFreeString(*textAttributes); - *textAttributes = SysAllocString( - reinterpret_cast<wchar_t const *>( - strAttrs.makeStringAndClear().getStr())); + *textAttributes = SysAllocString(SAL_W(strAttrs.makeStringAndClear().getStr())); if( offset < GetXInterface()->getCharacterCount() ) { @@ -493,7 +491,7 @@ STDMETHODIMP CAccTextBase::get_text(long startOffset, long endOffset, BSTR * tex } SysFreeString(*text); - *text = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr())); + *text = SysAllocString(SAL_W(ouStr.getStr())); return S_OK; LEAVE_PROTECTED_BLOCK @@ -578,7 +576,7 @@ STDMETHODIMP CAccTextBase::get_textBeforeOffset(long offset, IA2TextBoundaryType TextSegment segment = GetXInterface()->getTextBeforeIndex( offset, sal_Int16(lUnoBoundaryType)); ::rtl::OUString ouStr = segment.SegmentText; SysFreeString(*text); - *text = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr())); + *text = SysAllocString(SAL_W(ouStr.getStr())); *startOffset = segment.SegmentStart; *endOffset = segment.SegmentEnd; @@ -664,7 +662,7 @@ STDMETHODIMP CAccTextBase::get_textAfterOffset(long offset, IA2TextBoundaryType TextSegment segment = GetXInterface()->getTextBehindIndex( offset, sal_Int16(lUnoBoundaryType)); ::rtl::OUString ouStr = segment.SegmentText; SysFreeString(*text); - *text = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr())); + *text = SysAllocString(SAL_W(ouStr.getStr())); *startOffset = segment.SegmentStart; *endOffset = segment.SegmentEnd; @@ -751,7 +749,7 @@ STDMETHODIMP CAccTextBase::get_textAtOffset(long offset, IA2TextBoundaryType bou TextSegment segment = GetXInterface()->getTextAtIndex( offset, sal_Int16(lUnoBoundaryType)); ::rtl::OUString ouStr = segment.SegmentText; SysFreeString(*text); - *text = SysAllocString(reinterpret_cast<wchar_t const *>(ouStr.getStr())); + *text = SysAllocString(SAL_W(ouStr.getStr())); *startOffset = segment.SegmentStart; *endOffset = segment.SegmentEnd; diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index f0a72faa2d15..4a713760c21c 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -737,8 +737,7 @@ STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT varChild, BSTR *pszKe } SAFE_SYSFREESTRING(*pszKeyboardShortcut); - *pszKeyboardShortcut = SysAllocString( - reinterpret_cast<wchar_t const *>(wString.getStr())); + *pszKeyboardShortcut = SysAllocString(SAL_W(wString.getStr())); return S_OK; } @@ -2959,8 +2958,7 @@ void CMAccessible::ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pv pvData->vt = VT_BSTR; ::rtl::OUString val; rAnyVal >>= val; - pvData->bstrVal = SysAllocString( - reinterpret_cast<wchar_t const *>(val.getStr())); + pvData->bstrVal = SysAllocString(SAL_W(val.getStr())); break; } @@ -3013,7 +3011,7 @@ void CMAccessible::ConvertAnyToVariant(const css::uno::Any &rAnyVal, VARIANT *pv case TypeClass::TypeClass_MAKE_FIXED_SIZE: // Output the type string, if there is other uno value type. pvData->vt = VT_BSTR; - pvData->bstrVal = SysAllocString(reinterpret_cast<wchar_t const *>(rAnyVal.getValueTypeName().getStr())); + pvData->bstrVal = SysAllocString(SAL_W(rAnyVal.getValueTypeName().getStr())); break; default: @@ -3127,12 +3125,9 @@ STDMETHODIMP CMAccessible:: get_locale( IA2Locale __RPC_FAR *locale ) return E_FAIL; css::lang::Locale unoLoc = m_xContext.get()->getLocale(); - locale->language = SysAllocString( - reinterpret_cast<wchar_t const *>(unoLoc.Language.getStr())); - locale->country = SysAllocString( - reinterpret_cast<wchar_t const *>(unoLoc.Country.getStr())); - locale->variant = SysAllocString( - reinterpret_cast<wchar_t const *>(unoLoc.Variant.getStr())); + locale->language = SysAllocString(SAL_W(unoLoc.Language.getStr())); + locale->country = SysAllocString(SAL_W(unoLoc.Country.getStr())); + locale->variant = SysAllocString(SAL_W(unoLoc.Variant.getStr())); return S_OK; @@ -3219,8 +3214,7 @@ STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *pAttr) if(*pAttr) SAFE_SYSFREESTRING(*pAttr); - *pAttr = SysAllocString( - reinterpret_cast<wchar_t const *>(val.getStr())); + *pAttr = SysAllocString(SAL_W(val.getStr())); return S_OK; } diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index ccec26629c23..04f09d7c7725 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -271,7 +271,7 @@ void AccObject::UpdateName( ) } if( ( TEXT_FRAME == m_accRole ) && ( m_pParentObj !=nullptr )&& ( SCROLL_PANE == m_pParentObj -> m_accRole ) ) - m_pIMAcc->Put_XAccName( reinterpret_cast<wchar_t const *>(m_pParentObj->m_xAccContextRef->getAccessibleName().getStr()) ); + m_pIMAcc->Put_XAccName( SAL_W(m_pParentObj->m_xAccContextRef->getAccessibleName().getStr()) ); //IAccessibility2 Implementation 2009----- if ( PARAGRAPH == m_accRole) { @@ -279,7 +279,7 @@ void AccObject::UpdateName( ) } //-----IAccessibility2 Implementation 2009 else - m_pIMAcc->Put_XAccName(reinterpret_cast<wchar_t const *>(m_xAccContextRef->getAccessibleName().getStr())); + m_pIMAcc->Put_XAccName(SAL_W(m_xAccContextRef->getAccessibleName().getStr())); return ; } @@ -296,7 +296,7 @@ void AccObject::UpdateDescription() return; } - m_pIMAcc->Put_XAccDescription(reinterpret_cast<wchar_t const *>(m_xAccContextRef->getAccessibleDescription().getStr())); + m_pIMAcc->Put_XAccDescription(SAL_W(m_xAccContextRef->getAccessibleDescription().getStr())); return ; } @@ -365,7 +365,7 @@ void AccObject::UpdateDefaultAction( ) case CHECK_BOX: case TREE_ITEM: case BUTTON_DROPDOWN: - m_pIMAcc->Put_ActionDescription( reinterpret_cast<wchar_t const *>(m_xAccActionRef->getAccessibleActionDescription((sal_Int32)0).getStr()) ); + m_pIMAcc->Put_ActionDescription( SAL_W(m_xAccActionRef->getAccessibleActionDescription((sal_Int32)0).getStr()) ); return; } } @@ -401,19 +401,19 @@ void AccObject::SetValue( Any pAny ) { val = pRText->getText(); } - m_pIMAcc->Put_XAccValue( reinterpret_cast<wchar_t const *>(val.getStr()) ); + m_pIMAcc->Put_XAccValue( SAL_W(val.getStr()) ); break; case TREE_ITEM: //case CHECK_BOX: //Commented by Li Xing to disable the value for general checkbox case COMBO_BOX: case NOTE: case SCROLL_BAR: - m_pIMAcc->Put_XAccValue( reinterpret_cast<wchar_t const *>(GetMAccessibleValueFromAny(pAny).getStr()) ); + m_pIMAcc->Put_XAccValue( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) ); break ; // Added by Li Xing, only the checkbox in tree should have the value. case CHECK_BOX: if( ( m_pParentObj !=nullptr ) && (TREE == m_pParentObj->m_accRole || TREE_ITEM == m_pParentObj->m_accRole )) - m_pIMAcc->Put_XAccValue( reinterpret_cast<wchar_t const *>(GetMAccessibleValueFromAny(pAny).getStr()) ); + m_pIMAcc->Put_XAccValue( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) ); break; default: break; @@ -499,7 +499,7 @@ void AccObject::SetName( Any pAny) if( nullptr == m_pIMAcc ) return ; - m_pIMAcc->Put_XAccName( reinterpret_cast<wchar_t const *>(GetMAccessibleValueFromAny(pAny).getStr()) ); + m_pIMAcc->Put_XAccName( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) ); } @@ -512,7 +512,7 @@ void AccObject::SetDescription( Any pAny ) { if( nullptr == m_pIMAcc ) return ; - m_pIMAcc->Put_XAccDescription( reinterpret_cast<wchar_t const *>(GetMAccessibleValueFromAny(pAny).getStr()) ); + m_pIMAcc->Put_XAccDescription( SAL_W(GetMAccessibleValueFromAny(pAny).getStr()) ); } /** @@ -754,7 +754,7 @@ void AccObject::UpdateActionDesc() } ::rtl::OUString pXString = m_xAccContextRef->getAccessibleDescription(); - m_pIMAcc->Put_XAccDescription(reinterpret_cast<wchar_t const *>(pXString.getStr())); + m_pIMAcc->Put_XAccDescription(SAL_W(pXString.getStr())); long Role = m_accRole; if( Role == PUSH_BUTTON || Role == RADIO_BUTTON || Role == MENU_ITEM || @@ -776,7 +776,7 @@ void AccObject::UpdateActionDesc() pXString = m_xAccActionRef->getAccessibleActionDescription( 0 ); //Solution: if string length is more than zero, action is set. if( pXString.getLength() > 0) - m_pIMAcc->Put_ActionDescription( reinterpret_cast<wchar_t const *>(pXString.getStr()) ); + m_pIMAcc->Put_ActionDescription( SAL_W(pXString.getStr()) ); } } } |