VirtualBox

Changeset 62959 in vbox for trunk


Ignore:
Timestamp:
Aug 4, 2016 8:03:50 AM (8 years ago)
Author:
vboxsync
Message:

Devices: warnings

Location:
trunk/src/VBox/Devices/USB
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/VUSBDevice.cpp

    r62502 r62959  
    111111}
    112112
    113 static PCVUSBDESCINTERFACEEX vusbDevFindAltIfDesc(PVUSBDEV pDev, PCVUSBINTERFACESTATE pIfState, int iAlt)
     113static PCVUSBDESCINTERFACEEX vusbDevFindAltIfDesc(PCVUSBINTERFACESTATE pIfState, int iAlt)
    114114{
    115115    for (uint32_t i = 0; i < pIfState->pIf->cSettings; i++)
     
    308308static bool vusbDevStdReqSetConfig(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf)
    309309{
     310    RT_NOREF(EndPt, pbBuf, pcbBuf);
    310311    unsigned iCfg = pSetup->wValue & 0xff;
    311312
     
    360361static bool vusbDevStdReqGetConfig(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf)
    361362{
     363    RT_NOREF(EndPt);
    362364    if ((pSetup->bmRequestType & VUSB_RECIP_MASK) != VUSB_TO_DEVICE)
    363365    {
     
    402404static bool vusbDevStdReqGetInterface(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf)
    403405{
     406    RT_NOREF(EndPt);
    404407    if ((pSetup->bmRequestType & VUSB_RECIP_MASK) != VUSB_TO_INTERFACE)
    405408    {
     
    448451static bool vusbDevStdReqSetInterface(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf)
    449452{
     453    RT_NOREF(EndPt, pbBuf, pcbBuf);
    450454    if ((pSetup->bmRequestType & VUSB_RECIP_MASK) != VUSB_TO_INTERFACE)
    451455    {
     
    476480    }
    477481    uint8_t iAlt = pSetup->wValue;
    478     PCVUSBDESCINTERFACEEX pIfDesc = vusbDevFindAltIfDesc(pDev, pIfState, iAlt);
     482    PCVUSBDESCINTERFACEEX pIfDesc = vusbDevFindAltIfDesc(pIfState, iAlt);
    479483    if (!pIfDesc)
    480484    {
     
    510514static bool vusbDevStdReqSetAddress(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf)
    511515{
     516    RT_NOREF(EndPt, pbBuf, pcbBuf);
    512517    if ((pSetup->bmRequestType & VUSB_RECIP_MASK) != VUSB_TO_DEVICE)
    513518    {
     
    541546static bool vusbDevStdReqClearFeature(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf)
    542547{
     548    RT_NOREF(pbBuf, pcbBuf);
    543549    switch (pSetup->bmRequestType & VUSB_RECIP_MASK)
    544550    {
     
    575581static bool vusbDevStdReqSetFeature(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf)
    576582{
     583    RT_NOREF(pDev, EndPt, pbBuf, pcbBuf);
    577584    switch (pSetup->bmRequestType & VUSB_RECIP_MASK)
    578585    {
     
    599606static bool vusbDevStdReqGetStatus(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf)
    600607{
     608    RT_NOREF(EndPt);
    601609    if (*pcbBuf != 2)
    602610    {
     
    832840static bool vusbDevStdReqGetDescriptor(PVUSBDEV pDev, int EndPt, PVUSBSETUP pSetup, uint8_t *pbBuf, uint32_t *pcbBuf)
    833841{
     842    RT_NOREF(EndPt);
    834843    if ((pSetup->bmRequestType & VUSB_RECIP_MASK) == VUSB_TO_DEVICE)
    835844    {
     
    11681177        /* Process any URBs waiting to be cancelled first. */
    11691178        int rc = RTReqQueueProcess(pDev->hReqQueueSync, 0); /* Don't wait if there is nothing to do. */
    1170         Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT);
     1179        Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT); NOREF(rc);
    11711180    }
    11721181
     
    13571366static DECLCALLBACK(void) vusbDevResetDoneTimer(PPDMUSBINS pUsbIns, PTMTIMER pTimer, void *pvUser)
    13581367{
     1368    RT_NOREF(pUsbIns, pTimer);
    13591369    PVUSBDEV        pDev  = (PVUSBDEV)pvUser;
    13601370    PVUSBRESETARGS  pArgs = (PVUSBRESETARGS)pDev->pvArgs;
     
    14321442 * @thread  EMT
    14331443 */
    1434 static DECLCALLBACK(int) vusbIDeviceReset(PVUSBIDEVICE pDevice, bool fResetOnLinux, PFNVUSBRESETDONE pfnDone, void *pvUser, PVM pVM)
    1435 {
     1444static DECLCALLBACK(int) vusbIDeviceReset(PVUSBIDEVICE pDevice, bool fResetOnLinux,
     1445                                          PFNVUSBRESETDONE pfnDone, void *pvUser, PVM pVM)
     1446{
     1447    RT_NOREF(pVM);
    14361448    PVUSBDEV pDev = (PVUSBDEV)pDevice;
    14371449    Assert(!pfnDone || pVM);
     
    16561668        {
    16571669            int rc2 = RTReqQueueProcess(pDev->hReqQueueSync, 0);
    1658             Assert(RT_SUCCESS(rc2) || rc2 == VERR_TIMEOUT);
     1670            Assert(RT_SUCCESS(rc2) || rc2 == VERR_TIMEOUT); NOREF(rc2);
    16591671        }
    16601672        else
  • trunk/src/VBox/Devices/USB/VUSBSniffer.cpp

    r62956 r62959  
    137137                                  const char *pszDesc)
    138138{
     139    RT_NOREF(pszDesc);
    139140    int rc = VINF_SUCCESS;
    140141    PVUSBSNIFFERINT pThis = NULL;
  • trunk/src/VBox/Devices/USB/VUSBSnifferPcapNg.cpp

    r62956 r62959  
    429429 * @param   cbOption        Size of the optiob data.
    430430 */
    431 static int vusbSnifferAddOption(PVUSBSNIFFERFMTINT pThis, uint16_t u16OptionCode, const void *pvOption, uint16_t cbOption)
    432 {
    433     int rc = VINF_SUCCESS;
     431static int vusbSnifferAddOption(PVUSBSNIFFERFMTINT pThis, uint16_t u16OptionCode, const void *pvOption, size_t cbOption)
     432{
     433    AssertStmt((uint16_t)cbOption == cbOption, cbOption = UINT16_MAX);
    434434    DumpFileOptionHdr OptHdr;
    435 
    436435    OptHdr.u16OptionCode   = u16OptionCode;
    437     OptHdr.u16OptionLength = cbOption;
    438     rc = vusbSnifferBlockAddData(pThis, &OptHdr, sizeof(OptHdr));
     436    OptHdr.u16OptionLength = (uint16_t)cbOption;
     437    int rc = vusbSnifferBlockAddData(pThis, &OptHdr, sizeof(OptHdr));
    439438    if (   RT_SUCCESS(rc)
    440439        && u16OptionCode != DUMPFILE_OPTION_CODE_END
    441440        && cbOption != 0)
    442441    {
    443         rc = vusbSnifferBlockAddData(pThis, pvOption, cbOption);
     442        rc = vusbSnifferBlockAddData(pThis, pvOption, (uint16_t)cbOption);
    444443        if (RT_SUCCESS(rc))
    445444            rc = vusbSnifferBlockAlign(pThis);
     
    561560static DECLCALLBACK(int) vusbSnifferFmtPcanNgRecordEvent(PVUSBSNIFFERFMTINT pThis, PVUSBURB pUrb, VUSBSNIFFEREVENT enmEvent)
    562561{
    563     int rc = VINF_SUCCESS;
    564562    DumpFileEpb Epb;
    565563    DumpFileUsbHeaderLnxMmapped UsbHdr;
    566     DumpFileUsbSetup UsbSetup;
     564    uint32_t cbCapturedLength = sizeof(UsbHdr);
     565    uint8_t *pbData = NULL;
     566
    567567    RTTIMESPEC TimeNow;
    568     uint64_t u64TimestampEvent;
    569     size_t cbUrbLength = 0;
    570     uint32_t cbDataLength = 0;
    571     uint32_t cbCapturedLength = sizeof(UsbHdr);
    572     uint32_t cIsocPkts = 0;
    573     uint8_t *pbData = NULL;
    574 
    575568    RTTimeNow(&TimeNow);
    576     u64TimestampEvent = RTTimeSpecGetNano(&TimeNow);
     569    uint64_t u64TimestampEvent = RTTimeSpecGetNano(&TimeNow);
    577570
    578571    /* Start with the enhanced packet block. */
     
    584577
    585578    UsbHdr.u64Id = (uint64_t)pUrb; /** @todo: check whether the pointer is a good ID. */
     579    uint32_t cbUrbLength;
    586580    switch (enmEvent)
    587581    {
     
    597591        case VUSBSNIFFEREVENT_ERROR_COMPLETE:
    598592            UsbHdr.u8EventType = DUMPFILE_USB_EVENT_TYPE_ERROR;
     593            cbUrbLength = 0;
    599594            break;
    600595        default:
    601596            AssertMsgFailed(("Invalid event type %d\n", enmEvent));
    602     }
    603     cbDataLength = cbUrbLength;
     597            cbUrbLength = 0;
     598    }
     599    uint32_t cbDataLength = cbUrbLength;
    604600    pbData = &pUrb->abData[0];
    605601
     602    uint32_t cIsocPkts = 0;
    606603    switch (pUrb->enmType)
    607604    {
    608605        case VUSBXFERTYPE_ISOC:
    609606        {
    610             int32_t i32ErrorCount = 0;
     607            int32_t cErrors = 0;
    611608
    612609            UsbHdr.u8TransferType = 0;
     
    615612                if (   pUrb->aIsocPkts[i].enmStatus != VUSBSTATUS_OK
    616613                    && pUrb->aIsocPkts[i].enmStatus != VUSBSTATUS_NOT_ACCESSED)
    617                     i32ErrorCount++;
    618 
    619             UsbHdr.u.IsoRec.i32ErrorCount = i32ErrorCount;
     614                    cErrors++;
     615
     616            UsbHdr.u.IsoRec.i32ErrorCount = cErrors;
    620617            UsbHdr.u.IsoRec.i32NumDesc    = pUrb->cIsocPkts;
    621618            cbCapturedLength += cIsocPkts * sizeof(DumpFileUsbIsoDesc);
     
    623620        }
    624621        case VUSBXFERTYPE_BULK:
    625                 UsbHdr.u8TransferType = 3;
    626                 break;
     622            UsbHdr.u8TransferType = 3;
     623            break;
    627624        case VUSBXFERTYPE_INTR:
    628                 UsbHdr.u8TransferType = 1;
    629                 break;
     625            UsbHdr.u8TransferType = 1;
     626            break;
    630627        case VUSBXFERTYPE_CTRL:
    631628        case VUSBXFERTYPE_MSG:
    632                 UsbHdr.u8TransferType = 2;
    633                 break;
     629            UsbHdr.u8TransferType = 2;
     630            break;
    634631        default:
    635632            AssertMsgFailed(("invalid transfer type %d\n", pUrb->enmType));
     
    684681
    685682    /* Write the packet to the capture file. */
    686     rc = vusbSnifferBlockNew(pThis, &Epb.Hdr, sizeof(Epb));
     683    int rc = vusbSnifferBlockNew(pThis, &Epb.Hdr, sizeof(Epb));
    687684    if (RT_SUCCESS(rc))
    688685        rc = vusbSnifferBlockAddData(pThis, &UsbHdr, sizeof(UsbHdr));
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