aboutsummaryrefslogtreecommitdiffstats
path: root/lib/decoding
diff options
context:
space:
mode:
authoriZsh <izsh@fail0verflow.com>2015-08-16 14:42:18 +0200
committeriZsh <izsh@fail0verflow.com>2015-08-16 14:52:01 +0200
commit6698793a241a3acfa2c2193ba363f5041b4ec22b (patch)
treea793bddd91b710644a0aba0526f017a6125fe249 /lib/decoding
parentb9d8ce37900b1043e35bd2ea4eca1e69b3a44602 (diff)
Fix issue #112 (copy messages instead of modifying the input msg)
Diffstat (limited to 'lib/decoding')
-rw-r--r--lib/decoding/control_channels_decoder_impl.cc7
-rw-r--r--lib/decoding/tch_f_decoder_impl.cc5
2 files changed, 4 insertions, 8 deletions
diff --git a/lib/decoding/control_channels_decoder_impl.cc b/lib/decoding/control_channels_decoder_impl.cc
index 3ea3fd9..1d25664 100644
--- a/lib/decoding/control_channels_decoder_impl.cc
+++ b/lib/decoding/control_channels_decoder_impl.cc
@@ -137,13 +137,10 @@ namespace gr {
//send message with header of the first burst
pmt::pmt_t first_header_plus_burst = pmt::cdr(d_bursts[0]);
gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(first_header_plus_burst);
- header->type = GSMTAP_TYPE_UM;
-
- int8_t * header_content = (int8_t *)header;
-
int8_t header_plus_data[sizeof(gsmtap_hdr)+DATA_BYTES];
- memcpy(header_plus_data, header_content, sizeof(gsmtap_hdr));
+ memcpy(header_plus_data, header, sizeof(gsmtap_hdr));
memcpy(header_plus_data+sizeof(gsmtap_hdr), outmsg, DATA_BYTES);
+ ((gsmtap_hdr*)header_plus_data)->type = GSMTAP_TYPE_UM;
pmt::pmt_t msg_binary_blob = pmt::make_blob(header_plus_data,DATA_BYTES+sizeof(gsmtap_hdr));
pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob);
diff --git a/lib/decoding/tch_f_decoder_impl.cc b/lib/decoding/tch_f_decoder_impl.cc
index 467ffe9..cbb1481 100644
--- a/lib/decoding/tch_f_decoder_impl.cc
+++ b/lib/decoding/tch_f_decoder_impl.cc
@@ -155,11 +155,10 @@ namespace gr {
pmt::pmt_t first_header_plus_burst = pmt::cdr(d_bursts[0]);
gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(first_header_plus_burst);
- header->type = GSMTAP_TYPE_UM;
- int8_t * header_content = (int8_t *)header;
int8_t header_plus_data[sizeof(gsmtap_hdr)+DATA_BYTES];
- memcpy(header_plus_data, header_content, sizeof(gsmtap_hdr));
+ memcpy(header_plus_data, header, sizeof(gsmtap_hdr));
memcpy(header_plus_data+sizeof(gsmtap_hdr), outmsg, DATA_BYTES);
+ ((gsmtap_hdr*)header_plus_data)->type = GSMTAP_TYPE_UM;
pmt::pmt_t msg_binary_blob = pmt::make_blob(header_plus_data,DATA_BYTES+sizeof(gsmtap_hdr));
pmt::pmt_t msg_out = pmt::cons(pmt::PMT_NIL, msg_binary_blob);