Skip to content

Instantly share code, notes, and snippets.

@eblot
Created March 26, 2019 16:35
Show Gist options
  • Save eblot/4ac69e4d72fdbab36906f7c086289b63 to your computer and use it in GitHub Desktop.
Save eblot/4ac69e4d72fdbab36906f7c086289b63 to your computer and use it in GitHub Desktop.
Fix gr-osmosdr build issue with clang
diff --git a/lib/rtl_tcp/rtl_tcp_source_c.cc b/lib/rtl_tcp/rtl_tcp_source_c.cc
index ecdeee0..71f28ac 100644
--- a/lib/rtl_tcp/rtl_tcp_source_c.cc
+++ b/lib/rtl_tcp/rtl_tcp_source_c.cc
@@ -296,20 +296,18 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) :
set_gain_mode(false); /* enable manual gain mode by default */
// set direct sampling
- struct command cmd;
-
- cmd = { 0x09, htonl(direct_samp) };
- send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
+ struct command cmd1 = { 0x09, htonl(direct_samp) };
+ send(d_socket, (const char*)&cmd1, sizeof(cmd1), 0);
if (direct_samp)
_no_tuner = true;
// set offset tuning
- cmd = { 0x0a, htonl(offset_tune) };
- send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
+ struct command cmd2 = { 0x0a, htonl(offset_tune) };
+ send(d_socket, (const char*)&cmd2, sizeof(cmd2), 0);
// set bias tee
- cmd = { 0x0e, htonl(bias_tee) };
- send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
+ struct command cmd3 = { 0x0e, htonl(bias_tee) };
+ send(d_socket, (const char*)&cmd3, sizeof(cmd3), 0);
}
rtl_tcp_source_c::~rtl_tcp_source_c()
@@ -563,12 +561,12 @@ osmosdr::gain_range_t rtl_tcp_source_c::get_gain_range( const std::string & name
bool rtl_tcp_source_c::set_gain_mode( bool automatic, size_t chan )
{
// gain mode
- struct command cmd = { 0x03, htonl(!automatic) };
- send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
+ struct command cmd1 = { 0x03, htonl(!automatic) };
+ send(d_socket, (const char*)&cmd1, sizeof(cmd1), 0);
// AGC mode
- cmd = { 0x08, htonl(automatic) };
- send(d_socket, (const char*)&cmd, sizeof(cmd), 0);
+ struct command cmd2 = { 0x08, htonl(automatic) };
+ send(d_socket, (const char*)&cmd2, sizeof(cmd2), 0);
_auto_gain = automatic;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment