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

Fix for sonarcloud bugs #942

Closed

Conversation

stefan-andritoiu
Copy link
Contributor

No description provided.

Copy link
Contributor

@alext-mkrs alext-mkrs left a 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.

src/iio/iio.c Outdated Show resolved Hide resolved
src/iio/iio.c Show resolved Hide resolved
src/iio/iio.c Outdated Show resolved Hide resolved
src/iio/iio.c Show resolved Hide resolved
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>
cosmin-popescu and others added 6 commits January 17, 2019 12:40
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>
@cosmin-popescu cosmin-popescu force-pushed the sonarcloudbugs branch 2 times, most recently from ee06367 to 018ddd4 Compare January 17, 2019 17:02
adelindobre and others added 7 commits January 17, 2019 19:04
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>
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) {
Copy link
Contributor

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.

Copy link
Contributor

@alext-mkrs alext-mkrs left a 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) {
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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.

@Propanu
Copy link
Contributor

Propanu commented Mar 7, 2019

Merged and ran clang-format address issues raised by @alext-mkrs. Thank you!

@Propanu Propanu closed this Mar 7, 2019
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

Successfully merging this pull request may close these issues.

5 participants