Changeset 84843 in vbox
- Timestamp:
- Jun 16, 2020 9:44:14 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 138655
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
r84745 r84843 523 523 524 524 GuestProcessStream::GuestProcessStream(void) 525 : m_cbAllocated(0), 526 m_cbUsed(0), 527 m_offBuffer(0), 528 m_pbBuffer(NULL) 529 { 530 531 } 525 : m_cbMax(_32M) 526 , m_cbAllocated(0) 527 , m_cbUsed(0) 528 , m_offBuffer(0) 529 , m_pbBuffer(NULL) { } 532 530 533 531 GuestProcessStream::~GuestProcessStream(void) … … 540 538 * are multiple rounds of adding data needed. 541 539 * 542 * @return VBox status code. 540 * @return VBox status code. Will return VERR_TOO_MUCH_DATA if the buffer's maximum (limit) has been reached. 543 541 * @param pbData Pointer to data to add. 544 542 * @param cbData Size (in bytes) of data to add. … … 579 577 if (cbData + m_cbUsed > m_cbAllocated) 580 578 { 581 /** @todo Put an upper limit on the allocation? */582 579 size_t cbAlloc = m_cbUsed + cbData; 583 cbAlloc = RT_ALIGN_Z(cbAlloc, _64K); 584 void *pvNew = RTMemRealloc(m_pbBuffer, cbAlloc); 585 if (pvNew) 580 if (cbAlloc <= m_cbMax) 586 581 { 587 m_pbBuffer = (uint8_t *)pvNew; 588 m_cbAllocated = cbAlloc; 582 cbAlloc = RT_ALIGN_Z(cbAlloc, _64K); 583 void *pvNew = RTMemRealloc(m_pbBuffer, cbAlloc); 584 if (pvNew) 585 { 586 m_pbBuffer = (uint8_t *)pvNew; 587 m_cbAllocated = cbAlloc; 588 } 589 else 590 rc = VERR_NO_MEMORY; 589 591 } 590 592 else 591 rc = VERR_ NO_MEMORY;593 rc = VERR_TOO_MUCH_DATA; 592 594 } 593 595
Note:
See TracChangeset
for help on using the changeset viewer.