[Libreoffice-commits] core.git: 5 commits - idlc/source jvmfwk/plugins jvmfwk/source odk/source opencl/inc pyuno/source pyuno/zipcore
Stephan Bergmann
sbergman at redhat.com
Sun Oct 16 14:18:59 UTC 2016
idlc/source/idlcproduce.cxx | 2
jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 12 +-
jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 10 +-
jvmfwk/source/framework.cxx | 4
jvmfwk/source/fwkutil.cxx | 12 +-
odk/source/unowinreg/win/unowinreg.cxx | 90 +++++++++-----------
opencl/inc/opencl_device_selection.h | 2
pyuno/source/module/pyuno_util.cxx | 4
pyuno/zipcore/python.cxx | 28 +++---
9 files changed, 80 insertions(+), 84 deletions(-)
New commits:
commit 8b984dae44fba9a49448e19699261703be55d197
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 14 16:54:38 2016 +0200
clang-cl loplugin: idlc
Change-Id: Idcd117aa896779bb5ebdfa33c24d5e374dd943cf
Reviewed-on: https://gerrit.libreoffice.org/29861
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
Tested-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx
index 32e53db..ab4e52c 100644
--- a/idlc/source/idlcproduce.cxx
+++ b/idlc/source/idlcproduce.cxx
@@ -71,7 +71,7 @@ static bool checkOutputPath(const OString& completeName)
#if defined(SAL_UNX)
if (mkdir(buffer.getStr(), 0777) == -1)
#else
- if (mkdir((char*)buffer.getStr()) == -1)
+ if (mkdir(buffer.getStr()) == -1)
#endif
{
if (errno == ENOENT)
commit 1ccc7c425b47e1eaeca9463cb4367afd72fe1656
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 14 16:54:24 2016 +0200
clang-cl loplugin: jvmfwk
Change-Id: I4ae0795469e70d6be3d2052d96a2f0dad3920d8b
Reviewed-on: https://gerrit.libreoffice.org/29860
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 43ddc82..5053fda 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -538,7 +538,7 @@ static void load_msvcr(LPCWSTR jvm_dll, wchar_t const* msvcr)
// and just let the implicit loading try to take care of it.
static void do_msvcr_magic(rtl_uString *jvm_dll)
{
- rtl_uString* Module(0);
+ rtl_uString* Module(nullptr);
struct stat st;
oslFileError nError = osl_getSystemPathFromFileURL(jvm_dll, &Module);
@@ -557,7 +557,7 @@ static void do_msvcr_magic(rtl_uString *jvm_dll)
return;
}
- PIMAGE_DOS_HEADER dos_hdr = (PIMAGE_DOS_HEADER) malloc(st.st_size);
+ PIMAGE_DOS_HEADER dos_hdr = static_cast<PIMAGE_DOS_HEADER>(malloc(st.st_size));
if (fread(dos_hdr, st.st_size, 1, f) != 1 ||
memcmp(dos_hdr, "MZ", 2) != 0 ||
@@ -571,7 +571,7 @@ static void do_msvcr_magic(rtl_uString *jvm_dll)
fclose(f);
- IMAGE_NT_HEADERS *nt_hdr = (IMAGE_NT_HEADERS *) ((char *)dos_hdr + dos_hdr->e_lfanew);
+ IMAGE_NT_HEADERS *nt_hdr = reinterpret_cast<IMAGE_NT_HEADERS *>(reinterpret_cast<char *>(dos_hdr) + dos_hdr->e_lfanew);
DWORD importsVA = nt_hdr->OptionalHeader
.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
@@ -595,9 +595,9 @@ static void do_msvcr_magic(rtl_uString *jvm_dll)
return;
}
IMAGE_IMPORT_DESCRIPTOR *imports =
- (IMAGE_IMPORT_DESCRIPTOR *) ((char *) dos_hdr + importsVA + VAtoPhys);
+ reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR *>(reinterpret_cast<char *>(dos_hdr) + importsVA + VAtoPhys);
- while (imports <= (IMAGE_IMPORT_DESCRIPTOR *) ((char *) dos_hdr + st.st_size - sizeof (IMAGE_IMPORT_DESCRIPTOR)) &&
+ while (imports <= reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR *>(reinterpret_cast<char *>(dos_hdr) + st.st_size - sizeof (IMAGE_IMPORT_DESCRIPTOR)) &&
imports->Name != 0 &&
imports->Name + VAtoPhys < (DWORD) st.st_size)
{
@@ -606,7 +606,7 @@ static void do_msvcr_magic(rtl_uString *jvm_dll)
{ "msvcr71.dll" , L"msvcr71.dll" },
{ "msvcr100.dll", L"msvcr100.dll" },
};
- char const* importName = (char *) dos_hdr + imports->Name + VAtoPhys;
+ char const* importName = reinterpret_cast<char *>(dos_hdr) + imports->Name + VAtoPhys;
for (size_t i = 0; i < SAL_N_ELEMENTS(msvcrts); ++i)
{
if (0 == strnicmp(importName,
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index 9fe444c..153a939 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -621,7 +621,7 @@ bool getJavaInfoFromRegistry(const wchar_t* szRegKey,
DWORD nNameLen = sizeof(bufVersion);
// Iterate over all subkeys of HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment
- while (RegEnumKeyExW(hRoot, dwIndex, bufVersion, &nNameLen, NULL, NULL, NULL, &fileTime) != ERROR_NO_MORE_ITEMS)
+ while (RegEnumKeyExW(hRoot, dwIndex, bufVersion, &nNameLen, nullptr, nullptr, nullptr, &fileTime) != ERROR_NO_MORE_ITEMS)
{
HKEY hKey;
// Open a Java Runtime Environment sub key, e.g. "1.4.0"
@@ -631,14 +631,14 @@ bool getJavaInfoFromRegistry(const wchar_t* szRegKey,
DWORD dwTmpPathLen= 0;
// Get the path to the JavaHome every JRE entry
// Find out how long the string for JavaHome is and allocate memory to hold the path
- if( RegQueryValueExW(hKey, L"JavaHome", 0, &dwType, NULL, &dwTmpPathLen)== ERROR_SUCCESS)
+ if( RegQueryValueExW(hKey, L"JavaHome", nullptr, &dwType, nullptr, &dwTmpPathLen)== ERROR_SUCCESS)
{
- char* szTmpPath= (char *) malloc( dwTmpPathLen);
+ unsigned char* szTmpPath= static_cast<unsigned char *>(malloc( dwTmpPathLen));
// Get the path for the runtime lib
- if(RegQueryValueExW(hKey, L"JavaHome", 0, &dwType, (unsigned char*) szTmpPath, &dwTmpPathLen) == ERROR_SUCCESS)
+ if(RegQueryValueExW(hKey, L"JavaHome", nullptr, &dwType, szTmpPath, &dwTmpPathLen) == ERROR_SUCCESS)
{
// There can be several version entries referring with the same JavaHome,e.g 1.4 and 1.4.1
- OUString usHome((sal_Unicode*) szTmpPath);
+ OUString usHome(reinterpret_cast<sal_Unicode*>(szTmpPath));
// check if there is already an entry with the same JavaHomeruntime lib
// if so, we use the one with the more accurate version
OUString usHomeUrl;
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index bf174e3..81fd3fc 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -244,11 +244,11 @@ javaFrameworkError jfw_startVM(
{
// If no JRE has been selected then we do not select one. This function shall then
//return JFW_E_NO_SELECT
- if (aInfo != NULL &&
+ if (aInfo != nullptr &&
(aInfo->nFeatures & JFW_FEATURE_ACCESSBRIDGE) == 0)
{
//has the user manually selected a JRE?
- if (settings.getJavaInfoAttrAutoSelect() == true)
+ if (settings.getJavaInfoAttrAutoSelect())
{
// if not then the automatism has previously selected a JRE
//without accessibility support. We return JFW_E_NO_SELECT
diff --git a/jvmfwk/source/fwkutil.cxx b/jvmfwk/source/fwkutil.cxx
index 8bbcf60..a777278 100644
--- a/jvmfwk/source/fwkutil.cxx
+++ b/jvmfwk/source/fwkutil.cxx
@@ -63,7 +63,7 @@ bool isAccessibilitySupportDesired()
#ifdef _WIN32
bool retVal = false;
- HKEY hKey = 0;
+ HKEY hKey = nullptr;
if (RegOpenKeyEx(HKEY_CURRENT_USER,
"Software\\LibreOffice\\Accessibility\\AtToolSupport",
0, KEY_READ, &hKey) == ERROR_SUCCESS)
@@ -71,16 +71,16 @@ bool isAccessibilitySupportDesired()
DWORD dwType = 0;
DWORD dwLen = 16;
unsigned char arData[16];
- if( RegQueryValueEx(hKey, "SupportAssistiveTechnology", NULL, &dwType, arData,
+ if( RegQueryValueEx(hKey, "SupportAssistiveTechnology", nullptr, &dwType, arData,
& dwLen)== ERROR_SUCCESS)
{
if (dwType == REG_SZ)
{
- if (strcmp((char*) arData, "true") == 0
- || strcmp((char*) arData, "1") == 0)
+ if (strcmp(reinterpret_cast<char*>(arData), "true") == 0
+ || strcmp(reinterpret_cast<char*>(arData), "1") == 0)
retVal = true;
- else if (strcmp((char*) arData, "false") == 0
- || strcmp((char*) arData, "0") == 0)
+ else if (strcmp(reinterpret_cast<char*>(arData), "false") == 0
+ || strcmp(reinterpret_cast<char*>(arData), "0") == 0)
retVal = false;
else
SAL_WARN("jfw", "bad registry value " << arData);
commit 932c1c57a035d897d70a0cb774349a71e2269cd9
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 14 16:54:17 2016 +0200
clang-cl loplugin: odk
Change-Id: I8c524bd6522a04339d5e30d6e315347a48b6473f
Reviewed-on: https://gerrit.libreoffice.org/29859
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/odk/source/unowinreg/win/unowinreg.cxx b/odk/source/unowinreg/win/unowinreg.cxx
index e1a7ef8..92f7196 100644
--- a/odk/source/unowinreg/win/unowinreg.cxx
+++ b/odk/source/unowinreg/win/unowinreg.cxx
@@ -38,11 +38,11 @@ extern "C" JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jlongArray hkresult)
{
jboolean ret = JNI_FALSE;
- PHKEY phkey = (PHKEY)env->GetLongArrayElements(hkresult, 0);
- if (RegOpenKeyEx(HKEY_CLASSES_ROOT, NULL, 0, KEY_READ, phkey)
+ auto phkey = env->GetLongArrayElements(hkresult, nullptr);
+ if (RegOpenKeyEx(HKEY_CLASSES_ROOT, nullptr, 0, KEY_READ, reinterpret_cast<PHKEY>(phkey))
== ERROR_SUCCESS)
ret = JNI_TRUE;
- env->ReleaseLongArrayElements(hkresult, (jlong *)phkey, 0);
+ env->ReleaseLongArrayElements(hkresult, phkey, 0);
return ret;
}
@@ -51,11 +51,11 @@ extern "C" JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jlongArray hkresult)
{
jboolean ret = JNI_FALSE;
- PHKEY phkey = (PHKEY)env->GetLongArrayElements(hkresult, 0);
- if (RegOpenKeyEx(HKEY_CURRENT_CONFIG, NULL, 0, KEY_READ, phkey)
+ auto phkey = env->GetLongArrayElements(hkresult, nullptr);
+ if (RegOpenKeyEx(HKEY_CURRENT_CONFIG, nullptr, 0, KEY_READ, reinterpret_cast<PHKEY>(phkey))
== ERROR_SUCCESS)
ret = JNI_TRUE;
- env->ReleaseLongArrayElements(hkresult, (jlong *)phkey, 0);
+ env->ReleaseLongArrayElements(hkresult, phkey, 0);
return ret;
}
@@ -64,11 +64,11 @@ extern "C" JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jlongArray hkresult)
{
jboolean ret = JNI_FALSE;
- PHKEY phkey = (PHKEY)env->GetLongArrayElements(hkresult, 0);
- if (RegOpenKeyEx(HKEY_CURRENT_USER, NULL, 0, KEY_READ, phkey)
+ auto phkey = env->GetLongArrayElements(hkresult, nullptr);
+ if (RegOpenKeyEx(HKEY_CURRENT_USER, nullptr, 0, KEY_READ, reinterpret_cast<PHKEY>(phkey))
== ERROR_SUCCESS)
ret = JNI_TRUE;
- env->ReleaseLongArrayElements(hkresult, (jlong *)phkey, 0);
+ env->ReleaseLongArrayElements(hkresult, phkey, 0);
return ret;
}
@@ -77,11 +77,11 @@ extern "C" JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jlongArray hkresult)
{
jboolean ret = JNI_FALSE;
- PHKEY phkey = (PHKEY)env->GetLongArrayElements(hkresult, 0);
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, NULL, 0, KEY_READ, phkey)
+ auto phkey = env->GetLongArrayElements(hkresult, nullptr);
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, nullptr, 0, KEY_READ, reinterpret_cast<PHKEY>(phkey))
== ERROR_SUCCESS)
ret = JNI_TRUE;
- env->ReleaseLongArrayElements(hkresult, (jlong *)phkey, 0);
+ env->ReleaseLongArrayElements(hkresult, phkey, 0);
return ret;
}
@@ -90,10 +90,10 @@ extern "C" JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jlongArray hkresult)
{
jboolean ret = JNI_FALSE;
- PHKEY phkey = (PHKEY)env->GetLongArrayElements(hkresult, 0);
- if (RegOpenKeyEx(HKEY_USERS, NULL, 0, KEY_READ, phkey) == ERROR_SUCCESS)
+ auto phkey = env->GetLongArrayElements(hkresult, nullptr);
+ if (RegOpenKeyEx(HKEY_USERS, nullptr, 0, KEY_READ, reinterpret_cast<PHKEY>(phkey)) == ERROR_SUCCESS)
ret = JNI_TRUE;
- env->ReleaseLongArrayElements(hkresult, (jlong *)phkey, 0);
+ env->ReleaseLongArrayElements(hkresult, phkey, 0);
return ret;
}
@@ -102,13 +102,13 @@ extern "C" JNIEXPORT jboolean JNICALL
JNIEnv *env, jclass, jlong parent, jstring name, jlongArray hkresult)
{
jboolean ret = JNI_FALSE;
- const char *namestr = env->GetStringUTFChars(name, 0);
- PHKEY phkey = (PHKEY)env->GetLongArrayElements(hkresult, 0);
- if (RegOpenKeyEx((HKEY)parent, namestr, 0, KEY_READ, phkey)
+ const char *namestr = env->GetStringUTFChars(name, nullptr);
+ auto phkey = env->GetLongArrayElements(hkresult, nullptr);
+ if (RegOpenKeyEx(reinterpret_cast<HKEY>(parent), namestr, 0, KEY_READ, reinterpret_cast<PHKEY>(phkey))
== ERROR_SUCCESS)
ret = JNI_TRUE;
env->ReleaseStringUTFChars(name, namestr);
- env->ReleaseLongArrayElements(hkresult, (jlong *)phkey, 0);
+ env->ReleaseLongArrayElements(hkresult, phkey, 0);
return ret;
}
@@ -118,7 +118,7 @@ extern "C" JNIEXPORT jboolean JNICALL
JNIEnv *, jclass, jlong hkey)
{
jboolean ret = JNI_FALSE;
- if (RegCloseKey((HKEY)hkey) == ERROR_SUCCESS)
+ if (RegCloseKey(reinterpret_cast<HKEY>(hkey)) == ERROR_SUCCESS)
ret = JNI_TRUE;
return ret;
}
@@ -129,17 +129,17 @@ extern "C" JNIEXPORT jboolean
jbyteArray data, jlongArray size)
{
jboolean ret = JNI_FALSE;
- const char* valuestr = env->GetStringUTFChars(value, 0);
- LPDWORD ptype = (LPDWORD)env->GetLongArrayElements(type, 0);
- LPBYTE pdata = (LPBYTE)env->GetByteArrayElements(data, 0);
- LPDWORD psize = (LPDWORD)env->GetLongArrayElements(size, 0);
- if (RegQueryValueEx((HKEY)hkey, valuestr, NULL, ptype, pdata, psize)
+ const char* valuestr = env->GetStringUTFChars(value, nullptr);
+ auto ptype = env->GetLongArrayElements(type, nullptr);
+ auto pdata = env->GetByteArrayElements(data, nullptr);
+ auto psize = env->GetLongArrayElements(size, nullptr);
+ if (RegQueryValueEx(reinterpret_cast<HKEY>(hkey), valuestr, nullptr, reinterpret_cast<LPDWORD>(ptype), reinterpret_cast<LPBYTE>(pdata), reinterpret_cast<LPDWORD>(psize))
== ERROR_SUCCESS)
ret = JNI_TRUE;
env->ReleaseStringUTFChars(value, valuestr);
- env->ReleaseLongArrayElements(type, (jlong *)ptype, 0);
- env->ReleaseByteArrayElements(data, (jbyte *)pdata, 0);
- env->ReleaseLongArrayElements(size, (jlong *)psize, 0);
+ env->ReleaseLongArrayElements(type, ptype, 0);
+ env->ReleaseByteArrayElements(data, pdata, 0);
+ env->ReleaseLongArrayElements(size, psize, 0);
return ret;
}
@@ -150,27 +150,23 @@ extern "C" JNIEXPORT jboolean JNICALL
jlongArray maxValueLen, jlongArray secDescriptor)
{
jboolean ret = JNI_FALSE;
- LPDWORD psubkeys = (LPDWORD)env->GetLongArrayElements(subkeys, 0);
- LPDWORD pmaxSubkeyLen =
- (LPDWORD)env->GetLongArrayElements(maxSubkeyLen, 0);
- LPDWORD pvalues = (LPDWORD)env->GetLongArrayElements(values, 0);
- LPDWORD pmaxValueNameLen =
- (LPDWORD)env->GetLongArrayElements(maxValueNameLen, 0);
- LPDWORD pmaxValueLen =
- (LPDWORD)env->GetLongArrayElements(maxValueLen, 0);
- LPDWORD psecDescriptor =
- (LPDWORD)env->GetLongArrayElements(secDescriptor, 0);
+ auto psubkeys = env->GetLongArrayElements(subkeys, nullptr);
+ auto pmaxSubkeyLen = env->GetLongArrayElements(maxSubkeyLen, nullptr);
+ auto pvalues = env->GetLongArrayElements(values, nullptr);
+ auto pmaxValueNameLen = env->GetLongArrayElements(maxValueNameLen, nullptr);
+ auto pmaxValueLen = env->GetLongArrayElements(maxValueLen, nullptr);
+ auto psecDescriptor = env->GetLongArrayElements(secDescriptor, nullptr);
FILETIME ft;
- if (RegQueryInfoKey((HKEY)hkey, NULL, NULL, NULL, psubkeys, pmaxSubkeyLen,
- NULL, pvalues, pmaxValueNameLen, pmaxValueLen,
- psecDescriptor, &ft) == ERROR_SUCCESS)
+ if (RegQueryInfoKey(reinterpret_cast<HKEY>(hkey), nullptr, nullptr, nullptr, reinterpret_cast<LPDWORD>(psubkeys), reinterpret_cast<LPDWORD>(pmaxSubkeyLen),
+ nullptr, reinterpret_cast<LPDWORD>(pvalues), reinterpret_cast<LPDWORD>(pmaxValueNameLen), reinterpret_cast<LPDWORD>(pmaxValueLen),
+ reinterpret_cast<LPDWORD>(psecDescriptor), &ft) == ERROR_SUCCESS)
ret = JNI_TRUE;
- env->ReleaseLongArrayElements(subkeys, (jlong*)psubkeys, 0);
- env->ReleaseLongArrayElements(maxSubkeyLen, (jlong*)pmaxSubkeyLen, 0);
- env->ReleaseLongArrayElements(values, (jlong*)pvalues, 0);
- env->ReleaseLongArrayElements(maxValueNameLen, (jlong*)pmaxValueNameLen, 0);
- env->ReleaseLongArrayElements(maxValueLen, (jlong*)pmaxValueLen, 0);
- env->ReleaseLongArrayElements(secDescriptor, (jlong*)psecDescriptor, 0);
+ env->ReleaseLongArrayElements(subkeys, psubkeys, 0);
+ env->ReleaseLongArrayElements(maxSubkeyLen, pmaxSubkeyLen, 0);
+ env->ReleaseLongArrayElements(values, pvalues, 0);
+ env->ReleaseLongArrayElements(maxValueNameLen, pmaxValueNameLen, 0);
+ env->ReleaseLongArrayElements(maxValueLen, pmaxValueLen, 0);
+ env->ReleaseLongArrayElements(secDescriptor, psecDescriptor, 0);
return ret;
}
commit 52659c125e767bffedaae503b58a7a82b502fbf8
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 14 16:54:08 2016 +0200
clang-cl loplugin: opencl
Change-Id: I7e0e79d67d6701e519f841d893c9b7b2f5ebef80
Reviewed-on: https://gerrit.libreoffice.org/29858
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/opencl/inc/opencl_device_selection.h b/opencl/inc/opencl_device_selection.h
index 19202ad..d624f65 100644
--- a/opencl/inc/opencl_device_selection.h
+++ b/opencl/inc/opencl_device_selection.h
@@ -11,7 +11,7 @@
#define INCLUDED_OPENCL_INC_OPENCL_DEVICE_SELECTION_H
#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
+//#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdlib.h>
commit 941049c9da2b7ba5a589c6c2658b43ff53fe2e50
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 14 16:53:58 2016 +0200
clang-cl loplugin: pyuno
Change-Id: Ic093b58be1f2b78d904d6d036b52532f97c3b336
Reviewed-on: https://gerrit.libreoffice.org/29857
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx
index ede4cd6..e61ff77 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 239f315..b67b17f 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);
More information about the Libreoffice-commits
mailing list