diff --git a/urjtag/src/bsdl/bsdl.c b/urjtag/src/bsdl/bsdl.c index 7d776401..b2f32af5 100644 --- a/urjtag/src/bsdl/bsdl.c +++ b/urjtag/src/bsdl/bsdl.c @@ -256,14 +256,14 @@ urj_bsdl_set_path (urj_chain_t *chain, const char *pathlist) { num++; /* extend path list array */ - globs->path_list = - (char **) realloc (globs->path_list, - (num + 1) * sizeof (char *)); + globs->path_list = realloc (globs->path_list, + (num + 1) * sizeof (char *)); /* enter path element up to the delimeter */ if (delim == NULL) len = strlen (elem); else len = delim - elem; + /* @@@@ ToDo check malloc result RFHH */ pathelem = malloc (len + 1); memcpy (pathelem, elem, len); pathelem[len] = '\0'; @@ -324,8 +324,9 @@ urj_bsdl_scan_files (urj_chain_t *chain, const char *idcode, int proc_mode) { char *name; - name = (char *) malloc (strlen (globs->path_list[idx]) - + strlen (elem->d_name) + 1 + 1); + /* @@@@ ToDo handle malloc error result RFHH */ + name = malloc (strlen (globs->path_list[idx]) + + strlen (elem->d_name) + 1 + 1); if (name) { struct stat buf; diff --git a/urjtag/src/bsdl/bsdl_bison.y b/urjtag/src/bsdl/bsdl_bison.y index f801882a..2498808a 100644 --- a/urjtag/src/bsdl/bsdl_bison.y +++ b/urjtag/src/bsdl/bsdl_bison.y @@ -514,7 +514,8 @@ Safe_Value : IDENTIFIER | DECIMAL_NUMBER { char *tmp; - tmp = (char *)malloc( 2 ); + /* @@@@ ToDo check malloc result RFHH */ + tmp = malloc( 2 ); snprintf( tmp, 2, "%i", $1 ); tmp[1] = '\0'; $$ = tmp; diff --git a/urjtag/src/bsdl/bsdl_flex.l b/urjtag/src/bsdl/bsdl_flex.l index 34554eb0..953c4926 100644 --- a/urjtag/src/bsdl/bsdl_flex.l +++ b/urjtag/src/bsdl/bsdl_flex.l @@ -437,7 +437,7 @@ void *urj_bsdl_flex_init( int proc_mode ) return NULL; } - if (!(extra = (urj_bsdl_scan_extra_t *)malloc( sizeof( urj_bsdl_scan_extra_t ) ))) { + if (!(extra = malloc( sizeof( urj_bsdl_scan_extra_t ) ))) { urj_bsdl_msg( proc_mode, BSDL_MSG_FATAL, _("Out of memory, %s line %i\n"), __FILE__, __LINE__ ); yylex_destroy( scanner ); @@ -518,7 +518,7 @@ static char *new_string( urj_bsdl_scan_extra_t *extra, const char *str ) size_t n_str_size; n_str_size = strlen( str ) + 1; - if ((n_str = (char *)malloc( n_str_size ))) + if ((n_str = malloc( n_str_size ))) { strncpy( n_str, str, n_str_size-1 ); n_str[n_str_size-1] = '\0'; /* set very last element to EOS */ diff --git a/urjtag/src/bsdl/bsdl_sem.c b/urjtag/src/bsdl/bsdl_sem.c index a9da3a21..f91e5042 100644 --- a/urjtag/src/bsdl/bsdl_sem.c +++ b/urjtag/src/bsdl/bsdl_sem.c @@ -150,7 +150,7 @@ urj_bsdl_emit_ports (urj_bsdl_jtag_ctrl_t *jc) */ name_len = strlen (name->string); str_len = name_len + 1 + 10 + 1 + 1; - if ((port_string = (char *) malloc (str_len)) != NULL) + if ((port_string = malloc (str_len)) != NULL) { cmd[1] = port_string; @@ -577,7 +577,7 @@ parse_vhdl_elem (urj_bsdl_parser_priv_t *priv, urj_bsdl_vhdl_elem_t *elem) /* allocate enough memory for total buffer */ buf_len = name_string_len + 1 + elem_string_len + 1; - buf = (char *) malloc (buf_len); + buf = malloc (buf_len); if (!buf) { urj_bsdl_msg (priv->jtag_ctrl->proc_mode, diff --git a/urjtag/src/bsdl/vhdl_bison.y b/urjtag/src/bsdl/vhdl_bison.y index 2e84aa31..e3a775cb 100644 --- a/urjtag/src/bsdl/vhdl_bison.y +++ b/urjtag/src/bsdl/vhdl_bison.y @@ -612,7 +612,8 @@ static void Init_Text( urj_bsdl_vhdl_parser_priv_t *priv ) { if (priv->len_buffer == 0) { - priv->buffer = (char *)malloc( 160 ); + /* @@@@ ToDo check malloc result RFHH */ + priv->buffer = malloc( 160 ); priv->len_buffer = 160; } priv->buffer[0] = '\0'; @@ -646,7 +647,8 @@ static void Store_Text( urj_bsdl_vhdl_parser_priv_t *priv, char *Source ) req_len = strlen( priv->buffer ) + strlen( Source ) + 1; if (req_len > priv->len_buffer) { - priv->buffer = (char *)realloc( priv->buffer, req_len ); + /* @@@@ ToDo check realloc result RFHH */ + priv->buffer = realloc( priv->buffer, req_len ); priv->len_buffer = req_len; } strcat( priv->buffer, Source ); @@ -825,7 +827,7 @@ urj_bsdl_vhdl_parser_priv_t *urj_vhdl_parser_init( FILE *f, urj_bsdl_jtag_ctrl_t { urj_bsdl_vhdl_parser_priv_t *new_priv; - if (!(new_priv = (urj_bsdl_vhdl_parser_priv_t *)malloc( sizeof( urj_bsdl_vhdl_parser_priv_t ) ))) + if (!(new_priv = malloc( sizeof( urj_bsdl_vhdl_parser_priv_t ) ))) { urj_bsdl_msg( jtag_ctrl->proc_mode, BSDL_MSG_ERR, _("Out of memory, %s line %i\n"), __FILE__, __LINE__ ); @@ -919,7 +921,7 @@ static void urj_vhdl_port_add_name( urj_bsdl_vhdl_parser_priv_t *priv, char *nam urj_bsdl_port_desc_t *pd = &(priv->tmp_port_desc); urj_bsdl_string_elem_t *new_string; - new_string = (urj_bsdl_string_elem_t *)malloc( sizeof( urj_bsdl_string_elem_t ) ); + new_string = malloc( sizeof( urj_bsdl_string_elem_t ) ); if (new_string) { new_string->next = pd->names_list; @@ -997,7 +999,7 @@ static void urj_vhdl_port_add_range( urj_bsdl_vhdl_parser_priv_t *priv, int low, static void urj_vhdl_port_apply_port( urj_bsdl_vhdl_parser_priv_t *priv ) { urj_bsdl_port_desc_t *tmp_pd = &(priv->tmp_port_desc); - urj_bsdl_port_desc_t *pd = (urj_bsdl_port_desc_t *)malloc( sizeof( urj_bsdl_port_desc_t ) ); + urj_bsdl_port_desc_t *pd = malloc( sizeof( urj_bsdl_port_desc_t ) ); if (pd) { @@ -1038,7 +1040,7 @@ static void add_elem( urj_bsdl_vhdl_parser_priv_t *priv, urj_bsdl_vhdl_elem_t *e #if 0 static void set_attr_bool( urj_bsdl_vhdl_parser_priv_t *priv, char *name, int value ) { - urj_bsdl_vhdl_elem_t *el = (urj_bsdl_vhdl_elem_t *)malloc( sizeof( urj_bsdl_vhdl_elem_t ) ); + urj_bsdl_vhdl_elem_t *el = malloc( sizeof( urj_bsdl_vhdl_elem_t ) ); if (el) { @@ -1055,8 +1057,8 @@ static void set_attr_bool( urj_bsdl_vhdl_parser_priv_t *priv, char *name, int va static void set_attr_decimal( urj_bsdl_vhdl_parser_priv_t *priv, char *name, int value ) { - urj_bsdl_vhdl_elem_t *el = (urj_bsdl_vhdl_elem_t *)malloc( sizeof( urj_bsdl_vhdl_elem_t ) ); - char *string = (char *)malloc( 10 ); + urj_bsdl_vhdl_elem_t *el = malloc( sizeof( urj_bsdl_vhdl_elem_t ) ); + char *string = malloc( 10 ); if (el && string) { @@ -1074,7 +1076,7 @@ static void set_attr_decimal( urj_bsdl_vhdl_parser_priv_t *priv, char *name, int static void set_attr_string( urj_bsdl_vhdl_parser_priv_t *priv, char *name, char *string ) { - urj_bsdl_vhdl_elem_t *el = (urj_bsdl_vhdl_elem_t *)malloc( sizeof( urj_bsdl_vhdl_elem_t ) ); + urj_bsdl_vhdl_elem_t *el = malloc( sizeof( urj_bsdl_vhdl_elem_t ) ); /* skip certain attributes */ if ( (strcasecmp( name, "DESIGN_WARNING" ) == 0) @@ -1105,7 +1107,7 @@ static void set_attr_string( urj_bsdl_vhdl_parser_priv_t *priv, char *name, char #if 0 static void set_attr_real( urj_bsdl_vhdl_parser_priv_t *priv, char *name, char *string ) { - urj_bsdl_vhdl_elem_t *el = (urj_bsdl_vhdl_elem_t *)malloc( sizeof( urj_bsdl_vhdl_elem_t ) ); + urj_bsdl_vhdl_elem_t *el = malloc( sizeof( urj_bsdl_vhdl_elem_t ) ); if (el) { @@ -1123,7 +1125,7 @@ static void set_attr_real( urj_bsdl_vhdl_parser_priv_t *priv, char *name, char * #if 0 static void set_attr_const( urj_bsdl_vhdl_parser_priv_t *priv, char *name, char *string ) { - urj_bsdl_vhdl_elem_t *el = (urj_bsdl_vhdl_elem_t *)malloc( sizeof( urj_bsdl_vhdl_elem_t ) ); + urj_bsdl_vhdl_elem_t *el = malloc( sizeof( urj_bsdl_vhdl_elem_t ) ); if (el) { diff --git a/urjtag/src/bsdl/vhdl_flex.l b/urjtag/src/bsdl/vhdl_flex.l index 41fa5689..ce55a980 100644 --- a/urjtag/src/bsdl/vhdl_flex.l +++ b/urjtag/src/bsdl/vhdl_flex.l @@ -366,7 +366,7 @@ void *urj_vhdl_flex_init( FILE *f, int proc_mode ) } yyset_in( f, scanner ); - if (!(extra = (urj_bsdl_scan_extra_t *)malloc( sizeof( urj_bsdl_scan_extra_t ) ))) + if (!(extra = malloc( sizeof( urj_bsdl_scan_extra_t ) ))) { urj_bsdl_msg( proc_mode, BSDL_MSG_FATAL, _("Out of memory, %s line %i\n"), __FILE__, __LINE__ ); @@ -449,7 +449,7 @@ static char *new_string( urj_bsdl_scan_extra_t *extra, const char *str ) size_t n_str_size; n_str_size = strlen( str ) + 1; - if ((n_str = (char *)malloc( n_str_size ))) + if ((n_str = malloc( n_str_size ))) { strncpy( n_str, str, n_str_size-1 ); n_str[n_str_size-1] = '\0'; /* set very last element to EOS */ @@ -498,12 +498,12 @@ void urj_vhdl_flex_switch_file( yyscan_t scanner, char *filename ) const char *db_path = urj_cmd_jtag_get_data_dir(); char *db_file; - if ((db_file = (char *)malloc( strlen( db_path ) + - 1 + /* "/" */ - 4 + /* "bsdl" */ - 1 + /* "/" */ - strlen( filename ) + - 1 ))) + if ((db_file = malloc( strlen( db_path ) + + 1 + /* "/" */ + 4 + /* "bsdl" */ + 1 + /* "/" */ + strlen( filename ) + + 1 ))) { strcpy( db_file, db_path ); strcat( db_file, "/" ); diff --git a/urjtag/src/bus/fjmem.c b/urjtag/src/bus/fjmem.c index 13d0787b..9a1bd704 100644 --- a/urjtag/src/bus/fjmem.c +++ b/urjtag/src/bus/fjmem.c @@ -305,9 +305,7 @@ fjmem_query_blocks (urj_chain_t *chain, urj_part_t *part, urj_bus_t *bus) block_param_t *bl; int nbytes; - if ((bl = - (block_param_t *) calloc (1, - sizeof (block_param_t))) == NULL) + if ((bl = calloc (1, sizeof (block_param_t))) == NULL) { printf (_("out of memory\n")); failed |= 1; diff --git a/urjtag/src/bus/mpc5200.c b/urjtag/src/bus/mpc5200.c index 11041d75..482f9b6b 100644 --- a/urjtag/src/bus/mpc5200.c +++ b/urjtag/src/bus/mpc5200.c @@ -87,7 +87,7 @@ mpc5200_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, return NULL; bus->driver = driver; - bus->params = bp = (bus_params_t *) calloc (1, sizeof (bus_params_t)); + bus->params = bp = calloc (1, sizeof (bus_params_t)); if (!bus->params) { free (bus); diff --git a/urjtag/src/cmd/cmd_cable.c b/urjtag/src/cmd/cmd_cable.c index af2a0e0f..696f0a28 100644 --- a/urjtag/src/cmd/cmd_cable.c +++ b/urjtag/src/cmd/cmd_cable.c @@ -100,7 +100,7 @@ cmd_cable_run (urj_chain_t *chain, char *params[]) cable = calloc (1, sizeof (urj_cable_t)); if (!cable) { - printf (_("%s(%d) malloc failed!\n"), __FILE__, __LINE__); + printf (_("%s(%d) calloc failed!\n"), __FILE__, __LINE__); return 1; } diff --git a/urjtag/src/cmd/cmd_part.c b/urjtag/src/cmd/cmd_part.c index 0a3555a9..a1bb8ce5 100644 --- a/urjtag/src/cmd/cmd_part.c +++ b/urjtag/src/cmd/cmd_part.c @@ -44,6 +44,7 @@ cmd_part_run (urj_chain_t *chain, char *params[]) { urj_part_t *part; part = chain->parts->parts[chain->active_part]; + /* @@@@ ToDo RFHH check malloc result */ part->alias = malloc (strlen (params[2]) + 1); strcpy (part->alias, params[2]); return 1; diff --git a/urjtag/src/flash/cfi.c b/urjtag/src/flash/cfi.c index f8a33b2b..9beb8c47 100644 --- a/urjtag/src/flash/cfi.c +++ b/urjtag/src/flash/cfi.c @@ -267,15 +267,9 @@ urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr, num_of_banks = read1 (BANK_ORGANIZATION_OFFSET); else num_of_banks = 0; - pri_vendor_tbl = - (urj_flash_cfi_amd_pri_extened_query_structure_t *) calloc (1, - sizeof - (urj_flash_cfi_amd_pri_extened_query_structure_t) - + - num_of_banks - * - sizeof - (uint8_t)); + pri_vendor_tbl = calloc (1, + sizeof (urj_flash_cfi_amd_pri_extened_query_structure_t) + + num_of_banks * sizeof (uint8_t)); if (!pri_vendor_tbl) { write1 (0, CFI_CMD_READ_ARRAY1); diff --git a/urjtag/src/jim/tap.c b/urjtag/src/jim/tap.c index 266cf33b..cd80178c 100644 --- a/urjtag/src/jim/tap.c +++ b/urjtag/src/jim/tap.c @@ -233,8 +233,7 @@ urj_jim_alloc_device (int num_sregs, const int reg_size[]) { int i, r; - urj_jim_device_t *dev = - (urj_jim_device_t *) malloc (sizeof (urj_jim_device_t)); + urj_jim_device_t *dev = malloc (sizeof (urj_jim_device_t)); if (dev == NULL) { @@ -242,10 +241,7 @@ urj_jim_alloc_device (int num_sregs, const int reg_size[]) return NULL; } - dev->sreg = - (urj_jim_shift_reg_t *) malloc (num_sregs * - sizeof (urj_jim_shift_reg_t)); - + dev->sreg = malloc (num_sregs * sizeof (urj_jim_shift_reg_t)); if (dev->sreg == NULL) { free (dev); @@ -256,9 +252,8 @@ urj_jim_alloc_device (int num_sregs, const int reg_size[]) for (r = 0, i = 0; i < num_sregs; i++) { dev->sreg[i].len = reg_size[i]; - dev->sreg[i].reg = - (uint32_t *) calloc (((reg_size[i] + 31) / 32), - sizeof (uint32_t)); + dev->sreg[i].reg = calloc (((reg_size[i] + 31) / 32), + sizeof (uint32_t)); if (dev->sreg[i].reg == NULL) r++; } @@ -290,7 +285,7 @@ urj_jim_init (void) { urj_jim_state_t *s; - s = (urj_jim_state_t *) malloc (sizeof (urj_jim_state_t)); + s = malloc (sizeof (urj_jim_state_t)); if (s == NULL) { printf ("Out of memory!\n"); diff --git a/urjtag/src/svf/svf.c b/urjtag/src/svf/svf.c index ac376724..64e7f6e4 100644 --- a/urjtag/src/svf/svf.c +++ b/urjtag/src/svf/svf.c @@ -357,7 +357,7 @@ urj_svf_build_bit_string (char *hex_string, int len) char *hex_string_pos; int hex_string_idx; - if (!(bit_string = (char *) calloc (len + 1, sizeof (char)))) + if (!(bit_string = calloc (len + 1, sizeof (char)))) { printf (_("out of memory")); return (NULL); @@ -548,7 +548,7 @@ urj_svf_all_care (char **string, double number) num = num % 4 == 0 ? num / 4 : num / 4 + 1; /* build string with all cares */ - if (!(ptr = (char *) calloc (num + 1, sizeof (char)))) + if (!(ptr = calloc (num + 1, sizeof (char)))) { printf (_("out of memory")); return (0); @@ -1195,8 +1195,7 @@ urj_svf_run (urj_chain_t *chain, FILE * SVF_FILE, int stop_on_mismatch, len = priv.part->instruction_length; if (len > 0) { - if ((instruction_string = - (char *) calloc (len + 1, sizeof (char))) != NULL) + if ((instruction_string = calloc (len + 1, sizeof (char))) != NULL) { memset (instruction_string, '1', len); instruction_string[len] = '\0'; diff --git a/urjtag/src/svf/svf_flex.l b/urjtag/src/svf/svf_flex.l index ddccfd51..1c96a999 100644 --- a/urjtag/src/svf/svf_flex.l +++ b/urjtag/src/svf/svf_flex.l @@ -366,7 +366,7 @@ void *urj_svf_flex_init(FILE *f, int num_lines, int print_progress) yyset_in(f, scanner); - if (!(extra = (urj_svf_scanner_extra_t *)malloc(sizeof(urj_svf_scanner_extra_t)))) { + if (!(extra = malloc(sizeof(urj_svf_scanner_extra_t)))) { printf( _("Out of memory, %s line %i\n"), __FILE__, __LINE__ ); yylex_destroy(scanner); return NULL; diff --git a/urjtag/src/tap/cable/cmd_xfer.c b/urjtag/src/tap/cable/cmd_xfer.c index 741fb907..0de315e8 100644 --- a/urjtag/src/tap/cable/cmd_xfer.c +++ b/urjtag/src/tap/cable/cmd_xfer.c @@ -54,7 +54,7 @@ extend_cmd_buffer (urj_tap_cable_cmd_xfer_cx_cmd_t *cmd) { cmd->buf_len *= 2; if (cmd->buf) - cmd->buf = (uint8_t *) realloc (cmd->buf, cmd->buf_len); + cmd->buf = realloc (cmd->buf, cmd->buf_len); } return cmd->buf ? 1 : 0; @@ -196,13 +196,12 @@ urj_tap_cable_cx_cmd_queue (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, uint32_t to_recv) { urj_tap_cable_cmd_xfer_cx_cmd_t *cmd = - (urj_tap_cable_cmd_xfer_cx_cmd_t *) malloc (sizeof (urj_tap_cable_cmd_xfer_cx_cmd_t)); if (cmd) { cmd->buf_len = 64; - if ((cmd->buf = (uint8_t *) malloc (cmd->buf_len)) == NULL) + if ((cmd->buf = malloc (cmd->buf_len)) == NULL) { free (cmd); cmd = NULL; diff --git a/urjtag/src/tap/cable/ft2232.c b/urjtag/src/tap/cable/ft2232.c index 18381bc6..df4d2431 100644 --- a/urjtag/src/tap/cable/ft2232.c +++ b/urjtag/src/tap/cable/ft2232.c @@ -1732,7 +1732,7 @@ ft2232_connect (char *params[], urj_cable_t *cable) if ((result = urj_tap_cable_generic_usbconn_connect (params, cable)) != 0) return result; - cable_params = (params_t *) malloc (sizeof (params_t)); + cable_params = malloc (sizeof (params_t)); if (!cable_params) { printf (_("%s(%d) malloc failed!\n"), __FILE__, __LINE__); diff --git a/urjtag/src/tap/cable/generic.c b/urjtag/src/tap/cable/generic.c index 865a3ddb..4de57e64 100644 --- a/urjtag/src/tap/cable/generic.c +++ b/urjtag/src/tap/cable/generic.c @@ -289,6 +289,7 @@ urj_tap_cable_generic_flush_using_transfer (urj_cable_t *cable, if (in == NULL || out == NULL) { + /* @@@@ RFHH free(NULL) is correct */ if (in != NULL) free (in); if (out != NULL) diff --git a/urjtag/src/tap/cable/usbblaster.c b/urjtag/src/tap/cable/usbblaster.c index a7bd270c..522ec57e 100644 --- a/urjtag/src/tap/cable/usbblaster.c +++ b/urjtag/src/tap/cable/usbblaster.c @@ -74,7 +74,7 @@ usbblaster_connect (char *params[], urj_cable_t *cable) if ((result = urj_tap_cable_generic_usbconn_connect (params, cable)) != 0) return result; - cable_params = (params_t *) malloc (sizeof (params_t)); + cable_params = malloc (sizeof (params_t)); if (!cable_params) { printf (_("%s(%d) malloc failed!\n"), __FILE__, __LINE__); diff --git a/urjtag/src/tap/detect.c b/urjtag/src/tap/detect.c index 5b115930..f1ced9cd 100644 --- a/urjtag/src/tap/detect.c +++ b/urjtag/src/tap/detect.c @@ -477,7 +477,7 @@ urj_tap_manual_add (urj_chain_t *chain, int instr_len) cmd[1] = "BYPASS"; cmd[3] = "BR"; cmd[4] = NULL; - str = (char *) calloc (instr_len + 1, sizeof (char)); + str = calloc (instr_len + 1, sizeof (char)); if (str == NULL) { printf (_("Out of memory!\n")); diff --git a/urjtag/src/tap/usbconn/libftd2xx.c b/urjtag/src/tap/usbconn/libftd2xx.c index b29bf58f..526bfc6c 100644 --- a/urjtag/src/tap/usbconn/libftd2xx.c +++ b/urjtag/src/tap/usbconn/libftd2xx.c @@ -120,8 +120,7 @@ usbconn_ftd2xx_flush (ftd2xx_param_t *p) /* extend receive buffer */ p->recv_buf_len = p->recv_write_idx + p->to_recv; if (p->recv_buf) - p->recv_buf = - (uint8_t *) realloc (p->recv_buf, p->recv_buf_len); + p->recv_buf = realloc (p->recv_buf, p->recv_buf_len); } if (!p->recv_buf) @@ -242,7 +241,7 @@ usbconn_ftd2xx_write (urj_usbconn_t *conn, uint8_t *buf, int len, int recv) { p->send_buf_len = p->send_buffered + len; if (p->send_buf) - p->send_buf = (uint8_t *) realloc (p->send_buf, p->send_buf_len); + p->send_buf = realloc (p->send_buf, p->send_buf_len); } if (p->send_buf) @@ -283,12 +282,12 @@ usbconn_ftd2xx_connect (const char **param, int paramc, { p->send_buf_len = URJ_USBCONN_FTDX_MAXSEND; p->send_buffered = 0; - p->send_buf = (uint8_t *) malloc (p->send_buf_len); + p->send_buf = malloc (p->send_buf_len); p->recv_buf_len = URJ_USBCONN_FTD2XX_MAXRECV; p->to_recv = 0; p->recv_write_idx = 0; p->recv_read_idx = 0; - p->recv_buf = (uint8_t *) malloc (p->recv_buf_len); + p->recv_buf = malloc (p->recv_buf_len); } if (!p || !c || !p->send_buf || !p->recv_buf) diff --git a/urjtag/src/tap/usbconn/libftdi.c b/urjtag/src/tap/usbconn/libftdi.c index df5f0623..2ef6abec 100644 --- a/urjtag/src/tap/usbconn/libftdi.c +++ b/urjtag/src/tap/usbconn/libftdi.c @@ -103,8 +103,7 @@ usbconn_ftdi_flush (ftdi_param_t *p) /* extend receive buffer */ p->recv_buf_len = p->recv_write_idx + p->to_recv; if (p->recv_buf) - p->recv_buf = - (uint8_t *) realloc (p->recv_buf, p->recv_buf_len); + p->recv_buf = realloc (p->recv_buf, p->recv_buf_len); } if (!p->recv_buf) @@ -208,7 +207,7 @@ usbconn_ftdi_write (urj_usbconn_t *conn, uint8_t *buf, int len, int recv) { p->send_buf_len = p->send_buffered + len; if (p->send_buf) - p->send_buf = (uint8_t *) realloc (p->send_buf, p->send_buf_len); + p->send_buf = realloc (p->send_buf, p->send_buf_len); } if (p->send_buf) @@ -247,12 +246,12 @@ usbconn_ftdi_connect (const char **param, int paramc, { p->send_buf_len = URJ_USBCONN_FTDX_MAXSEND; p->send_buffered = 0; - p->send_buf = (uint8_t *) malloc (p->send_buf_len); + p->send_buf = malloc (p->send_buf_len); p->recv_buf_len = URJ_USBCONN_FTDI_MAXRECV; p->to_recv = 0; p->recv_write_idx = 0; p->recv_read_idx = 0; - p->recv_buf = (uint8_t *) malloc (p->recv_buf_len); + p->recv_buf = malloc (p->recv_buf_len); } if (!p || !c || !fc || !p->send_buf || !p->recv_buf)