remove warnings if compile with -W, use ENABLE_FEATURE vs CONFIG_FEATURE

This commit is contained in:
"Vladimir N. Oleynik" 2005-12-02 09:46:04 +00:00
parent 4a070d1460
commit 27d42a08c8

View File

@ -326,7 +326,7 @@ typedef struct
} HttpEnumString; } HttpEnumString;
static const HttpEnumString httpResponseNames[] = { static const HttpEnumString httpResponseNames[] = {
{ HTTP_OK, "OK" }, { HTTP_OK, "OK", NULL },
{ HTTP_MOVED_TEMPORARILY, "Found", "Directories must end with a slash." }, { HTTP_MOVED_TEMPORARILY, "Found", "Directories must end with a slash." },
{ HTTP_REQUEST_TIMEOUT, "Request Timeout", { HTTP_REQUEST_TIMEOUT, "Request Timeout",
"No request appeared within a reasonable time period." }, "No request appeared within a reasonable time period." },
@ -673,7 +673,7 @@ static void parse_conf(const char *path, int flag)
} else { } else {
/* sort path, if current lenght eq or bigger then move up */ /* sort path, if current lenght eq or bigger then move up */
Htaccess *prev_hti = config->auth; Htaccess *prev_hti = config->auth;
int l = strlen(cf); size_t l = strlen(cf);
Htaccess *hti; Htaccess *hti;
for(hti = prev_hti; hti; hti = hti->next) { for(hti = prev_hti; hti; hti = hti->next) {
@ -852,7 +852,7 @@ static void addEnvPort(const char *port_name)
static void decodeBase64(char *Data) static void decodeBase64(char *Data)
{ {
const unsigned char *in = Data; const unsigned char *in = (const unsigned char *)Data;
// The decoded size will be at most 3/4 the size of the encoded // The decoded size will be at most 3/4 the size of the encoded
unsigned long ch = 0; unsigned long ch = 0;
int i = 0; int i = 0;
@ -1268,7 +1268,7 @@ static int sendCgi(const char *url,
post_readed_size = post_readed_idx = bodyLen = 0; /* broken pipe to CGI */ post_readed_size = post_readed_idx = bodyLen = 0; /* broken pipe to CGI */
} }
} else if(bodyLen > 0 && post_readed_size == 0 && FD_ISSET(a_c_r, &readSet)) { } else if(bodyLen > 0 && post_readed_size == 0 && FD_ISSET(a_c_r, &readSet)) {
count = bodyLen > sizeof(wbuf) ? sizeof(wbuf) : bodyLen; count = bodyLen > (int)sizeof(wbuf) ? (int)sizeof(wbuf) : bodyLen;
count = safe_read(a_c_r, wbuf, count); count = safe_read(a_c_r, wbuf, count);
if(count > 0) { if(count > 0) {
post_readed_size += count; post_readed_size += count;
@ -1456,7 +1456,7 @@ static int checkPerm(const char *path, const char *request)
fprintf(stderr,"checkPerm: '%s' ? '%s'\n", p0, request); fprintf(stderr,"checkPerm: '%s' ? '%s'\n", p0, request);
#endif #endif
{ {
int l = strlen(p0); size_t l = strlen(p0);
if(strncmp(p0, path, l) == 0 && if(strncmp(p0, path, l) == 0 &&
(l == 1 || path[l] == '/' || path[l] == 0)) { (l == 1 || path[l] == '/' || path[l] == 0)) {
@ -1664,9 +1664,13 @@ BAD_REQUEST:
} }
*test = '/'; *test = '/';
} }
if(blank >= 0) {
// read until blank line for HTTP version specified, else parse immediate // read until blank line for HTTP version specified, else parse immediate
while (blank >= 0 && alarm(TIMEOUT) >= 0 && (count = getLine()) > 0) { while(1) {
alarm(TIMEOUT);
count = getLine();
if(count <= 0)
break;
#ifdef DEBUG #ifdef DEBUG
if (config->debugHttpd) fprintf(stderr, "Header: '%s'\n", buf); if (config->debugHttpd) fprintf(stderr, "Header: '%s'\n", buf);
@ -1710,7 +1714,7 @@ BAD_REQUEST:
#endif /* CONFIG_FEATURE_HTTPD_BASIC_AUTH */ #endif /* CONFIG_FEATURE_HTTPD_BASIC_AUTH */
} /* while extra header reading */ } /* while extra header reading */
}
(void) alarm( 0 ); (void) alarm( 0 );
if(config->alarm_signaled) if(config->alarm_signaled)
break; break;
@ -1927,38 +1931,36 @@ static void sighup_handler(int sig)
static const char httpd_opts[]="c:d:h:" static const char httpd_opts[]="c:d:h:"
#ifdef CONFIG_FEATURE_HTTPD_ENCODE_URL_STR #ifdef CONFIG_FEATURE_HTTPD_ENCODE_URL_STR
"e:" "e:"
#define OPT_INC_1 1
#else
#define OPT_INC_1 0
#endif #endif
#define OPT_INC_1 ENABLE_FEATURE_HTTPD_ENCODE_URL_STR
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
"r:" "r:"
# ifdef CONFIG_FEATURE_HTTPD_AUTH_MD5 #endif
#define OPT_INC_2 ENABLE_FEATURE_HTTPD_BASIC_AUTH
#ifdef CONFIG_FEATURE_HTTPD_AUTH_MD5
"m:" "m:"
# define OPT_INC_2 2
# else
# define OPT_INC_2 1
#endif
#else
#define OPT_INC_2 0
#endif #endif
#define OPT_INC_3 ENABLE_FEATURE_HTTPD_AUTH_MD5
#ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY #ifndef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
"p:v" "p:v"
#endif
#ifdef CONFIG_FEATURE_HTTPD_SETUID #ifdef CONFIG_FEATURE_HTTPD_SETUID
"u:" "u:"
#endif #endif
#endif /* CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY */
; ;
#define OPT_CONFIG_FILE (1<<0) #define OPT_CONFIG_FILE (1<<0) /* c */
#define OPT_DECODE_URL (1<<1) #define OPT_DECODE_URL (1<<1) /* d */
#define OPT_HOME_HTTPD (1<<2) #define OPT_HOME_HTTPD (1<<2) /* h */
#define OPT_ENCODE_URL (1<<(2+OPT_INC_1)) #define OPT_ENCODE_URL (1<<(2+OPT_INC_1)) /* e */
#define OPT_REALM (1<<(3+OPT_INC_1)) #define OPT_REALM (1<<(2+OPT_INC_1+OPT_INC_2)) /* r */
#define OPT_MD5 (1<<(4+OPT_INC_1)) #define OPT_MD5 (1<<(2+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* m */
#define OPT_PORT (1<<(3+OPT_INC_1+OPT_INC_2)) #define OPT_PORT (1<<(3+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* p */
#define OPT_DEBUG (1<<(4+OPT_INC_1+OPT_INC_2)) #define OPT_DEBUG (1<<(4+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* v */
#define OPT_SETUID (1<<(5+OPT_INC_1+OPT_INC_2)) #define OPT_SETUID (1<<(5+OPT_INC_1+OPT_INC_2+OPT_INC_3)) /* u */
#ifdef HTTPD_STANDALONE #ifdef HTTPD_STANDALONE