The following warnings drew my attention to a couple bugs in decode_optional_content:
/home/argilo/prefix_next/src/gr-rds/lib/parser_impl.cc: In member function ‘void gr::rds::parser_impl::decode_optional_content(int, long unsigned int*)’:
/home/argilo/prefix_next/src/gr-rds/lib/parser_impl.cc:442:36: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
label = (free_format[i] && (0xf << ff_pointer));
~~~~~^~~~~~~~~~~~~~
/home/argilo/prefix_next/src/gr-rds/lib/parser_impl.cc:445:66: warning: ‘<<’ in boolean context, did you mean ‘<’ ? [-Wint-in-bool-context]
content = (free_format[i] && (int(pow(2, content_length) - 1) << ff_pointer));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
This function is meant to extract packed bit fields from free_format but uses boolean AND instead of integer AND, and fails to right-shift the extracted bits.
I also included a second commit which silences some other compiler warnings.
The following warnings drew my attention to a couple bugs in
decode_optional_content
:This function is meant to extract packed bit fields from
free_format
but uses boolean AND instead of integer AND, and fails to right-shift the extracted bits.I also included a second commit which silences some other compiler warnings.