VirtualBox

Changeset 38636 in vbox for trunk/src/libs/xpcom18a4/java


Ignore:
Timestamp:
Sep 5, 2011 1:49:45 PM (13 years ago)
Author:
vboxsync
Message:

*,IPRT: Redid the ring-3 init to always convert the arguments to UTF-8.

Location:
trunk/src/libs/xpcom18a4/java
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/java/src/nsJavaInterfaces.cpp

    r31598 r38636  
    147147{
    148148#if defined(VBOX_PATH_APP_PRIVATE_ARCH) && defined(VBOX_PATH_SHARED_LIBS)
    149     rv = RTR3Init();
    150 #else
    151     const char *home  = nsnull;
     149    rv = RTR3InitDll(0);
     150#else
     151    const char *pszHome  = nsnull;
    152152    const char *jhome = nsnull;
    153153    jstring path = nsnull;
     
    164164    {
    165165        path = (jstring)env->CallObjectMethod(aVBoxBinDirectory, getPathMID);
    166         home = jhome = env->GetStringUTFChars(path, nsnull);
    167     }
    168 
    169     if (home == nsnull)
    170         home = getenv("VBOX_PROGRAM_PATH");
    171 
    172     if (home) {
    173       size_t len = strlen(home);
    174       char *exepath = (char *)alloca(len + 32);
    175       memcpy(exepath, home, len);
    176       memcpy(exepath + len, "/javafake", sizeof("/javafake"));
    177       rv = RTR3InitWithProgramPath(exepath);
     166        pszHome = jhome = env->GetStringUTFChars(path, nsnull);
     167    }
     168
     169    if (pszHome == nsnull)
     170        pszHome = getenv("VBOX_PROGRAM_PATH");
     171
     172    if (pszHome) {
     173      size_t cchHome = strlen(pszHome);
     174      char *pszExePath = (char *)alloca(cchHome + 32);
     175      memcpy(pszExePath, pszHome, cchHome);
     176      memcpy(pszExePath + cchHome, "/javafake", sizeof("/javafake"));
     177      rv = RTR3InitEx(RTR3INIT_VER_CUR, RTR3INIT_FLAGS_DLL, 0, NULL, pszExePath);
    178178    } else {
    179       rv = RTR3Init();
     179      rv = RTR3InitDll(0);
    180180    }
    181181
  • trunk/src/libs/xpcom18a4/java/tools/genifaces/GenerateJavaInterfaces.cpp

    r29179 r38636  
    874874#ifdef VBOX
    875875#if defined(VBOX_PATH_APP_PRIVATE_ARCH) && defined(VBOX_PATH_SHARED_LIBS)
    876     rv = RTR3Init();
     876  rv = RTR3InitExe(argc, &argv, 0);
    877877#else
    878     const char *home = getenv("VBOX_PROGRAM_PATH");
    879     if (home) {
    880       size_t len = strlen(home);
    881       char *exepath = (char *)alloca(len + 32);
    882       memcpy(exepath, home, len);
    883       memcpy(exepath + len, "/pythonfake", sizeof("/pythonfake"));
    884       rv = RTR3InitWithProgramPath(exepath);
    885     } else {
    886       rv = RTR3Init();
    887     }
     878  const char *pszHome = getenv("VBOX_PROGRAM_PATH");
     879  if (pszHome) {
     880    size_t cchHome = strlen(pszHome);
     881    char *pszExePath = (char *)alloca(cchHome + 32);
     882    memcpy(pszExePath, pszHome, cchHome);
     883    memcpy(pszExePath + cchHome, "/pythonfake", sizeof("/pythonfake"));
     884    rc = RTR3InitEx(RTR3INIT_VER_CUR, 0, argc, &argv, pszExePath);
     885  } else {
     886    rv = RTR3InitExe(argc, &argv, 0);
     887  }
    888888#endif
    889889#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette