[F] Fixed clang-tidy warning

This commit is contained in:
seleznevae 2019-01-01 18:50:08 +03:00
parent a87e060b7c
commit 06fdfc8490
2 changed files with 10 additions and 10 deletions

View File

@ -5570,8 +5570,8 @@ int vector_push(vector_t *vector, const void *item)
vector->m_capacity = vector->m_capacity * 2; vector->m_capacity = vector->m_capacity * 2;
} }
ptrdiff_t deviation = vector->m_size * vector->m_item_size; size_t offset = vector->m_size * vector->m_item_size;
memcpy((char *)vector->m_data + deviation, item, vector->m_item_size); memcpy((char *)vector->m_data + offset, item, vector->m_item_size);
++(vector->m_size); ++(vector->m_size);
@ -5620,7 +5620,7 @@ fort_status_t vector_swap(vector_t *cur_vec, vector_t *mv_vec, size_t pos)
cur_vec->m_capacity = min_targ_size; cur_vec->m_capacity = min_targ_size;
} }
ptrdiff_t deviation = pos * cur_vec->m_item_size; size_t offset = pos * cur_vec->m_item_size;
void *tmp = NULL; void *tmp = NULL;
size_t new_mv_sz = 0; size_t new_mv_sz = 0;
if (cur_sz > pos) { if (cur_sz > pos) {
@ -5633,11 +5633,11 @@ fort_status_t vector_swap(vector_t *cur_vec, vector_t *mv_vec, size_t pos)
if (tmp) { if (tmp) {
memcpy(tmp, memcpy(tmp,
(char *)cur_vec->m_data + deviation, (char *)cur_vec->m_data + offset,
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 + offset,
mv_vec->m_data, mv_vec->m_data,
cur_vec->m_item_size * mv_sz); cur_vec->m_item_size * mv_sz);

View File

@ -85,8 +85,8 @@ int vector_push(vector_t *vector, const void *item)
vector->m_capacity = vector->m_capacity * 2; vector->m_capacity = vector->m_capacity * 2;
} }
ptrdiff_t deviation = vector->m_size * vector->m_item_size; size_t offset = vector->m_size * vector->m_item_size;
memcpy((char *)vector->m_data + deviation, item, vector->m_item_size); memcpy((char *)vector->m_data + offset, item, vector->m_item_size);
++(vector->m_size); ++(vector->m_size);
@ -135,7 +135,7 @@ fort_status_t vector_swap(vector_t *cur_vec, vector_t *mv_vec, size_t pos)
cur_vec->m_capacity = min_targ_size; cur_vec->m_capacity = min_targ_size;
} }
ptrdiff_t deviation = pos * cur_vec->m_item_size; size_t offset = pos * cur_vec->m_item_size;
void *tmp = NULL; void *tmp = NULL;
size_t new_mv_sz = 0; size_t new_mv_sz = 0;
if (cur_sz > pos) { if (cur_sz > pos) {
@ -148,11 +148,11 @@ fort_status_t vector_swap(vector_t *cur_vec, vector_t *mv_vec, size_t pos)
if (tmp) { if (tmp) {
memcpy(tmp, memcpy(tmp,
(char *)cur_vec->m_data + deviation, (char *)cur_vec->m_data + offset,
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 + offset,
mv_vec->m_data, mv_vec->m_data,
cur_vec->m_item_size * mv_sz); cur_vec->m_item_size * mv_sz);