aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-05 17:13:24 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-08 00:45:35 +0100
commitb41262fa0bc7edb64e518839923933a3480d1d48 (patch)
treecc3e000387fdaac9be2582b5a40611d81a87a6c3 /src
parenteb08f86c0278bc6c6d1ba42c82c66d564a5f7c06 (diff)
edge: Use num_blocks in gprs_rlcmac_dl_tbf::analyse_errors
Currently a window size of 64 is being hard coded. Use the length of the show_rbb string instead. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src')
-rw-r--r--src/tbf_dl.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 161ec26f..80ea7419 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -644,16 +644,20 @@ int gprs_rlcmac_dl_tbf::analyse_errors(char *show_rbb, uint8_t ssn,
{
gprs_rlc_data *rlc_data;
uint16_t lost = 0, received = 0, skipped = 0;
- char info[65];
- memset(info, '.', sizeof(info));
- info[64] = 0;
+ char info[RLC_MAX_WS + 1];
+ memset(info, '.', m_window.ws());
+ info[m_window.ws()] = 0;
uint16_t bsn = 0;
unsigned received_bytes = 0, lost_bytes = 0;
unsigned received_packets = 0, lost_packets = 0;
+ unsigned num_blocks = strlen(show_rbb);
/* SSN - 1 is in range V(A)..V(S)-1 */
- for (int bitpos = 0; bitpos < m_window.ws(); bitpos++) {
- bool is_received = show_rbb[m_window.ws() - 1 - bitpos] == 'R';
+ for (unsigned int bitpos = 0; bitpos < num_blocks; bitpos++) {
+ bool is_received;
+ int index = num_blocks - 1 - bitpos;
+
+ is_received = (index >= 0 && show_rbb[index] == 'R');
bsn = m_window.mod_sns(bitnum_to_bsn(bitpos, ssn));