aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_ms.cpp
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-28 18:49:12 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-01 13:58:13 +0100
commitaa9daa1b9dfc74deb2ab4993f74ba61ee2712f73 (patch)
tree2b83b2e2820dcb02bc5fada8a4db45bd36ef3ba2 /src/gprs_ms.cpp
parent38f18698b3413bf3e608026aff519427af740335 (diff)
tbf: Replace static casts by calls to as_ul_tbf/as_dl_tbf
Currently casts from gprs_rlcmac_tbf to gprs_rlcmac_ul_tbf and gprs_rlcmac_dl_tbf are done by using static_cast. This doesn't provide protection against converting a gprs_rlcmac_ul_tbf pointer to a gprs_rlcmac_dl_tbf pointer and vice versa. This commit provides two functions as_ul_tbf and as_dl_tbf, that behave similar like dynamic_cast but use the direction field instead of RTTI. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/gprs_ms.cpp')
-rw-r--r--src/gprs_ms.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index 76fe47c2..2d482846 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -218,9 +218,9 @@ void GprsMs::stop_timer()
void GprsMs::attach_tbf(struct gprs_rlcmac_tbf *tbf)
{
if (tbf->direction == GPRS_RLCMAC_DL_TBF)
- attach_dl_tbf(static_cast<gprs_rlcmac_dl_tbf *>(tbf));
+ attach_dl_tbf(as_dl_tbf(tbf));
else
- attach_ul_tbf(static_cast<gprs_rlcmac_ul_tbf *>(tbf));
+ attach_ul_tbf(as_ul_tbf(tbf));
}
void GprsMs::attach_ul_tbf(struct gprs_rlcmac_ul_tbf *tbf)