mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-08 14:41:55 +00:00
stricter compiler flags
This commit is contained in:
@@ -216,7 +216,7 @@ static void *http_request(void *u_h_r)
|
||||
uwsgi_error("read()");
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < len; i++) {
|
||||
for (i = 0; i < (int) len; i++) {
|
||||
|
||||
if (buf[i] == ' ') {
|
||||
|
||||
@@ -328,7 +328,7 @@ static void *http_request(void *u_h_r)
|
||||
write(uwsgi_fd, uwsgipkt, ulen + 4);
|
||||
|
||||
if (http_body_len > 0) {
|
||||
if (http_body_len >= len - (i + 1)) {
|
||||
if (http_body_len >= (int) len - (i + 1)) {
|
||||
write(uwsgi_fd, buf + i + 1, len - (i + 1));
|
||||
http_body_len -= len - (i + 1);
|
||||
} else {
|
||||
|
||||
@@ -136,7 +136,7 @@ clear:
|
||||
}
|
||||
if (wsgi_req->async_post && !wsgi_req->fd_closed) {
|
||||
fclose(wsgi_req->async_post);
|
||||
if (!uwsgi->post_buffering || wsgi_req->post_cl <= uwsgi->post_buffering) {
|
||||
if (!uwsgi->post_buffering || wsgi_req->post_cl <= (size_t) uwsgi->post_buffering) {
|
||||
wsgi_req->fd_closed = 1 ;
|
||||
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ void manage_snmp(int fd, uint8_t * buffer, int size, struct sockaddr_in *client_
|
||||
|
||||
uint8_t community_len;
|
||||
|
||||
uint64_t snmp_int;
|
||||
uint64_t request_id;
|
||||
uint64_t version;
|
||||
uint64_t snmp_int = 0;
|
||||
uint64_t request_id = 0;
|
||||
uint64_t version = 0;
|
||||
|
||||
|
||||
// KISS for memory management
|
||||
@@ -122,9 +122,7 @@ void manage_snmp(int fd, uint8_t * buffer, int size, struct sockaddr_in *client_
|
||||
return;
|
||||
ptr++;
|
||||
|
||||
uwsgi_log("oops %p\n", ptr);
|
||||
ptrdelta = get_snmp_integer(ptr, &request_id);
|
||||
uwsgi_log("oops %p\n", ptr);
|
||||
|
||||
|
||||
if (ptrdelta <= 0)
|
||||
@@ -139,16 +137,15 @@ uwsgi_log("oops %p\n", ptr);
|
||||
return;
|
||||
ptr += ptrdelta;
|
||||
|
||||
uwsgi_log("oops %d %p\n", ptrdelta, ptr);
|
||||
|
||||
// get error
|
||||
if (*ptr != SNMP_INTEGER)
|
||||
return;
|
||||
|
||||
uwsgi_log("oops 2\n");
|
||||
|
||||
ptr++;
|
||||
snmp_int = 0;
|
||||
ptrdelta = get_snmp_integer(ptr, &snmp_int);
|
||||
|
||||
if (ptrdelta <= 0)
|
||||
return;
|
||||
if (ptr + ptrdelta >= buffer + size)
|
||||
@@ -156,15 +153,13 @@ uwsgi_log("oops 2\n");
|
||||
if (snmp_int != 0)
|
||||
return;
|
||||
|
||||
#ifdef UWSGI_DEBUG
|
||||
uwsgi_debug("SNMP int [0]: %d\n", snmp_int);
|
||||
#endif
|
||||
ptr += ptrdelta;
|
||||
|
||||
// get index
|
||||
if (*ptr != SNMP_INTEGER)
|
||||
return;
|
||||
ptr++;
|
||||
snmp_int = 0;
|
||||
ptrdelta = get_snmp_integer(ptr, &snmp_int);
|
||||
if (ptrdelta <= 0)
|
||||
return;
|
||||
@@ -283,13 +278,15 @@ static int get_snmp_integer(uint8_t * ptr, uint64_t * val) {
|
||||
uint16_t tlen;
|
||||
int i, j;
|
||||
|
||||
uint8_t *cval = (uint8_t *) val;
|
||||
|
||||
tlen = *ptr;
|
||||
|
||||
if (tlen > 4)
|
||||
return -1;
|
||||
|
||||
#ifdef UWSGI_DEBUG
|
||||
uwsgi_debug("SNMP get integer TLEN %d\n", tlen);
|
||||
uwsgi_debug("SNMP get integer TLEN %d %p\n", tlen, ptr);
|
||||
#endif
|
||||
|
||||
j = 0;
|
||||
@@ -297,19 +294,11 @@ static int get_snmp_integer(uint8_t * ptr, uint64_t * val) {
|
||||
for (i = 0; i < tlen; i++) {
|
||||
#else
|
||||
for (i = tlen - 1; i >= 0; i--) {
|
||||
#ifdef UWSGI_DEBUG
|
||||
uwsgi_debug("SNMP get integer iter %d %p\n", i, ptr);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
val[j] = ptr[1 + i];
|
||||
cval[j] = ptr[1 + i];
|
||||
j++;
|
||||
}
|
||||
|
||||
#ifdef UWSGI_DEBUG
|
||||
uwsgi_debug("SNMP get integer iter %d %p\n", i, ptr);
|
||||
#endif
|
||||
|
||||
return tlen + 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -422,7 +422,7 @@ void env_to_arg(char *src, char *dst) {
|
||||
int i;
|
||||
int val = 0 ;
|
||||
|
||||
for(i=0;i<strlen(src);i++) {
|
||||
for(i=0;i< (int) strlen(src);i++) {
|
||||
if (src[i] == '=') {
|
||||
val = 1 ;
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ int find_worker_id(pid_t pid) {
|
||||
|
||||
|
||||
PyMethodDef null_methods[] = {
|
||||
{NULL, NULL},
|
||||
{ NULL, NULL},
|
||||
};
|
||||
|
||||
struct uwsgi_app *wi;
|
||||
@@ -738,9 +738,9 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
|
||||
if (uwsgi.async > 1) {
|
||||
if (!getrlimit(RLIMIT_NOFILE, &uwsgi.rl)) {
|
||||
if (uwsgi.rl.rlim_cur < uwsgi.async) {
|
||||
if ( (unsigned long) uwsgi.rl.rlim_cur < (unsigned long) uwsgi.async) {
|
||||
uwsgi_log("- your current max open files limit is %lu, this is lower than requested async cores !!! -\n", (unsigned long) uwsgi.rl.rlim_cur);
|
||||
if (uwsgi.rl.rlim_cur < uwsgi.rl.rlim_max && uwsgi.rl.rlim_max > uwsgi.async) {
|
||||
if (uwsgi.rl.rlim_cur < uwsgi.rl.rlim_max && (unsigned long) uwsgi.rl.rlim_max > (unsigned long) uwsgi.async) {
|
||||
unsigned long tmp_nofile = (unsigned long) uwsgi.rl.rlim_cur ;
|
||||
uwsgi.rl.rlim_cur = uwsgi.async;
|
||||
if (!setrlimit(RLIMIT_NOFILE, &uwsgi.rl)) {
|
||||
@@ -2609,7 +2609,6 @@ void init_uwsgi_embedded_module() {
|
||||
PyObject *new_uwsgi_module, *zero;
|
||||
int i;
|
||||
|
||||
|
||||
/* initialize for stats */
|
||||
uwsgi.workers_tuple = PyTuple_New(uwsgi.numproc);
|
||||
for (i = 0; i < uwsgi.numproc; i++) {
|
||||
@@ -2740,7 +2739,7 @@ void init_uwsgi_embedded_module() {
|
||||
#endif
|
||||
|
||||
#ifdef UWSGI_PROXY
|
||||
pid_t proxy_start(has_master) {
|
||||
pid_t proxy_start(int has_master) {
|
||||
|
||||
pid_t pid;
|
||||
|
||||
|
||||
+1
-1
@@ -258,7 +258,7 @@ PyObject *py_uwsgi_sharedarea_write(PyObject * self, PyObject * args) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pos + strlen(value) >= uwsgi.page_size * uwsgi.sharedareasize) {
|
||||
if (pos + (int) strlen(value) >= uwsgi.page_size * uwsgi.sharedareasize) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ gcc_list = ['utils', 'pyutils', 'protocol', 'socket', 'logging', 'wsgi_handlers'
|
||||
|
||||
# large file support
|
||||
try:
|
||||
cflags = ['-Wall', '-Werror', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64'] + os.environ.get("CFLAGS", "").split()
|
||||
cflags = ['-Wall', '-Werror', '-Wextra', '-Wno-unused-parameter', '-Wno-missing-field-initializers', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64'] + os.environ.get("CFLAGS", "").split()
|
||||
except:
|
||||
print("You need python headers to build uWSGI.")
|
||||
sys.exit(1)
|
||||
|
||||
+3
-3
@@ -251,7 +251,7 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req
|
||||
// set wsgi vars
|
||||
|
||||
|
||||
if (uwsgi->post_buffering > 0 && wsgi_req->post_cl > uwsgi->post_buffering) {
|
||||
if (uwsgi->post_buffering > 0 && wsgi_req->post_cl > (size_t) uwsgi->post_buffering) {
|
||||
wsgi_req->async_post = tmpfile();
|
||||
if (!wsgi_req->async_post) {
|
||||
uwsgi_error("tmpfile()");
|
||||
@@ -264,7 +264,7 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req
|
||||
if (uwsgi->shared->options[UWSGI_OPTION_HARAKIRI] > 0) {
|
||||
inc_harakiri(uwsgi->shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
}
|
||||
if (post_remains > uwsgi->post_buffering_bufsize) {
|
||||
if (post_remains > (size_t) uwsgi->post_buffering_bufsize) {
|
||||
post_chunk = read(wsgi_req->poll.fd, wsgi_req->post_buffering_buf, uwsgi->post_buffering_bufsize);
|
||||
}
|
||||
else {
|
||||
@@ -274,7 +274,7 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req
|
||||
uwsgi_error("read()");
|
||||
goto clear;
|
||||
}
|
||||
if (fwrite(wsgi_req->post_buffering_buf, post_chunk, 1, wsgi_req->async_post) <0) {
|
||||
if (!fwrite(wsgi_req->post_buffering_buf, post_chunk, 1, wsgi_req->async_post)) {
|
||||
uwsgi_error("fwrite()");
|
||||
goto clear;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user