Ticket #19: jabberd2_fix_many_compile_warnings.diff

File jabberd2_fix_many_compile_warnings.diff, 13.6 KB (added by smoku, 21 months ago)

Patch by Mark Doliner <mark@…>

  • sm/mm.c

     
    4444 
    4545mm_t mm_new(sm_t sm) { 
    4646    mm_t mm; 
    47     int celem, melem, attr, i, *nlist = NULL; 
     47    int celem, melem, attr, *nlist = NULL; 
    4848    char id[13], name[32], mod_fullpath[512], arg[1024], *modules_path; 
    4949    mod_chain_t chain = (mod_chain_t) NULL; 
    5050    mod_instance_t **list = NULL, mi; 
  • sm/mod_amp.c

     
    104104 
    105105static mod_ret_t _amp_in_sess(mod_instance_t mi, sess_t sess, pkt_t pkt) { 
    106106    mod_amp_config_t config = (mod_amp_config_t) mi->mod->private; 
    107     int ns, elem, attr; 
    108107 
    109108    /* only handle messages */ 
    110109    if (pkt->type != pkt_MESSAGE) 
  • sm/sm.h

     
    324324sess_t          sess_start(sm_t sm, jid_t jid); 
    325325void            sess_end(sess_t sess); 
    326326sess_t          sess_match(user_t user, char *resource); 
     327sess_t          sess_match_exact(user_t user, char *resource); 
    327328 
    328329user_t          user_load(sm_t sm, jid_t jid); 
    329330void            user_free(user_t user); 
  • sm/mod_roster.c

     
    149149    for(scan = user->sessions; scan != NULL; scan = scan->next) 
    150150    { 
    151151        /* don't push to us or to anyone who hasn't loaded the roster */ 
    152         if((int) scan->module_data[mod_index] == 0) 
     152        if(scan->module_data[mod_index] == NULL) 
    153153            continue; 
    154154 
    155155        push = pkt_dup(pkt, jid_full(scan->jid), NULL); 
  • c2s/c2s.c

     
    2323static int _c2s_client_sx_callback(sx_t s, sx_event_t e, void *data, void *arg) { 
    2424    sess_t sess = (sess_t) arg; 
    2525    sx_buf_t buf = (sx_buf_t) data; 
    26     int rlen, len, ns, elem, attr, i, r; 
     26    int rlen, len, ns, elem, attr; 
    2727    sx_error_t *sxe; 
    2828    nad_t nad; 
    2929    char root[9]; 
  • sx/ssl.c

     
    154154                if( ((_sx_ssl_conn_t)s->plugin_data[p->index])->pemfile != NULL ) 
    155155                    free(((_sx_ssl_conn_t)s->plugin_data[p->index])->pemfile); 
    156156                free(s->plugin_data[p->index]); 
    157                 s->plugin_data[p->index] == NULL; 
     157                s->plugin_data[p->index] = NULL; 
    158158            } 
    159159 
    160160            _sx_debug(ZONE, "server can't handle ssl, business as usual"); 
     
    621621 
    622622    free(sc); 
    623623     
    624     s->plugin_data[p->index] == NULL; 
     624    s->plugin_data[p->index] = NULL; 
    625625} 
    626626 
    627627static void _sx_ssl_unload(sx_plugin_t p) { 
     
    716716} 
    717717 
    718718int sx_ssl_client_starttls(sx_plugin_t p, sx_t s, char *pemfile) { 
    719     assert((int) p); 
    720     assert((int) s); 
     719    assert((int) (p != NULL)); 
     720    assert((int) (s != NULL)); 
    721721 
    722722    /* sanity */ 
    723723    if(s->type != type_CLIENT || s->state != state_STREAM) { 
  • sx/sasl.c

     
    6666                              unsigned ulen) { 
    6767    const char *realm  = NULL; 
    6868    char *c; 
    69     int ret; 
    7069    const struct propval *to_fetch, *current; 
    7170    char *user_buf = NULL; 
    7271    char *value; 
     
    10081007    sasl_security_properties_t sec_props; 
    10091008    nad_t nad; 
    10101009 
    1011     assert((int) p); 
    1012     assert((int) s); 
    1013     assert((int) appname); 
    1014     assert((int) mech); 
     1010    assert((int) (p != NULL)); 
     1011    assert((int) (s != NULL)); 
     1012    assert((int) (appname != NULL)); 
     1013    assert((int) (mech != NULL)); 
    10151014 
    10161015    if(s->type != type_CLIENT || s->state != state_STREAM) { 
    10171016        _sx_debug(ZONE, "need client in stream state for sasl auth"); 
  • sx/server.c

     
    227227void sx_server_init(sx_t s, unsigned int flags) { 
    228228    int i; 
    229229 
    230     assert((int) s); 
     230    assert((int) (s != NULL)); 
    231231 
    232232    /* can't do anything if we're alive already */ 
    233233    if(s->state != state_NONE) 
  • sx/io.c

     
    9696 
    9797                    nad_print(nad, 0, &xml, &xlen); 
    9898                    errstring = (char *) malloc(sizeof(char) * (xlen + 1)); 
    99                     sprintf(errstring, "%.*s", &xlen, &xml); 
     99                    sprintf(errstring, "%.*s", xlen, xml); 
    100100                } 
    101101 
    102102                if(s->state < state_CLOSING) { 
     
    160160    sx_buf_t in, out; 
    161161    int read, ret; 
    162162 
    163     assert((int) s); 
     163    assert((int) (s != NULL)); 
    164164 
    165165    /* do we care? */ 
    166166    if(!s->want_read && s->state < state_CLOSING) 
     
    294294    sx_buf_t out; 
    295295    int ret, written; 
    296296     
    297     assert((int) s); 
     297    assert((int) (s != NULL)); 
    298298 
    299299    /* do we care? */ 
    300300    if(!s->want_write && s->state < state_CLOSING) 
     
    391391 
    392392/** app version */ 
    393393void sx_nad_write_elem(sx_t s, nad_t nad, int elem) { 
    394     assert((int) s); 
    395     assert((int) nad); 
     394    assert((int) (s != NULL)); 
     395    assert((int) (nad != NULL)); 
    396396 
    397397    if(_sx_nad_write(s, nad, elem) == 1) 
    398398        return; 
     
    425425 
    426426/** app version */ 
    427427void sx_raw_write(sx_t s, char *buf, int len) { 
    428     assert((int) s); 
    429     assert((int) buf); 
     428    assert((int) (s != NULL)); 
     429    assert((int) (buf != NULL)); 
    430430    assert(len); 
    431431 
    432432    if(_sx_raw_write(s, buf, len) == 1) 
     
    451451} 
    452452 
    453453void sx_close(sx_t s) { 
    454     assert((int) s); 
     454    assert((int) (s != NULL)); 
    455455 
    456456    if(s->state >= state_CLOSING) 
    457457        return; 
     
    466466} 
    467467 
    468468void sx_kill(sx_t s) { 
    469     assert((int) s); 
     469    assert((int) (s != NULL)); 
    470470 
    471471    _sx_state(s, state_CLOSED); 
    472472    _sx_event(s, event_CLOSED, NULL); 
  • sx/client.c

     
    113113    char *c; 
    114114    int i, len; 
    115115 
    116     assert((int) s); 
     116    assert((int) (s != NULL)); 
    117117 
    118118    /* can't do anything if we're alive already */ 
    119119    if(s->state != state_NONE) 
  • sx/env.c

     
    3232void sx_env_free(sx_env_t env) { 
    3333    int i; 
    3434 
    35     assert((int) env); 
     35    assert((int) (env != NULL)); 
    3636 
    3737    /* !!! usage counts */ 
    3838 
     
    5151    int ret; 
    5252    va_list args; 
    5353 
    54     assert((int) env); 
    55     assert((int) init); 
     54    assert((int) (env != NULL)); 
     55    assert((int) (init != NULL)); 
    5656 
    5757    va_start(args, init); 
    5858 
  • sx/sx.c

     
    2424    sx_t s; 
    2525    int i; 
    2626 
    27     assert((int) cb); 
     27    assert((int) (cb != NULL)); 
    2828 
    2929    s = (sx_t) malloc(sizeof(struct _sx_st)); 
    3030    memset(s, 0, sizeof(struct _sx_st)); 
     
    129129 
    130130/** force advance into auth state */ 
    131131void sx_auth(sx_t s, const char *auth_method, const char *auth_id) { 
    132     assert((int) s); 
     132    assert((int) (s != NULL)); 
    133133 
    134134    _sx_debug(ZONE, "authenticating stream (method=%s; id=%s)", auth_method, auth_id); 
    135135 
  • router/router.c

     
    858858            /* they did something */ 
    859859            comp->last_activity = time(NULL); 
    860860 
    861             ioctl(fd, FIONREAD, &nbytes); 
     861            ioctl(fd->fd, FIONREAD, &nbytes); 
    862862            if(nbytes == 0) { 
    863863                sx_kill(comp->s); 
    864864                return 0; 
  • router/router.h

     
    206206int     user_table_load(router_t r); 
    207207void    user_table_unload(router_t r); 
    208208 
     209int     filter_load(router_t r); 
     210void    filter_unload(router_t r); 
     211int     filter_packet(router_t r, nad_t nad); 
     212 
    209213/* union for xhash_iter_get to comply with strict-alias rules for gcc3 */ 
    210214union xhashv 
    211215{ 
  • mio/mio_impl.h

     
    128128{ 
    129129    struct sockaddr_storage serv_addr; 
    130130    socklen_t addrlen = (socklen_t) sizeof(serv_addr); 
    131     int newfd, dupfd; 
     131    int newfd; 
    132132    mio_fd_t mio_fd; 
    133133    char ip[INET6_ADDRSTRLEN]; 
    134134 
  • util/jqueue.c

     
    3535} 
    3636 
    3737void jqueue_free(jqueue_t q) { 
    38     assert((int) q); 
     38    assert((int) (q != NULL)); 
    3939 
    4040    pool_free(q->p); 
    4141} 
     
    4343void jqueue_push(jqueue_t q, void *data, int priority) { 
    4444    _jqueue_node_t qn, scan; 
    4545 
    46     assert((int) q); 
     46    assert((int) (q != NULL)); 
    4747 
    4848    q->size++; 
    4949 
     
    9696    void *data; 
    9797    _jqueue_node_t qn; 
    9898 
    99     assert((int) q); 
     99    assert((int) (q != NULL)); 
    100100 
    101101    if(q->front == NULL) 
    102102        return NULL; 
  • util/stanza.c

     
    2424nad_t stanza_error(nad_t nad, int elem, int err) { 
    2525    int ns; 
    2626 
    27     assert((int) nad); 
     27    assert((int) (nad != NULL)); 
    2828    assert((int) (elem >= 0)); 
    2929    assert((int) (err >= stanza_err_BAD_REQUEST && err < stanza_err_LAST)); 
    3030 
     
    5151    int attr; 
    5252    char to[3072], from[3072]; 
    5353 
    54     assert((int) nad); 
     54    assert((int) (nad != NULL)); 
    5555 
    5656    to[0] = '\0'; 
    5757    from[0] = '\0'; 
  • util/xdata.c

     
    4949xdata_field_t xdata_field_new(xdata_t xd, xdata_field_type_t type, char *var, char *label, char *desc, int required) { 
    5050    xdata_field_t xdf; 
    5151 
    52     assert((int) xd); 
     52    assert((int) (xd != NULL)); 
    5353    assert((int) type); 
    54     assert((int) var); 
     54    assert((int) (var != NULL)); 
    5555 
    5656    xdf = pmalloco(xd->p, sizeof(struct _xdata_field_st)); 
    5757 
     
    7373xdata_item_t xdata_item_new(xdata_t xd) { 
    7474    xdata_item_t xdi; 
    7575 
    76     assert((int) xd); 
     76    assert((int) (xd != NULL)); 
    7777 
    7878    xdi = pmalloco(xd->p, sizeof(struct _xdata_item_st)); 
    7979 
     
    8484 
    8585/** field insertion */ 
    8686void xdata_add_field(xdata_t xd, xdata_field_t xdf) { 
    87     assert((int) xd); 
    88     assert((int) xdf); 
     87    assert((int) (xd != NULL)); 
     88    assert((int) (xdf != NULL)); 
    8989 
    9090    if(xd->fields == NULL) 
    9191        xd->fields = xd->flast = xdf; 
     
    9696} 
    9797 
    9898void xdata_add_rfield(xdata_t xd, xdata_field_t xdf) { 
    99     assert((int) xd); 
    100     assert((int) xdf); 
     99    assert((int) (xd != NULL)); 
     100    assert((int) (xdf != NULL)); 
    101101 
    102102    if(xd->rfields == NULL) 
    103103        xd->rfields = xd->rflast = xdf; 
     
    108108} 
    109109 
    110110void xdata_add_field_item(xdata_item_t xdi, xdata_field_t xdf) { 
    111     assert((int) xdi); 
    112     assert((int) xdf); 
     111    assert((int) (xdi != NULL)); 
     112    assert((int) (xdf != NULL)); 
    113113 
    114114    if(xdi->fields == NULL) 
    115115        xdi->fields = xdi->flast = xdf; 
     
    121121 
    122122/** item insertion */ 
    123123void xdata_add_item(xdata_t xd, xdata_item_t xdi) { 
    124     assert((int) xd); 
    125     assert((int) xdi); 
     124    assert((int) (xd != NULL)); 
     125    assert((int) (xdi != NULL)); 
    126126 
    127127    if(xd->items == NULL) 
    128128        xd->items = xd->ilast = xdi; 
     
    136136void xdata_option_new(xdata_field_t xdf, char *value, int lvalue, char *label, int llabel) { 
    137137    xdata_option_t xdo; 
    138138 
    139     assert((int) xdf); 
    140     assert((int) value); 
     139    assert((int) (xdf != NULL)); 
     140    assert((int) (value != NULL)); 
    141141 
    142142    xdo = pmalloco(xdf->p, sizeof(struct _xdata_option_st)); 
    143143 
     
    160160void xdata_add_value(xdata_field_t xdf, char *value, int vlen) { 
    161161    int first = 0; 
    162162 
    163     assert((int) xdf); 
    164     assert((int) value); 
     163    assert((int) (xdf != NULL)); 
     164    assert((int) (value != NULL)); 
    165165 
    166166    if(vlen <= 0) vlen = strlen(value); 
    167167 
     
    271271    int atype, elem, field; 
    272272    xdata_field_t xdf; 
    273273 
    274     assert((int) nad); 
     274    assert((int) (nad != NULL)); 
    275275    assert((int) (root >= 0)); 
    276276 
    277277    log_debug(ZONE, "building xd from nad"); 
  • util/jid.c

     
    216216    prep_cache_t pc; 
    217217    unsigned char *myid, *cur, *olddata=NULL; 
    218218 
    219     assert((int) jid); 
     219    assert((int) (jid != NULL)); 
    220220 
    221221    pc = jid->pc; 
    222222    if (jid->jid_data != NULL) { 
     
    308308    int dataStatic; 
    309309    jid_static_buf staticTmpBuf; 
    310310 
    311     assert((int) jid); 
     311    assert((int) (jid != NULL)); 
    312312 
    313313    pc = jid->pc; 
    314314    if(jid->jid_data != NULL) 
  • util/datetime.c

     
    3838    struct timeval tv; 
    3939    struct timezone tz; 
    4040 
    41     assert((int) date); 
     41    assert((int) (date != NULL)); 
    4242 
    4343    /* !!! sucks having to call this each time */ 
    4444    tzset(); 
     
    115115    struct tm *gmt; 
    116116 
    117117    assert((int) type); 
    118     assert((int) date); 
     118    assert((int) (date != NULL)); 
    119119    assert((int) datelen); 
    120120 
    121121    gmt = gmtime(&t);