Prechádzať zdrojové kódy

don't grow the buffer quite so large

David Rose 18 rokov pred
rodič
commit
d505d4365c
1 zmenil súbory, kde vykonal 1 pridanie a 1 odobranie
  1. 1 1
      direct/src/dcparser/dcPackData.cxx

+ 1 - 1
direct/src/dcparser/dcPackData.cxx

@@ -30,7 +30,7 @@ static const size_t extra_size = 50;
 void DCPackData::
 set_used_length(size_t size) {
   if (size > _allocated_size) {
-    _allocated_size = size * size + extra_size;
+    _allocated_size = size + size + extra_size;
     char *new_buf = new char[_allocated_size];
     if (_used_length > 0) {
       memcpy(new_buf, _buffer, _used_length);