Ticket #1513: 04-shutup-many-compiler-warnings.patch

File 04-shutup-many-compiler-warnings.patch, 11.1 kB (added by stbuehler, 8 months ago)
  • src/fdevent.c

    Shutup many compiler warnings
    
    From: Stefan Bühler <stbuehler@web.de>
    
    - Unused vars
    - Conversion between object and function pointer (solved with intptr_t)
    - Wrong signedness
    ---
    
     src/fdevent.c            |    4 ++--
     src/fdevent_select.c     |    1 -
     src/http_auth.c          |   22 +++++++++++-----------
     src/lemon.c              |   13 +++++++------
     src/lempar.c             |   10 ++++++----
     src/log.c                |    2 +-
     src/mod_sql_vhost_core.c |    3 ++-
     src/plugin.c             |    2 +-
     src/server.c             |    8 +++++---
     src/stat_cache.c         |    6 ++++++
     10 files changed, 41 insertions(+), 30 deletions(-)
    
    
    diff --git a/src/fdevent.c b/src/fdevent.c
    index d513620..e939555 100644
    a b  
    340340} 
    341341 
    342342int fdevent_poll(fdevents *ev, int timeout_ms) { 
    343         if (ev->poll == NULL) SEGFAULT("ev->poll is %p", ev->poll); 
     343        if (ev->poll == NULL) SEGFAULT("ev->poll is %p", (void*) (intptr_t) ev->poll); 
    344344        return ev->poll(ev, timeout_ms); 
    345345} 
    346346 
    347347int fdevent_get_revents(fdevents *ev, size_t event_count, fdevent_revents *revents) { 
    348348        size_t i; 
    349349 
    350         if (ev->get_revents == NULL) SEGFAULT("ev->get_revents is %p", ev->get_revents); 
     350        if (ev->get_revents == NULL) SEGFAULT("ev->get_revents is %p", (void*) (intptr_t)  ev->get_revents); 
    351351 
    352352        fdevent_revents_reset(revents); 
    353353 
  • src/fdevent_select.c

    diff --git a/src/fdevent_select.c b/src/fdevent_select.c
    index c0142b7..fee7ec4 100644
    a b  
    5454static int fdevent_select_event_add(fdevents *ev, iosocket *sock, int events) { 
    5555        /* we should be protected by max-fds, but you never know */ 
    5656#ifndef _WIN32 
    57         u_int i; 
    5857        assert(sock->fd < FD_SETSIZE); 
    5958#endif 
    6059 
  • src/http_auth.c

    diff --git a/src/http_auth.c b/src/http_auth.c
    index 08bc68f..880c579 100644
    a b  
    487487    /* 
    488488     * The password first, since that is what is most unknown 
    489489     */ 
    490     MD5_Update(&ctx, pw, strlen(pw)); 
     490    MD5_Update(&ctx, (const unsigned char*) pw, strlen(pw)); 
    491491 
    492492    /* 
    493493     * Then our magic string 
    494494     */ 
    495     MD5_Update(&ctx, APR1_ID, strlen(APR1_ID)); 
     495    MD5_Update(&ctx, (const unsigned char*) APR1_ID, strlen(APR1_ID)); 
    496496 
    497497    /* 
    498498     * Then the raw salt 
    499499     */ 
    500     MD5_Update(&ctx, sp, sl); 
     500    MD5_Update(&ctx, (const unsigned char*) sp, sl); 
    501501 
    502502    /* 
    503503     * Then just as many characters of the MD5(pw, salt, pw) 
    504504     */ 
    505505    MD5_Init(&ctx1); 
    506     MD5_Update(&ctx1, pw, strlen(pw)); 
    507     MD5_Update(&ctx1, sp, sl); 
    508     MD5_Update(&ctx1, pw, strlen(pw)); 
     506    MD5_Update(&ctx1, (const unsigned char*) pw, strlen(pw)); 
     507    MD5_Update(&ctx1, (const unsigned char*) sp, sl); 
     508    MD5_Update(&ctx1, (const unsigned char*) pw, strlen(pw)); 
    509509    MD5_Final(final, &ctx1); 
    510510    for (pl = strlen(pw); pl > 0; pl -= APR_MD5_DIGESTSIZE) { 
    511511        MD5_Update(&ctx, final, 
     
    525525            MD5_Update(&ctx, final, 1); 
    526526        } 
    527527        else { 
    528             MD5_Update(&ctx, pw, 1); 
     528            MD5_Update(&ctx, (const unsigned char*) pw, 1); 
    529529        } 
    530530    } 
    531531 
     
    547547    for (i = 0; i < 1000; i++) { 
    548548        MD5_Init(&ctx1); 
    549549        if (i & 1) { 
    550             MD5_Update(&ctx1, pw, strlen(pw)); 
     550            MD5_Update(&ctx1, (const unsigned char*) pw, strlen(pw)); 
    551551        } 
    552552        else { 
    553553            MD5_Update(&ctx1, final, APR_MD5_DIGESTSIZE); 
    554554        } 
    555555        if (i % 3) { 
    556             MD5_Update(&ctx1, sp, sl); 
     556            MD5_Update(&ctx1, (const unsigned char*) sp, sl); 
    557557        } 
    558558 
    559559        if (i % 7) { 
    560             MD5_Update(&ctx1, pw, strlen(pw)); 
     560            MD5_Update(&ctx1, (const unsigned char*) pw, strlen(pw)); 
    561561        } 
    562562 
    563563        if (i & 1) { 
    564564            MD5_Update(&ctx1, final, APR_MD5_DIGESTSIZE); 
    565565        } 
    566566        else { 
    567             MD5_Update(&ctx1, pw, strlen(pw)); 
     567            MD5_Update(&ctx1, (const unsigned char*) pw, strlen(pw)); 
    568568        } 
    569569        MD5_Final(final,&ctx1); 
    570570    } 
  • src/lemon.c

    diff --git a/src/lemon.c b/src/lemon.c
    index 5dcf144..504be52 100644
    a b  
    1111#include <string.h> 
    1212#include <ctype.h> 
    1313#include <stdlib.h> 
     14#include <unistd.h> 
    1415 
    1516extern void qsort(); 
    1617extern double strtod(); 
     
    976977** If either action is a SHIFT, then it must be apx.  This 
    977978** function won't work if apx->type==REDUCE and apy->type==SHIFT. 
    978979*/ 
    979 static int resolve_conflict(apx,apy,errsym) 
     980static int resolve_conflict(apx,apy) 
    980981struct action *apx; 
    981982struct action *apy; 
    982 struct symbol *errsym;   /* The error symbol (if defined.  NULL otherwise) */ 
    983983{ 
    984984  struct symbol *spx, *spy; 
    985985  int errcnt = 0; 
     
    13261326int argc; 
    13271327char **argv; 
    13281328{ 
     1329  ( (void) argc ); // UNUSED(argc) 
    13291330  static int version = 0; 
    13301331  static int rpflag = 0; 
    13311332  static int basisflag = 0; 
     
    16511652  }else if( op[j].type==OPT_FLAG ){ 
    16521653    *((int*)op[j].arg) = v; 
    16531654  }else if( op[j].type==OPT_FFLAG ){ 
    1654     (*(void(*)())(op[j].arg))(v); 
     1655    (*(void(*)())((intptr_t)op[j].arg))(v); 
    16551656  }else{ 
    16561657    if( err ){ 
    16571658      fprintf(err,"%smissing argument on switch.\n",emsg); 
     
    17331734        *(double*)(op[j].arg) = dv; 
    17341735        break; 
    17351736      case OPT_FDBL: 
    1736         (*(void(*)())(op[j].arg))(dv); 
     1737        (*(void(*)())((intptr_t)op[j].arg))(dv); 
    17371738        break; 
    17381739      case OPT_INT: 
    17391740        *(int*)(op[j].arg) = lv; 
    17401741        break; 
    17411742      case OPT_FINT: 
    1742         (*(void(*)())(op[j].arg))((int)lv); 
     1743        (*(void(*)())((intptr_t)op[j].arg))((int)lv); 
    17431744        break; 
    17441745      case OPT_STR: 
    17451746        *(char**)(op[j].arg) = sv; 
    17461747        break; 
    17471748      case OPT_FSTR: 
    1748         (*(void(*)())(op[j].arg))(sv); 
     1749        (*(void(*)())((intptr_t)op[j].arg))(sv); 
    17491750        break; 
    17501751    } 
    17511752  } 
  • src/lempar.c

    diff --git a/src/lempar.c b/src/lempar.c
    index 9ab9075..07bb790 100644
    a b  
    210210*/ 
    211211const char *ParseTokenName(int tokenType){ 
    212212#ifndef NDEBUG 
    213   if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ 
     213  if( tokenType>0 && ((unsigned int)tokenType)<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ 
    214214    return yyTokenName[tokenType]; 
    215215  }else{ 
    216216    return "Unknown"; 
     
    335335    return YY_NO_ACTION; 
    336336  } 
    337337  i += iLookAhead; 
    338   if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ 
     338  if( i<0 || (unsigned int)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ 
    339339#ifdef YYFALLBACK 
    340340    int iFallback;            /* Fallback token */ 
    341341    if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) 
     
    378378    return YY_NO_ACTION; 
    379379  } 
    380380  i += iLookAhead; 
    381   if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ 
     381  if( i<0 || (unsigned int)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ 
    382382    return yy_default[stateno]; 
    383383  }else{ 
    384384    return yy_action[i]; 
     
    456456  yymsp = &yypParser->yystack[yypParser->yyidx]; 
    457457#ifndef NDEBUG 
    458458  if( yyTraceFILE && yyruleno>=0 
    459         && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){ 
     459        && (unsigned int) yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){ 
    460460    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt, 
    461461      yyRuleName[yyruleno]); 
    462462  } 
     
    511511  int yymajor,                   /* The major type of the error token */ 
    512512  YYMINORTYPE yyminor            /* The minor type of the error token */ 
    513513){ 
     514  ( (void) yymajor ); 
     515  ( (void) yyminor ); 
    514516  ParseARG_FETCH; 
    515517#define TOKEN (yyminor.yy0) 
    516518%% 
  • src/log.c

    diff --git a/src/log.c b/src/log.c
    index 341fc03..d1f166f 100644
    a b  
    321321                l = vsnprintf(b->ptr, b->size, fmt, ap); 
    322322                va_end(ap); 
    323323 
    324                 if (l > -1 && l < b->size) { 
     324                if (l > -1 && ((unsigned int) l) < b->size) { 
    325325                        b->used = l + 1; 
    326326 
    327327                        break; 
  • src/mod_sql_vhost_core.c

    diff --git a/src/mod_sql_vhost_core.c b/src/mod_sql_vhost_core.c
    index b9dedba..1e90929 100644
    a b  
    333333 
    334334#ifdef HAVE_GLIB_H 
    335335static gboolean cached_vhost_remove_expired(gpointer _key, gpointer _val, gpointer data) { 
    336         buffer *key       = _key; 
     336//      buffer *key       = _key; 
     337        UNUSED(_key); 
    337338        cached_vhost *val = _val; 
    338339        server *srv       = data; 
    339340 
  • src/plugin.c

    diff --git a/src/plugin.c b/src/plugin.c
    index aff2f12..0941c2c 100644
    a b  
    298298 
    299299#else 
    300300#if 1 
    301                 init = (int (*)(plugin *))dlsym(p->lib, srv->tmp_buf->ptr); 
     301                init = (int (*)(plugin *))(intptr_t)dlsym(p->lib, srv->tmp_buf->ptr); 
    302302#else 
    303303                *(void **)(&init) = dlsym(p->lib, srv->tmp_buf->ptr); 
    304304#endif 
  • src/server.c

    diff --git a/src/server.c b/src/server.c
    index 911b096..19f0ec7 100644
    a b  
    113113        switch (sig) { 
    114114        case SIGTERM:  
    115115                srv_shutdown = 1;  
    116                 memcpy(&last_sigterm_info, si, sizeof(*si)); 
     116                memcpy((siginfo_t*) &last_sigterm_info, si, sizeof(*si)); 
    117117                break; 
    118118        case SIGINT: 
    119119                if (graceful_shutdown) { 
     
    122122                        graceful_shutdown = 1; 
    123123                } 
    124124 
    125                 memcpy(&last_sigterm_info, si, sizeof(*si)); 
     125                memcpy((siginfo_t*) &last_sigterm_info, si, sizeof(*si)); 
    126126 
    127127                break; 
    128128        case SIGALRM:  
     
    130130                break; 
    131131        case SIGHUP:  
    132132                handle_sig_hup = 1;  
    133                 memcpy(&last_sighup_info, si, sizeof(*si)); 
     133                memcpy((siginfo_t*) &last_sighup_info, si, sizeof(*si)); 
    134134                break; 
    135135        case SIGCHLD:  
    136136                break; 
     
    10361036        int need_joblist_queue_thread = 0; 
    10371037        GThread **stat_cache_threads; 
    10381038        GThread **aio_write_threads = NULL; 
     1039#ifdef USE_LINUX_AIO_SENDFILE 
    10391040        GThread *linux_aio_read_thread_id = NULL; 
     1041#endif 
    10401042        GThread * joblist_queue_thread_id = NULL; 
    10411043        GError *gerr = NULL; 
    10421044#endif 
  • src/stat_cache.c

    diff --git a/src/stat_cache.c b/src/stat_cache.c
    index 9d1671b..27e6a78 100644
    a b  
    194194 
    195195#ifdef HAVE_GLIB_H 
    196196gboolean stat_cache_free_hrfunc(gpointer _key, gpointer _value, gpointer _user_data) { 
     197        UNUSED(_user_data); 
    197198        stat_cache_entry *sce = _value; 
    198199        buffer *b = _key; 
    199200 
     
    243244#ifdef HAVE_SYS_INOTIFY_H 
    244245        case STAT_CACHE_ENGINE_INOTIFY: 
    245246                return stat_cache_handle_fdevent_inotify(_srv, _fce, revent); 
     247#else 
     248        UNUSED(_fce); 
     249        UNUSED(revent); 
    246250#endif 
    247251        default: 
    248252                return HANDLER_GO_ON; 
     
    262266#endif 
    263267 
    264268static int stat_cache_entry_is_current(server *srv, stat_cache_entry *sce) { 
     269        UNUSED(srv); 
     270        UNUSED(sce); 
    265271        return 1; 
    266272} 
    267273