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

clang-cl loplugin: jvmfwk

Change-Id: I4ae0795469e70d6be3d2052d96a2f0dad3920d8b
Reviewed-on: https://gerrit.libreoffice.org/29860Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 932c1c57
......@@ -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,
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
......
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