VirtualBox

Changeset 69207 in vbox for trunk/src/bldprogs/scmstream.cpp


Ignore:
Timestamp:
Oct 24, 2017 1:06:06 PM (7 years ago)
Author:
vboxsync
Message:

scm: Relative filtering support. Zero file length allocation workaround.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bldprogs/scmstream.cpp

    r69166 r69207  
    9393
    9494    /* allocate stuff */
    95     size_t cbEstimate = pRelatedStream
    96                       ? pRelatedStream->cb + pRelatedStream->cb / 10
    97                       : _64K;
     95    size_t cbEstimate = !pRelatedStream ? _64K
     96                      : pRelatedStream->cb > 0 ? pRelatedStream->cb + pRelatedStream->cb / 10 : 64;
    9897    cbEstimate = RT_ALIGN(cbEstimate, _4K);
    9998    pStream->pch = (char *)RTMemAlloc(cbEstimate);
     
    104103                              : cbEstimate / 24;
    105104        cLinesEstimate = RT_ALIGN(cLinesEstimate, 512);
     105        if (cLinesEstimate == 0)
     106            cLinesEstimate = 16;
    106107        pStream->paLines = (PSCMSTREAMLINE)RTMemAlloc(cLinesEstimate * sizeof(SCMSTREAMLINE));
    107108        if (pStream->paLines)
     
    255256        return false;
    256257    if (!pStream->cb)
    257         return false;
     258        return true;
    258259    return true;
    259260}
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