Finish transforming 'u32' to 'uint32_t'.
- Replace '\([^_]\)u32' with '\1uint32_t'. - Replace '^u32' with 'uint32_t'. git-svn-id: svn://svn.berlios.de/openocd/trunk@2281 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
@@ -156,9 +156,9 @@ uint8_t* buf_set_buf(const uint8_t *src, int src_start, uint8_t *dst, int dst_st
|
||||
return dst;
|
||||
}
|
||||
|
||||
u32 flip_u32(u32 value, unsigned int num)
|
||||
uint32_t flip_u32(uint32_t value, unsigned int num)
|
||||
{
|
||||
u32 c;
|
||||
uint32_t c;
|
||||
|
||||
c = (bit_reverse_table256[value & 0xff] << 24) |
|
||||
(bit_reverse_table256[(value >> 8) & 0xff] << 16) |
|
||||
@@ -173,7 +173,7 @@ u32 flip_u32(u32 value, unsigned int num)
|
||||
|
||||
int ceil_f_to_u32(float x)
|
||||
{
|
||||
u32 y;
|
||||
uint32_t y;
|
||||
|
||||
if (x < 0) /* return zero for negative numbers */
|
||||
return 0;
|
||||
@@ -193,7 +193,7 @@ char* buf_to_str(const uint8_t *buf, int buf_len, int radix)
|
||||
char *str;
|
||||
int str_len;
|
||||
int b256_len = CEIL(buf_len, 8);
|
||||
u32 tmp;
|
||||
uint32_t tmp;
|
||||
|
||||
int j; /* base-256 digits */
|
||||
int i; /* output digits (radix) */
|
||||
@@ -224,7 +224,7 @@ char* buf_to_str(const uint8_t *buf, int buf_len, int radix)
|
||||
|
||||
for (j = str_len; j > 0; j--)
|
||||
{
|
||||
tmp += (u32)str[j-1] * 256;
|
||||
tmp += (uint32_t)str[j-1] * 256;
|
||||
str[j-1] = (uint8_t)(tmp % radix);
|
||||
tmp /= radix;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ char* buf_to_str(const uint8_t *buf, int buf_len, int radix)
|
||||
int str_to_buf(const char *str, int str_len, uint8_t *buf, int buf_len, int radix)
|
||||
{
|
||||
char *charbuf;
|
||||
u32 tmp;
|
||||
uint32_t tmp;
|
||||
float factor;
|
||||
uint8_t *b256_buf;
|
||||
int b256_len;
|
||||
@@ -298,12 +298,12 @@ int str_to_buf(const char *str, int str_len, uint8_t *buf, int buf_len, int radi
|
||||
tmp = (tmp - 'A' + 10);
|
||||
else continue; /* skip characters other than [0-9,a-f,A-F] */
|
||||
|
||||
if (tmp >= (u32)radix)
|
||||
if (tmp >= (uint32_t)radix)
|
||||
continue; /* skip digits invalid for the current radix */
|
||||
|
||||
for (j = 0; j < b256_len; j++)
|
||||
{
|
||||
tmp += (u32)b256_buf[j] * radix;
|
||||
tmp += (uint32_t)b256_buf[j] * radix;
|
||||
b256_buf[j] = (uint8_t)(tmp & 0xFF);
|
||||
tmp >>= 8;
|
||||
}
|
||||
@@ -330,7 +330,7 @@ int str_to_buf(const char *str, int str_len, uint8_t *buf, int buf_len, int radi
|
||||
|
||||
int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field_s *field)
|
||||
{
|
||||
u32 *dest = priv;
|
||||
uint32_t *dest = priv;
|
||||
|
||||
*dest = buf_get_u32(in_buf, 0, 32);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
/* inlining this will help show what fn that is taking time during profiling. */
|
||||
static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int num, u32 value)
|
||||
static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int num, uint32_t value)
|
||||
{
|
||||
if ((num==32)&&(first==0))
|
||||
{
|
||||
@@ -51,14 +51,14 @@ static inline void buf_set_u32(uint8_t* buffer, unsigned int first, unsigned int
|
||||
}
|
||||
}
|
||||
}
|
||||
static inline u32 buf_get_u32(const uint8_t* buffer, unsigned int first, unsigned int num)
|
||||
static inline uint32_t buf_get_u32(const uint8_t* buffer, unsigned int first, unsigned int num)
|
||||
{
|
||||
if ((num==32)&&(first==0))
|
||||
{
|
||||
return (((u32)buffer[3])<<24)|(((u32)buffer[2])<<16)|(((u32)buffer[1])<<8)|(((u32)buffer[0])<<0);
|
||||
return (((uint32_t)buffer[3])<<24)|(((uint32_t)buffer[2])<<16)|(((uint32_t)buffer[1])<<8)|(((uint32_t)buffer[0])<<0);
|
||||
} else
|
||||
{
|
||||
u32 result = 0;
|
||||
uint32_t result = 0;
|
||||
unsigned int i;
|
||||
|
||||
for (i=first; i<first+num; i++)
|
||||
@@ -71,7 +71,7 @@ static inline u32 buf_get_u32(const uint8_t* buffer, unsigned int first, unsigne
|
||||
}
|
||||
}
|
||||
|
||||
extern u32 flip_u32(u32 value, unsigned int num);
|
||||
extern uint32_t flip_u32(uint32_t value, unsigned int num);
|
||||
|
||||
extern int buf_cmp(const uint8_t *buf1, const uint8_t *buf2, int size);
|
||||
extern int buf_cmp_mask(const uint8_t *buf1, const uint8_t *buf2, const uint8_t *mask, int size);
|
||||
@@ -88,8 +88,8 @@ extern int buf_to_u32_handler(uint8_t *in_buf, void *priv, struct scan_field_s *
|
||||
|
||||
#define CEIL(m, n) ((m + n - 1) / n)
|
||||
|
||||
/* read a u32 from a buffer in target memory endianness */
|
||||
static inline u32 fast_target_buffer_get_u32(const uint8_t *buffer, int little)
|
||||
/* read a uint32_t from a buffer in target memory endianness */
|
||||
static inline uint32_t fast_target_buffer_get_u32(const uint8_t *buffer, int little)
|
||||
{
|
||||
if (little)
|
||||
return le_to_h_u32(buffer);
|
||||
|
||||
@@ -143,7 +143,7 @@ int fileio_close(fileio_t *fileio)
|
||||
return retval;
|
||||
}
|
||||
|
||||
int fileio_seek(fileio_t *fileio, u32 position)
|
||||
int fileio_seek(fileio_t *fileio, uint32_t position)
|
||||
{
|
||||
int retval;
|
||||
if ((retval = fseek(fileio->file, position, SEEK_SET)) != 0)
|
||||
@@ -155,22 +155,22 @@ int fileio_seek(fileio_t *fileio, u32 position)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static inline int fileio_local_read(fileio_t *fileio, u32 size, uint8_t *buffer, u32 *size_read)
|
||||
static inline int fileio_local_read(fileio_t *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
|
||||
{
|
||||
*size_read = fread(buffer, 1, size, fileio->file);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int fileio_read(fileio_t *fileio, u32 size, uint8_t *buffer, u32 *size_read)
|
||||
int fileio_read(fileio_t *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
|
||||
{
|
||||
return fileio_local_read(fileio, size, buffer, size_read);
|
||||
}
|
||||
|
||||
int fileio_read_u32(fileio_t *fileio, u32 *data)
|
||||
int fileio_read_u32(fileio_t *fileio, uint32_t *data)
|
||||
{
|
||||
uint8_t buf[4];
|
||||
u32 size_read;
|
||||
uint32_t size_read;
|
||||
int retval;
|
||||
|
||||
if ((retval = fileio_local_read(fileio, 4, buf, &size_read)) != ERROR_OK)
|
||||
@@ -180,7 +180,7 @@ int fileio_read_u32(fileio_t *fileio, u32 *data)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static inline int fileio_local_fgets(fileio_t *fileio, u32 size, char *buffer)
|
||||
static inline int fileio_local_fgets(fileio_t *fileio, uint32_t size, char *buffer)
|
||||
{
|
||||
if( fgets(buffer, size, fileio->file) == NULL)
|
||||
return ERROR_FILEIO_OPERATION_FAILED;
|
||||
@@ -188,19 +188,19 @@ static inline int fileio_local_fgets(fileio_t *fileio, u32 size, char *buffer)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int fileio_fgets(fileio_t *fileio, u32 size, char *buffer)
|
||||
int fileio_fgets(fileio_t *fileio, uint32_t size, char *buffer)
|
||||
{
|
||||
return fileio_local_fgets(fileio, size, buffer);
|
||||
}
|
||||
|
||||
static inline int fileio_local_write(fileio_t *fileio, u32 size, const uint8_t *buffer, u32 *size_written)
|
||||
static inline int fileio_local_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
|
||||
{
|
||||
*size_written = fwrite(buffer, 1, size, fileio->file);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int fileio_write(fileio_t *fileio, u32 size, const uint8_t *buffer, u32 *size_written)
|
||||
int fileio_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@@ -212,10 +212,10 @@ int fileio_write(fileio_t *fileio, u32 size, const uint8_t *buffer, u32 *size_wr
|
||||
return retval;;
|
||||
}
|
||||
|
||||
int fileio_write_u32(fileio_t *fileio, u32 data)
|
||||
int fileio_write_u32(fileio_t *fileio, uint32_t data)
|
||||
{
|
||||
uint8_t buf[4];
|
||||
u32 size_written;
|
||||
uint32_t size_written;
|
||||
int retval;
|
||||
|
||||
h_u32_to_be(buf, data);
|
||||
|
||||
@@ -54,14 +54,14 @@ typedef struct fileio_s
|
||||
FILE *file;
|
||||
} fileio_t;
|
||||
|
||||
extern int fileio_write(fileio_t *fileio, u32 size, const uint8_t *buffer, u32 *size_written);
|
||||
extern int fileio_read(fileio_t *fileio, u32 size, uint8_t *buffer, u32 *size_read);
|
||||
extern int fileio_fgets(fileio_t *fileio, u32 size, char *buffer);
|
||||
extern int fileio_seek(fileio_t *fileio, u32 position);
|
||||
extern int fileio_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written);
|
||||
extern int fileio_read(fileio_t *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read);
|
||||
extern int fileio_fgets(fileio_t *fileio, uint32_t size, char *buffer);
|
||||
extern int fileio_seek(fileio_t *fileio, uint32_t position);
|
||||
extern int fileio_close(fileio_t *fileio);
|
||||
extern int fileio_open(fileio_t *fileio, const char *url, enum fileio_access access, enum fileio_type type);
|
||||
extern int fileio_read_u32(fileio_t *fileio, u32 *data);
|
||||
extern int fileio_write_u32(fileio_t *fileio, u32 data);
|
||||
extern int fileio_read_u32(fileio_t *fileio, uint32_t *data);
|
||||
extern int fileio_write_u32(fileio_t *fileio, uint32_t data);
|
||||
|
||||
#define ERROR_FILEIO_LOCATION_UNKNOWN (-1200)
|
||||
#define ERROR_FILEIO_NOT_FOUND (-1201)
|
||||
|
||||
@@ -38,8 +38,8 @@ typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
#endif
|
||||
|
||||
#ifndef u32
|
||||
typedef unsigned int u32;
|
||||
#ifndef uint32_t
|
||||
typedef unsigned int uint32_t;
|
||||
#endif
|
||||
|
||||
#ifndef u64
|
||||
@@ -88,9 +88,9 @@ typedef bool _Bool;
|
||||
*/
|
||||
|
||||
|
||||
static inline u32 le_to_h_u32(const uint8_t* buf)
|
||||
static inline uint32_t le_to_h_u32(const uint8_t* buf)
|
||||
{
|
||||
return (u32)(buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24);
|
||||
return (uint32_t)(buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24);
|
||||
}
|
||||
|
||||
static inline uint16_t le_to_h_u16(const uint8_t* buf)
|
||||
@@ -98,9 +98,9 @@ static inline uint16_t le_to_h_u16(const uint8_t* buf)
|
||||
return (uint16_t)(buf[0] | buf[1] << 8);
|
||||
}
|
||||
|
||||
static inline u32 be_to_h_u32(const uint8_t* buf)
|
||||
static inline uint32_t be_to_h_u32(const uint8_t* buf)
|
||||
{
|
||||
return (u32)(buf[3] | buf[2] << 8 | buf[1] << 16 | buf[0] << 24);
|
||||
return (uint32_t)(buf[3] | buf[2] << 8 | buf[1] << 16 | buf[0] << 24);
|
||||
}
|
||||
|
||||
static inline uint16_t be_to_h_u16(const uint8_t* buf)
|
||||
|
||||
Reference in New Issue
Block a user