openocd: convert 'unsigned' to 'unsigned int'
Conversion done with checkpatch --fix-inplace -types UNSPECIFIED_INT Ignore the cast as they could be better addressed. Fix only minor additional checkpatch issue (spacing and line length). Change-Id: I4f936ffc4cedb153afa331cd293b08f4c913dc93 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8482 Tested-by: jenkins
This commit is contained in:
@@ -40,7 +40,7 @@ static const char hex_digits[] = {
|
||||
'a', 'b', 'c', 'd', 'e', 'f'
|
||||
};
|
||||
|
||||
void *buf_cpy(const void *from, void *_to, unsigned size)
|
||||
void *buf_cpy(const void *from, void *_to, unsigned int size)
|
||||
{
|
||||
if (!from || !_to)
|
||||
return NULL;
|
||||
@@ -49,7 +49,7 @@ void *buf_cpy(const void *from, void *_to, unsigned size)
|
||||
memcpy(_to, from, DIV_ROUND_UP(size, 8));
|
||||
|
||||
/* mask out bits that don't belong to the buffer */
|
||||
unsigned trailing_bits = size % 8;
|
||||
unsigned int trailing_bits = size % 8;
|
||||
if (trailing_bits) {
|
||||
uint8_t *to = _to;
|
||||
to[size / 8] &= (1 << trailing_bits) - 1;
|
||||
@@ -61,22 +61,22 @@ static bool buf_eq_masked(uint8_t a, uint8_t b, uint8_t m)
|
||||
{
|
||||
return (a & m) == (b & m);
|
||||
}
|
||||
static bool buf_eq_trailing(uint8_t a, uint8_t b, uint8_t m, unsigned trailing)
|
||||
static bool buf_eq_trailing(uint8_t a, uint8_t b, uint8_t m, unsigned int trailing)
|
||||
{
|
||||
uint8_t mask = (1 << trailing) - 1;
|
||||
return buf_eq_masked(a, b, mask & m);
|
||||
}
|
||||
|
||||
bool buf_eq(const void *_buf1, const void *_buf2, unsigned size)
|
||||
bool buf_eq(const void *_buf1, const void *_buf2, unsigned int size)
|
||||
{
|
||||
if (!_buf1 || !_buf2)
|
||||
return _buf1 == _buf2;
|
||||
|
||||
unsigned last = size / 8;
|
||||
unsigned int last = size / 8;
|
||||
if (memcmp(_buf1, _buf2, last) != 0)
|
||||
return false;
|
||||
|
||||
unsigned trailing = size % 8;
|
||||
unsigned int trailing = size % 8;
|
||||
if (!trailing)
|
||||
return true;
|
||||
|
||||
@@ -85,24 +85,24 @@ bool buf_eq(const void *_buf1, const void *_buf2, unsigned size)
|
||||
}
|
||||
|
||||
bool buf_eq_mask(const void *_buf1, const void *_buf2,
|
||||
const void *_mask, unsigned size)
|
||||
const void *_mask, unsigned int size)
|
||||
{
|
||||
if (!_buf1 || !_buf2)
|
||||
return _buf1 == _buf2 && _buf1 == _mask;
|
||||
|
||||
const uint8_t *buf1 = _buf1, *buf2 = _buf2, *mask = _mask;
|
||||
unsigned last = size / 8;
|
||||
for (unsigned i = 0; i < last; i++) {
|
||||
unsigned int last = size / 8;
|
||||
for (unsigned int i = 0; i < last; i++) {
|
||||
if (!buf_eq_masked(buf1[i], buf2[i], mask[i]))
|
||||
return false;
|
||||
}
|
||||
unsigned trailing = size % 8;
|
||||
unsigned int trailing = size % 8;
|
||||
if (!trailing)
|
||||
return true;
|
||||
return buf_eq_trailing(buf1[last], buf2[last], mask[last], trailing);
|
||||
}
|
||||
|
||||
void *buf_set_ones(void *_buf, unsigned size)
|
||||
void *buf_set_ones(void *_buf, unsigned int size)
|
||||
{
|
||||
uint8_t *buf = _buf;
|
||||
if (!buf)
|
||||
@@ -110,19 +110,19 @@ void *buf_set_ones(void *_buf, unsigned size)
|
||||
|
||||
memset(buf, 0xff, size / 8);
|
||||
|
||||
unsigned trailing_bits = size % 8;
|
||||
unsigned int trailing_bits = size % 8;
|
||||
if (trailing_bits)
|
||||
buf[size / 8] = (1 << trailing_bits) - 1;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void *buf_set_buf(const void *_src, unsigned src_start,
|
||||
void *_dst, unsigned dst_start, unsigned len)
|
||||
void *buf_set_buf(const void *_src, unsigned int src_start,
|
||||
void *_dst, unsigned int dst_start, unsigned int len)
|
||||
{
|
||||
const uint8_t *src = _src;
|
||||
uint8_t *dst = _dst;
|
||||
unsigned i, sb, db, sq, dq, lb, lq;
|
||||
unsigned int i, sb, db, sq, dq, lb, lq;
|
||||
|
||||
sb = src_start / 8;
|
||||
db = dst_start / 8;
|
||||
@@ -175,13 +175,13 @@ uint32_t flip_u32(uint32_t value, unsigned int num)
|
||||
return c;
|
||||
}
|
||||
|
||||
char *buf_to_hex_str(const void *_buf, unsigned buf_len)
|
||||
char *buf_to_hex_str(const void *_buf, unsigned int buf_len)
|
||||
{
|
||||
unsigned len_bytes = DIV_ROUND_UP(buf_len, 8);
|
||||
unsigned int len_bytes = DIV_ROUND_UP(buf_len, 8);
|
||||
char *str = calloc(len_bytes * 2 + 1, 1);
|
||||
|
||||
const uint8_t *buf = _buf;
|
||||
for (unsigned i = 0; i < len_bytes; i++) {
|
||||
for (unsigned int i = 0; i < len_bytes; i++) {
|
||||
uint8_t tmp = buf[len_bytes - i - 1];
|
||||
if ((i == 0) && (buf_len % 8))
|
||||
tmp &= (0xff >> (8 - (buf_len % 8)));
|
||||
@@ -289,8 +289,8 @@ void bit_copy_queue_init(struct bit_copy_queue *q)
|
||||
INIT_LIST_HEAD(&q->list);
|
||||
}
|
||||
|
||||
int bit_copy_queued(struct bit_copy_queue *q, uint8_t *dst, unsigned dst_offset, const uint8_t *src,
|
||||
unsigned src_offset, unsigned bit_count)
|
||||
int bit_copy_queued(struct bit_copy_queue *q, uint8_t *dst, unsigned int dst_offset, const uint8_t *src,
|
||||
unsigned int src_offset, unsigned int bit_count)
|
||||
{
|
||||
struct bit_copy_queue_entry *qe = malloc(sizeof(*qe));
|
||||
if (!qe)
|
||||
@@ -395,12 +395,12 @@ size_t hexify(char *hex, const uint8_t *bin, size_t count, size_t length)
|
||||
return i;
|
||||
}
|
||||
|
||||
void buffer_shr(void *_buf, unsigned buf_len, unsigned count)
|
||||
void buffer_shr(void *_buf, unsigned int buf_len, unsigned int count)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned int i;
|
||||
unsigned char *buf = _buf;
|
||||
unsigned bytes_to_remove;
|
||||
unsigned shift;
|
||||
unsigned int bytes_to_remove;
|
||||
unsigned int shift;
|
||||
|
||||
bytes_to_remove = count / 8;
|
||||
shift = count - (bytes_to_remove * 8);
|
||||
|
||||
Reference in New Issue
Block a user