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 /jvmfwk/plugins | |
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>
Diffstat (limited to 'jvmfwk/plugins')
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 12 | ||||
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 10 |
2 files changed, 11 insertions, 11 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; |