summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2014-04-21 14:57:10 +0400
committerAlexander Barkov <bar@mnogosearch.org>2014-04-21 14:57:10 +0400
commit6075c8246771dd14bd52a511ee665b8995e3f33f (patch)
treece58d06c31a735054ce2c8446d5e0c9da5bd97e5 /storage/connect
parent187e41697b7e4c43fcfe8e5c01f7cc7ad289f995 (diff)
parent7216afbc78f7a4b4d517e04364fcc23255d4dfeb (diff)
downloadmariadb-git-6075c8246771dd14bd52a511ee665b8995e3f33f.tar.gz
Merge 10.0 -> 10.0-connect
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/csort.cpp4
-rw-r--r--storage/connect/filamfix.cpp4
-rw-r--r--storage/connect/filamtxt.cpp2
-rwxr-xr-xstorage/connect/filamvct.cpp24
-rw-r--r--storage/connect/ha_connect.cc20
-rw-r--r--storage/connect/inihandl.c2
-rw-r--r--storage/connect/myconn.cpp4
-rw-r--r--storage/connect/odbconn.cpp9
-rw-r--r--storage/connect/os.h6
-rw-r--r--storage/connect/osutil.h10
-rw-r--r--storage/connect/plgdbutl.cpp10
-rw-r--r--storage/connect/reldef.cpp4
-rw-r--r--storage/connect/tabdos.cpp8
-rw-r--r--storage/connect/tabfmt.cpp24
-rw-r--r--storage/connect/tabmysql.cpp5
-rw-r--r--storage/connect/taboccur.cpp4
-rw-r--r--storage/connect/tabodbc.cpp2
-rw-r--r--storage/connect/valblk.cpp10
-rw-r--r--storage/connect/value.cpp14
-rwxr-xr-xstorage/connect/xindex.cpp4
20 files changed, 84 insertions, 86 deletions
diff --git a/storage/connect/csort.cpp b/storage/connect/csort.cpp
index 4a49666c914..2f918782c80 100644
--- a/storage/connect/csort.cpp
+++ b/storage/connect/csort.cpp
@@ -295,7 +295,7 @@ int CSORT::Qsortx(void)
/*****************************************************************/
/* Call conservative insertion sort not using/setting offset. */
/*****************************************************************/
- Istc(Pex, Pex + min(Nitem, Thresh), top);
+ Istc(Pex, Pex + MY_MIN(Nitem, Thresh), top);
} // endif Thresh
@@ -669,7 +669,7 @@ int CSORT::Qsortc(void)
/*****************************************************************/
/* Call conservative insertion sort not using/setting offset. */
/*****************************************************************/
- Istc(Pex, Pex + min(Nitem, Thresh), max);
+ Istc(Pex, Pex + MY_MIN(Nitem, Thresh), max);
} // endif Thresh
diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp
index f4455f3ce5b..a64d7bdc04d 100644
--- a/storage/connect/filamfix.cpp
+++ b/storage/connect/filamfix.cpp
@@ -476,7 +476,7 @@ bool FIXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
return true;
} // endif
- req = (size_t)min(n, Dbflen);
+ req = (size_t)MY_MIN(n, Dbflen);
len = fread(DelBuf, Lrecl, req, Stream);
if (trace > 1)
@@ -1322,7 +1322,7 @@ bool BGXFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
if (BigSeek(g, Hfile, (BIGINT)Spos * (BIGINT)Lrecl))
return true;
- req = min(n, Dbflen) * Lrecl;
+ req = MY_MIN(n, Dbflen) * Lrecl;
if ((nbr = BigRead(g, Hfile, DelBuf, req)) != req) {
sprintf(g->Message, MSG(DEL_READ_ERROR), req, nbr);
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index c9bef42c4be..ecd255afd2e 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -836,7 +836,7 @@ bool DOSFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
return true;
} // endif
- req = (size_t)min(n, Dbflen);
+ req = (size_t)MY_MIN(n, Dbflen);
len = fread(DelBuf, 1, req, Stream);
if (trace)
diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp
index e6c8bf23b50..97eb4c7c8b4 100755
--- a/storage/connect/filamvct.cpp
+++ b/storage/connect/filamvct.cpp
@@ -477,7 +477,7 @@ bool VCTFAM::AllocateBuffer(PGLOBAL g)
Clens[i] = cdp->GetClen();
Deplac[i] = Headlen + cdp->GetPoff() * n * Nrec;
Isnum[i] = IsTypeNum(cdp->GetType());
- Buflen = max(Buflen, cdp->GetClen());
+ Buflen = MY_MAX(Buflen, cdp->GetClen());
} // endfor cdp
if (!UseTemp || MaxBlk) {
@@ -852,9 +852,9 @@ bool VCTFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
/* Non consecutive line to delete. Move intermediate lines. */
/*******************************************************************/
if (!MaxBlk)
- req = (size_t)min(n, Nrec - max(Spos % Nrec, Tpos % Nrec));
+ req = (size_t)MY_MIN(n, Nrec - MY_MAX(Spos % Nrec, Tpos % Nrec));
else
- req = (size_t)min(n, Nrec);
+ req = (size_t)MY_MIN(n, Nrec);
if (req) for (i = 0; i < Ncol; i++) {
if (MaxBlk) {
@@ -985,7 +985,7 @@ bool VCTFAM::CleanUnusedSpace(PGLOBAL g)
/* Note: this seems to work even column blocks have been made */
/* with Blanks = true. Perhaps should it be set to false for VEC. */
/*******************************************************************/
- req = (size_t)min(n, Nrec);
+ req = (size_t)MY_MIN(n, Nrec);
memset(To_Buf, 0, Buflen);
for (i = 0; i < Ncol; i++) {
@@ -1574,7 +1574,7 @@ int VCMFAM::DeleteRecords(PGLOBAL g, int irc)
for (n = Fpos - Spos; n > 0; n -= req) {
soff = Spos % Nrec;
toff = Tpos % Nrec;
- req = (size_t)min(n, Nrec - max(soff, toff));
+ req = (size_t)MY_MIN(n, Nrec - MY_MAX(soff, toff));
for (i = 0; i < Ncol; i++) {
ps = Memcol[i] + (Spos / Nrec) * Blksize + soff * Clens[i];
@@ -2005,7 +2005,7 @@ bool VECFAM::AllocateBuffer(PGLOBAL g)
for (i = 0; cdp && i < Ncol; i++, cdp = cdp->GetNext()) {
Clens[i] = cdp->GetClen();
- Buflen = max(Buflen, cdp->GetClen());
+ Buflen = MY_MAX(Buflen, cdp->GetClen());
} // endfor cdp
} else { // Mode Update, only some columns are updated
@@ -2016,7 +2016,7 @@ bool VECFAM::AllocateBuffer(PGLOBAL g)
T_Streams[i] = NULL; // Mark the streams to open
Clens[i] = cp->Clen;
- Buflen = max(Buflen, cp->Clen);
+ Buflen = MY_MAX(Buflen, cp->Clen);
} // endfor cp
InitUpdate = true; // To be initialized
@@ -2297,7 +2297,7 @@ bool VECFAM::MoveIntermediateLines(PGLOBAL g, bool *bn)
/*******************************************************************/
/* Non consecutive line to delete. Move intermediate lines. */
/*******************************************************************/
- req = (size_t)min(n, Nrec);
+ req = (size_t)MY_MIN(n, Nrec);
for (i = 0; i < Ncol; i++) {
if (!T_Streams[i])
@@ -3603,7 +3603,7 @@ bool BGVFAM::AllocateBuffer(PGLOBAL g)
Clens[i] = cdp->GetClen();
Isnum[i] = IsTypeNum(cdp->GetType());
- Buflen = max(Buflen, cdp->GetClen());
+ Buflen = MY_MAX(Buflen, cdp->GetClen());
} // endfor cdp
if (!UseTemp || MaxBlk) {
@@ -3907,9 +3907,9 @@ bool BGVFAM::MoveIntermediateLines(PGLOBAL g, bool *b)
/* Non consecutive line to delete. Move intermediate lines. */
/*******************************************************************/
if (!MaxBlk)
- req = (DWORD)min(n, Nrec - max(Spos % Nrec, Tpos % Nrec));
+ req = (DWORD)MY_MIN(n, Nrec - MY_MAX(Spos % Nrec, Tpos % Nrec));
else
- req = (DWORD)min(n, Nrec);
+ req = (DWORD)MY_MIN(n, Nrec);
if (req) for (i = 0; i < Ncol; i++) {
if (!MaxBlk) {
@@ -4016,7 +4016,7 @@ bool BGVFAM::CleanUnusedSpace(PGLOBAL g)
/* This seems to work even column blocks have been made with */
/* Blanks = true. Perhaps should it be set to false for VEC. */
/*****************************************************************/
- req = min(n, Nrec);
+ req = MY_MIN(n, Nrec);
for (i = 0; i < Ncol; i++) {
pos = BigDep[i] + (BIGINT)Tpos * (BIGINT)Clens[i];
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index bf11d59c0ce..4788b669cbe 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -695,7 +695,7 @@ char *GetListOption(PGLOBAL g, const char *opname,
} else {
if (pn) {
- n= min(pn - pk, 15);
+ n= MY_MIN(pn - pk, 15);
memcpy(key, pk, n);
key[n]= 0;
} else
@@ -1009,7 +1009,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
break;
case TYPE_DOUBLE:
- pcf->Scale= max(min(fp->decimals(), ((unsigned)pcf->Length - 2)), 0);
+ pcf->Scale= MY_MAX(MY_MIN(fp->decimals(), ((unsigned)pcf->Length - 2)), 0);
break;
case TYPE_DECIM:
pcf->Precision= ((Field_new_decimal*)fp)->precision;
@@ -1639,7 +1639,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
for (kpart= kfp->key_part; rem; rem--, kpart++) {
fp= kpart->field;
stlen= kpart->store_length;
-// prtlen= min(stlen, len);
+// prtlen= MY_MIN(stlen, len);
nq= fp->str_needs_quotes();
if (b)
@@ -1688,7 +1688,7 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, char *qry, OPVAL op, char *q,
/* For nullable columns, null-byte is already skipped before, that is
ptr was incremented by 1. Since store_length still counts null-byte,
we need to subtract 1 from store_length. */
- ptr+= stlen - test(kpart->null_bit);
+ ptr+= stlen - MY_TEST(kpart->null_bit);
} // endfor kpart
strcat(qry, ")");
@@ -2942,8 +2942,8 @@ int ha_connect::info(uint flag)
if (flag & HA_STATUS_CONST) {
// This is imported from the previous handler and must be reconsidered
- stats.max_data_file_length= 4294967295;
- stats.max_index_file_length= 4398046510080;
+ stats.max_data_file_length= 4294967295LL;
+ stats.max_index_file_length= 4398046510080LL;
stats.create_time= 0;
data_file_name= xinfo.data_file_name;
index_file_name= NULL;
@@ -3847,11 +3847,11 @@ static bool add_field(String *sql, const char *field_name, int typ,
if (!strcmp(type, "DOUBLE")) {
error|= sql->append(',');
// dec must be < len and < 31
- error|= sql->append_ulonglong(min(dec, (min(len, 31) - 1)));
+ error|= sql->append_ulonglong(MY_MIN(dec, (MY_MIN(len, 31) - 1)));
} else if (dec > 0 && !strcmp(type, "DECIMAL")) {
error|= sql->append(',');
// dec must be < len
- error|= sql->append_ulonglong(min(dec, len - 1));
+ error|= sql->append_ulonglong(MY_MIN(dec, len - 1));
} // endif dec
error|= sql->append(')');
@@ -4030,7 +4030,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
TABLE_SHARE *table_s,
HA_CREATE_INFO *create_info)
{
- char v, spc= ',', qch= 0;
+ char v=0, spc= ',', qch= 0;
const char *fncn= "?";
const char *user, *fn, *db, *host, *pwd, *sep, *tbl, *src;
const char *col, *ocl, *rnk, *pic, *fcl, *skc;
@@ -4092,7 +4092,9 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
cls= GetListOption(g, "class", topt->oplist);
#endif // WIN32
port= atoi(GetListOption(g, "port", topt->oplist, "0"));
+#if defined(ODBC_SUPPORT)
mxr= atoi(GetListOption(g,"maxres", topt->oplist, "0"));
+#endif
mxe= atoi(GetListOption(g,"maxerr", topt->oplist, "0"));
#if defined(PROMPT_OK)
cop= atoi(GetListOption(g, "checkdsn", topt->oplist, "0"));
diff --git a/storage/connect/inihandl.c b/storage/connect/inihandl.c
index 1c1884c0144..9f1c06a9222 100644
--- a/storage/connect/inihandl.c
+++ b/storage/connect/inihandl.c
@@ -152,7 +152,7 @@ static void PROFILE_CopyEntry( char *buffer, const char *value, uint len,
if (!p2)
continue; /* ignore it */
- strncpy(env_val, p + 2, min((int) sizeof(env_val), (int)(p2-p)-1));
+ strncpy(env_val, p + 2, MY_MIN((int) sizeof(env_val), (int)(p2-p)-1));
if ((env_p = getenv(env_val)) != NULL) {
int buffer_len;
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp
index 8218c9d6c6e..2e563dbaf1e 100644
--- a/storage/connect/myconn.cpp
+++ b/storage/connect/myconn.cpp
@@ -204,7 +204,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
PushWarning(g, thd);
v = 'V';
} else
- len = min(len, 4096);
+ len = MY_MIN(len, 4096);
} // endif type
@@ -764,7 +764,7 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
crp->Prec = (crp->Type == TYPE_DOUBLE || crp->Type == TYPE_DECIM)
? fld->decimals : 0;
- crp->Length = max(fld->length, fld->max_length);
+ crp->Length = MY_MAX(fld->length, fld->max_length);
crp->Clen = GetTypeSize(crp->Type, crp->Length);
uns = (fld->flags & (UNSIGNED_FLAG | ZEROFILL_FLAG)) ? true : false;
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index a64dff76314..a857a1bc918 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -9,7 +9,8 @@
/***********************************************************************/
/* Include relevant MariaDB header file. */
/***********************************************************************/
-#include "my_global.h"
+#include <my_global.h>
+#include <m_string.h>
#if defined(WIN32)
//nclude <io.h>
//nclude <fcntl.h>
@@ -123,7 +124,7 @@ int TranslateSQLType(int stp, int prec, int& len, char& v)
case SQL_LONGVARCHAR: // (-1)
v = 'V';
type = TYPE_STRING;
- len = min(abs(len), 256);
+ len = MY_MIN(abs(len), 256);
break;
case SQL_NUMERIC: // 2
case SQL_DECIMAL: // 3
@@ -311,7 +312,7 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
if (table && !strchr(table, '%')) {
// We fix a MySQL limit because some data sources return 32767
n = ocp->GetMaxValue(SQL_MAX_COLUMNS_IN_TABLE);
- maxres = (n) ? min(n, 4096) : 4096;
+ maxres = (n) ? MY_MIN(n, 4096) : 4096;
} else if (!maxres)
maxres = 20000;
@@ -1857,7 +1858,7 @@ PQRYRES ODBConn::GetMetaData(PGLOBAL g, char *dsn, char *src)
if (!Check(rc))
ThrowDBX(rc, "SQLDescribeCol", hstmt);
- length[0] = max(length[0], (UINT)nl);
+ length[0] = MY_MAX(length[0], (UINT)nl);
} // endfor i
} catch(DBX *x) {
diff --git a/storage/connect/os.h b/storage/connect/os.h
index e3d452bf7b8..8e94f4241bb 100644
--- a/storage/connect/os.h
+++ b/storage/connect/os.h
@@ -9,6 +9,12 @@ typedef off_t off64_t;
#define O_LARGEFILE 0
#endif
+#ifdef _AIX
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+#endif
+
#if defined(WIN32)
typedef __int64 BIGINT;
#else // !WIN32
diff --git a/storage/connect/osutil.h b/storage/connect/osutil.h
index a6bdb5521b8..ac63d4ee973 100644
--- a/storage/connect/osutil.h
+++ b/storage/connect/osutil.h
@@ -9,16 +9,6 @@
#define MB_OK 0x00000000
-#if !defined(__MINMAX_DEFINED)
-#define __MINMAX_DEFINED
-#ifndef max
-#define max(x,y) (((x)>(y))?(x):(y))
-#endif
-#ifndef min
-#define min(x,y) (((x)<(y))?(x):(y))
-#endif
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index 939c6ab75eb..c0f7fc1c253 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -721,7 +721,7 @@ int ExtractDate(char *dts, PDTP pdp, int defy, int val[6])
n += 100;
val[0] = n;
- numval = max(numval, 1);
+ numval = MY_MAX(numval, 1);
break;
case 1:
case 2:
@@ -729,7 +729,7 @@ int ExtractDate(char *dts, PDTP pdp, int defy, int val[6])
case 4:
case 5:
val[k] = n;
- numval = max(numval, k + 1);
+ numval = MY_MAX(numval, k + 1);
break;
case -1:
c = toupper(W[i][0]);
@@ -753,7 +753,7 @@ int ExtractDate(char *dts, PDTP pdp, int defy, int val[6])
} /* endswitch c */
val[1] = n;
- numval = max(numval, 2);
+ numval = MY_MAX(numval, 2);
break;
case -6:
c = toupper(W[i][0]);
@@ -1225,7 +1225,7 @@ void *PlgDBrealloc(PGLOBAL g, void *area, MBLOCK& mp, size_t newsize)
if ((mp.Sub = (newsize <= (maxsub >> 2)))) {
mp.Memp = PlugSubAlloc(g, area, newsize);
- memcpy(mp.Memp, m.Memp, min(m.Size, newsize));
+ memcpy(mp.Memp, m.Memp, MY_MIN(m.Size, newsize));
PlgDBfree(m); // Free the old block
} else if (!(mp.Memp = realloc(mp.Memp, newsize))) {
mp = m; // Possible only if newsize > Size
@@ -1241,7 +1241,7 @@ void *PlgDBrealloc(PGLOBAL g, void *area, MBLOCK& mp, size_t newsize)
mp.Size = newsize;
if (PlgDBalloc(g, area, mp)) {
- memcpy(mp.Memp, m.Memp, min(m.Size, newsize));
+ memcpy(mp.Memp, m.Memp, MY_MIN(m.Size, newsize));
PlgDBfree(m); // Free the old block
} else {
mp = m; // No space to realloc, do nothing
diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp
index 5129d8b7980..e7a96a12908 100644
--- a/storage/connect/reldef.cpp
+++ b/storage/connect/reldef.cpp
@@ -242,7 +242,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g)
case TAB_VEC:
case TAB_DBF:
poff= loff + nof; // Default next offset
- nlg= max(nlg, poff); // Default lrecl
+ nlg= MY_MAX(nlg, poff); // Default lrecl
break;
case TAB_CSV:
case TAB_FMT:
@@ -367,7 +367,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g)
} // endswitch tc
// lrecl must be at least recln to avoid buffer overflow
- recln= max(recln, Hc->GetIntegerOption("Lrecl"));
+ recln= MY_MAX(recln, Hc->GetIntegerOption("Lrecl"));
Hc->SetIntegerOption("Lrecl", recln);
((PDOSDEF)this)->SetLrecl(recln);
} // endif Lrecl
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index de97c3a6ea5..86ce92160ab 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -494,7 +494,7 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
} // endif Type
colp->InitValue(g);
- n = max(n, xdp->GetNparts());
+ n = MY_MAX(n, xdp->GetNparts());
} // endfor kdp
keycols = (PCOL*)PlugSubAlloc(g, NULL, n * sizeof(PCOL));
@@ -687,7 +687,7 @@ int TDBDOS::EstimatedLength(PGLOBAL g)
// result if we set dep to 1
dep = 1 + cdp->GetLong() / 20; // Why 20 ?????
} else for (; cdp; cdp = cdp->GetNext())
- dep = max(dep, cdp->GetOffset());
+ dep = MY_MAX(dep, cdp->GetOffset());
return (int)dep;
} // end of Estimated Length
@@ -1004,7 +1004,7 @@ bool DOSCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check)
// Allocate the buffer used in WriteColumn for numeric columns
if (IsTypeNum(Buf_Type))
- Buf = (char*)PlugSubAlloc(g, NULL, max(32, Long + Dcm + 1));
+ Buf = (char*)PlugSubAlloc(g, NULL, MY_MAX(32, Long + Dcm + 1));
// Because Colblk's have been made from a copy of the original TDB in
// case of Update, we must reset them to point to the original one.
@@ -1133,7 +1133,7 @@ void DOSCOL::WriteColumn(PGLOBAL g)
memset(tdbp->To_Line + len, ' ', tdbp->Lrecl - len);
else
// The size actually available must be recalculated
- field = min(len - Deplac, Long);
+ field = MY_MIN(len - Deplac, Long);
} // endif Ftype
diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp
index 4760af41d9d..b15d5c201c9 100644
--- a/storage/connect/tabfmt.cpp
+++ b/storage/connect/tabfmt.cpp
@@ -118,7 +118,7 @@ PQRYRES CSVColumns(PGLOBAL g, const char *fn, char sep, char q,
} // endif fn
imax = hmax = nerr = 0;
- mxr = max(0, mxr);
+ mxr = MY_MAX(0, mxr);
for (i = 0; i < MAXCOL; i++) {
colname[i] = NULL;
@@ -190,7 +190,7 @@ PQRYRES CSVColumns(PGLOBAL g, const char *fn, char sep, char q,
imax = hmax = i;
for (i = 0; i < hmax; i++)
- length[0] = max(length[0], strlen(colname[i]));
+ length[0] = MY_MAX(length[0], strlen(colname[i]));
} // endif hdr
@@ -228,11 +228,11 @@ PQRYRES CSVColumns(PGLOBAL g, const char *fn, char sep, char q,
} // endif i
if (n) {
- len[i] = max(len[i], n);
+ len[i] = MY_MAX(len[i], n);
type = (digit || (dec && n == 1)) ? TYPE_STRING
: (dec) ? TYPE_DOUBLE : TYPE_INT;
- typ[i] = min(type, typ[i]);
- prc[i] = max((typ[i] == TYPE_DOUBLE) ? (dec - 1) : 0, prc[i]);
+ typ[i] = MY_MIN(type, typ[i]);
+ prc[i] = MY_MAX((typ[i] == TYPE_DOUBLE) ? (dec - 1) : 0, prc[i]);
} // endif n
i++;
@@ -308,14 +308,14 @@ PQRYRES CSVColumns(PGLOBAL g, const char *fn, char sep, char q,
goto skip;
if (n) {
- len[i] = max(len[i], n);
+ len[i] = MY_MAX(len[i], n);
type = (digit || n == 0 || (dec && n == 1)) ? TYPE_STRING
: (dec) ? TYPE_DOUBLE : TYPE_INT;
- typ[i] = min(type, typ[i]);
- prc[i] = max((typ[i] == TYPE_DOUBLE) ? (dec - 1) : 0, prc[i]);
+ typ[i] = MY_MIN(type, typ[i]);
+ prc[i] = MY_MAX((typ[i] == TYPE_DOUBLE) ? (dec - 1) : 0, prc[i]);
} // endif n
- imax = max(imax, i+1);
+ imax = MY_MAX(imax, i+1);
skip: ; // Skip erroneous line
} // endfor num_read
@@ -599,7 +599,7 @@ int TDBCSV::EstimatedLength(PGLOBAL g)
for (colp = (PCSVCOL)Columns; colp; colp = (PCSVCOL)colp->Next)
if (!colp->IsSpecial()) // Not a pseudo column
- Fields = max(Fields, (int)colp->Fldnum);
+ Fields = MY_MAX(Fields, (int)colp->Fldnum);
if (Columns)
Fields++; // Fldnum was 0 based
@@ -642,7 +642,7 @@ bool TDBCSV::OpenDB(PGLOBAL g)
if (Mode != MODE_UPDATE && Mode != MODE_INSERT) {
for (colp = (PCSVCOL)Columns; colp; colp = (PCSVCOL)colp->Next)
if (!colp->IsSpecial()) // Not a pseudo column
- Fields = max(Fields, (int)colp->Fldnum);
+ Fields = MY_MAX(Fields, (int)colp->Fldnum);
if (Columns)
Fields++; // Fldnum was 0 based
@@ -1102,7 +1102,7 @@ bool TDBFMT::OpenDB(PGLOBAL g)
for (colp = (PCSVCOL)Columns; colp; colp = (PCSVCOL)colp->Next)
if (!colp->IsSpecial()) // Not a pseudo column
- Fields = max(Fields, (int)colp->Fldnum);
+ Fields = MY_MAX(Fields, (int)colp->Fldnum);
if (Columns)
Fields++; // Fldnum was 0 based
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp
index 67eba4061bf..a57c7b21c94 100644
--- a/storage/connect/tabmysql.cpp
+++ b/storage/connect/tabmysql.cpp
@@ -396,7 +396,7 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBASE(tdp)
Pwd = tdp->Password;
Server = tdp->Server;
Qrystr = tdp->Qrystr;
- Quoted = max(0, tdp->Quoted);
+ Quoted = MY_MAX(0, tdp->Quoted);
Port = tdp->Portnumber;
Isview = tdp->Isview;
Prep = tdp->Bind;
@@ -1009,7 +1009,6 @@ int TDBMYSQL::SendCommand(PGLOBAL g)
bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
{
int oldlen = strlen(Query);
- bool rc;
if (op == OP_NEXT)
return false;
@@ -1021,7 +1020,7 @@ bool TDBMYSQL::ReadKey(PGLOBAL g, OPVAL op, const void *key, int len)
if (Myc.m_Res)
Myc.FreeResult();
- rc = To_Def->GetHandler()->MakeKeyWhere(g, Query, op, "`", key, len);
+ To_Def->GetHandler()->MakeKeyWhere(g, Query, op, "`", key, len);
if (To_CondFil)
strcat(strcat(strcat(Query, " AND ("), To_CondFil->Body), ")");
diff --git a/storage/connect/taboccur.cpp b/storage/connect/taboccur.cpp
index 96901424a7d..917685faae3 100644
--- a/storage/connect/taboccur.cpp
+++ b/storage/connect/taboccur.cpp
@@ -106,7 +106,7 @@ bool OcrColumns(PGLOBAL g, PQRYRES qrp, const char *col,
} // endif m
for (k = 0, pn = colist; k < m; k++, pn += (strlen(pn) + 1))
- n = max(n, (signed)strlen(pn));
+ n = MY_MAX(n, (signed)strlen(pn));
} // endif k
@@ -199,7 +199,7 @@ bool OcrSrcCols(PGLOBAL g, PQRYRES qrp, const char *col,
if ((rk = (rank && *rank)))
for (k = 0, pn = colist; k < m; k++, pn += (strlen(pn) + 1))
- n = max(n, (signed)strlen(pn));
+ n = MY_MAX(n, (signed)strlen(pn));
// Default occur column name is the 1st colist column name
if (!ocr || !*ocr)
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index 4231c5550e0..65226c9e36f 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -178,7 +178,7 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBASE(tdp)
Qrystr = tdp->Qrystr;
Sep = tdp->GetSep();
Options = tdp->Options;
- Quoted = max(0, tdp->GetQuoted());
+ Quoted = MY_MAX(0, tdp->GetQuoted());
Rows = tdp->GetElemt();
Catver = tdp->Catver;
} else {
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index 11ead7b14d2..ded7240cb2e 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -188,7 +188,7 @@ bool VALBLK::AllocBuff(PGLOBAL g, size_t size)
Mblk.Size = size;
if (!(Blkp = PlgDBalloc(g, NULL, Mblk))) {
- sprintf(g->Message, MSG(MEM_ALLOC_ERR), "Blkp", Mblk.Size);
+ sprintf(g->Message, MSG(MEM_ALLOC_ERR), "Blkp", (int) Mblk.Size);
fprintf(stderr, "%s\n", g->Message);
return true;
} // endif Blkp
@@ -571,7 +571,7 @@ int TYPBLK<TYPE>::GetMaxLength(void)
for (i = n = 0; i < Nval; i++) {
m = sprintf(buf, Fmt, Typp[i]);
- n = max(n, m);
+ n = MY_MAX(n, m);
} // endfor i
return n;
@@ -768,7 +768,7 @@ void CHRBLK::SetValue(char *sp, uint len, int n)
#endif // _DEBUG
if (sp)
- memcpy(p, sp, min((unsigned)Long, len));
+ memcpy(p, sp, MY_MIN((unsigned)Long, len));
if (Blanks) {
// Suppress eventual ending zero and right fill with blanks
@@ -934,7 +934,7 @@ int CHRBLK::GetMaxLength(void)
for (i = n = 0; i < Nval; i++)
if (!IsNull(i)) {
GetValPtrEx(i);
- n = max(n, (signed)strlen(Valp));
+ n = MY_MAX(n, (signed)strlen(Valp));
} // endif null
return n;
@@ -1208,7 +1208,7 @@ int STRBLK::GetMaxLength(void)
for (i = n = 0; i < Nval; i++)
if (Strp[i])
- n = max(n, (signed)strlen(Strp[i]));
+ n = MY_MAX(n, (signed)strlen(Strp[i]));
return n;
} // end of GetMaxLength
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index f915f9e9c98..12b6aced1cd 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -569,7 +569,7 @@ bool TYPVAL<double>::SetValue_char(char *p, int n)
for (; n > 0 && *p == ' '; p++)
n--;
- memcpy(buf, p, min(n, 31));
+ memcpy(buf, p, MY_MIN(n, 31));
buf[n] = '\0';
Tval = atof(buf);
@@ -986,7 +986,7 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
if (p) {
rc = n > Len;
- if ((n = min(n, Len))) {
+ if ((n = MY_MIN(n, Len))) {
strncpy(Strp, p, n);
// for (p = Strp + n - 1; p >= Strp && (*p == ' ' || *p == '\0'); p--) ;
@@ -1380,7 +1380,7 @@ bool DECVAL::SetValue_char(char *p, int n)
if (p) {
rc = n > Len;
- if ((n = min(n, Len))) {
+ if ((n = MY_MIN(n, Len))) {
strncpy(Strp, p, n);
// for (p = Strp + n - 1; p >= Strp && (*p == ' ' || *p == '\0'); p--) ;
@@ -1650,7 +1650,7 @@ bool BINVAL::SetValue_char(char *p, int n)
if (p) {
rc = n > Clen;
- Len = min(n, Clen);
+ Len = MY_MIN(n, Clen);
memcpy(Binp, p, Len);
Null = false;
} else {
@@ -1668,7 +1668,7 @@ bool BINVAL::SetValue_char(char *p, int n)
void BINVAL::SetValue_psz(PSZ s)
{
if (s) {
- Len = min(Clen, (signed)strlen(s));
+ Len = MY_MIN(Clen, (signed)strlen(s));
memcpy(Binp, s, Len);
Null = false;
} else {
@@ -1695,7 +1695,7 @@ void BINVAL::SetValue_pvblk(PVBLK blk, int n)
else
Len = blk->GetVlen();
- Len = min(Clen, Len);
+ Len = MY_MIN(Clen, Len);
memcpy(Binp, vp, Len);
Null = false;
} // endif vp
@@ -1844,7 +1844,7 @@ bool BINVAL::GetBinValue(void *buf, int buflen, bool go)
/***********************************************************************/
char *BINVAL::ShowValue(char *buf, int len)
{
- int n = min(Len, len / 2);
+ int n = MY_MIN(Len, len / 2);
sprintf(buf, GetXfmt(), n, Binp);
return buf;
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index 1006f0ed17c..ac4329d8683 100755
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -478,7 +478,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
for (kcp = To_KeyCol; kcp; kcp = kcp->Next)
kcp->Move(i, Pof[i]);
- MaxSame = max(MaxSame, Pof[i + 1] - Pof[i]);
+ MaxSame = MY_MAX(MaxSame, Pof[i + 1] - Pof[i]);
} // endfor i
for (kcp = To_KeyCol; kcp; kcp = kcp->Next)
@@ -615,7 +615,7 @@ int XINDEX::ColMaxSame(PXCOL kp)
ck2 = kof[ck2];
} // endfor kcp
- ckn = max(ckn, ck2 - ck1);
+ ckn = MY_MAX(ckn, ck2 - ck1);
} // endfor i
return ckn;