Skip to content
New issue

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

The throw occurs #103

Open
feelwa17 opened this issue Sep 13, 2024 · 0 comments
Open

The throw occurs #103

feelwa17 opened this issue Sep 13, 2024 · 0 comments

Comments

@feelwa17
Copy link

The throw occurs too frequently in the following code.

void FBEBuffer::remove(size_t offset, size_t size)
{
assert(((offset + size) <= _size) && "Invalid offset & size!!");
if ((offset + size) > _size)
throw std::invalid_argument("Invalid offset & size!!");

std::memcpy(_data + offset, _data + offset + size, _size - size - offset);
_size -= size;
if (_offset >= (offset + size))
    _offset -= size;
else if (_offset >= offset)
{
    _offset -= _offset - offset;
    if (_offset > _size)
        _offset = _size;
}

}

After that, the transmission doesn't proceed.
What is the solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant