Commit abe87bb0 authored by Olivier Bertrand's avatar Olivier Bertrand

Fix error and warnings raised by gcc on Linux:

 Define O_RDONLY in jsonudf.cpp
 Correct wrong deinit function names
 Make Locate functions use the variable more
 Avoid signed/unsigned warning in ha_connect.cc GetIntegerTableOption
 Initialize oom in tabodbc MakeInsert
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/tabodbc.cpp
parent 1816eca5
......@@ -169,7 +169,7 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
char version[]= "Version 1.04.0003 October 20, 2015";
char version[]= "Version 1.04.0003 October 25, 2015";
#if defined(__WIN__)
char compver[]= "Version 1.04.0003 " __DATE__ " " __TIME__;
char slash= '\\';
......@@ -1114,7 +1114,7 @@ int GetIntegerTableOption(PGLOBAL g, PTOS options, char *opname, int idef)
else if (!stricmp(opname, "Compressed"))
opval= (options->compressed);
if (opval == NO_IVAL) {
if (opval == (ulonglong)NO_IVAL) {
char *pv;
if ((pv= GetListOption(g, opname, options->oplist)))
......@@ -2222,7 +2222,8 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
const key_range *kr)
{
const uchar *ptr;
uint i, rem, len, klen, stlen;
//uint i, rem, len, klen, stlen;
uint i, rem, len, stlen;
bool nq, both, oom= false;
OPVAL op;
Field *fp;
......@@ -2255,7 +2256,8 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
else
oom|= qry->Append(" WHERE (");
klen= len= ranges[i]->length;
// klen= len= ranges[i]->length;
len= ranges[i]->length;
rem= kfp->user_defined_key_parts;
ptr= ranges[i]->key;
......@@ -2541,6 +2543,8 @@ PFIL ha_connect::CondFilter(PGLOBAL g, Item *cond)
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_NEWDATE:
return NULL;
default:
break;
} // endswitch type
if (trace) {
......
......@@ -15,10 +15,13 @@
#include "jsonudf.h"
#if defined(UNIX) || defined(UNIV_LINUX)
#define _O_RDONLY O_RDONLY
#endif
#define MEMFIX 4096
#if defined(connect_EXPORTS)
#define PUSH_WARNING(M) \
push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, M)
#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, M)
#else
#define PUSH_WARNING(M) htrc(M)
#endif
......@@ -1356,7 +1359,11 @@ static char *GetJsonFile(PGLOBAL g, char *fn)
char *str;
int h, n, len;
#if defined(UNIX) || defined(UNIV_LINUX)
h= open(fn, O_RDONLY);
#else
h= open(fn, _O_RDONLY, _O_TEXT);
#endif
if (h == -1) {
sprintf(g->Message, "Error %d opening %s", errno, fn);
......@@ -1504,7 +1511,7 @@ char *jsonvalue(UDF_INIT *initid, UDF_ARGS *args, char *result,
return str;
} // end of JsonValue
void JsonValue_deinit(UDF_INIT* initid)
void jsonvalue_deinit(UDF_INIT* initid)
{
JsonFreeMem((PGLOBAL)initid->ptr);
} // end of jsonvalue_deinit
......@@ -2804,12 +2811,12 @@ my_bool jsonlocate_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
strcpy(message, "Fourth argument is not an integer (memory)");
return true;
} else
more = (ulong)*(longlong*)args->args[2];
more += (ulong)*(longlong*)args->args[2];
CalcLen(args, false, reslen, memlen);
if (IsJson(args, 0) != 3)
memlen += 1000; // TODO: calculate this
memlen += more; // TODO: calculate this
return JsonInit(initid, args, message, true, reslen, memlen);
} // end of jsonlocate_init
......@@ -2905,7 +2912,7 @@ char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result,
return NULL;
} // end of jsonlocate
void json_locate_deinit(UDF_INIT* initid)
void jsonlocate_deinit(UDF_INIT* initid)
{
JsonFreeMem((PGLOBAL)initid->ptr);
} // end of jsonlocate_deinit
......@@ -2931,12 +2938,12 @@ my_bool json_locate_all_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
strcpy(message, "Fourth argument is not an integer (memory)");
return true;
} else
more = (ulong)*(longlong*)args->args[2];
more += (ulong)*(longlong*)args->args[2];
CalcLen(args, false, reslen, memlen);
if (IsJson(args, 0) != 3)
memlen += 1000; // TODO: calculate this
memlen += more; // TODO: calculate this
return JsonInit(initid, args, message, true, reslen, memlen);
} // end of json_locate_all_init
......@@ -3237,6 +3244,8 @@ char *jfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result,
case INT_RESULT:
pretty = (int)*(longlong*)args->args[i];
break;
default:
PUSH_WARNING("Unexpected argument type in jfile_make");
} // endswitch arg_type
if (fn) {
......@@ -3397,12 +3406,12 @@ char *jbin_array_add(UDF_INIT *initid, UDF_ARGS *args, char *result,
if (!CheckMemory(g, initid, args, 2, false, true)) {
int *x = NULL;
uint n = 2;
PJSON jsp;
// PJSON jsp;
PJVAL jvp;
PJAR arp;
jvp = MakeValue(g, args, 0, &top);
jsp = jvp->GetJson();
// jsp = jvp->GetJson();
x = GetIntArgPtr(g, args, n);
if (CheckPath(g, args, top, jvp, n))
......
......@@ -513,7 +513,7 @@ bool TDBODBC::MakeInsert(PGLOBAL g)
{
char *schmp = NULL, *catp = NULL, buf[NAM_LEN * 3];
int len = 0;
bool b = false, oom;
bool b = false, oom = false;
PTABLE tablep = To_Table;
PCOL colp;
......
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