diff options
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r-- | gnuradio-core/src/lib/general/gr_simple_correlator.cc | 9 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_simple_correlator.h | 1 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/qa_gri_lfsr.cc | 9 |
3 files changed, 11 insertions, 8 deletions
diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.cc b/gnuradio-core/src/lib/general/gr_simple_correlator.cc index 01c007122..bdfa73ef3 100644 --- a/gnuradio-core/src/lib/general/gr_simple_correlator.cc +++ b/gnuradio-core/src/lib/general/gr_simple_correlator.cc @@ -50,6 +50,7 @@ gr_simple_correlator::gr_simple_correlator (int payload_bytesize) d_state (ST_LOOKING), d_osi (0), d_bblen ((payload_bytesize + GRSF_PAYLOAD_OVERHEAD) * GRSF_BITS_PER_BYTE), d_bitbuf (new unsigned char [d_bblen]), + d_pktbuf (new unsigned char [d_bblen/GRSF_BITS_PER_BYTE]), d_bbi (0) { d_avbi = 0; @@ -71,6 +72,7 @@ gr_simple_correlator::~gr_simple_correlator () fclose(d_debug_fp); #endif delete [] d_bitbuf; + delete [] d_pktbuf; } @@ -184,10 +186,9 @@ gr_simple_correlator::general_work (int noutput_items, d_bbi++; if (d_bbi >= d_bblen){ // printf ("got whole packet\n"); - unsigned char pktbuf[d_bblen/GRSF_BITS_PER_BYTE]; - packit (pktbuf, d_bitbuf, d_bbi); - printf ("seqno %3d\n", pktbuf[0]); - memcpy (out, &pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize); + packit (d_pktbuf, d_bitbuf, d_bbi); + printf ("seqno %3d\n", d_pktbuf[0]); + memcpy (out, &d_pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize); enter_looking (); consume_each (n + 1); return d_payload_bytesize; diff --git a/gnuradio-core/src/lib/general/gr_simple_correlator.h b/gnuradio-core/src/lib/general/gr_simple_correlator.h index b21d38a04..55d799cfa 100644 --- a/gnuradio-core/src/lib/general/gr_simple_correlator.h +++ b/gnuradio-core/src/lib/general/gr_simple_correlator.h @@ -50,6 +50,7 @@ class gr_simple_correlator : public gr_block unsigned long long int d_shift_reg[OVERSAMPLE]; int d_bblen; // length of bitbuf unsigned char *d_bitbuf; // demodulated bits + unsigned char *d_pktbuf; // temp packet buf int d_bbi; // bitbuf index static const int AVG_PERIOD = 512; // must be power of 2 (for freq offset correction) diff --git a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc b/gnuradio-core/src/lib/general/qa_gri_lfsr.cc index 9f8b62dcf..9625071d8 100644 --- a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc +++ b/gnuradio-core/src/lib/general/qa_gri_lfsr.cc @@ -24,6 +24,7 @@ #include <cppunit/TestAssert.h> #include <stdio.h> #include <string.h> +#include <vector> void qa_gri_lfsr::test_lfsr () @@ -90,12 +91,12 @@ qa_gri_lfsr::test_scrambler() 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, }; int len = sizeof(src); - unsigned char actual[len]; + std::vector<unsigned char> actual(len); for (int i = 0; i < len; i++) actual[i] = scrambler.next_bit_scramble(src[i]); - CPPUNIT_ASSERT(memcmp(expected, actual, len) == 0); + CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0); } void @@ -132,10 +133,10 @@ qa_gri_lfsr::test_descrambler() 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int len = sizeof(src); - unsigned char actual[len]; + std::vector<unsigned char> actual(len); for (int i = 0; i < len; i++) actual[i] = descrambler.next_bit_descramble(src[i]); - CPPUNIT_ASSERT(memcmp(expected, actual, len) == 0); + CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0); } |