summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-14 16:53:58 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-10-16 14:18:30 +0000
commit941049c9da2b7ba5a589c6c2658b43ff53fe2e50 (patch)
treebedb35d77267981c3989962d26f7ccee6dcaa261 /pyuno
parent4cfb22aaf50f93019ee888e84a2db2efd048b894 (diff)
clang-cl loplugin: pyuno
Change-Id: Ic093b58be1f2b78d904d6d036b52532f97c3b336 Reviewed-on: https://gerrit.libreoffice.org/29857 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/module/pyuno_util.cxx4
-rw-r--r--pyuno/zipcore/python.cxx28
2 files changed, 16 insertions, 16 deletions
diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx
index ede4cd6f01c0..e61ff77cfd7f 100644
--- a/pyuno/source/module/pyuno_util.cxx
+++ b/pyuno/source/module/pyuno_util.cxx
@@ -40,7 +40,7 @@ PyRef ustring2PyUnicode( const OUString & str )
PyRef ret;
#if Py_UNICODE_SIZE == 2
// YD force conversion since python/2 uses wchar_t
- ret = PyRef( PyUnicode_FromUnicode( (const Py_UNICODE*)str.getStr(), str.getLength() ), SAL_NO_ACQUIRE );
+ ret = PyRef( PyUnicode_FromUnicode( str.getStr(), str.getLength() ), SAL_NO_ACQUIRE );
#else
OString sUtf8(OUStringToOString(str, RTL_TEXTENCODING_UTF8));
ret = PyRef( PyUnicode_DecodeUTF8( sUtf8.getStr(), sUtf8.getLength(), nullptr) , SAL_NO_ACQUIRE );
@@ -60,7 +60,7 @@ OUString pyString2ustring( PyObject *pystr )
if( PyUnicode_Check( pystr ) )
{
#if Py_UNICODE_SIZE == 2
- ret = OUString( (sal_Unicode * ) PyUnicode_AS_UNICODE( pystr ) );
+ ret = OUString( PyUnicode_AS_UNICODE( pystr ) );
#else
#if PY_MAJOR_VERSION >= 3
Py_ssize_t size(0);
diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx
index 239f31546533..b67b17f28f4f 100644
--- a/pyuno/zipcore/python.cxx
+++ b/pyuno/zipcore/python.cxx
@@ -75,13 +75,13 @@ int main(int argc, char ** argv, char **) {
int wmain(int argc, wchar_t ** argv, wchar_t **) {
#endif
wchar_t path[MAX_PATH];
- DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH);
+ DWORD n = GetModuleFileNameW(nullptr, path, MAX_PATH);
if (n == 0 || n >= MAX_PATH) {
exit(EXIT_FAILURE);
}
wchar_t * pathEnd = tools::filename(path);
*pathEnd = L'\0';
- n = GetEnvironmentVariableW(L"UNO_PATH", NULL, 0);
+ n = GetEnvironmentVariableW(L"UNO_PATH", nullptr, 0);
if (n == 0) {
if (GetLastError() != ERROR_ENVVAR_NOT_FOUND ||
!SetEnvironmentVariableW(L"UNO_PATH", path))
@@ -94,21 +94,21 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
wchar_t * bootstrapEnd = tools::buildPath(
bootstrap + MY_LENGTH(L"vnd.sun.star.pathname:"), path, pathEnd,
MY_STRING(L"fundamental.ini"));
- if (bootstrapEnd == NULL) {
+ if (bootstrapEnd == nullptr) {
exit(EXIT_FAILURE);
}
wchar_t pythonpath2[MAX_PATH];
wchar_t * pythonpath2End = tools::buildPath(
pythonpath2, path, pathEnd,
MY_STRING(L"\\python-core-" PYTHON_VERSION_STRING L"\\lib"));
- if (pythonpath2End == NULL) {
+ if (pythonpath2End == nullptr) {
exit(EXIT_FAILURE);
}
wchar_t pythonpath3[MAX_PATH];
wchar_t * pythonpath3End = tools::buildPath(
pythonpath3, path, pathEnd,
MY_STRING(L"\\python-core-" PYTHON_VERSION_STRING L"\\lib\\site-packages"));
- if (pythonpath3End == NULL) {
+ if (pythonpath3End == nullptr) {
exit(EXIT_FAILURE);
}
#ifdef __MINGW32__
@@ -123,14 +123,14 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
wchar_t pythonhome[MAX_PATH];
wchar_t * pythonhomeEnd = tools::buildPath(
pythonhome, path, pathEnd, MY_STRING(L"\\python-core-" PYTHON_VERSION_STRING));
- if (pythonhomeEnd == NULL) {
+ if (pythonhomeEnd == nullptr) {
exit(EXIT_FAILURE);
}
wchar_t pythonexe[MAX_PATH];
wchar_t * pythonexeEnd = tools::buildPath(
pythonexe, path, pathEnd,
MY_STRING(L"\\python-core-" PYTHON_VERSION_STRING L"\\bin\\python.exe"));
- if (pythonexeEnd == NULL) {
+ if (pythonexeEnd == nullptr) {
exit(EXIT_FAILURE);
}
std::size_t clSize = MY_LENGTH(L"\"") + 4 * (pythonexeEnd - pythonexe) +
@@ -161,13 +161,13 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
#endif
}
*cp = L'\0';
- n = GetEnvironmentVariableW(L"PATH", NULL, 0);
+ n = GetEnvironmentVariableW(L"PATH", nullptr, 0);
wchar_t * orig;
if (n == 0) {
if (GetLastError() != ERROR_ENVVAR_NOT_FOUND) {
exit(EXIT_FAILURE);
}
- orig = (wchar_t *)L"";
+ orig = const_cast<wchar_t *>(L"");
} else {
orig = new wchar_t[n];
if (GetEnvironmentVariableW(L"PATH", orig, n) != n - 1)
@@ -188,12 +188,12 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
delete [] orig;
}
delete [] value;
- n = GetEnvironmentVariableW(L"PYTHONPATH", NULL, 0);
+ n = GetEnvironmentVariableW(L"PYTHONPATH", nullptr, 0);
if (n == 0) {
if (GetLastError() != ERROR_ENVVAR_NOT_FOUND) {
exit(EXIT_FAILURE);
}
- orig = (wchar_t *)L"";
+ orig = const_cast<wchar_t *>(L"");
} else {
orig = new wchar_t[n];
if (GetEnvironmentVariableW(L"PYTHONPATH", orig, n) != n - 1)
@@ -229,7 +229,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
if (!SetEnvironmentVariableW(L"PYTHONHOME", pythonhome)) {
exit(EXIT_FAILURE);
}
- n = GetEnvironmentVariableW(L"URE_BOOTSTRAP", NULL, 0);
+ n = GetEnvironmentVariableW(L"URE_BOOTSTRAP", nullptr, 0);
if (n == 0) {
if (GetLastError() != ERROR_ENVVAR_NOT_FOUND ||
!SetEnvironmentVariableW(L"URE_BOOTSTRAP", bootstrap))
@@ -242,8 +242,8 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) {
startinfo.cb = sizeof (STARTUPINFOW);
PROCESS_INFORMATION procinfo;
if (!CreateProcessW(
- pythonexe, cl, NULL, NULL, FALSE, CREATE_UNICODE_ENVIRONMENT, NULL,
- NULL, &startinfo, &procinfo)) {
+ pythonexe, cl, nullptr, nullptr, FALSE, CREATE_UNICODE_ENVIRONMENT, nullptr,
+ nullptr, &startinfo, &procinfo)) {
exit(EXIT_FAILURE);
}
WaitForSingleObject(procinfo.hProcess,INFINITE);