VirtualBox

Changeset 77387 in vbox


Ignore:
Timestamp:
Feb 20, 2019 2:20:19 PM (6 years ago)
Author:
vboxsync
Message:

GuestControl/Main: Const'ed data to write in i_writeData[At].

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestFileImpl.h

    r76562 r77387  
    7070    int             i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, FileStatus_T *pFileStatus, int *pGuestRc);
    7171    int             i_waitForWrite(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, uint32_t *pcbWritten);
    72     int             i_writeData(uint32_t uTimeoutMS, void *pvData, uint32_t cbData, uint32_t *pcbWritten);
    73     int             i_writeDataAt(uint64_t uOffset, uint32_t uTimeoutMS, void *pvData, uint32_t cbData, uint32_t *pcbWritten);
     72    int             i_writeData(uint32_t uTimeoutMS, const void *pvData, uint32_t cbData, uint32_t *pcbWritten);
     73    int             i_writeDataAt(uint64_t uOffset, uint32_t uTimeoutMS, const void *pvData, uint32_t cbData, uint32_t *pcbWritten);
    7474    /** @}  */
    7575
  • trunk/src/VBox/Main/src-client/GuestFileImpl.cpp

    r77386 r77387  
    11321132}
    11331133
    1134 int GuestFile::i_writeData(uint32_t uTimeoutMS, void *pvData, uint32_t cbData,
     1134int GuestFile::i_writeData(uint32_t uTimeoutMS, const void *pvData, uint32_t cbData,
    11351135                           uint32_t *pcbWritten)
    11361136{
     
    11681168    HGCMSvcSetU32(&paParms[i++], mObjectID /* File handle */);
    11691169    HGCMSvcSetU32(&paParms[i++], cbData /* Size (in bytes) to write */);
    1170     HGCMSvcSetPv(&paParms[i++], pvData, cbData);
     1170    HGCMSvcSetPv (&paParms[i++], unconst(pvData), cbData);
    11711171
    11721172    alock.release(); /* Drop write lock before sending. */
     
    11961196
    11971197int GuestFile::i_writeDataAt(uint64_t uOffset, uint32_t uTimeoutMS,
    1198                              void *pvData, uint32_t cbData, uint32_t *pcbWritten)
     1198                             const void *pvData, uint32_t cbData, uint32_t *pcbWritten)
    11991199{
    12001200    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     
    12321232    HGCMSvcSetU64(&paParms[i++], uOffset /* Offset where to starting writing */);
    12331233    HGCMSvcSetU32(&paParms[i++], cbData /* Size (in bytes) to write */);
    1234     HGCMSvcSetPv(&paParms[i++], pvData, cbData);
     1234    HGCMSvcSetPv (&paParms[i++], unconst(pvData), cbData);
    12351235
    12361236    alock.release(); /* Drop write lock before sending. */
     
    14871487    HRESULT hr = S_OK;
    14881488
    1489     uint32_t cbData = (uint32_t)aData.size();
    1490     void *pvData = cbData > 0? (void *)&aData.front(): NULL;
     1489    const uint32_t cbData = (uint32_t)aData.size();
     1490    const void *pvData = (void *)&aData.front();
    14911491    int vrc = i_writeData(aTimeoutMS, pvData, cbData, (uint32_t*)aWritten);
    14921492    if (RT_FAILURE(vrc))
     
    15101510    HRESULT hr = S_OK;
    15111511
    1512     uint32_t cbData = (uint32_t)aData.size();
    1513     void *pvData = cbData > 0? (void *)&aData.front(): NULL;
     1512    const uint32_t cbData = (uint32_t)aData.size();
     1513    const void *pvData = (void *)&aData.front();
    15141514    int vrc = i_writeData(aTimeoutMS, pvData, cbData, (uint32_t*)aWritten);
    15151515    if (RT_FAILURE(vrc))
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