|
|
@ -354,7 +354,7 @@ void srsran_vec_fprint_hex(FILE* stream, uint8_t* x, const uint32_t len)
|
|
|
|
fprintf(stream, "];\n");
|
|
|
|
fprintf(stream, "];\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void srsran_vec_sprint_hex(char* str, const uint32_t max_str_len, uint8_t* x, const uint32_t len)
|
|
|
|
uint32_t srsran_vec_sprint_hex(char* str, const uint32_t max_str_len, uint8_t* x, const uint32_t len)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32_t i, nbytes;
|
|
|
|
uint32_t i, nbytes;
|
|
|
|
uint8_t byte;
|
|
|
|
uint8_t byte;
|
|
|
@ -362,7 +362,7 @@ void srsran_vec_sprint_hex(char* str, const uint32_t max_str_len, uint8_t* x, co
|
|
|
|
// check that hex string fits in buffer (every byte takes 3 characters, plus brackets)
|
|
|
|
// check that hex string fits in buffer (every byte takes 3 characters, plus brackets)
|
|
|
|
if ((3 * (len / 8 + ((len % 8) ? 1 : 0))) + 2 >= max_str_len) {
|
|
|
|
if ((3 * (len / 8 + ((len % 8) ? 1 : 0))) + 2 >= max_str_len) {
|
|
|
|
ERROR("Buffer too small for printing hex string (max_str_len=%d, payload_len=%d).", max_str_len, len);
|
|
|
|
ERROR("Buffer too small for printing hex string (max_str_len=%d, payload_len=%d).", max_str_len, len);
|
|
|
|
return;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int n = 0;
|
|
|
|
int n = 0;
|
|
|
@ -376,7 +376,10 @@ void srsran_vec_sprint_hex(char* str, const uint32_t max_str_len, uint8_t* x, co
|
|
|
|
n += sprintf(&str[n], "%02x ", byte);
|
|
|
|
n += sprintf(&str[n], "%02x ", byte);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
n += sprintf(&str[n], "]");
|
|
|
|
n += sprintf(&str[n], "]");
|
|
|
|
|
|
|
|
str[n] = 0;
|
|
|
|
str[max_str_len - 1] = 0;
|
|
|
|
str[max_str_len - 1] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void srsran_vec_sprint_bin(char* str, const uint32_t max_str_len, const uint8_t* x, const uint32_t len)
|
|
|
|
void srsran_vec_sprint_bin(char* str, const uint32_t max_str_len, const uint8_t* x, const uint32_t len)
|
|
|
|