From 38aafc76cfeb7b3bd0f17816d3f7b375d278c3ec Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 22 Dec 2004 19:48:10 +0000 Subject: [PATCH] Do not push_back entries after resize()ing the vector. --- src/merge/pr_generic.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/merge/pr_generic.cpp b/src/merge/pr_generic.cpp index b87060b0c..9bf40eeec 100644 --- a/src/merge/pr_generic.cpp +++ b/src/merge/pr_generic.cpp @@ -859,9 +859,9 @@ generic_packetizer_c::add_packet(memories_c &mems, mems[0]->release(); for (i = 1; i < mems.size(); i++) { add_length = mems[i]->size; - pack->data_adds.push_back(compressor->compress(mems[i]->data, - add_length)); - pack->data_adds_lengths.push_back(add_length); + pack->data_adds[i - 1] = compressor->compress(mems[i]->data, + add_length); + pack->data_adds_lengths[i - 1] = add_length; mems[i]->release(); } } else { @@ -874,12 +874,12 @@ generic_packetizer_c::add_packet(memories_c &mems, for (i = 1; i < mems.size(); i++) { if (!mems[i]->is_free) { add_length = mems[i]->size; - pack->data_adds.push_back((unsigned char *)safememdup(mems[i]->data, - add_length)); - pack->data_adds_lengths.push_back(add_length); + pack->data_adds[i - 1] = (unsigned char *)safememdup(mems[i]->data, + add_length); + pack->data_adds_lengths[i - 1] = add_length; } else { - pack->data_adds.push_back(mems[i]->data); - pack->data_adds_lengths.push_back(mems[i]->size); + pack->data_adds[i - 1] = mems[i]->data; + pack->data_adds_lengths[i - 1] = mems[i]->size; mems[i]->lock(); } }