-
Notifications
You must be signed in to change notification settings - Fork 1
Draft: meson: increase compiler checks #7
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,7 @@ | ||||||
| /* SPDX-License-Identifier: AGPL-3.0-or-later */ | ||||||
|
|
||||||
| #include "pmbus_io.h" | ||||||
| #include "mfr_user_data.h" | ||||||
| #include "util_json.h" | ||||||
|
|
||||||
| #include <jansson.h> | ||||||
|
|
@@ -27,7 +28,7 @@ cmd_user_data(int fd, int argc, char *const *argv, int pretty) { | |||||
|
|
||||||
| json_t *o = json_object(); | ||||||
| json_object_set_new(o, "len", json_integer(n)); | ||||||
| json_object_set_new(o, "ascii", json_stringn((char *) b, n)); | ||||||
| json_object_set_new(o, "ascii", json_stringn((char *) b, (size_t)n)); | ||||||
| json_add_hex_ascii(o, "hex", b, (size_t)n); | ||||||
|
|
||||||
| json_print_or_pretty(o, pretty); | ||||||
|
|
@@ -45,7 +46,7 @@ cmd_user_data(int fd, int argc, char *const *argv, int pretty) { | |||||
| ascii = argv[++i]; | ||||||
| } | ||||||
|
|
||||||
| int n = 0; | ||||||
| size_t n = 0; | ||||||
|
|
||||||
| if (hex) { | ||||||
| size_t L = strlen(hex); | ||||||
|
|
@@ -62,9 +63,9 @@ cmd_user_data(int fd, int argc, char *const *argv, int pretty) { | |||||
| sscanf(hex + 2 * i, "%2x", &v); | ||||||
| b[i] = (uint8_t) v; | ||||||
| } | ||||||
| n = (int) (L / 2); | ||||||
| n = L / 2; | ||||||
| } else if (ascii) { | ||||||
| n = (int) strlen(ascii); | ||||||
| n = strlen(ascii); | ||||||
| if (n > 32) | ||||||
| n = 32; | ||||||
| memcpy(b, ascii, n); | ||||||
|
|
@@ -74,7 +75,11 @@ cmd_user_data(int fd, int argc, char *const *argv, int pretty) { | |||||
| return 2; | ||||||
| } | ||||||
|
|
||||||
| if (pmbus_wr_block(fd, MFR_USER_DATA_00, b, n) < 0) { | ||||||
| if (n > 255) { | ||||||
| fprintf(stderr, "USER_DATA_00 write: len %zu > 255", n); | ||||||
|
||||||
| fprintf(stderr, "USER_DATA_00 write: len %zu > 255", n); | |
| fprintf(stderr, "USER_DATA_00 write: len %zu > 255\n", n); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,9 @@ | ||||||
| /* SPDX-License-Identifier: AGPL-3.0-or-later */ | ||||||
|
|
||||||
| #include "pmbus_io.h" | ||||||
| #include "operation_cmd.h" | ||||||
| #include "util_json.h" | ||||||
|
|
||||||
| #include <jansson.h> | ||||||
| #include <string.h> | ||||||
| #include <stdio.h> | ||||||
|
|
@@ -162,6 +164,9 @@ cmd_operation(int fd, int argc, char *const *argv, int pretty) { | |||||
| case 3: | ||||||
| m = "reserved"; | ||||||
| break; | ||||||
| default: | ||||||
| fprintf(stderr, "invalid pmbus operation\n"); | ||||||
| return 2; | ||||||
|
||||||
| return 2; | |
| return 2; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -63,7 +63,7 @@ pmbus_wr_word(int fd, uint8_t cmd, uint16_t val) { | |||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| int | ||||||||||||||||
| pmbus_wr_block(int fd, uint8_t cmd, const uint8_t *buf, int len) { | ||||||||||||||||
| pmbus_wr_block(int fd, uint8_t cmd, const uint8_t *buf, uint8_t len) { | ||||||||||||||||
| return i2c_smbus_write_block_data(fd, cmd, len, buf); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -111,14 +111,16 @@ pmbus_lin16u_to_double(uint16_t raw, int exp5) { | |||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| uint16_t | ||||||||||||||||
| le16(const uint8_t *p) { | ||||||||||||||||
| return (uint16_t) p[0] | ||||||||||||||||
| | ((uint16_t) p[1] << 8) | ||||||||||||||||
| ; | ||||||||||||||||
| BMR_PURE le16(const uint8_t *p) { | ||||||||||||||||
| return (uint16_t)( | ||||||||||||||||
| (uint16_t)p[0] | ||||||||||||||||
| | ((uint16_t)p[1] << 8) | ||||||||||||||||
| ); | ||||||||||||||||
|
|
||||||||||||||||
|
Comment on lines
+115
to
+119
|
||||||||||||||||
| return (uint16_t)( | |
| (uint16_t)p[0] | |
| | ((uint16_t)p[1] << 8) | |
| ); | |
| return (uint16_t) p[0] | |
| | ((uint16_t) p[1] << 8) | |
| ; |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,15 @@ | |||||||
| #include <stdint.h> | ||||||||
| #include <stdbool.h> | ||||||||
|
|
||||||||
|
||||||||
| /* Use double literals (e.g., 0.0), not float literals (e.g., 0.0f), with D() to avoid unnecessary float-to-double conversion and potential precision loss. */ |
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.
Missing space after
FLAG_ISSET8(rb,- there should be a space after the comma for consistency with the other calls on lines 225-228.