Skip to content

Correct return value of nsapi_dns_query_multiple #5945

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

Merged
merged 1 commit into from
Jan 29, 2018

Conversation

kjbracey
Copy link
Contributor

@kjbracey kjbracey commented Jan 26, 2018

Documentation states that nsapi_dns_query_multiple returns the number of
addresses found on success - it was returning 0.

Overloads using SocketAddress are relying on the return value, meaning
those calls didn't work at all.

Fixes #5921.

Documentation states that nsapi_dns_query_multiple returns the number of
addresses found on success - it was returning 0.

Overloads using SocketAddress are relying on the return value, meaning
those calls didn't work at all.

Fixes ARMmbed#5921.
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 26, 2018

/morph build

Copy link

@kFYatek kFYatek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, just one comment.

@@ -243,8 +243,9 @@ static nsapi_size_or_error_t nsapi_dns_query_multiple(NetworkStack *stack, const
}

const uint8_t *response = packet;
if (dns_scan_response(&response, addr, addr_count) > 0) {
result = NSAPI_ERROR_OK;
int count = dns_scan_response(&response, addr, addr_count);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might consider changing the return type of dns_scan_response(). It currently returns an int, even though its main return path is return count; and count is an unsigned.

Seems pretty fishy if you ask me. On the other hand, this function returns nsapi_size_or_error_t anyway, and that's an alias to signed int, so the cast from unsigned to int will happen somewhere anyway, so I guess this point is just purely stylistic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, we've got to get from addr_count being unsigned ultimately back to that nsapi_size_or_error_t. I don't think it's worth worrying about - any changes are liable to trigger new "comparison of signed and unsigned" warning. Let's keep this change minimal and it can slip into a patch release.

@mbed-ci
Copy link

mbed-ci commented Jan 26, 2018

Build : SUCCESS

Build number : 969
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5945/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jan 26, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 26, 2018

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jan 26, 2018

@mbed-ci
Copy link

mbed-ci commented Jan 26, 2018

@orenc17
Copy link
Contributor

orenc17 commented Jan 28, 2018

/morph uvisor-test

@cmonr cmonr merged commit 49cdb0b into ARMmbed:master Jan 29, 2018
@kjbracey kjbracey deleted the dns_multiple branch January 30, 2018 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants