void ReByteBuffer::ensureSize(size_t size){
if (m_capacity < size){
int delta = m_delta > 0 ? m_delta
- : 2 * m_capacity < - m_delta ? 2 * m_capacity : - m_delta;
- if (size - m_capacity < delta)
+ : (int) m_capacity < - m_delta / 2 ? (int) 2 * m_capacity : - m_delta;
+ if (int(size - m_capacity) < delta)
size = m_capacity + delta;
// Think for the ending '\0':
Byte* buffer = new Byte[size + 1];
}
protected:
// The minimum difference between old and new size after a new allocation.
- size_t m_delta;
+ int m_delta;
//@ If the needed space is small enough this buffer will be used.
char m_primaryBuffer[PRIMARY_BUFFER_SIZE];
//@ The internal buffer. Points to <code>m_primaryBuffer</code> if the space is small enough.
int maxDelta = 512 * (1 << 10);
buf.setDelta(- maxDelta);
int count = 0;
- while(buf.capacity() < maxDelta){
+ while(buf.capacity() < (size_t) maxDelta){
buf.ensureSize(buf.capacity() + 2);
count++;
}