echo: enable Werror

Part of #9460

* If there is an operation between signed and unsigned int, the unsigned is changed to signed one,
  except for some operations (if before the operation the signed one is checked to be less than
  zero or not, then the signed one get cast to be unsigned (errors due to sign error when casting
  are impossible))
* When doing operations on pointers, integers get cast to uintptr_t type

Untested: I don't have the hardware.

Change-Id: I6a959c004862e055ee99f6f2ad5ca3397b32cdd2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7484
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Muhamed Emad
2024-04-15 16:02:49 +00:00
committed by waddlesplash
parent fe640d9339
commit af8ec5e1b4
2 changed files with 4 additions and 4 deletions
@@ -255,7 +255,7 @@ echo_get_mix(echo_dev *card, multi_mix_value_info * mmvi)
multi_mixer_control *control = NULL;
for (i = 0; i < mmvi->item_count; i++) {
id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) {
if (id < 0 || (uint32)id >= card->multi.control_count) {
PRINT(("echo_get_mix : invalid control id requested : %" B_PRIu32
"\n", id));
continue;
@@ -297,7 +297,7 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * mmvi)
multi_mixer_control *control = NULL;
for (i = 0; i < mmvi->item_count; i++) {
id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) {
if (id < 0 || (uint32)id >= card->multi.control_count) {
PRINT(("echo_set_mix : invalid control id requested : %" B_PRIu32
"\n", id));
continue;
@@ -308,7 +308,7 @@ echo_set_mix(echo_dev *card, multi_mix_value_info * mmvi)
multi_mixer_control *control2 = NULL;
if (i + 1 < mmvi->item_count) {
id = mmvi->values[i + 1].id - MULTI_CONTROL_FIRSTID;
if (id < 0 || id >= card->multi.control_count) {
if (id < 0 || (uint32)id >= card->multi.control_count) {
PRINT(("echo_set_mix : invalid control id requested : %"
B_PRIu32 "\n", id));
} else {
+1 -1
View File
@@ -114,7 +114,7 @@ map_mem(void **log, phys_addr_t phy, size_t size, const char *name)
size = round_to_pagesize(size + offset);
area = map_physical_memory(name, phyadr, size, B_ANY_KERNEL_ADDRESS,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, &mapadr);
*log = mapadr + offset;
*log = (void *)((uintptr_t)mapadr + (uintptr_t)offset);
LOG(("physical = %p, logical = %p, offset = %#x, phyadr = %p, mapadr = %p, size = %#x, area = %#x\n",
phy, *log, offset, phyadr, mapadr, size, area));