Changeset 82477 in vbox for trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp
- Timestamp:
- Dec 6, 2019 11:54:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp
r82280 r82477 45 45 { 46 46 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 47 AssertReturn (cbData, VERR_INVALID_PARAMETER); 48 49 PSHCLEVENTPAYLOAD pPayload = 50 (PSHCLEVENTPAYLOAD)RTMemAlloc(sizeof(SHCLEVENTPAYLOAD)); 51 if (!pPayload) 52 return VERR_NO_MEMORY; 53 54 pPayload->pvData = RTMemAlloc(cbData); 55 if (pPayload->pvData) 56 { 57 memcpy(pPayload->pvData, pvData, cbData); 58 59 pPayload->cbData = cbData; 60 pPayload->uID = uID; 61 62 *ppPayload = pPayload; 63 64 return VINF_SUCCESS; 65 } 66 67 RTMemFree(pPayload); 47 AssertReturn(cbData > 0, VERR_INVALID_PARAMETER); 48 49 PSHCLEVENTPAYLOAD pPayload = (PSHCLEVENTPAYLOAD)RTMemAlloc(sizeof(SHCLEVENTPAYLOAD)); 50 if (pPayload) 51 { 52 pPayload->pvData = RTMemDup(pvData, cbData); 53 if (pPayload->pvData) 54 { 55 pPayload->cbData = cbData; 56 pPayload->uID = uID; 57 58 *ppPayload = pPayload; 59 return VINF_SUCCESS; 60 } 61 62 RTMemFree(pPayload); 63 } 68 64 return VERR_NO_MEMORY; 69 65 } … … 88 84 89 85 pPayload->cbData = 0; 86 pPayload->uID = UINT32_MAX; 90 87 91 88 RTMemFree(pPayload); 92 pPayload = NULL;93 89 } 94 90 … … 148 144 int ShClEventSourceCreate(PSHCLEVENTSOURCE pSource, SHCLEVENTSOURCEID uID) 149 145 { 146 LogFlowFunc(("pSource=%p, uID=%RU16\n", pSource, uID)); 150 147 AssertPtrReturn(pSource, VERR_INVALID_POINTER); 151 152 LogFlowFunc(("pSource=%p, uID=%RU32\n", pSource, uID));153 154 int rc = VINF_SUCCESS;155 148 156 149 RTListInit(&pSource->lstEvents); … … 160 153 pSource->uEventIDNext = RTRandU32() % VBOX_SHCL_MAX_EVENTS; 161 154 162 LogFlowFuncLeaveRC( rc);163 return rc;155 LogFlowFuncLeaveRC(VINF_SUCCESS); 156 return VINF_SUCCESS; 164 157 } 165 158 … … 178 171 ShClEventSourceReset(pSource); 179 172 180 pSource->uID = 0;181 pSource->uEventIDNext = 0;173 pSource->uID = UINT16_MAX; 174 pSource->uEventIDNext = UINT32_MAX; 182 175 } 183 176
Note:
See TracChangeset
for help on using the changeset viewer.