summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-12 20:15:18 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-12 20:15:18 +0100
commitd76f636cc41df3618962aac44ef989f13d4680b8 (patch)
treec3f85dfe49409139a6ab34ae5c2950258d508b20 /stoc
parent0b0a6e9b4d99a647d12b25f608150bf652d3f9da (diff)
More loplugin:cstylecast: stoc
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I2a9c00b7c0427a99597a7aead6d77d370a507da8
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/corereflection/criface.cxx2
-rw-r--r--stoc/source/inspect/introspection.cxx10
-rw-r--r--stoc/source/invocation/invocation.cxx4
-rw-r--r--stoc/source/javavm/javavm.cxx6
-rw-r--r--stoc/source/typeconv/convert.cxx48
5 files changed, 35 insertions, 35 deletions
diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx
index fddaff0b4b6a..28ac96e37504 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -663,7 +663,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
+ " expected: \"" + OUString(pTD->pTypeName)
+ "\" actual: \"" + OUString(pCppArgs[nPos].getValueTypeRef()->pTypeName)
+ "\"",
- *o3tl::doAccess<Reference<XInterface>>(rObj), (sal_Int16)nPos );
+ *o3tl::doAccess<Reference<XInterface>>(rObj), static_cast<sal_Int16>(nPos) );
// cleanup
while (nPos--)
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 67d2226a286b..6088a65e266b 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -626,7 +626,7 @@ Any IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any& obj, sal_
// Helper method to adjust the size of the vectors
void IntrospectionAccessStatic_Impl::checkPropertyArraysSize( sal_Int32 iNextIndex )
{
- sal_Int32 nLen = (sal_Int32)maAllPropertySeq.size();
+ sal_Int32 nLen = static_cast<sal_Int32>(maAllPropertySeq.size());
if( iNextIndex >= nLen )
{
maAllPropertySeq.resize( nLen + ARRAY_SIZE_STEP );
@@ -1308,7 +1308,7 @@ Sequence< Property > ImplIntrospectionAccess::getProperties(sal_Int32 PropertyCo
// Go through all the properties and apply according to the concept
const std::vector<Property>& rPropSeq = mpStaticImpl->getProperties();
const std::vector<sal_Int32>& rConcepts = mpStaticImpl->getPropertyConcepts();
- sal_Int32 nLen = (sal_Int32)rPropSeq.size();
+ sal_Int32 nLen = static_cast<sal_Int32>(rPropSeq.size());
sal_Int32 iDest = 0;
for( sal_Int32 i = 0 ; i < nLen ; i++ )
@@ -1379,7 +1379,7 @@ Sequence< Reference<XIdlMethod> > ImplIntrospectionAccess::getMethods(sal_Int32
// Get method sequences
const std::vector< Reference<XIdlMethod> >& aMethodSeq = mpStaticImpl->getMethods();
- sal_Int32 nLen = (sal_Int32)aMethodSeq.size();
+ sal_Int32 nLen = static_cast<sal_Int32>(aMethodSeq.size());
// Realloc sequence according to the required number
// Unlike Properties, the number can not be determined by counters in
@@ -1687,7 +1687,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
{
SupportedClassSeq.resize( nTypeCount );
- for( i = 0 ; i < (sal_Int32)nTypeCount ; i++ )
+ for( i = 0 ; i < static_cast<sal_Int32>(nTypeCount) ; i++ )
SupportedClassSeq[i] = reflection->forName( SupportedTypesSeq[i].getTypeName() );
}
@@ -1767,7 +1767,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect(
bool bFoundXInterface = false;
size_t nClassCount = SupportedClassSeq.size();
- for( sal_Int32 nIdx = 0 ; nIdx < (sal_Int32)nClassCount; nIdx++ )
+ for( sal_Int32 nIdx = 0 ; nIdx < static_cast<sal_Int32>(nClassCount); nIdx++ )
{
Reference<XIdlClass> xImplClass2 = SupportedClassSeq[nIdx];
while( xImplClass2.is() )
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index fa75e1dbf94b..f639e55bdee8 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -609,7 +609,7 @@ Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>&
throw IllegalArgumentException(
"incorrect number of parameters passed invoking function " + FunctionName +
"expected " + OUString::number(nFParamsLen) + ", got " + OUString::number(InParams.getLength()),
- static_cast<OWeakObject *>(this), (sal_Int16) 1 );
+ static_cast<OWeakObject *>(this), sal_Int16(1) );
}
// IN Parameter
@@ -655,7 +655,7 @@ Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>&
// is OUT/INOUT parameter?
if (rFParam.aMode != ParamMode_IN)
{
- pOutIndices[nOutIndex] = (sal_Int16)nPos;
+ pOutIndices[nOutIndex] = static_cast<sal_Int16>(nPos);
if (rFParam.aMode == ParamMode_OUT)
rDestType->createObject( pInvokeParams[nPos] ); // default init
++nOutIndex;
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index b03834ea46bc..6a6652390683 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -490,7 +490,7 @@ void getJavaPropsFromSafetySettings(
"VirtualMachine/Security");
if( key_CheckSecurity.is())
{
- bool val = (bool) key_CheckSecurity->getLongValue();
+ bool val = static_cast<bool>(key_CheckSecurity->getLongValue());
OUString sProperty("stardiv.security.disableSecurity=");
if( val)
sProperty= sProperty + "false";
@@ -1305,7 +1305,7 @@ void JavaVirtualMachine::registerConfigChangesListener()
css::uno::Sequence<css::uno::Any> aArguments(comphelper::InitAnyPropertySequence(
{
{"nodepath", css::uno::Any(OUString("org.openoffice.Inet/Settings"))},
- {"depth", css::uno::Any((sal_Int32)-1)}
+ {"depth", css::uno::Any(sal_Int32(-1))}
}));
m_xInetConfiguration.set(
xConfigProvider->createInstanceWithArguments(
@@ -1320,7 +1320,7 @@ void JavaVirtualMachine::registerConfigChangesListener()
css::uno::Sequence<css::uno::Any> aArguments2(comphelper::InitAnyPropertySequence(
{
{"nodepath", css::uno::Any(OUString("org.openoffice.Office.Java/VirtualMachine"))},
- {"depth", css::uno::Any((sal_Int32)-1)} // depth: -1 means unlimited
+ {"depth", css::uno::Any(sal_Int32(-1))} // depth: -1 means unlimited
}));
m_xJavaConfiguration.set(
xConfigProvider->createInstanceWithArguments(
diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx
index c5ceaaa7a13c..e3844d19feda 100644
--- a/stoc/source/typeconv/convert.cxx
+++ b/stoc/source/typeconv/convert.cxx
@@ -56,11 +56,11 @@ namespace stoc_tcv
{
static const sal_uInt64 SAL_UINT64_MAX =
- ((((sal_uInt64)0xffffffff) << 32) | (sal_uInt64)0xffffffff);
+ (((sal_uInt64(0xffffffff)) << 32) | sal_uInt64(0xffffffff));
static const sal_Int64 SAL_INT64_MAX =
- (sal_Int64)((((sal_uInt64)0x7fffffff) << 32) | (sal_uInt64)0xffffffff);
+ sal_Int64(((sal_uInt64(0x7fffffff)) << 32) | sal_uInt64(0xffffffff));
static const sal_Int64 SAL_INT64_MIN =
- (sal_Int64)(((sal_uInt64)0x80000000) << 32);
+ sal_Int64((sal_uInt64(0x80000000)) << 32);
/* MS Visual C++ no conversion from unsigned __int64 to double */
#ifdef _MSC_VER
@@ -74,11 +74,11 @@ static inline double unsigned_int64_to_double( sal_uInt64 n )
}
#else
static const double DOUBLE_SAL_UINT64_MAX =
- (double)((((sal_uInt64)0xffffffff) << 32) | (sal_uInt64)0xffffffff);
+ double(((sal_uInt64(0xffffffff)) << 32) | sal_uInt64(0xffffffff));
static inline double unsigned_int64_to_double( sal_uInt64 n )
{
- return (double)n;
+ return static_cast<double>(n);
}
#endif
@@ -142,7 +142,7 @@ static bool getNumericValue( double & rfVal, const OUString & rStr )
}
}
- rfVal = (bNeg ? -(double)nRet : (double)nRet);
+ rfVal = (bNeg ? -static_cast<double>(nRet) : static_cast<double>(nRet));
return true;
}
@@ -231,10 +231,10 @@ static bool getHyperValue( sal_Int64 & rnVal, const OUString & rStr )
double fVal;
if (getNumericValue( fVal, rStr ) &&
- fVal >= (double)SAL_INT64_MIN &&
+ fVal >= double(SAL_INT64_MIN) &&
fVal <= DOUBLE_SAL_UINT64_MAX)
{
- rnVal = (sal_Int64)round( fVal );
+ rnVal = static_cast<sal_Int64>(round( fVal ));
return true;
}
return false;
@@ -331,8 +331,8 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6
case TypeClass_UNSIGNED_HYPER:
{
nRet = static_cast<sal_Int64>(*o3tl::forceAccess<sal_uInt64>(rAny));
- if ((min < 0 || (sal_uInt64)nRet >= (sal_uInt64)min) && // lower bound
- (sal_uInt64)nRet <= max) // upper bound
+ if ((min < 0 || static_cast<sal_uInt64>(nRet) >= static_cast<sal_uInt64>(min)) && // lower bound
+ static_cast<sal_uInt64>(nRet) <= max) // upper bound
{
return nRet;
}
@@ -345,7 +345,7 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6
case TypeClass_FLOAT:
{
double fVal = round( *o3tl::forceAccess<float>(rAny) );
- nRet = (fVal > SAL_INT64_MAX ? (sal_Int64)(sal_uInt64)fVal : (sal_Int64)fVal);
+ nRet = (fVal > SAL_INT64_MAX ? static_cast<sal_Int64>(static_cast<sal_uInt64>(fVal)) : static_cast<sal_Int64>(fVal));
if (fVal >= min && fVal <= unsigned_int64_to_double( max ))
{
return nRet;
@@ -357,7 +357,7 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6
case TypeClass_DOUBLE:
{
double fVal = round( *o3tl::forceAccess<double>(rAny) );
- nRet = (fVal > SAL_INT64_MAX ? (sal_Int64)(sal_uInt64)fVal : (sal_Int64)fVal);
+ nRet = (fVal > SAL_INT64_MAX ? static_cast<sal_Int64>(static_cast<sal_uInt64>(fVal)) : static_cast<sal_Int64>(fVal));
if (fVal >= min && fVal <= unsigned_int64_to_double( max ))
{
return nRet;
@@ -378,7 +378,7 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6
Reference<XInterface>(), aDestinationClass, FailReason::IS_NOT_NUMBER, 0 );
}
nRet = nVal;
- if (nVal >= min && (nVal < 0 || ((sal_uInt64)nVal) <= max))
+ if (nVal >= min && (nVal < 0 || static_cast<sal_uInt64>(nVal) <= max))
return nRet;
throw CannotConvertException(
"STRING value out of range!",
@@ -391,7 +391,7 @@ sal_Int64 TypeConverter_Impl::toHyper( const Any& rAny, sal_Int64 min, sal_uInt6
Reference<XInterface>(), aDestinationClass, FailReason::TYPE_NOT_SUPPORTED, 0 );
}
- if (nRet >= min && (nRet < 0 || (sal_uInt64)nRet <= max))
+ if (nRet >= min && (nRet < 0 || static_cast<sal_uInt64>(nRet) <= max))
return nRet;
throw CannotConvertException(
"VALUE is out of range!",
@@ -439,7 +439,7 @@ double TypeConverter_Impl::toDouble( const Any& rAny, double min, double max )
break;
// HYPER
case TypeClass_HYPER:
- fRet = (double)*o3tl::forceAccess<sal_Int64>(rAny);
+ fRet = static_cast<double>(*o3tl::forceAccess<sal_Int64>(rAny));
break;
// UNSIGNED HYPER
case TypeClass_UNSIGNED_HYPER:
@@ -625,7 +625,7 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy
aSourceClass!=TypeClass_BOOLEAN &&
aSourceClass!=TypeClass_CHAR)
{
- sal_Int32 nEnumValue = (sal_Int32)toHyper( rVal, -(sal_Int64)0x80000000, 0x7fffffff );
+ sal_Int32 nEnumValue = static_cast<sal_Int32>(toHyper( rVal, -sal_Int64(0x80000000), 0x7fffffff ));
for ( nPos = reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->nEnumValues; nPos--; )
{
if (nEnumValue == reinterpret_cast<typelib_EnumTypeDescription *>(aEnumTD.get())->pEnumValues[nPos])
@@ -692,7 +692,7 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina
default:
throw IllegalArgumentException(
"destination type is not simple!",
- Reference< XInterface >(), (sal_Int16) 1 );
+ Reference< XInterface >(), sal_Int16(1) );
}
const Type& aSourceType = rVal.getValueType();
@@ -761,23 +761,23 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina
break;
}
case TypeClass_BYTE:
- aRet <<= (sal_Int8)( toHyper( rVal, -(sal_Int64)0x80, 0x7f ) );
+ aRet <<= static_cast<sal_Int8>( toHyper( rVal, -sal_Int64(0x80), 0x7f ) );
break;
// --- to SHORT, UNSIGNED SHORT -------------------------------------------------------------
case TypeClass_SHORT:
- aRet <<= (sal_Int16)( toHyper( rVal, -(sal_Int64)0x8000, 0x7fff ) );
+ aRet <<= static_cast<sal_Int16>( toHyper( rVal, -sal_Int64(0x8000), 0x7fff ) );
break;
case TypeClass_UNSIGNED_SHORT:
- aRet <<= (sal_uInt16)( toHyper( rVal, 0, 0xffff ) );
+ aRet <<= static_cast<sal_uInt16>( toHyper( rVal, 0, 0xffff ) );
break;
// --- to LONG, UNSIGNED LONG ---------------------------------------------------------------
case TypeClass_LONG:
- aRet <<= (sal_Int32)( toHyper( rVal, -(sal_Int64)0x80000000, 0x7fffffff ) );
+ aRet <<= static_cast<sal_Int32>( toHyper( rVal, -sal_Int64(0x80000000), 0x7fffffff ) );
break;
case TypeClass_UNSIGNED_LONG:
- aRet <<= (sal_uInt32)( toHyper( rVal, 0, 0xffffffff ) );
+ aRet <<= static_cast<sal_uInt32>( toHyper( rVal, 0, 0xffffffff ) );
break;
// --- to HYPER, UNSIGNED HYPER--------------------------------------------
@@ -785,12 +785,12 @@ Any TypeConverter_Impl::convertToSimpleType( const Any& rVal, TypeClass aDestina
aRet <<= toHyper( rVal, SAL_INT64_MIN, SAL_INT64_MAX );
break;
case TypeClass_UNSIGNED_HYPER:
- aRet <<= (sal_uInt64)( toHyper( rVal, 0 ) );
+ aRet <<= static_cast<sal_uInt64>( toHyper( rVal, 0 ) );
break;
// --- to FLOAT, DOUBLE ---------------------------------------------------------------------
case TypeClass_FLOAT:
- aRet <<= (float)( toDouble( rVal, -FLT_MAX, FLT_MAX ) );
+ aRet <<= static_cast<float>( toDouble( rVal, -FLT_MAX, FLT_MAX ) );
break;
case TypeClass_DOUBLE:
aRet <<= toDouble( rVal, -DBL_MAX, DBL_MAX );