diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-10-14 16:54:24 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-10-16 14:18:35 +0000 |
commit | 1ccc7c425b47e1eaeca9463cb4367afd72fe1656 (patch) | |
tree | 3c0d435801f873f8c4450bb908176827709e435c | |
parent | 932c1c57a035d897d70a0cb774349a71e2269cd9 (diff) |
clang-cl loplugin: jvmfwk
Change-Id: I4ae0795469e70d6be3d2052d96a2f0dad3920d8b
Reviewed-on: https://gerrit.libreoffice.org/29860
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 12 | ||||
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 10 | ||||
-rw-r--r-- | jvmfwk/source/framework.cxx | 4 | ||||
-rw-r--r-- | jvmfwk/source/fwkutil.cxx | 12 |
4 files changed, 19 insertions, 19 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index 43ddc827fefa..5053fdacc0af 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 9fe444c0bc32..153a9399fb07 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 bf174e3c6a68..81fd3fc076da 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 8bbcf60a7cea..a77727865d17 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); |