We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
int Move_Rows_Down(_ListboxData *data, int row) { int size = sizeof(_ListEntryRow) * (data->m_endPos - row); char *buf = new char[size]; memcpy(buf, &data->m_listData[row], size); memcpy(&data->m_listData[row + 1], buf, size); delete[] buf; ... }
It allocates a buf, copies data->m_listData[row] into buf, and copies buf into data->m_listData[row + 1].
data->m_listData[row]
buf
data->m_listData[row + 1]
This makes no sense. It can copy data->m_listData[row] directly into data->m_listData[row + 1]:
memcpy(&data->m_listData[row + 1], &data->m_listData[row], size);
Alternatively, perhaps this meant to swap the rows? In that case one would need to add as 2nd copy step:
memcpy(&data->m_listData[row], &data->m_listData[row + 1], size);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It allocates a buf, copies
data->m_listData[row]
intobuf
, and copiesbuf
intodata->m_listData[row + 1]
.This makes no sense. It can copy
data->m_listData[row]
directly intodata->m_listData[row + 1]
:Alternatively, perhaps this meant to swap the rows? In that case one would need to add as 2nd copy step:
The text was updated successfully, but these errors were encountered: