From a3d5514c21d1086e47548c134a3d108047b458ce Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 20 Feb 2010 19:10:44 +0100 Subject: change from u_int* to uint* (stdint.h) --- libosmocore/src/bitvec.c | 8 ++++---- libosmocore/src/comp128.c | 18 +++++++++--------- libosmocore/src/gsm_utils.c | 11 ++++++----- libosmocore/src/msgb.c | 2 +- libosmocore/src/tlv_parser.c | 17 +++++++++-------- 5 files changed, 29 insertions(+), 27 deletions(-) (limited to 'libosmocore/src') diff --git a/libosmocore/src/bitvec.c b/libosmocore/src/bitvec.c index 322f499ec..235c3ce15 100644 --- a/libosmocore/src/bitvec.c +++ b/libosmocore/src/bitvec.c @@ -22,7 +22,7 @@ #include -#include +#include #include @@ -36,7 +36,7 @@ static inline unsigned int bytenum_from_bitnum(unsigned int bitnum) } /* convert ZERO/ONE/L/H to a bitmask at given pos in a byte */ -static u_int8_t bitval2mask(enum bit_value bit, u_int8_t bitnum) +static uint8_t bitval2mask(enum bit_value bit, uint8_t bitnum) { int bitval; @@ -64,7 +64,7 @@ enum bit_value bitvec_get_bit_pos(struct bitvec *bv, unsigned int bitnr) { unsigned int bytenum = bytenum_from_bitnum(bitnr); unsigned int bitnum = 7 - (bitnr % 8); - u_int8_t bitval; + uint8_t bitval; if (bytenum >= bv->data_len) return -EINVAL; @@ -99,7 +99,7 @@ int bitvec_set_bit_pos(struct bitvec *bv, unsigned int bitnr, { unsigned int bytenum = bytenum_from_bitnum(bitnr); unsigned int bitnum = 7 - (bitnr % 8); - u_int8_t bitval; + uint8_t bitval; if (bytenum >= bv->data_len) return -EINVAL; diff --git a/libosmocore/src/comp128.c b/libosmocore/src/comp128.c index 9df545256..5d5680c72 100644 --- a/libosmocore/src/comp128.c +++ b/libosmocore/src/comp128.c @@ -66,10 +66,10 @@ */ #include -#include +#include /* The compression tables (just copied ...) */ -static const u_int8_t table_0[512] = { +static const uint8_t table_0[512] = { 102, 177, 186, 162, 2, 156, 112, 75, 55, 25, 8, 12, 251, 193, 246, 188, 109, 213, 151, 53, 42, 79, 191, 115, 233, 242, 164, 223, 209, 148, 108, 161, 252, 37, 244, 47, 64, 211, 6, 237, 185, 160, 139, 113, 76, 138, 59, 70, @@ -138,11 +138,11 @@ static const u_int8_t table_0[512] = { 10, 3, 4, 9, 6, 0, 3, 2, 5, 6, 8, 9, 11, 13, 15, 12, }; -static const u_int8_t *_comp128_table[5] = { table_0, table_1, table_2, table_3, table_4 }; +static const uint8_t *_comp128_table[5] = { table_0, table_1, table_2, table_3, table_4 }; static inline void -_comp128_compression_round(u_int8_t *x, int n, const u_int8_t *tbl) +_comp128_compression_round(uint8_t *x, int n, const uint8_t *tbl) { int i, j, m, a, b, y, z; m = 4 - n; @@ -158,7 +158,7 @@ _comp128_compression_round(u_int8_t *x, int n, const u_int8_t *tbl) } static inline void -_comp128_compression(u_int8_t *x) +_comp128_compression(uint8_t *x) { int n; for (n=0; n<5; n++) @@ -166,7 +166,7 @@ _comp128_compression(u_int8_t *x) } static inline void -_comp128_bitsfrombytes(u_int8_t *x, u_int8_t *bits) +_comp128_bitsfrombytes(uint8_t *x, uint8_t *bits) { int i; memset(bits, 0x00, 128); @@ -176,7 +176,7 @@ _comp128_bitsfrombytes(u_int8_t *x, u_int8_t *bits) } static inline void -_comp128_permutation(u_int8_t *x, u_int8_t *bits) +_comp128_permutation(uint8_t *x, uint8_t *bits) { int i; memset(&x[16], 0x00, 16); @@ -185,10 +185,10 @@ _comp128_permutation(u_int8_t *x, u_int8_t *bits) } void -comp128(u_int8_t *ki, u_int8_t *rand, u_int8_t *sres, u_int8_t *kc) +comp128(uint8_t *ki, uint8_t *rand, uint8_t *sres, uint8_t *kc) { int i; - u_int8_t x[32], bits[128]; + uint8_t x[32], bits[128]; /* x[16-31] = RAND */ memcpy(&x[16], rand, 16); diff --git a/libosmocore/src/gsm_utils.c b/libosmocore/src/gsm_utils.c index aabd7b734..85f78391e 100644 --- a/libosmocore/src/gsm_utils.c +++ b/libosmocore/src/gsm_utils.c @@ -26,12 +26,13 @@ #include #include +#include #include #include #include /* GSM 03.38 6.2.1 Charachter packing */ -int gsm_7bit_decode(char *text, const u_int8_t *user_data, u_int8_t length) +int gsm_7bit_decode(char *text, const uint8_t *user_data, uint8_t length) { int i = 0; int l = 0; @@ -51,7 +52,7 @@ int gsm_7bit_decode(char *text, const u_int8_t *user_data, u_int8_t length) /* GSM 03.38 6.2.1 Charachter packing */ -int gsm_7bit_encode(u_int8_t *result, const char *data) +int gsm_7bit_encode(uint8_t *result, const char *data) { int i,j = 0; unsigned char ch1, ch2; @@ -129,7 +130,7 @@ int ms_pwr_ctl_lvl(enum gsm_band band, unsigned int dbm) return -EINVAL; } -int ms_pwr_dbm(enum gsm_band band, u_int8_t lvl) +int ms_pwr_dbm(enum gsm_band band, uint8_t lvl) { lvl &= 0x1f; @@ -168,7 +169,7 @@ int ms_pwr_dbm(enum gsm_band band, u_int8_t lvl) } /* According to TS 08.05 Chapter 8.1.4 */ -int rxlev2dbm(u_int8_t rxlev) +int rxlev2dbm(uint8_t rxlev) { if (rxlev > 63) rxlev = 63; @@ -177,7 +178,7 @@ int rxlev2dbm(u_int8_t rxlev) } /* According to TS 08.05 Chapter 8.1.4 */ -u_int8_t dbm2rxlev(int dbm) +uint8_t dbm2rxlev(int dbm) { int rxlev = dbm + 110; diff --git a/libosmocore/src/msgb.c b/libosmocore/src/msgb.c index ab9b4131c..2521ca868 100644 --- a/libosmocore/src/msgb.c +++ b/libosmocore/src/msgb.c @@ -30,7 +30,7 @@ void *tall_msgb_ctx; -struct msgb *msgb_alloc(u_int16_t size, const char *name) +struct msgb *msgb_alloc(uint16_t size, const char *name) { struct msgb *msg; diff --git a/libosmocore/src/tlv_parser.c b/libosmocore/src/tlv_parser.c index e9b15120a..407e57aa2 100644 --- a/libosmocore/src/tlv_parser.c +++ b/libosmocore/src/tlv_parser.c @@ -1,4 +1,5 @@ #include +#include #include #include @@ -25,11 +26,11 @@ int tlv_dump(struct tlv_parsed *dec) * * Also, returns the number of bytes consumed by the TLV entry */ -int tlv_parse_one(u_int8_t *o_tag, u_int16_t *o_len, const u_int8_t **o_val, +int tlv_parse_one(uint8_t *o_tag, uint16_t *o_len, const uint8_t **o_val, const struct tlv_definition *def, - const u_int8_t *buf, int buf_len) + const uint8_t *buf, int buf_len) { - u_int8_t tag; + uint8_t tag; int len; tag = *buf; @@ -100,11 +101,11 @@ int tlv_parse_one(u_int8_t *o_tag, u_int16_t *o_len, const u_int8_t **o_val, * lv_tag2: input: a second initial LV tag following lv_tag */ int tlv_parse(struct tlv_parsed *dec, const struct tlv_definition *def, - const u_int8_t *buf, int buf_len, u_int8_t lv_tag, - u_int8_t lv_tag2) + const uint8_t *buf, int buf_len, uint8_t lv_tag, + uint8_t lv_tag2) { int ofs = 0, num_parsed = 0; - u_int16_t len; + uint16_t len; memset(dec, 0, sizeof(*dec)); @@ -133,8 +134,8 @@ int tlv_parse(struct tlv_parsed *dec, const struct tlv_definition *def, while (ofs < buf_len) { int rv; - u_int8_t tag; - const u_int8_t *val; + uint8_t tag; + const uint8_t *val; rv = tlv_parse_one(&tag, &len, &val, def, &buf[ofs], buf_len-ofs); -- cgit v1.2.3