diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2015-10-25 21:11:04 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2015-10-25 21:11:04 +0100 |
commit | abe87bb011069ca9354b183dc72b2566b13ee8be (patch) | |
tree | 9ed4116d1e61b36b3e086736dc5c6f412a2edffd /storage | |
parent | 1816eca57c6f29d3ff8230c65232fc2e0df8574f (diff) | |
download | mariadb-git-abe87bb011069ca9354b183dc72b2566b13ee8be.tar.gz |
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
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/ha_connect.cc | 12 | ||||
-rw-r--r-- | storage/connect/jsonudf.cpp | 35 | ||||
-rw-r--r-- | storage/connect/tabodbc.cpp | 2 |
3 files changed, 31 insertions, 18 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index fecf7f70796..f4121ea0f18 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -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) { diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 4d029ce9a7c..0b40f1d18cf 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -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,14 +2938,14 @@ 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); + CalcLen(args, false, reslen, memlen); - if (IsJson(args, 0) != 3) - memlen += 1000; // TODO: calculate this + if (IsJson(args, 0) != 3) + memlen += more; // TODO: calculate this - return JsonInit(initid, args, message, true, reslen, memlen); + return JsonInit(initid, args, message, true, reslen, memlen); } // end of json_locate_all_init char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result, @@ -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)) diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index 22a026c77b6..fd9a049a05a 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -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; |