diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-06-02 16:37:40 +0200 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-06-03 15:13:53 +0000 |
commit | f50f172efbe534863c91f4b1cc6dc58a05f1eeb9 (patch) | |
tree | 51b678a96d1a358b1be5448ddc3638aa56547874 /jvmfwk | |
parent | 9e5342509b302ba1f816f21cc3ad1cb7093982e0 (diff) |
jvmfwk: de-Pascalize do_msvcr71_magic
The uninitialized Module variable causes the smoketest to fail when
built with MSVC 2012 (assinging to it raises some weird exception).
Change-Id: I77b3b591a94f4dfbb373938e3787f75e6a8e09c5
(cherry picked from commit 1ff01d207d90685cb897f518c2a688b5ef33358e)
Reviewed-on: https://gerrit.libreoffice.org/4135
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index fbc4eeb9a3d8..33db97de4683 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -488,20 +488,15 @@ static void load_msvcr71(LPCWSTR jvm_dll) // and just let the implicit loading try to take care of it. static void do_msvcr71_magic(rtl_uString *jvm_dll) { - FILE *f; - rtl_uString* Module; - oslFileError nError; + rtl_uString* Module(0); struct stat st; - PIMAGE_DOS_HEADER dos_hdr; - IMAGE_NT_HEADERS *nt_hdr; - IMAGE_IMPORT_DESCRIPTOR *imports; - nError = osl_getSystemPathFromFileURL(jvm_dll, &Module); + oslFileError nError = osl_getSystemPathFromFileURL(jvm_dll, &Module); if ( osl_File_E_None != nError ) rtl_uString_assign(&Module, jvm_dll); - f = _wfopen(reinterpret_cast<LPCWSTR>(Module->buffer), L"rb"); + FILE *f = _wfopen(reinterpret_cast<LPCWSTR>(Module->buffer), L"rb"); if (fstat(fileno(f), &st) == -1) { @@ -509,7 +504,7 @@ static void do_msvcr71_magic(rtl_uString *jvm_dll) return; } - dos_hdr = (PIMAGE_DOS_HEADER) malloc(st.st_size); + PIMAGE_DOS_HEADER dos_hdr = (PIMAGE_DOS_HEADER) malloc(st.st_size); if (fread(dos_hdr, st.st_size, 1, f) != 1 || memcmp(dos_hdr, "MZ", 2) != 0 || @@ -523,9 +518,10 @@ static void do_msvcr71_magic(rtl_uString *jvm_dll) fclose(f); - nt_hdr = (IMAGE_NT_HEADERS *) ((char *)dos_hdr + dos_hdr->e_lfanew); + IMAGE_NT_HEADERS *nt_hdr = (IMAGE_NT_HEADERS *) ((char *)dos_hdr + dos_hdr->e_lfanew); - imports = (IMAGE_IMPORT_DESCRIPTOR *) ((char *) dos_hdr + nt_hdr->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); + IMAGE_IMPORT_DESCRIPTOR *imports = + (IMAGE_IMPORT_DESCRIPTOR *) ((char *) dos_hdr + nt_hdr->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress); while (imports <= (IMAGE_IMPORT_DESCRIPTOR *) ((char *) dos_hdr + st.st_size - sizeof (IMAGE_IMPORT_DESCRIPTOR)) && imports->Name != 0 && |