-
Notifications
You must be signed in to change notification settings - Fork 613
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
Fix for sonarcloud bugs #942
Conversation
9f59702
to
01fe207
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, but please see line comments for the first commit - we better split that one into three.
733c8b8
to
e59ea9d
Compare
fd90ffc
to
ebf83b8
Compare
ebf83b8
to
bbc9abd
Compare
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
bbc9abd
to
0d53de1
Compare
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
ee06367
to
018ddd4
Compare
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
018ddd4
to
270559c
Compare
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
@@ -68,7 +68,10 @@ mraa_gpio_close_event_handles_sysfs(int fds[], int num_fds) | |||
} | |||
|
|||
for (int i = 0; i < num_fds; ++i) { | |||
close(fds[i]); | |||
// Check required to avoid closing stdin and of an uninitialized fd | |||
if(fds[i] != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't noticed this one before, sorry - please add a space between if
and (
to align with mraa code style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of new (or rather I haven't noticed them before) style-related comments and we're good to go.
@@ -291,7 +291,11 @@ mraa_init_json_platform_i2c(json_object* jobj_i2c, mraa_board_t* board, int inde | |||
json_object* jobj_temp = NULL; | |||
|
|||
// Default to no mux pins defined | |||
board->pins[pin].i2c.mux_total = 0; | |||
if(board->pins != NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't noticed this one before, sorry - please add a space between if
and (
to align with mraa code style.
@@ -171,7 +171,7 @@ parse_uart(char** proto, size_t n, const char* proto_full) | |||
|
|||
/* Check for bytesize. */ | |||
int bytesize = -1; | |||
if (mraa_atoi_x(proto[idx], &end, &bytesize, 0) != MRAA_SUCCESS) { | |||
if (proto[idx] != NULL && mraa_atoi_x(proto[idx], &end, &bytesize, 0) != MRAA_SUCCESS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's enough to use if (proto[idx] && <...>)
as in other if
statements here and elsewhere in the library - please align to that.
@@ -1374,10 +1374,13 @@ mraa_add_subplatform(mraa_platform_t subplatformtype, const char* dev) | |||
return MRAA_ERROR_FEATURE_NOT_SUPPORTED; | |||
} | |||
int i2c_bus; | |||
if(mraa_atoi(strdup(dev), &i2c_bus) != MRAA_SUCCESS && i2c_bus < plat->i2c_bus_count) { | |||
char *dev_dup = strdup(dev); | |||
if(mraa_atoi(dev_dup, &i2c_bus) != MRAA_SUCCESS && i2c_bus < plat->i2c_bus_count) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't noticed this one before, sorry - please add a space between if
and (
to align with mraa code style.
Merged and ran clang-format address issues raised by @alext-mkrs. Thank you! |
No description provided.