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:
Antonio Borneo 2024-09-08 21:22:40 +02:00
parent a64dc23bf1
commit 436e6f1770
12 changed files with 78 additions and 78 deletions

View File

@ -40,7 +40,7 @@ static const char hex_digits[] = {
'a', 'b', 'c', 'd', 'e', 'f' '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) if (!from || !_to)
return NULL; return NULL;
@ -49,7 +49,7 @@ void *buf_cpy(const void *from, void *_to, unsigned size)
memcpy(_to, from, DIV_ROUND_UP(size, 8)); memcpy(_to, from, DIV_ROUND_UP(size, 8));
/* mask out bits that don't belong to the buffer */ /* mask out bits that don't belong to the buffer */
unsigned trailing_bits = size % 8; unsigned int trailing_bits = size % 8;
if (trailing_bits) { if (trailing_bits) {
uint8_t *to = _to; uint8_t *to = _to;
to[size / 8] &= (1 << trailing_bits) - 1; 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); 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; uint8_t mask = (1 << trailing) - 1;
return buf_eq_masked(a, b, mask & m); 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) if (!_buf1 || !_buf2)
return _buf1 == _buf2; return _buf1 == _buf2;
unsigned last = size / 8; unsigned int last = size / 8;
if (memcmp(_buf1, _buf2, last) != 0) if (memcmp(_buf1, _buf2, last) != 0)
return false; return false;
unsigned trailing = size % 8; unsigned int trailing = size % 8;
if (!trailing) if (!trailing)
return true; 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, bool buf_eq_mask(const void *_buf1, const void *_buf2,
const void *_mask, unsigned size) const void *_mask, unsigned int size)
{ {
if (!_buf1 || !_buf2) if (!_buf1 || !_buf2)
return _buf1 == _buf2 && _buf1 == _mask; return _buf1 == _buf2 && _buf1 == _mask;
const uint8_t *buf1 = _buf1, *buf2 = _buf2, *mask = _mask; const uint8_t *buf1 = _buf1, *buf2 = _buf2, *mask = _mask;
unsigned last = size / 8; unsigned int last = size / 8;
for (unsigned i = 0; i < last; i++) { for (unsigned int i = 0; i < last; i++) {
if (!buf_eq_masked(buf1[i], buf2[i], mask[i])) if (!buf_eq_masked(buf1[i], buf2[i], mask[i]))
return false; return false;
} }
unsigned trailing = size % 8; unsigned int trailing = size % 8;
if (!trailing) if (!trailing)
return true; return true;
return buf_eq_trailing(buf1[last], buf2[last], mask[last], trailing); 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; uint8_t *buf = _buf;
if (!buf) if (!buf)
@ -110,19 +110,19 @@ void *buf_set_ones(void *_buf, unsigned size)
memset(buf, 0xff, size / 8); memset(buf, 0xff, size / 8);
unsigned trailing_bits = size % 8; unsigned int trailing_bits = size % 8;
if (trailing_bits) if (trailing_bits)
buf[size / 8] = (1 << trailing_bits) - 1; buf[size / 8] = (1 << trailing_bits) - 1;
return buf; return buf;
} }
void *buf_set_buf(const void *_src, unsigned src_start, void *buf_set_buf(const void *_src, unsigned int src_start,
void *_dst, unsigned dst_start, unsigned len) void *_dst, unsigned int dst_start, unsigned int len)
{ {
const uint8_t *src = _src; const uint8_t *src = _src;
uint8_t *dst = _dst; 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; sb = src_start / 8;
db = dst_start / 8; db = dst_start / 8;
@ -175,13 +175,13 @@ uint32_t flip_u32(uint32_t value, unsigned int num)
return c; 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); char *str = calloc(len_bytes * 2 + 1, 1);
const uint8_t *buf = _buf; 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]; uint8_t tmp = buf[len_bytes - i - 1];
if ((i == 0) && (buf_len % 8)) if ((i == 0) && (buf_len % 8))
tmp &= (0xff >> (8 - (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); INIT_LIST_HEAD(&q->list);
} }
int bit_copy_queued(struct bit_copy_queue *q, uint8_t *dst, unsigned dst_offset, const uint8_t *src, int bit_copy_queued(struct bit_copy_queue *q, uint8_t *dst, unsigned int dst_offset, const uint8_t *src,
unsigned src_offset, unsigned bit_count) unsigned int src_offset, unsigned int bit_count)
{ {
struct bit_copy_queue_entry *qe = malloc(sizeof(*qe)); struct bit_copy_queue_entry *qe = malloc(sizeof(*qe));
if (!qe) if (!qe)
@ -395,12 +395,12 @@ size_t hexify(char *hex, const uint8_t *bin, size_t count, size_t length)
return i; 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 char *buf = _buf;
unsigned bytes_to_remove; unsigned int bytes_to_remove;
unsigned shift; unsigned int shift;
bytes_to_remove = count / 8; bytes_to_remove = count / 8;
shift = count - (bytes_to_remove * 8); shift = count - (bytes_to_remove * 8);

View File

@ -32,7 +32,7 @@
* @param value Up to 32 bits that will be copied to _buffer. * @param value Up to 32 bits that will be copied to _buffer.
*/ */
static inline void buf_set_u32(uint8_t *_buffer, static inline void buf_set_u32(uint8_t *_buffer,
unsigned first, unsigned num, uint32_t value) unsigned int first, unsigned int num, uint32_t value)
{ {
assert(num >= 1 && num <= 32); assert(num >= 1 && num <= 32);
uint8_t *buffer = _buffer; uint8_t *buffer = _buffer;
@ -43,7 +43,7 @@ static inline void buf_set_u32(uint8_t *_buffer,
buffer[1] = (value >> 8) & 0xff; buffer[1] = (value >> 8) & 0xff;
buffer[0] = (value >> 0) & 0xff; buffer[0] = (value >> 0) & 0xff;
} else { } else {
for (unsigned i = first; i < first + num; i++) { for (unsigned int i = first; i < first + num; i++) {
if (((value >> (i - first)) & 1) == 1) if (((value >> (i - first)) & 1) == 1)
buffer[i / 8] |= 1 << (i % 8); buffer[i / 8] |= 1 << (i % 8);
else else
@ -63,7 +63,7 @@ static inline void buf_set_u32(uint8_t *_buffer,
* @param value Up to 64 bits that will be copied to _buffer. * @param value Up to 64 bits that will be copied to _buffer.
*/ */
static inline void buf_set_u64(uint8_t *_buffer, static inline void buf_set_u64(uint8_t *_buffer,
unsigned first, unsigned num, uint64_t value) unsigned int first, unsigned int num, uint64_t value)
{ {
assert(num >= 1 && num <= 64); assert(num >= 1 && num <= 64);
uint8_t *buffer = _buffer; uint8_t *buffer = _buffer;
@ -83,7 +83,7 @@ static inline void buf_set_u64(uint8_t *_buffer,
buffer[1] = (value >> 8) & 0xff; buffer[1] = (value >> 8) & 0xff;
buffer[0] = (value >> 0) & 0xff; buffer[0] = (value >> 0) & 0xff;
} else { } else {
for (unsigned i = first; i < first + num; i++) { for (unsigned int i = first; i < first + num; i++) {
if (((value >> (i - first)) & 1) == 1) if (((value >> (i - first)) & 1) == 1)
buffer[i / 8] |= 1 << (i % 8); buffer[i / 8] |= 1 << (i % 8);
else else
@ -102,7 +102,7 @@ static inline void buf_set_u64(uint8_t *_buffer,
* @returns Up to 32-bits that were read from @c _buffer. * @returns Up to 32-bits that were read from @c _buffer.
*/ */
static inline uint32_t buf_get_u32(const uint8_t *_buffer, static inline uint32_t buf_get_u32(const uint8_t *_buffer,
unsigned first, unsigned num) unsigned int first, unsigned int num)
{ {
assert(num >= 1 && num <= 32); assert(num >= 1 && num <= 32);
const uint8_t *buffer = _buffer; const uint8_t *buffer = _buffer;
@ -114,7 +114,7 @@ static inline uint32_t buf_get_u32(const uint8_t *_buffer,
(((uint32_t)buffer[0]) << 0); (((uint32_t)buffer[0]) << 0);
} else { } else {
uint32_t result = 0; uint32_t result = 0;
for (unsigned i = first; i < first + num; i++) { for (unsigned int i = first; i < first + num; i++) {
if (((buffer[i / 8] >> (i % 8)) & 1) == 1) if (((buffer[i / 8] >> (i % 8)) & 1) == 1)
result |= 1U << (i - first); result |= 1U << (i - first);
} }
@ -132,7 +132,7 @@ static inline uint32_t buf_get_u32(const uint8_t *_buffer,
* @returns Up to 64-bits that were read from @c _buffer. * @returns Up to 64-bits that were read from @c _buffer.
*/ */
static inline uint64_t buf_get_u64(const uint8_t *_buffer, static inline uint64_t buf_get_u64(const uint8_t *_buffer,
unsigned first, unsigned num) unsigned int first, unsigned int num)
{ {
assert(num >= 1 && num <= 64); assert(num >= 1 && num <= 64);
const uint8_t *buffer = _buffer; const uint8_t *buffer = _buffer;
@ -153,7 +153,7 @@ static inline uint64_t buf_get_u64(const uint8_t *_buffer,
(((uint64_t)buffer[0]) << 0)); (((uint64_t)buffer[0]) << 0));
} else { } else {
uint64_t result = 0; uint64_t result = 0;
for (unsigned i = first; i < first + num; i++) { for (unsigned int i = first; i < first + num; i++) {
if (((buffer[i / 8] >> (i % 8)) & 1) == 1) if (((buffer[i / 8] >> (i % 8)) & 1) == 1)
result = result | ((uint64_t)1 << (uint64_t)(i - first)); result = result | ((uint64_t)1 << (uint64_t)(i - first));
} }
@ -170,11 +170,11 @@ static inline uint64_t buf_get_u64(const uint8_t *_buffer,
* @param width The number of bits in value (2-32). * @param width The number of bits in value (2-32).
* @returns A 32-bit word with @c value in reversed bit-order. * @returns A 32-bit word with @c value in reversed bit-order.
*/ */
uint32_t flip_u32(uint32_t value, unsigned width); uint32_t flip_u32(uint32_t value, unsigned int width);
bool buf_eq(const void *buf1, const void *buf2, unsigned size); bool buf_eq(const void *buf1, const void *buf2, unsigned int size);
bool buf_eq_mask(const void *buf1, const void *buf2, bool buf_eq_mask(const void *buf1, const void *buf2,
const void *mask, unsigned size); const void *mask, unsigned int size);
/** /**
* Copies @c size bits out of @c from and into @c to. Any extra * Copies @c size bits out of @c from and into @c to. Any extra
@ -183,7 +183,7 @@ bool buf_eq_mask(const void *buf1, const void *buf2,
* @param to The buffer that will receive the copy of @c from. * @param to The buffer that will receive the copy of @c from.
* @param size The number of bits to copy. * @param size The number of bits to copy.
*/ */
void *buf_cpy(const void *from, void *to, unsigned size); void *buf_cpy(const void *from, void *to, unsigned int size);
/** /**
* Set the contents of @c buf with @c count bits, all set to 1. * Set the contents of @c buf with @c count bits, all set to 1.
@ -191,10 +191,10 @@ void *buf_cpy(const void *from, void *to, unsigned size);
* @param size The number of bits. * @param size The number of bits.
* @returns The original buffer (@c buf). * @returns The original buffer (@c buf).
*/ */
void *buf_set_ones(void *buf, unsigned size); void *buf_set_ones(void *buf, unsigned int size);
void *buf_set_buf(const void *src, unsigned src_start, void *buf_set_buf(const void *src, unsigned int src_start,
void *dst, unsigned dst_start, unsigned len); void *dst, unsigned int dst_start, unsigned int len);
/** /**
* Parse an unsigned number (provided as a zero-terminated string) * Parse an unsigned number (provided as a zero-terminated string)
@ -207,7 +207,7 @@ void *buf_set_buf(const void *src, unsigned src_start,
*/ */
int str_to_buf(const char *str, void *_buf, unsigned int buf_bitsize); int str_to_buf(const char *str, void *_buf, unsigned int buf_bitsize);
char *buf_to_hex_str(const void *buf, unsigned size); char *buf_to_hex_str(const void *buf, unsigned int size);
/* read a uint32_t from a buffer in target memory endianness */ /* read a uint32_t from a buffer in target memory endianness */
static inline uint32_t fast_target_buffer_get_u32(const void *p, bool le) static inline uint32_t fast_target_buffer_get_u32(const void *p, bool le)
@ -215,8 +215,8 @@ static inline uint32_t fast_target_buffer_get_u32(const void *p, bool le)
return le ? le_to_h_u32(p) : be_to_h_u32(p); return le ? le_to_h_u32(p) : be_to_h_u32(p);
} }
static inline void bit_copy(uint8_t *dst, unsigned dst_offset, const uint8_t *src, static inline void bit_copy(uint8_t *dst, unsigned int dst_offset, const uint8_t *src,
unsigned src_offset, unsigned bit_count) unsigned int src_offset, unsigned int bit_count)
{ {
buf_set_buf(src, src_offset, dst, dst_offset, bit_count); buf_set_buf(src, src_offset, dst, dst_offset, bit_count);
} }
@ -227,16 +227,16 @@ struct bit_copy_queue {
struct bit_copy_queue_entry { struct bit_copy_queue_entry {
uint8_t *dst; uint8_t *dst;
unsigned dst_offset; unsigned int dst_offset;
const uint8_t *src; const uint8_t *src;
unsigned src_offset; unsigned int src_offset;
unsigned bit_count; unsigned int bit_count;
struct list_head list; struct list_head list;
}; };
void bit_copy_queue_init(struct bit_copy_queue *q); void bit_copy_queue_init(struct bit_copy_queue *q);
int bit_copy_queued(struct bit_copy_queue *q, uint8_t *dst, unsigned dst_offset, const uint8_t *src, int bit_copy_queued(struct bit_copy_queue *q, uint8_t *dst, unsigned int dst_offset, const uint8_t *src,
unsigned src_offset, unsigned bit_count); unsigned int src_offset, unsigned int bit_count);
void bit_copy_execute(struct bit_copy_queue *q); void bit_copy_execute(struct bit_copy_queue *q);
void bit_copy_discard(struct bit_copy_queue *q); void bit_copy_discard(struct bit_copy_queue *q);
@ -244,6 +244,6 @@ void bit_copy_discard(struct bit_copy_queue *q);
* used in ti-icdi driver and gdb server */ * used in ti-icdi driver and gdb server */
size_t unhexify(uint8_t *bin, const char *hex, size_t count); size_t unhexify(uint8_t *bin, const char *hex, size_t count);
size_t hexify(char *hex, const uint8_t *bin, size_t count, size_t out_maxlen); size_t hexify(char *hex, const uint8_t *bin, size_t count, size_t out_maxlen);
void buffer_shr(void *_buf, unsigned buf_len, unsigned count); void buffer_shr(void *_buf, unsigned int buf_len, unsigned int count);
#endif /* OPENOCD_HELPER_BINARYBUFFER_H */ #endif /* OPENOCD_HELPER_BINARYBUFFER_H */

View File

@ -58,7 +58,7 @@ void *jimcmd_privdata(Jim_Cmd *cmd)
return cmd->isproc ? NULL : cmd->u.native.privData; return cmd->isproc ? NULL : cmd->u.native.privData;
} }
static void tcl_output(void *privData, const char *file, unsigned line, static void tcl_output(void *privData, const char *file, unsigned int line,
const char *function, const char *string) const char *function, const char *string)
{ {
struct log_capture_state *state = privData; struct log_capture_state *state = privData;
@ -144,7 +144,7 @@ static void script_debug(Jim_Interp *interp, unsigned int argc, Jim_Obj * const
return; return;
char *dbg = alloc_printf("command -"); char *dbg = alloc_printf("command -");
for (unsigned i = 0; i < argc; i++) { for (unsigned int i = 0; i < argc; i++) {
const char *w = Jim_GetString(argv[i], NULL); const char *w = Jim_GetString(argv[i], NULL);
char *t = alloc_printf("%s %s", dbg, w); char *t = alloc_printf("%s %s", dbg, w);
free(dbg); free(dbg);
@ -288,7 +288,7 @@ int __register_commands(struct command_context *cmd_ctx, const char *cmd_prefix,
struct target *override_target) struct target *override_target)
{ {
int retval = ERROR_OK; int retval = ERROR_OK;
unsigned i; unsigned int i;
for (i = 0; cmds[i].name || cmds[i].chain; i++) { for (i = 0; cmds[i].name || cmds[i].chain; i++) {
const struct command_registration *cr = cmds + i; const struct command_registration *cr = cmds + i;
@ -323,7 +323,7 @@ int __register_commands(struct command_context *cmd_ctx, const char *cmd_prefix,
} }
} }
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
for (unsigned j = 0; j < i; j++) for (unsigned int j = 0; j < i; j++)
unregister_command(cmd_ctx, cmd_prefix, cmds[j].name); unregister_command(cmd_ctx, cmd_prefix, cmds[j].name);
} }
return retval; return retval;
@ -728,12 +728,12 @@ static COMMAND_HELPER(command_help_show_list, bool show_help, const char *cmd_ma
#define HELP_LINE_WIDTH(_n) (int)(76 - (2 * _n)) #define HELP_LINE_WIDTH(_n) (int)(76 - (2 * _n))
static void command_help_show_indent(unsigned n) static void command_help_show_indent(unsigned int n)
{ {
for (unsigned i = 0; i < n; i++) for (unsigned int i = 0; i < n; i++)
LOG_USER_N(" "); LOG_USER_N(" ");
} }
static void command_help_show_wrap(const char *str, unsigned n, unsigned n2) static void command_help_show_wrap(const char *str, unsigned int n, unsigned int n2)
{ {
const char *cp = str, *last = str; const char *cp = str, *last = str;
while (*cp) { while (*cp) {
@ -1317,7 +1317,7 @@ DEFINE_PARSE_NUM_TYPE(_llong, long long, strtoll, LLONG_MIN, LLONG_MAX)
#define DEFINE_PARSE_ULONGLONG(name, type, min, max) \ #define DEFINE_PARSE_ULONGLONG(name, type, min, max) \
DEFINE_PARSE_WRAPPER(name, type, min, max, unsigned long long, _ullong) DEFINE_PARSE_WRAPPER(name, type, min, max, unsigned long long, _ullong)
DEFINE_PARSE_ULONGLONG(_uint, unsigned, 0, UINT_MAX) DEFINE_PARSE_ULONGLONG(_uint, unsigned int, 0, UINT_MAX)
DEFINE_PARSE_ULONGLONG(_u64, uint64_t, 0, UINT64_MAX) DEFINE_PARSE_ULONGLONG(_u64, uint64_t, 0, UINT64_MAX)
DEFINE_PARSE_ULONGLONG(_u32, uint32_t, 0, UINT32_MAX) DEFINE_PARSE_ULONGLONG(_u32, uint32_t, 0, UINT32_MAX)
DEFINE_PARSE_ULONGLONG(_u16, uint16_t, 0, UINT16_MAX) DEFINE_PARSE_ULONGLONG(_u16, uint16_t, 0, UINT16_MAX)

View File

@ -77,7 +77,7 @@ struct command_invocation {
struct command_context *ctx; struct command_context *ctx;
struct command *current; struct command *current;
const char *name; const char *name;
unsigned argc; unsigned int argc;
const char **argv; const char **argv;
Jim_Obj * const *jimtcl_argv; Jim_Obj * const *jimtcl_argv;
Jim_Obj *output; Jim_Obj *output;
@ -414,7 +414,7 @@ int parse_llong(const char *str, long long *ul);
#define DECLARE_PARSE_WRAPPER(name, type) \ #define DECLARE_PARSE_WRAPPER(name, type) \
int parse ## name(const char *str, type * ul) int parse ## name(const char *str, type * ul)
DECLARE_PARSE_WRAPPER(_uint, unsigned); DECLARE_PARSE_WRAPPER(_uint, unsigned int);
DECLARE_PARSE_WRAPPER(_u64, uint64_t); DECLARE_PARSE_WRAPPER(_u64, uint64_t);
DECLARE_PARSE_WRAPPER(_u32, uint32_t); DECLARE_PARSE_WRAPPER(_u32, uint32_t);
DECLARE_PARSE_WRAPPER(_u16, uint16_t); DECLARE_PARSE_WRAPPER(_u16, uint16_t);

View File

@ -53,7 +53,7 @@ static const char * const log_strings[6] = {
static int count; static int count;
/* forward the log to the listeners */ /* forward the log to the listeners */
static void log_forward(const char *file, unsigned line, const char *function, const char *string) static void log_forward(const char *file, unsigned int line, const char *function, const char *string)
{ {
struct log_callback *cb, *next; struct log_callback *cb, *next;
cb = log_callbacks; cb = log_callbacks;
@ -133,7 +133,7 @@ static void log_puts(enum log_levels level,
void log_printf(enum log_levels level, void log_printf(enum log_levels level,
const char *file, const char *file,
unsigned line, unsigned int line,
const char *function, const char *function,
const char *format, const char *format,
...) ...)
@ -156,7 +156,7 @@ void log_printf(enum log_levels level,
va_end(ap); va_end(ap);
} }
void log_vprintf_lf(enum log_levels level, const char *file, unsigned line, void log_vprintf_lf(enum log_levels level, const char *file, unsigned int line,
const char *function, const char *format, va_list args) const char *function, const char *format, va_list args)
{ {
char *tmp; char *tmp;
@ -182,7 +182,7 @@ void log_vprintf_lf(enum log_levels level, const char *file, unsigned line,
void log_printf_lf(enum log_levels level, void log_printf_lf(enum log_levels level,
const char *file, const char *file,
unsigned line, unsigned int line,
const char *function, const char *function,
const char *format, const char *format,
...) ...)
@ -505,7 +505,7 @@ void log_socket_error(const char *socket_desc)
* Find the first non-printable character in the char buffer, return a pointer to it. * Find the first non-printable character in the char buffer, return a pointer to it.
* If no such character exists, return NULL. * If no such character exists, return NULL.
*/ */
char *find_nonprint_char(char *buf, unsigned buf_len) char *find_nonprint_char(char *buf, unsigned int buf_len)
{ {
for (unsigned int i = 0; i < buf_len; i++) { for (unsigned int i = 0; i < buf_len; i++) {
if (!isprint(buf[i])) if (!isprint(buf[i]))

View File

@ -48,12 +48,12 @@ enum log_levels {
LOG_LVL_DEBUG_IO = 4, LOG_LVL_DEBUG_IO = 4,
}; };
void log_printf(enum log_levels level, const char *file, unsigned line, void log_printf(enum log_levels level, const char *file, unsigned int line,
const char *function, const char *format, ...) const char *function, const char *format, ...)
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6))); __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6)));
void log_vprintf_lf(enum log_levels level, const char *file, unsigned line, void log_vprintf_lf(enum log_levels level, const char *file, unsigned int line,
const char *function, const char *format, va_list args); const char *function, const char *format, va_list args);
void log_printf_lf(enum log_levels level, const char *file, unsigned line, void log_printf_lf(enum log_levels level, const char *file, unsigned int line,
const char *function, const char *format, ...) const char *function, const char *format, ...)
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6))); __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 5, 6)));
@ -73,7 +73,7 @@ void busy_sleep(uint64_t ms);
void log_socket_error(const char *socket_desc); void log_socket_error(const char *socket_desc);
typedef void (*log_callback_fn)(void *priv, const char *file, unsigned line, typedef void (*log_callback_fn)(void *priv, const char *file, unsigned int line,
const char *function, const char *string); const char *function, const char *string);
struct log_callback { struct log_callback {
@ -89,7 +89,7 @@ char *alloc_vprintf(const char *fmt, va_list ap);
char *alloc_printf(const char *fmt, ...) char *alloc_printf(const char *fmt, ...)
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 1, 2))); __attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 1, 2)));
char *find_nonprint_char(char *buf, unsigned buf_len); char *find_nonprint_char(char *buf, unsigned int buf_len);
extern int debug_level; extern int debug_level;

View File

@ -111,7 +111,7 @@ size_t strnlen(const char *s, size_t maxlen);
#ifndef HAVE_USLEEP #ifndef HAVE_USLEEP
#ifdef _WIN32 #ifdef _WIN32
static inline unsigned usleep(unsigned int usecs) static inline unsigned int usleep(unsigned int usecs)
{ {
Sleep((usecs/1000)); Sleep((usecs/1000));
return 0; return 0;

View File

@ -258,7 +258,7 @@ static struct command_context *setup_command_handler(Jim_Interp *interp)
&arm_tpiu_swo_register_commands, &arm_tpiu_swo_register_commands,
NULL NULL
}; };
for (unsigned i = 0; command_registrants[i]; i++) { for (unsigned int i = 0; command_registrants[i]; i++) {
int retval = (*command_registrants[i])(cmd_ctx); int retval = (*command_registrants[i])(cmd_ctx);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
command_done(cmd_ctx); command_done(cmd_ctx);

View File

@ -320,7 +320,7 @@ static int hwthread_get_thread_reg(struct rtos *rtos, int64_t thread_id,
rtos_reg->number = reg->number; rtos_reg->number = reg->number;
rtos_reg->size = reg->size; rtos_reg->size = reg->size;
unsigned bytes = (reg->size + 7) / 8; unsigned int bytes = (reg->size + 7) / 8;
assert(bytes <= sizeof(rtos_reg->value)); assert(bytes <= sizeof(rtos_reg->value));
memcpy(rtos_reg->value, reg->value, bytes); memcpy(rtos_reg->value, reg->value, bytes);

View File

@ -245,7 +245,7 @@ static int svf_last_printed_percentage = -1;
#define SVF_BUF_LOG(_lvl, _buf, _nbits, _desc) \ #define SVF_BUF_LOG(_lvl, _buf, _nbits, _desc) \
svf_hexbuf_print(LOG_LVL_##_lvl, __FILE__, __LINE__, __func__, _buf, _nbits, _desc) svf_hexbuf_print(LOG_LVL_##_lvl, __FILE__, __LINE__, __func__, _buf, _nbits, _desc)
static void svf_hexbuf_print(int dbg_lvl, const char *file, unsigned line, static void svf_hexbuf_print(int dbg_lvl, const char *file, unsigned int line,
const char *function, const uint8_t *buf, const char *function, const uint8_t *buf,
int bit_len, const char *desc) int bit_len, const char *desc)
{ {
@ -316,7 +316,7 @@ static void svf_free_xxd_para(struct svf_xxr_para *para)
int svf_add_statemove(tap_state_t state_to) int svf_add_statemove(tap_state_t state_to)
{ {
tap_state_t state_from = cmd_queue_cur_state; tap_state_t state_from = cmd_queue_cur_state;
unsigned index_var; unsigned int index_var;
/* when resetting, be paranoid and ignore current state */ /* when resetting, be paranoid and ignore current state */
if (state_to == TAP_RESET) { if (state_to == TAP_RESET) {

View File

@ -176,8 +176,8 @@ struct transport *get_current_transport(void)
COMMAND_HELPER(transport_list_parse, char ***vector) COMMAND_HELPER(transport_list_parse, char ***vector)
{ {
char **argv; char **argv;
unsigned n = CMD_ARGC; unsigned int n = CMD_ARGC;
unsigned j = 0; unsigned int j = 0;
*vector = NULL; *vector = NULL;
@ -189,7 +189,7 @@ COMMAND_HELPER(transport_list_parse, char ***vector)
if (!argv) if (!argv)
return ERROR_FAIL; return ERROR_FAIL;
for (unsigned i = 0; i < n; i++) { for (unsigned int i = 0; i < n; i++) {
struct transport *t; struct transport *t;
for (t = transport_list; t; t = t->next) { for (t = transport_list; t; t = t->next) {
@ -208,7 +208,7 @@ COMMAND_HELPER(transport_list_parse, char ***vector)
return ERROR_OK; return ERROR_OK;
fail: fail:
for (unsigned i = 0; i < n; i++) for (unsigned int i = 0; i < n; i++)
free(argv[i]); free(argv[i]);
free(argv); free(argv);
return ERROR_FAIL; return ERROR_FAIL;

View File

@ -217,7 +217,7 @@ COMMAND_HANDLER(handle_xsvf_command)
bool collecting_path = false; bool collecting_path = false;
tap_state_t path[XSTATE_MAX_PATH]; tap_state_t path[XSTATE_MAX_PATH];
unsigned pathlen = 0; unsigned int pathlen = 0;
/* a flag telling whether to clock TCK during waits, /* a flag telling whether to clock TCK during waits,
* or simply sleep, controlled by virt2 * or simply sleep, controlled by virt2