VirtualBox

Changeset 62849 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 1, 2016 9:52:45 PM (8 years ago)
Author:
vboxsync
Message:

GAs/common: warnings

Location:
trunk/src/VBox/Additions/common/VBoxControl
Files:
2 edited

Legend:

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

    r62679 r62849  
    241241LONG (WINAPI * gpfnChangeDisplaySettingsEx)(LPCTSTR lpszDeviceName, LPDEVMODE lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam);
    242242
    243 static unsigned nextAdjacentRectXP (RECTL *paRects, unsigned nRects, unsigned iRect)
    244 {
    245     unsigned i;
    246     for (i = 0; i < nRects; i++)
    247     {
     243static unsigned nextAdjacentRectXP(RECTL const *paRects, unsigned cRects, unsigned iRect)
     244{
     245    for (unsigned i = 0; i < cRects; i++)
    248246        if (paRects[iRect].right == paRects[i].left)
    249         {
    250247            return i;
    251         }
    252     }
    253     return ~0;
    254 }
    255 
    256 static unsigned nextAdjacentRectXN (RECTL *paRects, unsigned nRects, unsigned iRect)
    257 {
    258     unsigned i;
    259     for (i = 0; i < nRects; i++)
    260     {
     248    return ~0U;
     249}
     250
     251static unsigned nextAdjacentRectXN(RECTL const *paRects, unsigned cRects, unsigned iRect)
     252{
     253    for (unsigned i = 0; i < cRects; i++)
    261254        if (paRects[iRect].left == paRects[i].right)
    262         {
    263255            return i;
    264         }
    265     }
    266     return ~0;
    267 }
    268 
    269 static unsigned nextAdjacentRectYP (RECTL *paRects, unsigned nRects, unsigned iRect)
    270 {
    271     unsigned i;
    272     for (i = 0; i < nRects; i++)
    273     {
     256    return ~0U;
     257}
     258
     259static unsigned nextAdjacentRectYP(RECTL const *paRects, unsigned cRects, unsigned iRect)
     260{
     261    for (unsigned i = 0; i < cRects; i++)
    274262        if (paRects[iRect].bottom == paRects[i].top)
    275         {
    276263            return i;
    277         }
    278     }
    279     return ~0;
    280 }
    281 
    282 unsigned nextAdjacentRectYN (RECTL *paRects, unsigned nRects, unsigned iRect)
    283 {
    284     unsigned i;
    285     for (i = 0; i < nRects; i++)
    286     {
     264    return ~0U;
     265}
     266
     267unsigned nextAdjacentRectYN(RECTL const *paRects, unsigned cRects, unsigned iRect)
     268{
     269    for (unsigned i = 0; i < cRects; i++)
    287270        if (paRects[iRect].top == paRects[i].bottom)
    288         {
    289271            return i;
    290         }
    291     }
    292     return ~0;
    293 }
    294 
    295 void resizeRect(RECTL *paRects, unsigned nRects, unsigned iPrimary, unsigned iResized, int NewWidth, int NewHeight)
    296 {
    297     RECTL *paNewRects = (RECTL *)alloca (sizeof (RECTL) * nRects);
    298     memcpy (paNewRects, paRects, sizeof (RECTL) * nRects);
    299     paNewRects[iResized].right += NewWidth - (paNewRects[iResized].right - paNewRects[iResized].left);
     272    return ~0U;
     273}
     274
     275void resizeRect(RECTL *paRects, unsigned cRects, unsigned iPrimary, unsigned iResized, int NewWidth, int NewHeight)
     276{
     277    RECTL *paNewRects = (RECTL *)alloca(sizeof (RECTL) * cRects);
     278    memcpy (paNewRects, paRects, sizeof(RECTL) * cRects);
     279    paNewRects[iResized].right  += NewWidth - (paNewRects[iResized].right - paNewRects[iResized].left);
    300280    paNewRects[iResized].bottom += NewHeight - (paNewRects[iResized].bottom - paNewRects[iResized].top);
    301281
     
    308288    /* X positive. */
    309289    unsigned iRect;
    310     for (iRect = 0; iRect < nRects; iRect++)
     290    for (iRect = 0; iRect < cRects; iRect++)
    311291    {
    312292        /* Find the next adjacent original rect in x positive direction. */
    313         unsigned iNextRect = nextAdjacentRectXP (paRects, nRects, iRect);
     293        unsigned iNextRect = nextAdjacentRectXP (paRects, cRects, iRect);
    314294        Log(("next %d -> %d\n", iRect, iNextRect));
    315295
     
    336316
    337317    /* X negative. */
    338     for (iRect = 0; iRect < nRects; iRect++)
     318    for (iRect = 0; iRect < cRects; iRect++)
    339319    {
    340320        /* Find the next adjacent original rect in x negative direction. */
    341         unsigned iNextRect = nextAdjacentRectXN (paRects, nRects, iRect);
     321        unsigned iNextRect = nextAdjacentRectXN (paRects, cRects, iRect);
    342322        Log(("next %d -> %d\n", iRect, iNextRect));
    343323
     
    364344
    365345    /* Y positive (in the computer sense, top->down). */
    366     for (iRect = 0; iRect < nRects; iRect++)
     346    for (iRect = 0; iRect < cRects; iRect++)
    367347    {
    368348        /* Find the next adjacent original rect in y positive direction. */
    369         unsigned iNextRect = nextAdjacentRectYP (paRects, nRects, iRect);
     349        unsigned iNextRect = nextAdjacentRectYP (paRects, cRects, iRect);
    370350        Log(("next %d -> %d\n", iRect, iNextRect));
    371351
     
    392372
    393373    /* Y negative (in the computer sense, down->top). */
    394     for (iRect = 0; iRect < nRects; iRect++)
     374    for (iRect = 0; iRect < cRects; iRect++)
    395375    {
    396376        /* Find the next adjacent original rect in x negative direction. */
    397         unsigned iNextRect = nextAdjacentRectYN (paRects, nRects, iRect);
     377        unsigned iNextRect = nextAdjacentRectYN (paRects, cRects, iRect);
    398378        Log(("next %d -> %d\n", iRect, iNextRect));
    399379
     
    419399    }
    420400
    421     memcpy (paRects, paNewRects, sizeof (RECTL) * nRects);
     401    memcpy (paRects, paNewRects, sizeof (RECTL) * cRects);
    422402    return;
    423403}
     
    429409
    430410    DISPLAY_DEVICE DisplayDevice;
    431 
    432     ZeroMemory(&DisplayDevice, sizeof(DisplayDevice));
     411    RT_ZERO(DisplayDevice);
    433412    DisplayDevice.cb = sizeof(DisplayDevice);
    434413
     
    436415    DWORD NumDevices = 0;
    437416    DWORD i = 0;
    438     while (EnumDisplayDevices (NULL, i, &DisplayDevice, 0))
     417    while (EnumDisplayDevices(NULL, i, &DisplayDevice, 0))
    439418    {
    440419        Log(("[%d] %s\n", i, DisplayDevice.DeviceName));
     
    442421        if (DisplayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
    443422        {
    444             Log(("Found primary device. err %d\n", GetLastError ()));
     423            Log(("Found primary device. err %d\n", GetLastError()));
    445424            NumDevices++;
    446425        }
     
    448427        {
    449428
    450             Log(("Found secondary device. err %d\n", GetLastError ()));
     429            Log(("Found secondary device. err %d\n", GetLastError()));
    451430            NumDevices++;
    452431        }
    453432
    454         ZeroMemory(&DisplayDevice, sizeof(DisplayDevice));
     433        RT_ZERO(DisplayDevice);
    455434        DisplayDevice.cb = sizeof(DisplayDevice);
    456435        i++;
    457436    }
    458437
    459     Log(("Found total %d devices. err %d\n", NumDevices, GetLastError ()));
     438    Log(("Found total %d devices. err %d\n", NumDevices, GetLastError()));
    460439
    461440    if (NumDevices == 0 || Id >= NumDevices)
    462441    {
    463         Log(("Requested identifier %d is invalid. err %d\n", Id, GetLastError ()));
     442        Log(("Requested identifier %d is invalid. err %d\n", Id, GetLastError()));
    464443        return FALSE;
    465444    }
    466445
    467     DISPLAY_DEVICE *paDisplayDevices = (DISPLAY_DEVICE *)alloca (sizeof (DISPLAY_DEVICE) * NumDevices);
    468     DEVMODE *paDeviceModes = (DEVMODE *)alloca (sizeof (DEVMODE) * NumDevices);
    469     RECTL *paRects = (RECTL *)alloca (sizeof (RECTL) * NumDevices);
     446    DISPLAY_DEVICE *paDisplayDevices = (DISPLAY_DEVICE *)alloca(sizeof (DISPLAY_DEVICE) * NumDevices);
     447    DEVMODE *paDeviceModes = (DEVMODE *)alloca(sizeof (DEVMODE) * NumDevices);
     448    RECTL *paRects = (RECTL *)alloca(sizeof (RECTL) * NumDevices);
    470449
    471450    /* Fetch information about current devices and modes. */
     
    473452    DWORD DevPrimaryNum = 0;
    474453
    475     ZeroMemory(&DisplayDevice, sizeof(DISPLAY_DEVICE));
     454    RT_ZERO(DisplayDevice);
    476455    DisplayDevice.cb = sizeof(DISPLAY_DEVICE);
    477456
     
    481460        Log(("[%d(%d)] %s\n", i, DevNum, DisplayDevice.DeviceName));
    482461
    483         BOOL bFetchDevice = FALSE;
     462        BOOL fFetchDevice = FALSE;
    484463
    485464        if (DisplayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
    486465        {
    487             Log(("Found primary device. err %d\n", GetLastError ()));
     466            Log(("Found primary device. err %d\n", GetLastError()));
    488467            DevPrimaryNum = DevNum;
    489             bFetchDevice = TRUE;
     468            fFetchDevice = TRUE;
    490469        }
    491470        else if (!(DisplayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER))
    492471        {
    493472
    494             Log(("Found secondary device. err %d\n", GetLastError ()));
    495             bFetchDevice = TRUE;
    496         }
    497 
    498         if (bFetchDevice)
     473            Log(("Found secondary device. err %d\n", GetLastError()));
     474            fFetchDevice = TRUE;
     475        }
     476
     477        if (fFetchDevice)
    499478        {
    500479            if (DevNum >= NumDevices)
     
    506485            paDisplayDevices[DevNum] = DisplayDevice;
    507486
    508             ZeroMemory(&paDeviceModes[DevNum], sizeof(DEVMODE));
     487            RT_BZERO(&paDeviceModes[DevNum], sizeof(DEVMODE));
    509488            paDeviceModes[DevNum].dmSize = sizeof(DEVMODE);
    510             if (!EnumDisplaySettings((LPSTR)DisplayDevice.DeviceName,
    511                  ENUM_REGISTRY_SETTINGS, &paDeviceModes[DevNum]))
     489            if (!EnumDisplaySettings((LPSTR)DisplayDevice.DeviceName, ENUM_REGISTRY_SETTINGS, &paDeviceModes[DevNum]))
    512490            {
    513                 Log(("EnumDisplaySettings err %d\n", GetLastError ()));
     491                Log(("EnumDisplaySettings err %d\n", GetLastError()));
    514492                return FALSE;
    515493            }
     
    528506        }
    529507
    530         ZeroMemory(&DisplayDevice, sizeof(DISPLAY_DEVICE));
     508        RT_ZERO(DisplayDevice);
    531509        DisplayDevice.cb = sizeof(DISPLAY_DEVICE);
    532510        i++;
     
    534512
    535513    if (Width == 0)
    536     {
    537514        Width = paRects[Id].right - paRects[Id].left;
    538     }
    539515
    540516    if (Height == 0)
    541     {
    542517        Height = paRects[Id].bottom - paRects[Id].top;
    543     }
    544518
    545519    /* Check whether a mode reset or a change is requested. */
    546520    if (   !fModeReset
    547         && paRects[Id].right - paRects[Id].left == Width
    548         && paRects[Id].bottom - paRects[Id].top == Height
     521        && paRects[Id].right - paRects[Id].left == (LONG)Width
     522        && paRects[Id].bottom - paRects[Id].top == (LONG)Height
    549523        && paDeviceModes[Id].dmBitsPerPel == BitsPerPixel)
    550524    {
     
    554528
    555529    resizeRect(paRects, NumDevices, DevPrimaryNum, Id, Width, Height);
    556 #ifdef Log
     530#ifdef LOG_ENABLED
    557531    for (i = 0; i < NumDevices; i++)
    558     {
    559532        Log(("[%d]: %d,%d %dx%d\n",
    560                 i, paRects[i].left, paRects[i].top,
    561                 paRects[i].right - paRects[i].left,
    562                 paRects[i].bottom - paRects[i].top));
    563     }
     533             i, paRects[i].left, paRects[i].top,
     534             paRects[i].right - paRects[i].left,
     535             paRects[i].bottom - paRects[i].top));
    564536#endif /* Log */
    565537
     
    568540     */
    569541    DEVMODE tempDevMode;
    570     ZeroMemory (&tempDevMode, sizeof (tempDevMode));
     542    RT_ZERO(tempDevMode);
    571543    tempDevMode.dmSize = sizeof(DEVMODE);
    572544    EnumDisplaySettings(NULL, 0xffffff, &tempDevMode);
     
    591563        gpfnChangeDisplaySettingsEx((LPSTR)paDisplayDevices[i].DeviceName,
    592564                 &paDeviceModes[i], NULL, CDS_NORESET | CDS_UPDATEREGISTRY, NULL);
    593         Log(("ChangeDisplaySettings position err %d\n", GetLastError ()));
     565        Log(("ChangeDisplaySettings position err %d\n", GetLastError()));
    594566    }
    595567
     
    619591    DWORD bpp  = atoi(argv[2]);
    620592    DWORD scr  = 0;
    621 
    622593    if (argc == 4)
    623     {
    624594        scr = atoi(argv[3]);
    625     }
    626595
    627596    HMODULE hUser = GetModuleHandle("user32.dll");
    628 
    629597    if (hUser)
    630598    {
     
    635603        {
    636604            /* The screen index is 0 based in the ResizeDisplayDevice call. */
    637             scr = scr > 0? scr - 1: 0;
     605            scr = scr > 0 ? scr - 1 : 0;
    638606
    639607            /* Horizontal resolution must be a multiple of 8, round down. */
     
    655623static int checkVBoxVideoKey(HKEY hkeyVideo)
    656624{
    657     char szValue[128];
    658     DWORD len = sizeof(szValue);
    659     DWORD dwKeyType;
    660     LONG status = RegQueryValueExA(hkeyVideo, "Device Description", NULL, &dwKeyType,
    661                                    (LPBYTE)szValue, &len);
    662 
     625    RTUTF16 wszValue[128];
     626    DWORD   cbValue = sizeof(wszValue);
     627    DWORD   dwKeyType;
     628    LONG status = RegQueryValueExW(hkeyVideo, L"Device Description", NULL, &dwKeyType, (LPBYTE)wszValue, &cbValue);
    663629    if (status == ERROR_SUCCESS)
    664630    {
    665631        /* WDDM has additional chars after "Adapter" */
    666         static char sszDeviceDescription[] = "VirtualBox Graphics Adapter";
    667         if (_strnicmp(szValue, sszDeviceDescription, sizeof(sszDeviceDescription) - sizeof(char)) == 0)
    668         {
     632        static char s_szDeviceDescription[] = "VirtualBox Graphics Adapter";
     633        wszValue[sizeof(s_szDeviceDescription) - 1] = '\0';
     634        if (RTUtf16ICmpAscii(wszValue, s_szDeviceDescription) == 0)
    669635            return VINF_SUCCESS;
    670         }
    671636    }
    672637
     
    694659
    695660    /* Get the 'ObjectNumberList' */
    696     ULONG numDevices = 0;
     661    ULONG cDevices = 0;
    697662    DWORD adwObjectNumberList[256];
    698     DWORD len = sizeof(adwObjectNumberList);
    699     status = RegQueryValueExA(hkeyDeviceMap, "ObjectNumberList", NULL, &dwKeyType, (LPBYTE)&adwObjectNumberList[0], &len);
     663    DWORD cbValue = sizeof(adwObjectNumberList);
     664    status = RegQueryValueExA(hkeyDeviceMap, "ObjectNumberList", NULL, &dwKeyType, (LPBYTE)&adwObjectNumberList[0], &cbValue);
    700665
    701666    if (   status == ERROR_SUCCESS
    702667        && dwKeyType == REG_BINARY)
    703     {
    704         numDevices = len / sizeof(DWORD);
    705     }
     668        cDevices = cbValue / sizeof(DWORD);
    706669    else
    707670    {
    708671       /* The list might not exists. Use 'MaxObjectNumber' REG_DWORD and build a list. */
    709672       DWORD dwMaxObjectNumber = 0;
    710        len = sizeof(dwMaxObjectNumber);
    711        status = RegQueryValueExA(hkeyDeviceMap, "MaxObjectNumber", NULL, &dwKeyType, (LPBYTE)&dwMaxObjectNumber, &len);
    712 
     673       cbValue = sizeof(dwMaxObjectNumber);
     674       status = RegQueryValueExA(hkeyDeviceMap, "MaxObjectNumber", NULL, &dwKeyType, (LPBYTE)&dwMaxObjectNumber, &cbValue);
    713675       if (   status == ERROR_SUCCESS
    714676           && dwKeyType == REG_DWORD)
    715677       {
    716678           /* 'MaxObjectNumber' is inclusive. */
    717            numDevices = RT_MIN(dwMaxObjectNumber + 1, RT_ELEMENTS(adwObjectNumberList));
    718            for (iDevice = 0; iDevice < numDevices; iDevice++)
    719            {
     679           cDevices = RT_MIN(dwMaxObjectNumber + 1, RT_ELEMENTS(adwObjectNumberList));
     680           for (iDevice = 0; iDevice < cDevices; iDevice++)
    720681               adwObjectNumberList[iDevice] = iDevice;
    721            }
    722682       }
    723683    }
    724684
    725     if (numDevices == 0)
     685    if (cDevices == 0)
    726686    {
    727687        /* Always try '\Device\Video0' as the old code did. Enum can be used in this case in principle. */
    728688        adwObjectNumberList[0] = 0;
    729         numDevices = 1;
     689        cDevices = 1;
    730690    }
    731691
    732692    /* Scan device entries */
    733     for (iDevice = 0; iDevice < numDevices; iDevice++)
     693    for (iDevice = 0; iDevice < cDevices; iDevice++)
    734694    {
    735695        char szValueName[64];
     
    737697
    738698        char szVideoLocation[256];
    739         len = sizeof(szVideoLocation);
    740         status = RegQueryValueExA(hkeyDeviceMap, szValueName, NULL, &dwKeyType, (LPBYTE)&szVideoLocation[0], &len);
     699        cbValue = sizeof(szVideoLocation);
     700        status = RegQueryValueExA(hkeyDeviceMap, szValueName, NULL, &dwKeyType, (LPBYTE)&szVideoLocation[0], &cbValue);
    741701
    742702        /* This value starts with '\REGISTRY\Machine' */
     
    773733static DECLCALLBACK(RTEXITCODE) handleGetVideoAcceleration(int argc, char *argv[])
    774734{
     735    RT_NOREF2(argc, argv);
    775736    ULONG status;
    776737    HKEY hkeyVideo = getVideoKey(false);
     
    780741        /* query the actual value */
    781742        DWORD fAcceleration = 1;
    782         DWORD len = sizeof(fAcceleration);
     743        DWORD cbValue = sizeof(fAcceleration);
    783744        DWORD dwKeyType;
    784         status = RegQueryValueExA(hkeyVideo, "EnableVideoAccel", NULL, &dwKeyType, (LPBYTE)&fAcceleration, &len);
     745        status = RegQueryValueExA(hkeyVideo, "EnableVideoAccel", NULL, &dwKeyType, (LPBYTE)&fAcceleration, &cbValue);
    785746        if (status != ERROR_SUCCESS)
    786747            RTPrintf("Video acceleration: default\n");
     
    831792    {
    832793        DWORD dwFlags = 0;
    833         DWORD len = sizeof(dwFlags);
     794        DWORD cbValue = sizeof(dwFlags);
    834795        DWORD dwKeyType;
    835         ULONG status = RegQueryValueExA(hkeyVideo, "VBoxVideoFlags", NULL, &dwKeyType, (LPBYTE)&dwFlags, &len);
     796        ULONG status = RegQueryValueExA(hkeyVideo, "VBoxVideoFlags", NULL, &dwKeyType, (LPBYTE)&dwFlags, &cbValue);
    836797        if (status != ERROR_SUCCESS)
    837798            RTPrintf("Video flags: default\n");
     
    883844    {
    884845        DWORD dwFlags = 0;
    885         DWORD len = sizeof(dwFlags);
     846        DWORD cbValue = sizeof(dwFlags);
    886847        DWORD dwKeyType;
    887         ULONG status = RegQueryValueExA(hkeyVideo, "VBoxVideoFlags", NULL, &dwKeyType, (LPBYTE)&dwFlags, &len);
     848        ULONG status = RegQueryValueExA(hkeyVideo, "VBoxVideoFlags", NULL, &dwKeyType, (LPBYTE)&dwFlags, &cbValue);
    888849        if (status != ERROR_SUCCESS)
    889         {
    890850            dwFlags = 0;
    891         }
    892 
    893         dwFlags = fSet? (dwFlags | u32Mask):
    894                         (dwFlags & ~u32Mask);
     851
     852        dwFlags = fSet ? dwFlags | u32Mask : dwFlags & ~u32Mask;
    895853
    896854        status = RegSetValueExA(hkeyVideo, "VBoxVideoFlags", 0, REG_DWORD, (LPBYTE)&dwFlags, sizeof(dwFlags));
     
    10641022static DECLCALLBACK(RTEXITCODE) handleListCustomModes(int argc, char *argv[])
    10651023{
     1024    RT_NOREF1(argv);
    10661025    if (argc != 0)
    10671026    {
     
    12021161
    12031162    bool fVerbose = false;
    1204     if (   2 == argc
     1163    if (   argc == 2
    12051164        && (   strcmp(argv[1], "-verbose")  == 0
    12061165            || strcmp(argv[1], "--verbose") == 0)
     
    12371196         * hope.  Actually this should never go wrong, as we are generous
    12381197         * enough with buffer space. */
    1239         bool finish = false;
    1240         for (unsigned i = 0; (i < 10) && !finish; ++i)
     1198        bool fFinished = false;
     1199        for (unsigned i = 0; i < 10 && !fFinished; ++i)
    12411200        {
    12421201            void *pvTmpBuf = RTMemRealloc(pvBuf, cbBuf);
     
    12571216                cbBuf += 1024;
    12581217            else
    1259                 finish = true;
     1218                fFinished = true;
    12601219        }
    12611220        if (VERR_TOO_MUCH_DATA == rc)
     
    13001259     * arguments.
    13011260     */
    1302     bool usageOK = true;
     1261    bool fUsageOK = true;
    13031262    const char *pszName = NULL;
    13041263    const char *pszValue = NULL;
     
    13091268    }
    13101269    else if (3 == argc)
    1311         usageOK = false;
     1270        fUsageOK = false;
    13121271    else if (4 == argc)
    13131272    {
     
    13151274        if (   strcmp(argv[2], "-flags") != 0
    13161275            && strcmp(argv[2], "--flags") != 0)
    1317             usageOK = false;
     1276            fUsageOK = false;
    13181277        pszFlags = argv[3];
    13191278    }
    13201279    else if (argc != 1)
    1321         usageOK = false;
    1322     if (!usageOK)
     1280        fUsageOK = false;
     1281    if (!fUsageOK)
    13231282    {
    13241283        usage(GUEST_PROP);
     
    13651324     * arguments.
    13661325     */
    1367     bool usageOK = true;
     1326    bool fUsageOK = true;
    13681327    const char *pszName = NULL;
    13691328    if (argc < 1)
    1370         usageOK = false;
    1371     if (!usageOK)
     1329        fUsageOK = false;
     1330    if (!fUsageOK)
    13721331    {
    13731332        usage(GUEST_PROP);
     
    14811440    uint64_t u64TimestampIn = 0;
    14821441    uint32_t u32Timeout = RT_INDEFINITE_WAIT;
    1483     bool usageOK = true;
     1442    bool fUsageOK = true;
    14841443    if (argc < 1)
    1485         usageOK = false;
     1444        fUsageOK = false;
    14861445    pszPatterns = argv[0];
    1487     for (int i = 1; usageOK && i < argc; ++i)
     1446    for (int i = 1; fUsageOK && i < argc; ++i)
    14881447    {
    14891448        if (   strcmp(argv[i], "-timeout")  == 0
     
    14941453                       != VINF_SUCCESS
    14951454               )
    1496                 usageOK = false;
     1455                fUsageOK = false;
    14971456            else
    14981457                ++i;
     
    15051464                       != VINF_SUCCESS
    15061465               )
    1507                 usageOK = false;
     1466                fUsageOK = false;
    15081467            else
    15091468                ++i;
    15101469        }
    15111470        else
    1512             usageOK = false;
    1513     }
    1514     if (!usageOK)
     1471            fUsageOK = false;
     1472    }
     1473    if (!fUsageOK)
    15151474    {
    15161475        usage(GUEST_PROP);
     
    15431502     * hope.  Actually this should never go wrong, as we are generous
    15441503     * enough with buffer space. */
    1545     bool finish = false;
    1546     for (unsigned i = 0;
    1547          (RT_SUCCESS(rc) || rc == VERR_BUFFER_OVERFLOW) && !finish && (i < 10);
    1548          ++i)
     1504    bool fFinished = false;
     1505    for (unsigned i = 0; (RT_SUCCESS(rc) || rc == VERR_BUFFER_OVERFLOW) && !fFinished && i < 10; i++)
    15491506    {
    15501507        void *pvTmpBuf = RTMemRealloc(pvBuf, cbBuf);
     
    15661523            cbBuf += 1024;
    15671524        else
    1568             finish = true;
     1525            fFinished = true;
    15691526        if (rc == VERR_TOO_MUCH_DATA)
    15701527            VBoxControlError("Temporarily unable to get a notification\n");
     
    16081565static DECLCALLBACK(RTEXITCODE) handleGuestProperty(int argc, char *argv[])
    16091566{
    1610     if (0 == argc)
     1567    if (argc == 0)
    16111568    {
    16121569        usage(GUEST_PROP);
     
    16151572    if (!strcmp(argv[0], "get"))
    16161573        return getGuestProperty(argc - 1, argv + 1);
    1617     else if (!strcmp(argv[0], "set"))
     1574    if (!strcmp(argv[0], "set"))
    16181575        return setGuestProperty(argc - 1, argv + 1);
    1619     else if (!strcmp(argv[0], "delete") || !strcmp(argv[0], "unset"))
     1576    if (!strcmp(argv[0], "delete") || !strcmp(argv[0], "unset"))
    16201577        return deleteGuestProperty(argc - 1, argv + 1);
    1621     else if (!strcmp(argv[0], "enumerate"))
     1578    if (!strcmp(argv[0], "enumerate"))
    16221579        return enumGuestProperty(argc - 1, argv + 1);
    1623     else if (!strcmp(argv[0], "wait"))
     1580    if (!strcmp(argv[0], "wait"))
    16241581        return waitGuestProperty(argc - 1, argv + 1);
    1625     /* else */
     1582    /* unknown cmd */
    16261583    usage(GUEST_PROP);
    16271584    return RTEXITCODE_FAILURE;
     
    16351592static RTEXITCODE listSharedFolders(int argc, char **argv)
    16361593{
    1637     bool usageOK = true;
     1594    bool fUsageOK = true;
    16381595    bool fOnlyShowAutoMount = false;
    16391596    if (argc == 1)
     
    16431600            fOnlyShowAutoMount = true;
    16441601        else
    1645             usageOK = false;
     1602            fUsageOK = false;
    16461603    }
    16471604    else if (argc > 1)
    1648         usageOK = false;
    1649 
    1650     if (!usageOK)
     1605        fUsageOK = false;
     1606    if (!fUsageOK)
    16511607    {
    16521608        usage(GUEST_SHAREDFOLDERS);
     
    16621618        PVBGLR3SHAREDFOLDERMAPPING paMappings;
    16631619        uint32_t cMappings;
    1664         rc = VbglR3SharedFolderGetMappings(u32ClientId, fOnlyShowAutoMount,
    1665                                            &paMappings, &cMappings);
     1620        rc = VbglR3SharedFolderGetMappings(u32ClientId, fOnlyShowAutoMount, &paMappings, &cMappings);
    16661621        if (RT_SUCCESS(rc))
    16671622        {
     
    17041659static DECLCALLBACK(RTEXITCODE) handleSharedFolder(int argc, char *argv[])
    17051660{
    1706     if (0 == argc)
     1661    if (argc == 0)
    17071662    {
    17081663        usage(GUEST_SHAREDFOLDERS);
     
    17231678static DECLCALLBACK(RTEXITCODE) handleWriteCoreDump(int argc, char *argv[])
    17241679{
     1680    RT_NOREF2(argc, argv);
    17251681    int rc = VbglR3WriteCoreDump();
    17261682    if (RT_SUCCESS(rc))
     
    18311787static DECLCALLBACK(RTEXITCODE) handleTakeSnapshot(int argc, char *argv[])
    18321788{
    1833     //VbglR3VmTakeSnapshot(argv[0], argv[1]);
     1789    RT_NOREF2(argc, argv); //VbglR3VmTakeSnapshot(argv[0], argv[1]);
    18341790    return VBoxControlError("not implemented");
    18351791}
     
    18401796static DECLCALLBACK(RTEXITCODE) handleSaveState(int argc, char *argv[])
    18411797{
    1842     //VbglR3VmSaveState();
     1798    RT_NOREF2(argc, argv); //VbglR3VmSaveState();
    18431799    return VBoxControlError("not implemented");
    18441800}
     
    18491805static DECLCALLBACK(RTEXITCODE) handleSuspend(int argc, char *argv[])
    18501806{
    1851     //VbglR3VmSuspend();
     1807    RT_NOREF2(argc, argv); //VbglR3VmSuspend();
    18521808    return VBoxControlError("not implemented");
    18531809}
     
    18581814static DECLCALLBACK(RTEXITCODE) handlePowerOff(int argc, char *argv[])
    18591815{
    1860     //VbglR3VmPowerOff();
     1816    RT_NOREF2(argc, argv); //VbglR3VmPowerOff();
    18611817    return VBoxControlError("not implemented");
    18621818}
     
    18671823static DECLCALLBACK(RTEXITCODE) handleVersion(int argc, char *argv[])
    18681824{
     1825    RT_NOREF1(argv);
    18691826    if (argc)
    18701827        return VBoxControlSyntaxError("getversion does not take any arguments");
     
    18771834static DECLCALLBACK(RTEXITCODE) handleHelp(int argc, char *argv[])
    18781835{
    1879     /* ignore arguments for now. */
     1836    RT_NOREF2(argc, argv); /* ignore arguments for now. */
    18801837    usage();
    18811838    return RTEXITCODE_SUCCESS;
  • trunk/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp

    r62521 r62849  
    8383                                        uint32_t *pcbBufActual)
    8484{
     85    RT_NOREF2(pvBuf, cbBuf);
    8586    RTPrintf("Called GET_PROP, client %d, name %s...\n",
    8687             idClient, pszName);
     
    120121                                        char const **ppszFlags)
    121122{
     123    RT_NOREF2(ppaszPatterns, cPatterns);
    122124    RTPrintf("Called ENUM_PROPS, client %d...\n", idClient);
    123125    AssertPtrReturn(ppHandle, VERR_INVALID_POINTER);
     
    144146                                            char const **ppszFlags)
    145147{
     148    RT_NOREF1(pHandle);
    146149    RTPrintf("Called enumerate next...\n");
    147150    AssertReturn(VALID_PTR(ppszName) || VALID_PTR(ppszValue) || VALID_PTR(ppszFlags),
     
    160163VBGLR3DECL(void)    VbglR3GuestPropEnumFree(PVBGLR3GUESTPROPENUM pHandle)
    161164{
     165    RT_NOREF1(pHandle);
    162166    RTPrintf("Called enumerate free...\n");
    163167}
     
    175179                                        uint32_t *pcbBufActual)
    176180{
     181    RT_NOREF2(pvBuf, cbBuf);
    177182    if (u32Timeout == RT_INDEFINITE_WAIT)
    178183        RTPrintf("Called GET_NOTIFICATION, client %d, patterns %s, timestamp %llu,\n"
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