Changeset 58293 in vbox
- Timestamp:
- Oct 17, 2015 10:30:41 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
include/iprt/localipc.h (modified) (3 diffs)
-
src/VBox/Runtime/r3/posix/localipc-posix.cpp (modified) (4 diffs)
-
src/VBox/Runtime/r3/win/localipc-win.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/localipc.h
r58290 r58293 152 152 * 153 153 * @param hSession The session handle. 154 * @param pvBuffer Where to store the data. 155 * @param cbBuffer If pcbRead is non-NULL this indicates the maximum number of 156 * bytes to read. If pcbRead is NULL then this is the exact number 157 * of bytes to read. 158 * @param pcbRead Optional argument for indicating a partial read and returning 159 * the number of bytes actually read. 160 * This may return 0 on some implementations? 161 */ 162 RTDECL(int) RTLocalIpcSessionRead(RTLOCALIPCSESSION hSession, void *pvBuffer, size_t cbBuffer, size_t *pcbRead); 154 * @param pvBuf Where to store the data. 155 * @param cbToRead How much to read. This is exact request if 156 * pcbRead is NULL, otherwise it's an upper limit. 157 * @param pcbRead Optional argument for indicating a partial read 158 * and returning the number of bytes actually read. 159 */ 160 RTDECL(int) RTLocalIpcSessionRead(RTLOCALIPCSESSION hSession, void *pvBuf, size_t cbToRead, size_t *pcbRead); 163 161 164 162 /** … … 166 164 * 167 165 * This may or may not block until the data is received by the other party, 168 * this is an implementation detail. If you want to make sure that the data166 * this is an implementation detail. If you want to make sure that the data 169 167 * has been received you should always call RTLocalIpcSessionFlush(). 170 168 * … … 173 171 * 174 172 * @param hSession The session handle. 175 * @param pvBuf ferThe data to write.176 * @param cb Buffer The number of bytesto write.177 */ 178 RTDECL(int) RTLocalIpcSessionWrite(RTLOCALIPCSESSION hSession, const void *pvBuf fer, size_t cbBuffer);173 * @param pvBuf The data to write. 174 * @param cbToWrite How much to write. 175 */ 176 RTDECL(int) RTLocalIpcSessionWrite(RTLOCALIPCSESSION hSession, const void *pvBuf, size_t cbToWrite); 179 177 180 178 /** -
trunk/src/VBox/Runtime/r3/posix/localipc-posix.cpp
r58292 r58293 662 662 663 663 664 RTDECL(int) RTLocalIpcSessionRead(RTLOCALIPCSESSION hSession, void *pvBuf fer, size_t cbBuffer, size_t *pcbRead)664 RTDECL(int) RTLocalIpcSessionRead(RTLOCALIPCSESSION hSession, void *pvBuf, size_t cbToRead, size_t *pcbRead) 665 665 { 666 666 /* … … 690 690 AssertRCBreak(rc); 691 691 692 rc = RTSocketRead(pThis->hSocket, pvBuf fer, cbBuffer, pcbRead);692 rc = RTSocketRead(pThis->hSocket, pvBuf, cbToRead, pcbRead); 693 693 694 694 /* Detect broken pipe. */ … … 726 726 727 727 728 RTDECL(int) RTLocalIpcSessionWrite(RTLOCALIPCSESSION hSession, const void *pvBuf fer, size_t cbBuffer)728 RTDECL(int) RTLocalIpcSessionWrite(RTLOCALIPCSESSION hSession, const void *pvBuf, size_t cbToWrite) 729 729 { 730 730 /* … … 754 754 AssertRCBreak(rc); 755 755 756 rc = RTSocketWrite(pThis->hSocket, pvBuf fer, cbBuffer);756 rc = RTSocketWrite(pThis->hSocket, pvBuf, cbToWrite); 757 757 758 758 int rc2 = RTCritSectEnter(&pThis->CritSect); -
trunk/src/VBox/Runtime/r3/win/localipc-win.cpp
r58290 r58293 795 795 796 796 797 RTDECL(int) RTLocalIpcSessionRead(RTLOCALIPCSESSION hSession, void *pvBuf fer, size_t cbBuffer, size_t *pcbRead)797 RTDECL(int) RTLocalIpcSessionRead(RTLOCALIPCSESSION hSession, void *pvBuf, size_t cbToRead, size_t *pcbRead) 798 798 { 799 799 PRTLOCALIPCSESSIONINT pThis = (PRTLOCALIPCSESSIONINT)hSession; 800 800 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 801 801 AssertReturn(pThis->u32Magic == RTLOCALIPCSESSION_MAGIC, VERR_INVALID_HANDLE); 802 AssertPtrReturn(pvBuf fer, VERR_INVALID_POINTER);802 AssertPtrReturn(pvBuf, VERR_INVALID_POINTER); 803 803 /* pcbRead is optional. */ 804 804 … … 811 811 pThis->cRefs++; 812 812 813 size_t cbToRead = cbBuffer;814 813 size_t cbTotalRead = 0; 815 814 while (cbToRead > 0) … … 825 824 RTCritSectLeave(&pThis->CritSect); 826 825 827 if (ReadFile(pThis->hNmPipe, pvBuf fer,826 if (ReadFile(pThis->hNmPipe, pvBuf, 828 827 cbToRead <= ~(DWORD)0 ? (DWORD)cbToRead : ~(DWORD)0, 829 828 &cbRead, &pThis->OverlappedIO)) … … 857 856 cbToRead -= cbRead; 858 857 cbTotalRead += cbRead; 859 pvBuf fer = (uint8_t *)pvBuffer+ cbRead;858 pvBuf = (uint8_t *)pvBuf + cbRead; 860 859 } 861 860 … … 948 947 949 948 950 RTDECL(int) RTLocalIpcSessionWrite(RTLOCALIPCSESSION hSession, const void *pvBuf fer, size_t cbBuffer)949 RTDECL(int) RTLocalIpcSessionWrite(RTLOCALIPCSESSION hSession, const void *pvBuf, size_t cbToWrite) 951 950 { 952 951 PRTLOCALIPCSESSIONINT pThis = (PRTLOCALIPCSESSIONINT)hSession; 953 952 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 954 953 AssertReturn(pThis->u32Magic == RTLOCALIPCSESSION_MAGIC, VERR_INVALID_HANDLE); 955 AssertPtrReturn(pvBuf fer, VERR_INVALID_POINTER);956 AssertReturn(cb Buffer, VERR_INVALID_PARAMETER);954 AssertPtrReturn(pvBuf, VERR_INVALID_POINTER); 955 AssertReturn(cbToWrite, VERR_INVALID_PARAMETER); 957 956 958 957 int rc = RTCritSectEnter(&pThis->CritSect); … … 988 987 */ 989 988 size_t cbTotalWritten = 0; 990 while (cb Buffer> 0)989 while (cbToWrite > 0) 991 990 { 992 991 BOOL fRc = ResetEvent(pThis->OverlappedIO.hEvent); Assert(fRc == TRUE); … … 995 994 996 995 DWORD cbWritten = 0; 997 fRc = WriteFile(pThis->hNmPipe, pvBuf fer,998 cb Buffer <= ~(DWORD)0 ? (DWORD)cbBuffer: ~(DWORD)0,996 fRc = WriteFile(pThis->hNmPipe, pvBuf, 997 cbToWrite <= ~(DWORD)0 ? (DWORD)cbToWrite : ~(DWORD)0, 999 998 &cbWritten, &pThis->OverlappedIO); 1000 999 if (fRc) … … 1034 1033 1035 1034 /* Advance. */ 1036 pvBuf fer = (char const *)pvBuffer+ cbWritten;1035 pvBuf = (char const *)pvBuf + cbWritten; 1037 1036 cbTotalWritten += cbWritten; 1038 cb Buffer-= cbWritten;1037 cbToWrite -= cbWritten; 1039 1038 } 1040 1039 }
Note:
See TracChangeset
for help on using the changeset viewer.

