Merge pull request #72 from hholzgra/hartmut-warnings-2nd

"Hartmut warnings 2nd" merged.
This commit is contained in:
markus456
2015-02-15 20:26:09 +02:00
9 changed files with 23 additions and 17 deletions

View File

@ -40,8 +40,8 @@ configure_file(${CMAKE_SOURCE_DIR}/server/test/maxscale_test.h.in ${CMAKE_BINARY
configure_file(${CMAKE_SOURCE_DIR}/etc/postinst.in ${CMAKE_BINARY_DIR}/postinst) configure_file(${CMAKE_SOURCE_DIR}/etc/postinst.in ${CMAKE_BINARY_DIR}/postinst)
configure_file(${CMAKE_SOURCE_DIR}/etc/postrm.in ${CMAKE_BINARY_DIR}/postrm) configure_file(${CMAKE_SOURCE_DIR}/etc/postrm.in ${CMAKE_BINARY_DIR}/postrm)
set(CMAKE_C_FLAGS "-Wall -fPIC") set(CMAKE_C_FLAGS "-Wall -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function -fPIC")
set(CMAKE_CXX_FLAGS "-Wall -fPIC") set(CMAKE_CXX_FLAGS "-Wall -Wno-unused-variable -Wno-unused-but-set-variable -fPIC")
set(DEBUG_FLAGS "-ggdb -pthread -pipe -Wformat -fstack-protector --param=ssp-buffer-size=4") set(DEBUG_FLAGS "-ggdb -pthread -pipe -Wformat -fstack-protector --param=ssp-buffer-size=4")
if(CMAKE_VERSION VERSION_GREATER 2.6) if(CMAKE_VERSION VERSION_GREATER 2.6)

View File

@ -167,7 +167,7 @@ struct logfile_st {
size_t lf_file_size; size_t lf_file_size;
/** list of block-sized log buffers */ /** list of block-sized log buffers */
mlist_t lf_blockbuf_list; mlist_t lf_blockbuf_list;
int lf_buf_size; size_t lf_buf_size;
bool lf_flushflag; bool lf_flushflag;
bool lf_rotateflag; bool lf_rotateflag;
int lf_spinlock; /**< lf_flushflag & lf_rotateflag */ int lf_spinlock; /**< lf_flushflag & lf_rotateflag */
@ -633,7 +633,7 @@ static int logmanager_write_log(
int err = 0; int err = 0;
blockbuf_t* bb; blockbuf_t* bb;
blockbuf_t* bb_c; blockbuf_t* bb_c;
int timestamp_len; size_t timestamp_len;
int i; int i;
CHK_LOGMANAGER(lm); CHK_LOGMANAGER(lm);
@ -680,9 +680,9 @@ static int logmanager_write_log(
else else
{ {
/** Length of string that will be written, limited by bufsize */ /** Length of string that will be written, limited by bufsize */
int safe_str_len; size_t safe_str_len;
/** Length of session id */ /** Length of session id */
int sesid_str_len; size_t sesid_str_len;
/** /**
* 2 braces, 2 spaces and terminating char * 2 braces, 2 spaces and terminating char

View File

@ -1253,7 +1253,7 @@ char* skygw_get_affected_fields(GWBUF* buf)
List_iterator<Item> ilist(lex->current_select->item_list); List_iterator<Item> ilist(lex->current_select->item_list);
item = (Item*)ilist.next(); item = (Item*)ilist.next();
for (item; item != NULL; item=(Item*)ilist.next()) for (; item != NULL; item=(Item*)ilist.next())
{ {
itype = item->type(); itype = item->type();

View File

@ -1039,6 +1039,7 @@ int main(int argc, char **argv)
int l; int l;
int i; int i;
int n; int n;
intptr_t thread_id;
int n_threads; /*< number of epoll listener threads */ int n_threads; /*< number of epoll listener threads */
int n_services; int n_services;
int eno = 0; /*< local variable for errno */ int eno = 0; /*< local variable for errno */
@ -1788,9 +1789,9 @@ int main(int argc, char **argv)
/*< /*<
* Start server threads. * Start server threads.
*/ */
for (n = 0; n < n_threads - 1; n++) for (thread_id = 0; thread_id < n_threads - 1; thread_id++)
{ {
threads[n] = thread_start(poll_waitevents, (void *)(n + 1)); threads[thread_id] = thread_start(poll_waitevents, (void *)(thread_id + 1));
} }
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE, LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
"MaxScale started with %d server threads.", "MaxScale started with %d server threads.",
@ -1803,9 +1804,9 @@ int main(int argc, char **argv)
/*< /*<
* Wait server threads' completion. * Wait server threads' completion.
*/ */
for (n = 0; n < n_threads - 1; n++) for (thread_id = 0; thread_id < n_threads - 1; thread_id++)
{ {
thread_wait(threads[n]); thread_wait(threads[thread_id]);
} }
/*< /*<
* Wait the flush thread. * Wait the flush thread.

View File

@ -30,7 +30,7 @@
#include <stdio.h> #include <stdio.h>
#include <secrets.h> #include <secrets.h>
main(int argc, char **argv) int main(int argc, char **argv)
{ {
if (argc != 2) if (argc != 2)
{ {

View File

@ -28,10 +28,12 @@
* @endverbatim * @endverbatim
*/ */
#include <memlog.h> #include <memlog.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
static MEMLOG *memlogs = NULL; static MEMLOG *memlogs = NULL;
static SPINLOCK *memlock = SPINLOCK_INIT; static SPINLOCK memlock = SPINLOCK_INIT;
/** /**
* Create a new instance of a memory logger. * Create a new instance of a memory logger.

View File

@ -237,7 +237,7 @@ char *
modutil_get_SQL(GWBUF *buf) modutil_get_SQL(GWBUF *buf)
{ {
unsigned int len, length; unsigned int len, length;
unsigned char *ptr, *dptr, *rval = NULL; char *ptr, *dptr, *rval = NULL;
if (!modutil_is_SQL(buf)) if (!modutil_is_SQL(buf))
return rval; return rval;

View File

@ -438,7 +438,7 @@ poll_waitevents(void *arg)
{ {
struct epoll_event events[MAX_EVENTS]; struct epoll_event events[MAX_EVENTS];
int i, nfds, timeout_bias = 1; int i, nfds, timeout_bias = 1;
int thread_id = (int)arg; intptr_t thread_id = (intptr_t)arg;
DCB *zombies = NULL; DCB *zombies = NULL;
int poll_spins = 0; int poll_spins = 0;

View File

@ -488,8 +488,11 @@ char *ptr;
} }
static int static int
cmp_topn(TOPNQ **a, TOPNQ **b) cmp_topn(const void *va, const void *vb)
{ {
TOPNQ **a = (TOPNQ **)va;
TOPNQ **b = (TOPNQ **)vb;
if ((*b)->duration.tv_sec == (*a)->duration.tv_sec) if ((*b)->duration.tv_sec == (*a)->duration.tv_sec)
return (*b)->duration.tv_usec - (*a)->duration.tv_usec; return (*b)->duration.tv_usec - (*a)->duration.tv_usec;
return (*b)->duration.tv_sec - (*a)->duration.tv_sec; return (*b)->duration.tv_sec - (*a)->duration.tv_sec;