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

More loplugin:cstylecast: pyuno

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: I11e4fde47c5da601e4ffeada31083c3bdb4286f9
üst fe3924a3
......@@ -126,7 +126,7 @@ static void setPythonHome ( const OUString & pythonHome )
// static because Py_SetPythonHome just copies the "wide" pointer
static wchar_t wide[PATH_MAX + 1];
size_t len = mbstowcs(wide, o.pData->buffer, PATH_MAX + 1);
if(len == (size_t)-1)
if(len == size_t(-1))
{
PyErr_SetString(PyExc_SystemError, "invalid multibyte sequence in python home path");
return;
......
......@@ -263,15 +263,15 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
break;
case typelib_TypeClass_BYTE:
buf.append( "0x" );
buf.append( (sal_Int32)*static_cast<sal_Int8 const *>(pVal), 16 );
buf.append( static_cast<sal_Int32>(*static_cast<sal_Int8 const *>(pVal)), 16 );
break;
case typelib_TypeClass_SHORT:
buf.append( "0x" );
buf.append( (sal_Int32)*static_cast<sal_Int16 const *>(pVal), 16 );
buf.append( static_cast<sal_Int32>(*static_cast<sal_Int16 const *>(pVal)), 16 );
break;
case typelib_TypeClass_UNSIGNED_SHORT:
buf.append( "0x" );
buf.append( (sal_Int32)*static_cast<sal_uInt16 const *>(pVal), 16 );
buf.append( static_cast<sal_Int32>(*static_cast<sal_uInt16 const *>(pVal)), 16 );
break;
case typelib_TypeClass_LONG:
buf.append( "0x" );
......@@ -279,7 +279,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
break;
case typelib_TypeClass_UNSIGNED_LONG:
buf.append( "0x" );
buf.append( (sal_Int64)*static_cast<sal_uInt32 const *>(pVal), 16 );
buf.append( static_cast<sal_Int64>(*static_cast<sal_uInt32 const *>(pVal)), 16 );
break;
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
......@@ -356,10 +356,10 @@ int lcl_PySlice_GetIndicesEx( PyObject *pObject, sal_Int32 nLen, sal_Int32 *nSta
return -1;
}
*nStart = (sal_Int32)nStart_ssize;
*nStop = (sal_Int32)nStop_ssize;
*nStep = (sal_Int32)nStep_ssize;
*nSliceLength = (sal_Int32)nSliceLength_ssize;
*nStart = static_cast<sal_Int32>(nStart_ssize);
*nStop = static_cast<sal_Int32>(nStop_ssize);
*nStep = static_cast<sal_Int32>(nStep_ssize);
*nSliceLength = static_cast<sal_Int32>(nSliceLength_ssize);
return 0;
}
......@@ -1013,7 +1013,7 @@ int lcl_setitem_slice( PyUNO const *me, PyObject *pKey, PyObject *pValue )
PyErr_SetString( PyExc_ValueError, "tuple too large" );
return 1;
}
sal_Int32 nTupleLength = (sal_Int32)nTupleLength_ssize;
sal_Int32 nTupleLength = static_cast<sal_Int32>(nTupleLength_ssize);
if ( (nTupleLength != nSliceLength) && (nStep != 1) )
{
......
......@@ -158,7 +158,7 @@ Sequence< sal_Int16 > Adapter::getOutIndexes( const OUString & functionName )
if( seqInfo[i].aMode == css::reflection::ParamMode_OUT ||
seqInfo[i].aMode == css::reflection::ParamMode_INOUT )
{
ret[nOutsAssigned] = (sal_Int16) i;
ret[nOutsAssigned] = static_cast<sal_Int16>(i);
nOutsAssigned ++;
}
}
......
......@@ -658,7 +658,7 @@ static PyObject *systemPathToFileUrl(
buf.append( "Couldn't convert " );
buf.append( sysPath );
buf.append( " to a file url for reason (" );
buf.append( (sal_Int32) e );
buf.append( static_cast<sal_Int32>(e) );
buf.append( ")" );
raisePyExceptionWithAny(
makeAny( RuntimeException( buf.makeStringAndClear() )));
......@@ -684,7 +684,7 @@ static PyObject * fileUrlToSystemPath(
buf.append( "Couldn't convert file url " );
buf.append( sysPath );
buf.append( " to a system path for reason (" );
buf.append( (sal_Int32) e );
buf.append( static_cast<sal_Int32>(e) );
buf.append( ")" );
raisePyExceptionWithAny(
makeAny( RuntimeException( buf.makeStringAndClear() )));
......@@ -709,7 +709,7 @@ static PyObject * absolutize( SAL_UNUSED_PARAMETER PyObject *, PyObject * args )
buf.append( " using root " );
buf.append( ouPath );
buf.append( " for reason (" );
buf.append( (sal_Int32) e );
buf.append( static_cast<sal_Int32>(e) );
buf.append( ")" );
PyErr_SetString(
......
......@@ -680,21 +680,21 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
else
{
#endif /* PY_MAJOR_VERSION >= 3 */
sal_Int64 l = (sal_Int64)PyLong_AsLong (o);
sal_Int64 l = static_cast<sal_Int64>(PyLong_AsLong (o));
if( l < 128 && l >= -128 )
{
sal_Int8 b = (sal_Int8 ) l;
sal_Int8 b = static_cast<sal_Int8>(l);
a <<= b;
}
else if( l <= 0x7fff && l >= -0x8000 )
{
sal_Int16 s = (sal_Int16) l;
sal_Int16 s = static_cast<sal_Int16>(l);
a <<= s;
}
else if( l <= SAL_CONST_INT64(0x7fffffff) &&
l >= -SAL_CONST_INT64(0x80000000) )
{
sal_Int32 l32 = (sal_Int32) l;
sal_Int32 l32 = static_cast<sal_Int32>(l);
a <<= l32;
}
else
......
......@@ -141,7 +141,7 @@ sal_Unicode PyChar2Unicode( PyObject *obj )
"uno.Char contains an empty unicode string");
}
sal_Unicode c = (sal_Unicode)PyUnicode_AsUnicode( value.get() )[0];
sal_Unicode c = static_cast<sal_Unicode>(PyUnicode_AsUnicode( value.get() )[0]);
return c;
}
......
......@@ -140,7 +140,7 @@ void log( RuntimeCargo * cargo, sal_Int32 level, const char *str )
localDateTime.NanoSeconds/1000000),
strLevel[level],
sal::static_int_cast< long >(
(sal_Int32) osl::Thread::getCurrentIdentifier()),
static_cast<sal_Int32>(osl::Thread::getCurrentIdentifier())),
str );
}
}
......
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