VirtualBox

Changeset 38633 in vbox


Ignore:
Timestamp:
Sep 5, 2011 11:33:01 AM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
73840
Message:

VBoxService: Fixed German Umlauts handling in toolbox, minimized/adjusted log locking.

Location:
trunk/src/VBox/Additions/common/VBoxService
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp

    r38223 r38633  
    218218 *
    219219 * @returns 1
     220 * @param   iLevel      Minimum log level required to display this message.
    220221 * @param   pszFormat   The message text.
    221222 * @param   ...         Format arguments.
     
    223224void VBoxServiceVerbose(int iLevel, const char *pszFormat, ...)
    224225{
     226    if (iLevel <= g_cVerbosity)
     227    {
    225228#ifdef DEBUG
    226     int rc = RTCritSectEnter(&g_csLog);
    227     if (RT_SUCCESS(rc))
    228     {
    229 #endif
    230         if (iLevel <= g_cVerbosity)
    231         {
    232 #ifdef DEBUG
     229        int rc = RTCritSectEnter(&g_csLog);
     230        if (RT_SUCCESS(rc))
     231        {
    233232            const char *pszThreadName = RTThreadSelfName();
    234233            AssertPtr(pszThreadName);
     
    245244            LogRel(("%s: %N", g_pszProgName, pszFormat, &va));
    246245            va_end(va);
     246#ifdef DEBUG
     247            RTCritSectLeave(&g_csLog);
    247248        }
    248 #ifdef DEBUG
    249         int rc2 = RTCritSectLeave(&g_csLog);
    250         if (RT_SUCCESS(rc))
    251             rc = rc2;
    252     }
    253 #endif
     249#endif
     250    }
    254251}
    255252
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp

    r38629 r38633  
    612612                   && cbRead)
    613613            {
    614                 VBoxServiceVerbose(5, "[%u]: %s\n", pData->uPID, szBuf);
     614#ifdef DEBUG
     615                int rc2 = RTCritSectEnter(&g_csLog);
     616                if (RT_SUCCESS(rc2))
     617                {
     618#endif
     619                    RTStrmWriteEx(g_pStdOut, szBuf, cbRead, NULL /* No partial write. */);
     620#ifdef DEBUG
     621                    rc2 = RTCritSectLeave(&g_csLog);
     622                    if (RT_SUCCESS(rc))
     623                        rc = rc2;
     624                }
     625#endif
    615626                cbOffset += cbRead;
    616627                if (!cbLeft)
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h

    r38587 r38633  
    276276extern VBOXSERVICE  g_AutoMount;
    277277#endif
     278#ifdef DEBUG
     279extern RTCRITSECT   g_csLog; /* For guest process stdout dumping. */
     280#endif
    278281
    279282extern RTEXITCODE   VBoxServiceSyntax(const char *pszFormat, ...);
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp

    r38625 r38633  
    11851185
    11861186    /*
     1187     * The input is ASSUMED to be in the current process codeset (NT guarantees
     1188     * ACP, unixy systems doesn't guarantee anything).  This loop converts all
     1189     * the argv[*] strings to UTF-8, which is a tad ugly but who cares.
     1190     * (As a rule all strings in VirtualBox are UTF-8.)
     1191     */
     1192    for (int i = 0; i < argc; i++)
     1193    {
     1194        char *pszConverted;
     1195        int rc = RTStrCurrentCPToUtf8(&pszConverted, argv[i]);
     1196        if (RT_SUCCESS(rc))
     1197            argv[i] = pszConverted;
     1198        else
     1199        {
     1200            RTMsgError("Failed to convert argument %d to UTF-8, rc=%Rrc\n",
     1201                       i + 1, rc);
     1202
     1203            /* Conversion was not possible,probably due to invalid characters.
     1204             * Keep in mind that we do RTStrFree on the whole array below. */
     1205            argv[i] = RTStrDup(argv[i]);
     1206        }
     1207    }
     1208
     1209    /*
    11871210     * Invoke the handler.
    11881211     */
    11891212    RTMsgSetProgName("VBoxService/%s", pszTool);
    11901213    *prcExit = pfnHandler(argc, argv);
     1214
     1215    /*
     1216     * Free converted argument vector
     1217     */
     1218    for (int i = 0; i < argc; i++)
     1219    {
     1220        RTStrFree(argv[i]);
     1221        argv[i] = NULL;
     1222    }
    11911223    return true;
    11921224
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