[ 
https://issues.apache.org/jira/browse/PROTON-98?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13482144#comment-13482144
 ] 

Cliff Jansen commented on PROTON-98:
------------------------------------

Hi Mary,

This is an excellently scoped sub-task for Visual Studio support.  Well done.

It is also an opportunity to familiarize yourself with diffs and patches.  
Could you please provide your proposed changes in patch format?  Feel free to 
contact me directly if you need help with that.

Cliff
                
> Porting Issue -- Visual Studio compiler requires explicit casts
> ---------------------------------------------------------------
>
>                 Key: PROTON-98
>                 URL: https://issues.apache.org/jira/browse/PROTON-98
>             Project: Qpid Proton
>          Issue Type: Improvement
>          Components: proton-c
>         Environment: Windows using Visual Studio 2010
>            Reporter: Mary hinton
>              Labels: build
>
> I would like to get the code changed to add explicit casts where the Visual 
> Studio compiler requires it. 
> The GNU compiler isn’t so picky, but we need the explicit casts for Visual 
> Studio tools.
> The problem is in many of the files.
>   C:\qpid\qpid\proton\proton-c\src\proton.c(278):  struct client_context *ctx 
> = (client_context *) pn_connector_context(ctor);                // explicit 
> cast
>   C:\qpid\qpid\proton\proton-c\src\buffer.c(41):  pn_buffer_t *buf = 
> (pn_buffer_t *) malloc(sizeof(pn_buffer_t));                             // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\buffer.c(45):  buf->bytes = capacity ? 
> (char *) malloc(capacity) : NULL;                                   // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\codec\codec.c(706):    return (pn_type_t) 
> PN_ARG_ERR;                                                              // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\codec\codec.c(758):    return (pn_type_t) 
> PN_ARG_ERR;                                                              // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\codec\codec.c(1210):    atom->u.type = 
> (pn_type_t) va_arg(*ap, int);                                       // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\codec\codec.c(1311):          char **sptr 
> = (char **) ptr;                                                 // explicit 
> cast
>   C:\qpid\qpid\proton\proton-c\src\codec\codec.c(1875):  pn_data_t *data = 
> (pn_data_t *) malloc(sizeof(pn_data_t));                           // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\codec\codec.c(1878):  data->nodes = 
> capacity ? (pn_node_t *) malloc(capacity * sizeof(pn_node_t)) : NULL;   // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\codec\codec.c(1931):  data->nodes = 
> (pn_node_t *) realloc(data->nodes, data->capacity * sizeof(pn_node_t));       
>  // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\codec\codec.c(2151):            char 
> **sptr = (char**) ptr;                                                        
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\codec\codec.c(3114):    return (pn_type_t) 
> -1;                                                                     // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\codec\codec.c(3764):    return (pn_type_t) 
> -1;                                                                     // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\dispatcher\dispatcher.c(32):  
> pn_dispatcher_t *disp = (pn_dispatcher_t *) calloc(sizeof(pn_dispatcher_t), 
> 1);      // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\dispatcher\dispatcher.c(47):  disp->output 
> = (char *) malloc(disp->capacity);                              // explicit 
> cast
>   C:\qpid\qpid\proton\proton-c\src\dispatcher\dispatcher.c(248):        
> disp->output = (char *) realloc(disp->output, disp->capacity);        // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\driver.c(193):  pn_listener_t *l = 
> (pn_listener_t *) malloc(sizeof(pn_listener_t));                        // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\driver.c(410):  pn_connector_t *c = 
> (pn_connector_t *) malloc(sizeof(pn_connector_t));                     // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\driver.c(656):  pn_driver_t *d = 
> (pn_driver_t *) malloc(sizeof(pn_driver_t));                              // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\driver.c(748):    d->fds = (pollfd *) 
> realloc(d->fds, d->capacity*sizeof(struct pollfd));          // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(47):  db->deliveries = 
> (pn_delivery_state_t *) malloc(sizeof(pn_delivery_state_t) * capacity);    // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(438):  pn_connection_t 
> *conn = (pn_connection_t *)malloc(sizeof(pn_connection_t));                 
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(730):  pn_session_t *ssn = 
> (pn_session_t *) malloc(sizeof(pn_session_t));                          // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(866):  pn_transport_t 
> *transport = (pn_transport_t *) malloc(sizeof(pn_transport_t));               
>        // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(964):  return terminus ? 
> terminus->type : (pn_terminus_type_t) 0;                                      
>     // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(982):  return terminus ? 
> terminus->durability : (pn_durability_t) 0;                                   
>     // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(994):  return terminus ? 
> terminus->expiry_policy : (pn_expiry_policy_t) 0;                 // explicit 
> cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1128):  pn_link_t *snd = 
> (pn_link_t *) malloc(sizeof(pn_link_t));                                  // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1137):  pn_link_t *rcv = 
> (pn_link_t *) malloc(sizeof(pn_link_t));                                  // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1179):    delivery = 
> (pn_delivery_t *) malloc(sizeof(pn_delivery_t));                              
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1351):  
> pn_delivery_state_t *state = (pn_delivery_state_t *) 
> delivery->transport_context;  // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1415):  pn_transport_t 
> *transport = (pn_transport_t *) disp->context;                              
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1443):  pn_transport_t 
> *transport = (pn_transport_t *) disp->context;                              
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1500):  pn_transport_t 
> *transport = (pn_transport_t *) disp->context;                              
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1595):  pn_transport_t 
> *transport = (pn_transport_t *) disp->context;                              
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1648):  pn_transport_t 
> *transport = (pn_transport_t *) disp->context;                              
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1713):  pn_transport_t 
> *transport = (pn_transport_t *) disp->context;                              
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1815):  pn_transport_t 
> *transport = (pn_transport_t *) disp->context;                              
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1853):  pn_transport_t 
> *transport = (pn_transport_t *) disp->context;                              
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(1976):    
> pn_delivery_state_t *state = (pn_delivery_state_t *) 
> delivery->transport_context;                // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(2126):  
> pn_delivery_state_t *state = (pn_delivery_state_t *) 
> delivery->transport_context;          // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(2154):    
> pn_delivery_state_t *state = (pn_delivery_state_t *) 
> delivery->transport_context;                // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(2182):  
> pn_delivery_state_t *state = (pn_delivery_state_t *) 
> delivery->transport_context;          // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(2592):  return 
> (pn_disposition_t) delivery->local_state;                                     
>       // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\engine\engine.c(2597):  return 
> (pn_disposition_t) delivery->remote_state;                                    
>       // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\error.c(37):  pn_error_t *error = 
> (pn_error_t *) malloc(sizeof(pn_error_t));                                    
>    // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\message\message.c(83):  pn_message_t *msg 
> = (pn_message_t *) malloc(sizeof(pn_message_t));                 // explicit 
> cast
>   C:\qpid\qpid\proton\proton-c\src\messenger.c(90):  pn_messenger_t *m = 
> (pn_messenger_t *) malloc(sizeof(pn_messenger_t));                           
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\messenger.c(309):      char *scheme = 
> (char *)pn_listener_context(l);                                              
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\parser.c(42):  pn_parser_t *parser = 
> (pn_parser_t *) malloc(sizeof(pn_parser_t));                                  
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\parser.c(54):    parser->atoms = (char *) 
> realloc(parser->atoms, parser->capacity);                                // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\sasl\sasl.c(349):  pn_sasl_t *sasl = 
> (pn_sasl_t *)disp->context;                                                   
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\scanner.c(83):  pn_scanner_t *scanner = 
> (pn_scanner_t *) malloc(sizeof(pn_scanner_t));                             // 
> explicit cast
>   C:\qpid\qpid\proton\proton-c\src\types.c(42):    char *dup = (char *) 
> malloc(size);                                                                 
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\util.c(171):    char *dest = (char *) 
> malloc((strlen(src)+1)*sizeof(char));                                        
> // explicit cast
>   C:\qpid\qpid\proton\proton-c\src\util.c(187):    char *dest = (char *) 
> malloc(size + 1);                                                            
> // explicit cast

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to