]> gitweb.hamatoma.de Git - crepublib/commitdiff
unsigned/signed trouble
authorkawi <winfriedkappeler@atron.de>
Fri, 16 Jan 2015 07:32:41 +0000 (08:32 +0100)
committerkawi <winfriedkappeler@atron.de>
Fri, 16 Jan 2015 07:32:41 +0000 (08:32 +0100)
base/ReByteBuffer.cpp
base/ReByteBuffer.hpp
cunit/cuReByteBuffer.cpp

index b45206bc6d179ed714163c965ec5017abf78a6ce..c44ef3fefd928385575fe2fab933cf58ced13933 100644 (file)
@@ -246,8 +246,8 @@ bool ReByteBuffer::endsWith(const Byte* tail, size_t tailLength,
 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];
index 1fbb0fe82af5ba533be01f46969c0c427fc19580..aa6f891b762b0a9e06ff1e49e31f7dfe82b4567f 100644 (file)
@@ -173,7 +173,7 @@ public:
        }
 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.
index 91d44d19adda608a12c6a9eba60662fe14cfb353..a97af5fa7d08b3e44e333f2e92419cd79089b642 100644 (file)
@@ -37,7 +37,7 @@ private:
                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++;
                }