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

[codesmell] weird shadowing of parameter in readBytes() #129

Closed
dirkmueller opened this issue Dec 18, 2019 · 0 comments
Closed

[codesmell] weird shadowing of parameter in readBytes() #129

dirkmueller opened this issue Dec 18, 2019 · 0 comments
Assignees
Labels

Comments

@dirkmueller
Copy link

I am not 100% sure this is a bug, but it looks weird:

size_t SoftwareSerial::readBytes(uint8_t * buffer, size_t size) {
    if (!m_rxValid) { return -1; }
    if (0 == (size = m_buffer->pop_n(buffer, size))) {
        rxBits();
>>>        size = m_buffer->pop_n(buffer, size);
    }

The size in the highlighted parameter passed in is always 0 because size is overwritten in the if() condition just above with the result of pop_n. that doesn't look correct to me?

@dok-net dok-net self-assigned this Dec 18, 2019
@dok-net dok-net added the bug label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants