[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - jvmfwk/plugins

Michael Stahl mstahl at redhat.com
Mon Jun 3 08:14:15 PDT 2013


 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx |   18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

New commits:
commit f50f172efbe534863c91f4b1cc6dc58a05f1eeb9
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sun Jun 2 16:37:40 2013 +0200

    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 at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index fbc4eeb9..33db97d 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 &&


More information about the Libreoffice-commits mailing list