Removed all size_t variables. Fixed type of readIndex and writeIndex variables.

We use unsigned int type for readIndex and writeIndex parameters in bitvec_read_field() and bitvec_write_field() functions.
zecke/hacks/quick-exit
Ivan Kluchnikov 11 years ago
parent 856221fd3d
commit 9b06ff0c4c
  1. 12
      src/csn1.cpp
  2. 8
      src/csn1.h
  3. 18
      src/gsm_rlcmac.cpp

@ -52,7 +52,7 @@ static const unsigned char ixBitsTab[] = {0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4,
/* Returns no_of_bits (up to 8) masked with 0x2B */
static guint8
get_masked_bits8( bitvec *vector, size_t& readIndex, gint bit_offset, const gint no_of_bits)
get_masked_bits8( bitvec *vector, unsigned& readIndex, gint bit_offset, const gint no_of_bits)
{
static const guint8 maskBits[] = {0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF};
//gint byte_offset = bit_offset >> 3; /* divide by 8 */
@ -104,7 +104,7 @@ static const char* ErrCodes[] =
};
static gint16
ProcessError( size_t readIndex, const char* sz, gint16 err, const CSN_DESCR* pDescr)
ProcessError( unsigned readIndex, const char* sz, gint16 err, const CSN_DESCR* pDescr)
{
gint16 i = MIN(-err, ((gint16) ElementsOf(ErrCodes)-1));
if (i >= 0)
@ -166,7 +166,7 @@ static const char* CSN_DESCR_type[]=
*/
static gboolean
existNextElement(bitvec *vector, size_t& readIndex, guint8 Tag)
existNextElement(bitvec *vector, unsigned& readIndex, guint8 Tag)
{
guint8 res = bitvec_read_field(vector, readIndex, 1);
if (Tag == STANDARD_TAG)
@ -178,7 +178,7 @@ existNextElement(bitvec *vector, size_t& readIndex, guint8 Tag)
gint16
csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data)
csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, unsigned& readIndex, void* data)
{
gint remaining_bits_len = ar->remaining_bits_len;
gint bit_offset = ar->bit_offset;
@ -1405,7 +1405,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_
gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& writeIndex, void* data)
gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, unsigned& writeIndex, void* data)
{
gint remaining_bits_len = ar->remaining_bits_len;
gint bit_offset = ar->bit_offset;
@ -1767,7 +1767,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector
StreamSerializeFcn_t serialize = pDescr->serialize.fcn;
csnStream_t arT = *ar;
gint16 Status = -1;
size_t lengthIndex;
unsigned lengthIndex;
// store writeIndex for length value (7 bit)
lengthIndex = writeIndex;

@ -82,7 +82,7 @@ typedef struct
gint direction; /* 0 - decode; 1 - encode */
} csnStream_t;
typedef gint16 (*StreamSerializeFcn_t)(csnStream_t* ar, bitvec *vector, size_t& readIndex, void* data);
typedef gint16 (*StreamSerializeFcn_t)(csnStream_t* ar, bitvec *vector, unsigned& readIndex, void* data);
typedef enum
{
CSN_END = 0,
@ -187,7 +187,7 @@ typedef struct
void* ptr;
guint32 value;
} descr;
size_t offset;
unsigned offset;
const char* sz;
union
{
@ -223,9 +223,9 @@ void csnStreamInit(csnStream_t* ar,gint BitOffset,gint BitCount);
* RETURNS: int Number of bits left to be unpacked. Negative Error code if failed to unpack all bits
******************************************************************************/
gint16 csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data);
gint16 csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, unsigned& readIndex, void* data);
gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data);
gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, unsigned& readIndex, void* data);
/* CSN struct macro's */
#define CSN_DESCR_BEGIN(_STRUCT)\

