Kaydet (Commit) c3f4909b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

const_cast: convert some C-style casts and remove some redundant ones

Change-Id: I7b184414d822e7d3f4f7694dcea540d731f970d9
üst b98a8221
......@@ -52,8 +52,8 @@ CollatorImpl::compareSubstring( const OUString& str1, sal_Int32 off1, sal_Int32
if (cachedItem)
return cachedItem->xC->compareSubstring(str1, off1, len1, str2, off2, len2);
sal_Unicode *unistr1 = (sal_Unicode*) str1.getStr() + off1;
sal_Unicode *unistr2 = (sal_Unicode*) str2.getStr() + off2;
sal_Unicode *unistr1 = const_cast<sal_Unicode*>(str1.getStr()) + off1;
sal_Unicode *unistr2 = const_cast<sal_Unicode*>(str2.getStr()) + off2;
for (int i = 0; i < len1 && i < len2; i++)
if (unistr1[i] != unistr2[i])
return unistr1[i] < unistr2[i] ? -1 : 1;
......
......@@ -95,10 +95,10 @@ InputSequenceCheckerImpl::getLanguageByScripType(sal_Unicode cChar, sal_Unicode
if (type != UnicodeScript_kScriptCount &&
type == unicode::getUnicodeScriptType( nChar, typeList, UnicodeScript_kScriptCount )) {
switch(type) {
case UnicodeScript_kThai: return (sal_Char*)"th";
case UnicodeScript_kThai: return const_cast<sal_Char*>("th");
//case UnicodeScript_kArabic: return (sal_Char*)"ar";
//case UnicodeScript_kHebrew: return (sal_Char*)"he";
case UnicodeScript_kDevanagari: return (sal_Char*)"hi";
case UnicodeScript_kDevanagari: return const_cast<sal_Char*>("hi");
}
}
return NULL;
......
......@@ -121,8 +121,8 @@ Transliteration_caseignore::compare(
const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2)
throw(RuntimeException)
{
const sal_Unicode *unistr1 = (sal_Unicode*) str1.getStr() + pos1;
const sal_Unicode *unistr2 = (sal_Unicode*) str2.getStr() + pos2;
const sal_Unicode *unistr1 = const_cast<sal_Unicode*>(str1.getStr()) + pos1;
const sal_Unicode *unistr2 = const_cast<sal_Unicode*>(str2.getStr()) + pos2;
sal_Unicode c1, c2;
MappingElement e1, e2;
nMatch1 = nMatch2 = 0;
......
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