#include <errno.h>
#include <stdio.h>
-#include <osmocore/utils.h>
+#include <osmocom/core/utils.h>
static char namebuf[255];
const char *get_value_string(const struct value_string *vs, uint32_t val)
return -EINVAL;
}
-char bcd2char(uint8_t bcd)
+char osmo_bcd2char(uint8_t bcd)
{
if (bcd < 0xa)
return '0' + bcd;
}
/* only works for numbers in ascii */
-uint8_t char2bcd(char c)
+uint8_t osmo_char2bcd(char c)
{
return c - 0x30;
}
-int hexparse(const char *str, uint8_t *b, int max_len)
+int osmo_hexparse(const char *str, uint8_t *b, int max_len)
{
int i, l, v;
static char hexd_buff[4096];
-static char *_hexdump(const unsigned char *buf, int len, char *delim)
+static char *_osmo_hexdump(const unsigned char *buf, int len, char *delim)
{
int i;
char *cur = hexd_buff;
hexd_buff[0] = 0;
for (i = 0; i < len; i++) {
int len_remain = sizeof(hexd_buff) - (cur - hexd_buff);
+ if (len_remain <= 0)
+ break;
int rc = snprintf(cur, len_remain, "%02x%s", buf[i], delim);
if (rc <= 0)
break;
return hexd_buff;
}
-char *ubit_dump(const uint8_t *bits, unsigned int len)
+char *osmo_ubit_dump(const uint8_t *bits, unsigned int len)
{
int i;
return hexd_buff;
}
-char *hexdump(const unsigned char *buf, int len)
+char *osmo_hexdump(const unsigned char *buf, int len)
{
- return _hexdump(buf, len, " ");
+ return _osmo_hexdump(buf, len, " ");
}
-char *hexdump_nospc(const unsigned char *buf, int len)
+char *osmo_osmo_hexdump_nospc(const unsigned char *buf, int len)
{
- return _hexdump(buf, len, "");
+ return _osmo_hexdump(buf, len, "");
}
#include "../config.h"