Skip to content

Conversation

@ShangzhiXu
Copy link

The compiler complain frequently when I compile with EXTENDED_FILTERING

 cmake .. \
  -DCMAKE_BUILD_TYPE=Debug \
  -DWITH_DLT_DEBUGGERS=ON \
  -DWITH_EXTENDED_FILTERING=ON

The warnings are

/home/shangzhi/fuz/fix/dlt-daemon/src/console/dlt-control-common.c: In function ‘dlt_json_filter_save’:
/home/shangzhi/fuz/fix/dlt-daemon/src/console/dlt-control-common.c:922:25: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
  922 |     json_object_to_file((char*)filename, json_filter_obj);
      |                         ^
/home/shangzhi/fuz/fix/dlt-daemon/src/console/dlt-control-common.c:901:39: error: ‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=]
  901 |         sprintf(filter_name, "filter%i", num);
      |                                       ^
/home/shangzhi/fuz/fix/dlt-daemon/src/console/dlt-control-common.c:901:9: note: ‘sprintf’ output between 8 and 17 bytes into a destination of size 16
  901 |         sprintf(filter_name, "filter%i", num);

I fixed with snprintf and removed the casting

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.

1 participant