Changeset 2160

Show
Ignore:
Timestamp:
04/29/2008 11:03:26 AM (2 weeks ago)
Author:
stbuehler
Message:

Fixed many warnings (compare (un)signed, unused vars, and initialize with zero)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/lighttpd-1.4.x/src/lemon.c

    r1371 r2160  
    1212#include <ctype.h> 
    1313#include <stdlib.h> 
     14 
     15#ifdef HAVE_CONFIG_H 
     16#include "config.h" 
     17#endif 
     18 
     19#ifdef HAVE_STDINT_H 
     20# include <stdint.h> 
     21#endif 
     22#ifdef HAVE_INTTYPES_H 
     23# include <inttypes.h> 
     24#endif 
     25 
     26#define UNUSED(x) ( (void)(x) ) 
    1427 
    1528extern void qsort(); 
     
    984997  struct symbol *spx, *spy; 
    985998  int errcnt = 0; 
     999  UNUSED(errsym); 
    9861000  assert( apx->sp==apy->sp );  /* Otherwise there would be no conflict */ 
    9871001  if( apx->type==SHIFT && apy->type==REDUCE ){ 
     
    13481362  char *def_tmpl_name = "lempar.c"; 
    13491363 
     1364  UNUSED(argc); 
    13501365  OptInit(argv,options,stderr); 
    13511366  if( version ){ 
     
    16521667    *((int*)op[j].arg) = v; 
    16531668  }else if( op[j].type==OPT_FFLAG ){ 
    1654     (*(void(*)())(op[j].arg))(v); 
     1669    (*(void(*)())(intptr_t)(op[j].arg))(v); 
    16551670  }else{ 
    16561671    if( err ){ 
     
    17341749        break; 
    17351750      case OPT_FDBL: 
    1736         (*(void(*)())(op[j].arg))(dv); 
     1751        (*(void(*)())(intptr_t)(op[j].arg))(dv); 
    17371752        break; 
    17381753      case OPT_INT: 
     
    17401755        break; 
    17411756      case OPT_FINT: 
    1742         (*(void(*)())(op[j].arg))((int)lv); 
     1757        (*(void(*)())(intptr_t)(op[j].arg))((int)lv); 
    17431758        break; 
    17441759      case OPT_STR: 
     
    17461761        break; 
    17471762      case OPT_FSTR: 
    1748         (*(void(*)())(op[j].arg))(sv); 
     1763        (*(void(*)())(intptr_t)(op[j].arg))(sv); 
    17491764        break; 
    17501765    } 
     
    22872302** the appropriate data structures in the global state vector "gp". 
    22882303*/ 
     2304struct pstate ps; 
    22892305void Parse(gp) 
    22902306struct lemon *gp; 
    22912307{ 
    2292   struct pstate ps; 
    22932308  FILE *fp; 
    22942309  char *filebuf; 
  • branches/lighttpd-1.4.x/src/lempar.c

    r1371 r2160  
    211211const char *ParseTokenName(int tokenType){ 
    212212#ifndef NDEBUG 
    213   if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ 
     213  if( tokenType>0 && (size_t)tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ 
    214214    return yyTokenName[tokenType]; 
    215215  }else{ 
     
    336336  } 
    337337  i += iLookAhead; 
    338   if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ 
     338  if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ 
    339339#ifdef YYFALLBACK 
    340340    int iFallback;            /* Fallback token */ 
     
    379379  } 
    380380  i += iLookAhead; 
    381   if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ 
     381  if( i<0 || (size_t)i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ 
    382382    return yy_default[stateno]; 
    383383  }else{ 
     
    457457#ifndef NDEBUG 
    458458  if( yyTraceFILE && yyruleno>=0 
    459         && yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){ 
     459        && (size_t)yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){ 
    460460    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt, 
    461461      yyRuleName[yyruleno]); 
     
    512512  YYMINORTYPE yyminor            /* The minor type of the error token */ 
    513513){ 
     514  UNUSED(yymajor); 
     515  UNUSED(yyminor); 
    514516  ParseARG_FETCH; 
    515517#define TOKEN (yyminor.yy0) 
  • branches/lighttpd-1.4.x/src/lighttpd-angel.c

    r1981 r2160  
    2929static volatile pid_t pid = -1; 
    3030 
     31#define UNUSED(x) ( (void)(x) ) 
     32 
    3133static void sigaction_handler(int sig, siginfo_t *si, void *context) { 
    3234        int exitcode; 
    3335 
     36        UNUSED(context); 
    3437        switch (sig) { 
    3538        case SIGINT:  
     
    6063        int is_shutdown = 0; 
    6164        struct sigaction act; 
     65 
     66        UNUSED(argc); 
    6267 
    6368        /** 
  • branches/lighttpd-1.4.x/src/mod_auth.c

    r2026 r2160  
    520520handler_t auth_ldap_init(server *srv, mod_auth_plugin_config *s) { 
    521521#ifdef USE_LDAP 
    522                        int ret; 
     522        int ret; 
    523523#if 0 
    524                         if (s->auth_ldap_basedn->used == 0) { 
    525                                 log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.base-dn has to be set"); 
    526  
    527                                 return HANDLER_ERROR; 
    528                         } 
    529 #endif 
    530  
    531                         if (s->auth_ldap_filter->used) { 
    532                                 char *dollar; 
    533  
    534                                 /* parse filter */ 
    535  
    536                                 if (NULL == (dollar = strchr(s->auth_ldap_filter->ptr, '$'))) { 
    537                                         log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.filter is missing a replace-operator '$'"); 
     524        if (s->auth_ldap_basedn->used == 0) { 
     525                log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.base-dn has to be set"); 
     526 
     527                return HANDLER_ERROR; 
     528        } 
     529#endif 
     530 
     531        if (s->auth_ldap_filter->used) { 
     532                char *dollar; 
     533 
     534                /* parse filter */ 
     535 
     536                if (NULL == (dollar = strchr(s->auth_ldap_filter->ptr, '$'))) { 
     537                        log_error_write(srv, __FILE__, __LINE__, "s", "ldap: auth.backend.ldap.filter is missing a replace-operator '$'"); 
     538 
     539                        return HANDLER_ERROR; 
     540                } 
     541 
     542                buffer_copy_string_len(s->ldap_filter_pre, s->auth_ldap_filter->ptr, dollar - s->auth_ldap_filter->ptr); 
     543                buffer_copy_string(s->ldap_filter_post, dollar+1); 
     544        } 
     545 
     546        if (s->auth_ldap_hostname->used) { 
     547                if (NULL == (s->ldap = ldap_init(s->auth_ldap_hostname->ptr, LDAP_PORT))) { 
     548                        log_error_write(srv, __FILE__, __LINE__, "ss", "ldap ...", strerror(errno)); 
     549 
     550                        return HANDLER_ERROR; 
     551                } 
     552 
     553                ret = LDAP_VERSION3; 
     554                if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(s->ldap, LDAP_OPT_PROTOCOL_VERSION, &ret))) { 
     555                        log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret)); 
     556 
     557                        return HANDLER_ERROR; 
     558                } 
     559 
     560                if (s->auth_ldap_starttls) { 
     561                        /* if no CA file is given, it is ok, as we will use encryption 
     562                                * if the server requires a CAfile it will tell us */ 
     563                        if (!buffer_is_empty(s->auth_ldap_cafile)) { 
     564                                if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, 
     565                                                                s->auth_ldap_cafile->ptr))) { 
     566                                        log_error_write(srv, __FILE__, __LINE__, "ss", 
     567                                                        "Loading CA certificate failed:", ldap_err2string(ret)); 
    538568 
    539569                                        return HANDLER_ERROR; 
    540570                                } 
    541  
    542                                 buffer_copy_string_len(s->ldap_filter_pre, s->auth_ldap_filter->ptr, dollar - s->auth_ldap_filter->ptr); 
    543                                 buffer_copy_string(s->ldap_filter_post, dollar+1); 
    544                         } 
    545  
    546                         if (s->auth_ldap_hostname->used) { 
    547                                 if (NULL == (s->ldap = ldap_init(s->auth_ldap_hostname->ptr, LDAP_PORT))) { 
    548                                         log_error_write(srv, __FILE__, __LINE__, "ss", "ldap ...", strerror(errno)); 
    549  
    550                                         return HANDLER_ERROR; 
    551                                 } 
    552  
    553                                 ret = LDAP_VERSION3; 
    554                                 if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(s->ldap, LDAP_OPT_PROTOCOL_VERSION, &ret))) { 
    555                                         log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret)); 
    556  
    557                                         return HANDLER_ERROR; 
    558                                 } 
    559  
    560                                 if (s->auth_ldap_starttls) { 
    561                                         /* if no CA file is given, it is ok, as we will use encryption 
    562                                          * if the server requires a CAfile it will tell us */ 
    563                                         if (!buffer_is_empty(s->auth_ldap_cafile)) { 
    564                                                 if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, 
    565                                                                                 s->auth_ldap_cafile->ptr))) { 
    566                                                         log_error_write(srv, __FILE__, __LINE__, "ss", 
    567                                                                         "Loading CA certificate failed:", ldap_err2string(ret)); 
    568  
    569                                                         return HANDLER_ERROR; 
    570                                                 } 
    571                                         } 
    572  
    573                                         if (LDAP_OPT_SUCCESS != (ret = ldap_start_tls_s(s->ldap, NULL,  NULL))) { 
    574                                                 log_error_write(srv, __FILE__, __LINE__, "ss", "ldap startTLS failed:", ldap_err2string(ret)); 
    575  
    576                                                 return HANDLER_ERROR; 
    577                                         } 
    578                                 } 
    579  
    580  
    581                                 /* 1. */ 
    582                                 if (s->auth_ldap_binddn->used) { 
    583                                         if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, s->auth_ldap_binddn->ptr, s->auth_ldap_bindpw->ptr))) { 
    584                                                 log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret)); 
    585  
    586                                                 return HANDLER_ERROR; 
    587                                         } 
    588                                 } else { 
    589                                         if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, NULL, NULL))) { 
    590                                                 log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret)); 
    591  
    592                                                 return HANDLER_ERROR; 
    593                                         } 
    594                                 } 
    595                         } 
     571                        } 
     572 
     573                        if (LDAP_OPT_SUCCESS != (ret = ldap_start_tls_s(s->ldap, NULL,  NULL))) { 
     574                                log_error_write(srv, __FILE__, __LINE__, "ss", "ldap startTLS failed:", ldap_err2string(ret)); 
     575 
     576                                return HANDLER_ERROR; 
     577                        } 
     578                } 
     579 
     580 
     581                /* 1. */ 
     582                if (s->auth_ldap_binddn->used) { 
     583                        if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, s->auth_ldap_binddn->ptr, s->auth_ldap_bindpw->ptr))) { 
     584                                log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret)); 
     585 
     586                                return HANDLER_ERROR; 
     587                        } 
     588                } else { 
     589                        if (LDAP_SUCCESS != (ret = ldap_simple_bind_s(s->ldap, NULL, NULL))) { 
     590                                log_error_write(srv, __FILE__, __LINE__, "ss", "ldap:", ldap_err2string(ret)); 
     591 
     592                                return HANDLER_ERROR; 
     593                        } 
     594                } 
     595        } 
     596        return HANDLER_GO_ON; 
    596597#else 
    597                        log_error_write(srv, __FILE__, __LINE__, "s", "no ldap support available"); 
    598                        return HANDLER_ERROR
    599 #endif 
    600                 return HANDLER_GO_ON; 
     598        UNUSED(s); 
     599        log_error_write(srv, __FILE__, __LINE__, "s", "no ldap support available")
     600        return HANDLER_ERROR; 
     601#endif 
    601602} 
    602603 
  • branches/lighttpd-1.4.x/src/mod_webdav.c

    r1882 r2160  
    11551155 
    11561156#ifdef USE_LOCKS 
     1157        UNUSED(srv); 
    11571158        data_string *ds; 
    11581159 
     
    11931194                } 
    11941195        } 
     1196#else 
     1197        UNUSED(srv); 
     1198        UNUSED(con); 
     1199        UNUSED(p); 
     1200        UNUSED(uri); 
    11951201#endif 
    11961202 
  • branches/lighttpd-1.4.x/src/plugin.c

    r1387 r2160  
    198198#else 
    199199#if 1 
    200                 init = (int (*)(plugin *))dlsym(p->lib, srv->tmp_buf->ptr); 
     200                init = (int (*)(plugin *))(intptr_t)dlsym(p->lib, srv->tmp_buf->ptr); 
    201201#else 
    202202                *(void **)(&init) = dlsym(p->lib, srv->tmp_buf->ptr);