[F] Fixed memory buf

This commit is contained in:
seleznevae 2018-05-12 13:09:07 +03:00
parent bc567c0014
commit 59718f4f8d
2 changed files with 24 additions and 12 deletions

View File

@ -2730,15 +2730,21 @@ fort_status_t vector_swap(vector_t *cur_vec, vector_t *mv_vec, size_t pos)
} }
} }
if (tmp) {
memcpy(tmp, memcpy(tmp,
(char *)cur_vec->m_data + deviation, (char *)cur_vec->m_data + deviation,
cur_vec->m_item_size * new_mv_sz); cur_vec->m_item_size * new_mv_sz);
}
memcpy((char *)cur_vec->m_data + deviation, memcpy((char *)cur_vec->m_data + deviation,
mv_vec->m_data, mv_vec->m_data,
cur_vec->m_item_size * mv_sz); cur_vec->m_item_size * mv_sz);
if (tmp) {
memcpy(mv_vec->m_data, memcpy(mv_vec->m_data,
tmp, tmp,
cur_vec->m_item_size * new_mv_sz); cur_vec->m_item_size * new_mv_sz);
}
cur_vec->m_size = MAX(cur_vec->m_size, min_targ_size); cur_vec->m_size = MAX(cur_vec->m_size, min_targ_size);
mv_vec->m_size = new_mv_sz; mv_vec->m_size = new_mv_sz;

View File

@ -196,15 +196,21 @@ fort_status_t vector_swap(vector_t *cur_vec, vector_t *mv_vec, size_t pos)
} }
} }
if (tmp) {
memcpy(tmp, memcpy(tmp,
(char *)cur_vec->m_data + deviation, (char *)cur_vec->m_data + deviation,
cur_vec->m_item_size * new_mv_sz); cur_vec->m_item_size * new_mv_sz);
}
memcpy((char *)cur_vec->m_data + deviation, memcpy((char *)cur_vec->m_data + deviation,
mv_vec->m_data, mv_vec->m_data,
cur_vec->m_item_size * mv_sz); cur_vec->m_item_size * mv_sz);
if (tmp) {
memcpy(mv_vec->m_data, memcpy(mv_vec->m_data,
tmp, tmp,
cur_vec->m_item_size * new_mv_sz); cur_vec->m_item_size * new_mv_sz);
}
cur_vec->m_size = MAX(cur_vec->m_size, min_targ_size); cur_vec->m_size = MAX(cur_vec->m_size, min_targ_size);
mv_vec->m_size = new_mv_sz; mv_vec->m_size = new_mv_sz;