@ -714,7 +714,7 @@ CSN_DESCR_BEGIN(Receive_N_PDU_Number_t)
M_UINT (Receive_N_PDU_Number_t, value, 8),
CSN_DESCR_END (Receive_N_PDU_Number_t)
gint16 Receive_N_PDU_Number_list_Dissector(csnStream_t* ar, bitvec *vector, size_t& readIndex, void* data)
gint16 Receive_N_PDU_Number_list_Dissector(csnStream_t* ar, bitvec *vector, unsigned& readIndex, void* data)
{
if (ar->direction == 0)
{
@ -825,7 +825,7 @@ CSN_DESCR_BEGIN (Content_t)
M_UINT (Content_t, PS_HandoverCapability, 1),
CSN_DESCR_END (Content_t)
gint16 Content_Dissector(csnStream_t* ar, bitvec *vector, size_t& readIndex, void* data)
gint16 Content_Dissector(csnStream_t* ar, bitvec *vector, unsigned& readIndex, void* data)
{
if (ar->direction == 0)
{
@ -849,7 +849,7 @@ CSN_DESCR_BEGIN (Additional_access_technologies_t)
M_REC_TARRAY (Additional_access_technologies_t, Additional_access_technologies[0], Additional_access_technologies_struct_t, Count_additional_access_technologies),
CSN_DESCR_END (Additional_access_technologies_t)
gint16 Additional_access_technologies_Dissector(csnStream_t* ar, bitvec* vector, size_t& readIndex, void* data)
gint16 Additional_access_technologies_Dissector(csnStream_t* ar, bitvec* vector, unsigned& readIndex, void* data)
{
if (ar->direction == 0)
{
@ -4719,7 +4719,7 @@ CSN_DESCR_END (SI6_RestOctet_t)
void decode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data)
{
csnStream_t ar;
size_t readIndex = 0;
unsigned readIndex = 0;
guint8 payload_type = bitvec_read_field(vector, readIndex, 2);
if (payload_type == PAYLOAD_TYPE_DATA)
@ -4827,7 +4827,7 @@ void decode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data)
/* See RLC/MAC downlink control block structure in TS 44.060 / 10.3.1 */
gint bit_offset = 0;
gint bit_length;
size_t readIndex = 0;
unsigned readIndex = 0;
data->PAYLOAD_TYPE = bitvec_read_field(vector, readIndex, 2);
data->RRBP = bitvec_read_field(vector, readIndex, 2);
data->SP = bitvec_read_field(vector, readIndex, 1);
@ -5016,7 +5016,7 @@ void decode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data)
void encode_gsm_rlcmac_uplink(bitvec * vector, RlcMacUplink_t * data)
{
csnStream_t ar;
size_t writeIndex = 0;
unsigned writeIndex = 0;
data->NrOfBits = (23 - 1) * 8;
csnStreamInit(&ar, 0, data->NrOfBits);
writeIndex = 0;
@ -5111,7 +5111,7 @@ void encode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data)
/* See RLC/MAC downlink control block structure in TS 44.060 / 10.3.1 */
gint bit_offset = 0;
gint bit_length;
size_t writeIndex = 0;
unsigned writeIndex = 0;
if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_DATA)
{
@ -5297,7 +5297,7 @@ void encode_gsm_rlcmac_downlink(bitvec * vector, RlcMacDownlink_t * data)
void decode_gsm_rlcmac_uplink_data(bitvec * vector, RlcMacUplinkDataBlock_t * data)
{
size_t readIndex = 0;
unsigned readIndex = 0;
//unsigned dataLen = 0;
guint8 payload_type = bitvec_read_field(vector, readIndex, 2);
if (payload_type == PAYLOAD_TYPE_DATA)
@ -5374,7 +5374,7 @@ void decode_gsm_rlcmac_uplink_data(bitvec * vector, RlcMacUplinkDataBlock_t * da
void encode_gsm_rlcmac_downlink_data(bitvec * vector, RlcMacDownlinkDataBlock_t * data)
{
size_t writeIndex = 0;
unsigned writeIndex = 0;
if (data->PAYLOAD_TYPE == PAYLOAD_TYPE_DATA)
{

Loading…
Cancel
Save