Commit 40398f36 authored by Alexander Barkov's avatar Alexander Barkov

Fixing some of the compilation warnings.

parent 8cfa84ca
......@@ -39,7 +39,7 @@ add_definitions( -DHUGE_SUPPORT -DZIP_SUPPORT )
#
IF(UNIX)
if(WITH_WARNINGS)
add_definitions(-Wall -Wfatal-errors -Wextra)
add_definitions(-Wall -Wfatal-errors -Wextra -Wmissing-declarations)
message(STATUS "CONNECT: GCC: All warnings enabled")
else()
add_definitions(--no-warnings)
......
......@@ -46,8 +46,6 @@
#include "filamap.h"
#include "tabdos.h"
bool PushWarning(PGLOBAL, PTDBASE);
/* --------------------------- Class MAPFAM -------------------------- */
/***********************************************************************/
......
......@@ -70,7 +70,6 @@
/****************************************************************************/
PQRYRES PlgAllocResult(PGLOBAL, int, int, int, int *, int *,
unsigned int *, bool blank = true, bool nonull = false);
bool PushWarning(PGLOBAL, PTDBASE);
extern "C" int trace; // The general trace value
......
......@@ -52,7 +52,6 @@
#endif
extern int num_read, num_there, num_eq[2]; // Statistics
bool PushWarning(PGLOBAL g, PTDBASE tdbp);
/* --------------------------- Class FIXFAM -------------------------- */
......
......@@ -58,8 +58,6 @@
extern int num_read, num_there, num_eq[2]; // Statistics
extern "C" int trace;
bool PushWarning(PGLOBAL g, PTDBASE tdbp);
/* --------------------------- Class TXTFAM -------------------------- */
/***********************************************************************/
......
......@@ -92,7 +92,6 @@ typedef struct _vecheader {
/***********************************************************************/
PVBLK AllocValBlock(PGLOBAL, void *, int, int, int, int,
bool check = true, bool blank = true);
bool PushWarning(PGLOBAL, PTDBASE);
/* -------------------------- Class VCTFAM --------------------------- */
......
......@@ -62,7 +62,6 @@
/* DB static variables. */
/***********************************************************************/
extern int num_read, num_there, num_eq[]; // Statistics
bool PushWarning(PGLOBAL g, PTDBASE tdbp);
/* ------------------------------------------------------------------- */
......
......@@ -160,14 +160,13 @@ PQRYRES CSVColumns(PGLOBAL g, char *fn, char sep, char q, int hdr, int mxr);
PQRYRES MyODBCCols(PGLOBAL g, char *tab, char *dsn);
#endif // ODBC_SUPPORT
#if defined(MYSQL_SUPPORT)
PQRYRES MyColumns(PGLOBAL g, char *host, char *db, char *user, char *pwd,
char *table, char *colpat, int port, bool key);
#include "tabmysql.h"
#endif // MYSQL_SUPPORT
enum enum_field_types PLGtoMYSQL(int type, bool gdf);
#if defined(WIN32)
PQRYRES WMIColumns(PGLOBAL g, char *nsp, char *classname, PWMIUT wp= NULL);
#endif // WIN32
char GetTypeID(char *type);
bool check_string_char_length(LEX_STRING *str, const char *err_msg,
uint max_char_length, CHARSET_INFO *cs,
bool no_error);
......@@ -630,7 +629,9 @@ PGLOBAL ha_connect::GetPlug(THD *thd)
/****************************************************************************/
/* Return the value of an option specified in the option list. */
/****************************************************************************/
char *ha_connect::GetListOption(char *opname, const char *oplist, char *def)
char *ha_connect::GetListOption(const char *opname,
const char *oplist,
const char *def)
{
char key[16], val[256];
char *pk, *pv, *pn;
......@@ -1382,7 +1383,7 @@ int ha_connect::MakeRecord(char *buf)
if (xtrace > 1)
#if defined(MARIADB)
printf("Maps: read=%p write=%p vcol=%p defr=%p defw=%p\n",
printf("Maps: read=%08X write=%08X vcol=%08X defr=%08X defw=%08X\n",
*table->read_set->bitmap, *table->write_set->bitmap,
*table->vcol_set->bitmap,
*table->def_read_set.bitmap, *table->def_write_set.bitmap);
......@@ -1577,9 +1578,9 @@ int ha_connect::CheckRecord(PGLOBAL g, const uchar *oldbuf, uchar *newbuf)
/***********************************************************************/
/* Return the string representing an operator. */
/***********************************************************************/
char *ha_connect::GetValStr(OPVAL vop, bool neg)
const char *ha_connect::GetValStr(OPVAL vop, bool neg)
{
char *val;
const char *val;
switch (vop) {
case OP_EQ:
......@@ -3171,7 +3172,6 @@ bool ha_connect::add_fields(THD *thd, void *alt_info,
engine_option_value *create_options)
{
register Create_field *new_field;
LEX *lex= thd->lex;
Alter_info *alter_info= (Alter_info*)alt_info;
Virtual_column_info *vcol_info= (Virtual_column_info *)vcolinfo;
......@@ -3271,14 +3271,16 @@ bool ha_connect::add_fields(THD *thd, void *alt_info,
*/
bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
{
char ttp= '?', spc= ',', qch= 0, *typn= "DOS";
char *fn, *dsn, *tab, *db, *host, *user, *pwd, *prt, *sep, *inf;
char ttp= '?', spc= ',', qch= 0;
const char *typn= "DOS";
const char *user;
char *host, *db, *pwd, *tab, *dsn;
char *fn, *prt, *sep, *inf;
#if defined(WIN32)
char *nsp= NULL, *cls= NULL;
#endif // WIN32
int port= MYSQL_PORT, hdr= 0, mxr= 0;
bool b= false, ok= false, info= false;
LEX *lex= thd->lex;
LEX_STRING *comment, *name;
HA_CREATE_INFO *create_info= (HA_CREATE_INFO *)crt_info;
engine_option_value *pov;
......@@ -3286,7 +3288,8 @@ bool ha_connect::pre_create(THD *thd, void *crt_info, void *alt_info)
PCOLRES crp;
PGLOBAL g= GetPlug(thd);
fn= dsn= tab= db= host= user= pwd= prt= sep= inf= NULL;
fn= dsn= tab= db= host= pwd= prt= sep= inf= NULL;
user= NULL;
if (g) {
// Set default values
......
......@@ -241,7 +241,7 @@ public:
*/
virtual const COND *cond_push(const COND *cond);
PFIL CheckCond(PGLOBAL g, PFIL filp, AMT tty, Item *cond);
char *GetValStr(OPVAL vop, bool neg);
const char *GetValStr(OPVAL vop, bool neg);
/**
Number of rows in table. It will only be called if
......@@ -346,7 +346,7 @@ char *GetValStr(OPVAL vop, bool neg);
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
protected:
char *GetListOption(char *opname, const char *oplist, char *def= NULL);
char *GetListOption(const char *opname, const char *oplist, const char *def= NULL);
char *encode(PGLOBAL g, char *cnm);
bool add_fields(THD *thd, void *alter_info,
LEX_STRING *field_name,
......
......@@ -182,7 +182,7 @@ PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids,
/* Get a unique char identifier for types. The letter used are: */
/* ABCDEF..I.KLM.O..R.T.VWXY.. */
/***********************************************************************/
char GetTypeID(char *type)
char GetTypeID(const char *type)
{
return (!type) ? 'D' // DOS (default)
: (!stricmp(type, "FMT")) ? 'T' // CSV
......@@ -569,7 +569,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am)
/* Get a unique char identifier for types. The letter used are: */
/* ABCDEF..IJKLM.OPQRSTUVWXYZ and Allocate table definition class */
/*********************************************************************/
tc= GetTypeID((char*)am);
tc= GetTypeID(am);
switch (tc) {
case 'F':
......
......@@ -24,6 +24,8 @@
#include "block.h"
#include "catalog.h"
char GetTypeID(const char *type);
/***********************************************************************/
/* MYCAT: class for managing the CONNECT plugin DB items. */
/***********************************************************************/
......@@ -61,4 +63,4 @@ class MYCAT : public CATALOG {
ha_connect *Hc; // The Connect handler
}; // end of class MYCAT
#endif __MYCAT__H
#endif /* __MYCAT__H */
......@@ -94,7 +94,9 @@ int MYSQLC::GetResultSize(PGLOBAL g, PSZ sql)
/***********************************************************************/
/* Open a MySQL (remote) connection. */
/***********************************************************************/
int MYSQLC::Open(PGLOBAL g, PSZ host, PSZ db, PSZ user, PSZ pwd, int pt)
int MYSQLC::Open(PGLOBAL g, const char *host, const char *db,
const char *user, const char *pwd,
int pt)
{
m_DB = mysql_init(NULL);
......@@ -182,7 +184,7 @@ int MYSQLC::KillQuery(ulong id)
{
char kill[20];
sprintf(kill, "KILL QUERY %u", id);
sprintf(kill, "KILL QUERY %u", (unsigned int) id);
return (m_DB) ? mysql_query(m_DB, kill) : 1;
} // end of KillQuery
......@@ -477,7 +479,7 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
} // endif m_Row
for (crp = qrp->Colresp; crp; crp = crp->Next) {
if (row = m_Row + (crp->Ncol - 1))
if ((row = m_Row + (crp->Ncol - 1))) {
if (*row)
crp->Kdata->SetValue((PSZ)*row, n);
else {
......@@ -486,10 +488,11 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
crp->Kdata->Reset(n);
} // endelse *row
}
} // endfor crp
} // endfor crp
} // endfor n
} // endfor n
qrp->Nblin = n;
return qrp;
......
......@@ -59,8 +59,9 @@ class DllItem MYSQLC {
// int GetCurPos(void) {return (m_Res) ? N : 0;}
// int GetProgCur(void) {return N;}
int GetResultSize(PGLOBAL g, PSZ sql);
int Open(PGLOBAL g, PSZ host, PSZ db, PSZ user = "root",
PSZ pwd = "*", int pt = 0);
int Open(PGLOBAL g, const char *host, const char *db,
const char *user= "root", const char *pwd= "*",
int pt= 0);
ulong GetThreadID(void);
ulong ServerVersion(void);
const char *ServerInfo(void);
......
......@@ -521,3 +521,5 @@ DllExport void NewPointer(PTABS, void *, void *);
FILE *global_fopen(GLOBAL *g, int msgid, const char *path, const char *mode);
int global_open(GLOBAL *g, int msgid, const char *filename, int flags);
int global_open(GLOBAL *g, int msgid, const char *filename, int flags, int mode);
bool PushWarning(PGLOBAL, PTDBASE);
......@@ -78,8 +78,10 @@ PQRYRES PlgAllocResult(PGLOBAL g, int ncol, int maxres, int ids,
/* of a MySQL table that will be retrieved by GetData commands. */
/* key = TRUE when called from Create Table to get key informations. */
/************************************************************************/
PQRYRES MyColumns(PGLOBAL g, char *host, char *db, char *user, char *pwd,
char *table, char *colpat, int port, bool key)
PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db,
const char *user, const char *pwd,
const char *table, const char *colpat,
int port, bool key)
{
static int dbtype[] = {DB_CHAR, DB_SHORT, DB_CHAR, DB_INT,
DB_INT, DB_SHORT, DB_CHAR, DB_CHAR};
......
......@@ -137,3 +137,7 @@ class MYSQLCOL : public COLBLK {
int Rank; // Rank (position) number in the query
}; // end of class MYSQLCOL
PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db,
const char *user, const char *pwd,
const char *table, const char *colpat, int port, bool key);
......@@ -59,8 +59,6 @@ extern int trace;
#define XMLSUP "libxml2"
#endif // !WIN32
bool PushWarning(PGLOBAL g, PTDBASE tdbp);
/* -------------- Implementation of the XMLDEF class ---------------- */
/***********************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment