VirtualBox

Changeset 26296 in vbox for trunk/src/VBox/Main/linux


Ignore:
Timestamp:
Feb 5, 2010 2:53:35 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57365
Message:

more warnings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/linux/HostHardwareLinux.cpp

    r26186 r26296  
    325325    AssertPtrNullReturn(pchModel, VERR_INVALID_POINTER);
    326326
    327     unsigned char u8Response[96] = { 0 };
    328     struct cdrom_generic_command CdromCommandReq =
    329     { { INQUIRY, 0, 0, 0, sizeof(u8Response), 0 }  /* INQUIRY */ };
    330     int rc, rcIoCtl = 0;
    331     RTFILE file;
    332     rc = RTFileOpen(&file, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);
     327    RTFILE hFile;
     328    int rc = RTFileOpen(&hFile, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);
    333329    if (RT_SUCCESS(rc))
    334330    {
    335         CdromCommandReq.buffer = u8Response;
    336         CdromCommandReq.buflen = sizeof(u8Response);
     331        int                             rcIoCtl        = 0;
     332        unsigned char                   u8Response[96] = { 0 };
     333        struct cdrom_generic_command    CdromCommandReq;
     334        RT_ZERO(CdromCommandReq);
     335        CdromCommandReq.cmd[0]         = INQUIRY;
     336        CdromCommandReq.cmd[4]         = sizeof(u8Response);
     337        CdromCommandReq.buffer         = u8Response;
     338        CdromCommandReq.buflen         = sizeof(u8Response);
    337339        CdromCommandReq.data_direction = CGC_DATA_READ;
    338         CdromCommandReq.timeout = 5000;  /* ms */
    339         rc = RTFileIoCtl(file, CDROM_SEND_PACKET, &CdromCommandReq, 0,
    340                          &rcIoCtl);
     340        CdromCommandReq.timeout        = 5000;  /* ms */
     341        rc = RTFileIoCtl(hFile, CDROM_SEND_PACKET, &CdromCommandReq, 0, &rcIoCtl);
    341342        if (RT_SUCCESS(rc) && rcIoCtl < 0)
    342343            rc = RTErrConvertFromErrno(-CdromCommandReq.stat);
    343         RTFileClose(file);
    344     }
    345     if (RT_SUCCESS(rc))
    346     {
    347         if (pu8Type)
    348             *pu8Type = u8Response[0] & 0x1f;
    349         if (pchVendor)
    350             RTStrPrintf(pchVendor, cchVendor, "%.8s",
    351                         (char *) &u8Response[8] /* vendor id string */);
    352         if (pchModel)
    353             RTStrPrintf(pchModel, cchModel, "%.16s",
    354                         (char *) &u8Response[16] /* product id string */);
     344        RTFileClose(hFile);
     345
     346        if (RT_SUCCESS(rc))
     347        {
     348            if (pu8Type)
     349                *pu8Type = u8Response[0] & 0x1f;
     350            if (pchVendor)
     351                RTStrPrintf(pchVendor, cchVendor, "%.8s",
     352                            &u8Response[8] /* vendor id string */);
     353            if (pchModel)
     354                RTStrPrintf(pchModel, cchModel, "%.16s",
     355                            &u8Response[16] /* product id string */);
     356            LogRelFlowFunc(("returning success: type=%u, vendor=%.8s, product=%.16s\n",
     357                            u8Response[0] & 0x1f, &u8Response[8], &u8Response[16]));
     358            return VINF_SUCCESS;
     359        }
    355360    }
    356361    LogRelFlowFunc(("returning %Rrc\n", rc));
    357     if (RT_SUCCESS(rc))
    358         LogRelFlowFunc(("    type=%u, vendor=%.8s, product=%.16s\n",
    359                         u8Response[0] & 0x1f, (char *) &u8Response[8],
    360                         (char *) &u8Response[16]));
    361362    return rc;
    362363}
     
    801802                  pList, (unsigned) isDVD, pfSuccess));
    802803    PRTDIR pDir = NULL;
    803     RTDIRENTRY entry = {0};
    804804    int rc;
    805805    bool fSuccess = false;
     
    813813    fSuccess = true;
    814814    if (RT_SUCCESS(rc))
    815         while (true)
    816         {
     815        for (;;)
     816        {
     817            RTDIRENTRY entry;
    817818            rc = RTDirRead(pDir, &entry, NULL);
    818819            Assert(rc != VERR_BUFFER_OVERFLOW);  /* Should never happen... */
     
    989990    bool success = false;
    990991
    991     deviceNodeArray aDevices = { { 0 } };
    992992    char szPath[RTPATH_MAX] = "/dev";
     993    deviceNodeArray aDevices;
     994    RT_ZERO(aDevices);
    993995    devFindDeviceRecursive(szPath, sizeof(szPath), aDevices, isDVD);
    994996    try
Note: See TracChangeset for help on using the changeset viewer.

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