Fix compilation errors/warning with gcc-5.4.0 (#137)

Warning are like this:
 error: ‘delimiter’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
This commit is contained in:
geaaru
2017-08-15 08:56:22 +02:00
committed by Johan Wikman
parent 7021041804
commit 3485a32731
13 changed files with 25 additions and 25 deletions

View File

@ -215,7 +215,7 @@ public:
static MXS_FILTER_SESSION* newSession(MXS_FILTER* pInstance, MXS_SESSION* pSession) static MXS_FILTER_SESSION* newSession(MXS_FILTER* pInstance, MXS_SESSION* pSession)
{ {
FilterType* pFilter = static_cast<FilterType*>(pInstance); FilterType* pFilter = static_cast<FilterType*>(pInstance);
FilterSessionType* pFilterSession; FilterSessionType* pFilterSession = NULL;
MXS_EXCEPTION_GUARD(pFilterSession = pFilter->newSession(pSession)); MXS_EXCEPTION_GUARD(pFilterSession = pFilter->newSession(pSession));

View File

@ -2991,7 +2991,7 @@ static int32_t qc_sqlite_process_init(void)
{ {
if (this_unit.log_level != QC_LOG_NOTHING) if (this_unit.log_level != QC_LOG_NOTHING)
{ {
const char* message; const char* message = NULL;
switch (this_unit.log_level) switch (this_unit.log_level)
{ {

View File

@ -526,8 +526,8 @@ int gwbuf_compare(const GWBUF* lhs, const GWBUF* rhs)
while ((rv == 0) && (i < llen)) while ((rv == 0) && (i < llen))
{ {
uint8_t lc; uint8_t lc = 0;
uint8_t rc; uint8_t rc = 0;
ss_debug(bool rv1 = ) gwbuf_get_byte(&lhs, &loffset, &lc); ss_debug(bool rv1 = ) gwbuf_get_byte(&lhs, &loffset, &lc);
ss_debug(bool rv2 = ) gwbuf_get_byte(&rhs, &roffset, &rc); ss_debug(bool rv2 = ) gwbuf_get_byte(&rhs, &roffset, &rc);

View File

@ -37,7 +37,7 @@ int tokenize_arguments(char* argstr, char** argv)
bool escaped = false; bool escaped = false;
char *ptr, *start; char *ptr, *start;
char args[strlen(argstr) + 1]; char args[strlen(argstr) + 1];
char qc; char qc = 0;
strcpy(args, argstr); strcpy(args, argstr);
start = args; start = args;

View File

@ -751,11 +751,11 @@ static int logmanager_write_log(int priority,
size_t str_len, size_t str_len,
const char* str) const char* str)
{ {
logfile_t* lf; logfile_t* lf = NULL;
char* wp; char* wp = NULL;
int err = 0; int err = 0;
blockbuf_t* bb; blockbuf_t* bb = NULL;
blockbuf_t* bb_c; blockbuf_t* bb_c = NULL;
size_t timestamp_len; size_t timestamp_len;
int i; int i;

View File

@ -797,7 +797,7 @@ char* strnchr_esc(char* ptr, char c, int len)
char* p = (char*)ptr; char* p = (char*)ptr;
char* start = p; char* start = p;
bool quoted = false, escaped = false; bool quoted = false, escaped = false;
char qc; char qc = 0;
while (p < start + len) while (p < start + len)
{ {
@ -843,7 +843,7 @@ char* strnchr_esc_mysql(char* ptr, char c, int len)
char* p = (char*) ptr; char* p = (char*) ptr;
char* start = p, *end = start + len; char* start = p, *end = start + len;
bool quoted = false, escaped = false, backtick = false, comment = false; bool quoted = false, escaped = false, backtick = false, comment = false;
char qc; char qc = 0;
while (p < end) while (p < end)
{ {

View File

@ -1256,7 +1256,7 @@ void
dShowThreads(DCB *dcb) dShowThreads(DCB *dcb)
{ {
int i, j, n; int i, j, n;
char *state; char *state = NULL;
double avg1 = 0.0, avg5 = 0.0, avg15 = 0.0; double avg1 = 0.0, avg5 = 0.0, avg15 = 0.0;
double qavg1 = 0.0, qavg5 = 0.0, qavg15 = 0.0; double qavg1 = 0.0, qavg5 = 0.0, qavg15 = 0.0;

View File

@ -941,9 +941,9 @@ serverRowCallback(RESULTSET *set, void *data)
{ {
int *rowno = (int *)data; int *rowno = (int *)data;
int i = 0; int i = 0;
char *stat, buf[20]; char *stat = NULL, buf[20];
RESULT_ROW *row; RESULT_ROW *row = NULL;
SERVER *server; SERVER *server = NULL;
spinlock_acquire(&server_spin); spinlock_acquire(&server_spin);
server = allServers; server = allServers;

View File

@ -1210,8 +1210,8 @@ void serviceSetRetryOnFailure(SERVICE *service, char* value)
bool bool
serviceSetFilters(SERVICE *service, char *filters) serviceSetFilters(SERVICE *service, char *filters)
{ {
MXS_FILTER_DEF **flist; MXS_FILTER_DEF **flist = NULL;
char *ptr, *brkt; char *ptr = NULL, *brkt = NULL;
int n = 0; int n = 0;
bool rval = true; bool rval = true;
uint64_t capabilities = 0; uint64_t capabilities = 0;

View File

@ -957,7 +957,7 @@ int open_network_socket(enum mxs_socket_type type, struct sockaddr_storage *addr
ss_dassert(type == MXS_SOCKET_NETWORK || type == MXS_SOCKET_LISTENER); ss_dassert(type == MXS_SOCKET_NETWORK || type == MXS_SOCKET_LISTENER);
#ifdef __USE_POSIX #ifdef __USE_POSIX
struct addrinfo *ai = NULL, hint = {}; struct addrinfo *ai = NULL, hint = {};
int so, rc; int so = 0, rc = 0;
hint.ai_socktype = SOCK_STREAM; hint.ai_socktype = SOCK_STREAM;
hint.ai_family = AF_UNSPEC; hint.ai_family = AF_UNSPEC;
hint.ai_flags = AI_ALL; hint.ai_flags = AI_ALL;

View File

@ -596,11 +596,11 @@ static CACHE_RULE *cache_rule_create_simple_user(cache_rule_attribute_t attribut
const char *cvalue, const char *cvalue,
uint32_t debug) uint32_t debug)
{ {
CACHE_RULE *rule = NULL;
ss_dassert(attribute == CACHE_ATTRIBUTE_USER); ss_dassert(attribute == CACHE_ATTRIBUTE_USER);
ss_dassert((op == CACHE_OP_EQ) || (op == CACHE_OP_NEQ)); ss_dassert((op == CACHE_OP_EQ) || (op == CACHE_OP_NEQ));
CACHE_RULE *rule = NULL;
bool error = false; bool error = false;
size_t len = strlen(cvalue); size_t len = strlen(cvalue);
@ -911,7 +911,7 @@ static CACHE_RULE *cache_rule_create_simple(cache_rule_attribute_t attribute,
{ {
ss_dassert((op == CACHE_OP_EQ) || (op == CACHE_OP_NEQ)); ss_dassert((op == CACHE_OP_EQ) || (op == CACHE_OP_NEQ));
CACHE_RULE *rule; CACHE_RULE *rule = NULL;
switch (attribute) switch (attribute)
{ {
@ -1526,7 +1526,7 @@ static bool cache_rule_matches_table_regexp(CACHE_RULE *self,
bool matches = false; bool matches = false;
int n; int n;
char **names; char **names = NULL;
bool fullnames; bool fullnames;
fullnames = true; fullnames = true;
@ -1612,7 +1612,7 @@ static bool cache_rule_matches_table_simple(CACHE_RULE *self, const char *defaul
} }
int n; int n;
char **names; char **names = NULL;
names = qc_get_table_names((GWBUF*)query, &n, fullnames); names = qc_get_table_names((GWBUF*)query, &n, fullnames);

View File

@ -892,7 +892,7 @@ char* get_regex_string(char** saved)
{ {
char *start = NULL, *ptr = *saved; char *start = NULL, *ptr = *saved;
bool escaped = false, quoted = false; bool escaped = false, quoted = false;
char delimiter; char delimiter = 0;
while (*ptr != '\0') while (*ptr != '\0')
{ {
if (!escaped) if (!escaped)

View File

@ -1669,7 +1669,7 @@ static struct
static unsigned long static unsigned long
convert_arg(char *arg, int arg_type) convert_arg(char *arg, int arg_type)
{ {
unsigned long rval; unsigned long rval = 0;
switch (arg_type) switch (arg_type)
{ {