aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/src
diff options
context:
space:
mode:
authorJoel Spadin <[email protected]>2024-12-11 14:00:48 -0600
committerGitHub <[email protected]>2024-12-11 15:00:48 -0500
commit7013158a6715d94b34e8c471ce25bb5005f3bb49 (patch)
tree48a0efc0f402f8d14e943da9b2ea23b0b7fee5e1 /app/src
parenta8f5ab67b5d449a2624e2de7ddfb264da778ea6c (diff)
downloadzmk-7013158a6715d94b34e8c471ce25bb5005f3bb49.tar.gz
zmk-7013158a6715d94b34e8c471ce25bb5005f3bb49.zip
fix: Fix warnings in nanopb encoding code (#2643)
The "arg" field on nanopb structs is a void* because it is shared between the encode and decode callbacks, even though the encode callback probably should not modify the data. We are passing const data using this non-const pointer, which causes warnings about discarding const. This commit explicitly casts to void* to suppress these warnings.
Diffstat (limited to 'app/src')
-rw-r--r--app/src/studio/behavior_subsystem.c2
-rw-r--r--app/src/studio/keymap_subsystem.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/app/src/studio/behavior_subsystem.c b/app/src/studio/behavior_subsystem.c
index 96c1f236e6..24591315c3 100644
--- a/app/src/studio/behavior_subsystem.c
+++ b/app/src/studio/behavior_subsystem.c
@@ -84,7 +84,7 @@ static bool encode_value_description(pb_ostream_t *stream, const pb_field_t *fie
zmk_behaviors_BehaviorParameterValueDescription desc =
zmk_behaviors_BehaviorParameterValueDescription_init_zero;
desc.name.funcs.encode = encode_value_description_name;
- desc.name.arg = val;
+ desc.name.arg = (void *)val;
switch (val->type) {
case BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE:
diff --git a/app/src/studio/keymap_subsystem.c b/app/src/studio/keymap_subsystem.c
index 3516a3fb9f..6ac1e7efc1 100644
--- a/app/src/studio/keymap_subsystem.c
+++ b/app/src/studio/keymap_subsystem.c
@@ -306,10 +306,10 @@ static bool encode_layouts(pb_ostream_t *stream, const pb_field_t *field, void *
zmk_keymap_PhysicalLayout layout = zmk_keymap_PhysicalLayout_init_zero;
layout.name.funcs.encode = encode_layout_name;
- layout.name.arg = l;
+ layout.name.arg = (void *)l;
layout.keys.funcs.encode = encode_layout_keys;
- layout.keys.arg = l;
+ layout.keys.arg = (void *)l;
if (!pb_encode_submessage(stream, &zmk_keymap_PhysicalLayout_msg, &layout)) {
LOG_WRN("Failed to encode layout submessage");
@@ -465,10 +465,10 @@ zmk_studio_Response restore_layer(const zmk_studio_Request *req) {
resp.result.ok.id = restore_req->layer_id;
resp.result.ok.name.funcs.encode = encode_layer_name;
- resp.result.ok.name.arg = &restore_req->layer_id;
+ resp.result.ok.name.arg = (void *)&restore_req->layer_id;
resp.result.ok.bindings.funcs.encode = encode_layer_bindings;
- resp.result.ok.bindings.arg = &restore_req->layer_id;
+ resp.result.ok.bindings.arg = (void *)&restore_req->layer_id;
raise_zmk_studio_rpc_notification((struct zmk_studio_rpc_notification){
.notification = KEYMAP_NOTIFICATION(unsaved_changes_status_changed, true)});