diff --git a/dbcon/execplan/calpontsystemcatalog.cpp b/dbcon/execplan/calpontsystemcatalog.cpp index 16b98583e..3d2baf418 100644 --- a/dbcon/execplan/calpontsystemcatalog.cpp +++ b/dbcon/execplan/calpontsystemcatalog.cpp @@ -21,9 +21,6 @@ * * ***********************************************************************/ -#include -#undef set_bits // mariadb.h defines set_bits, which is incompatible with boost -#include #include #include @@ -80,6 +77,10 @@ using namespace rowgroup; #include "idbregistry.h" #endif +#include +#undef set_bits // mariadb.h defines set_bits, which is incompatible with boost +#include + #undef BAIL_IF_0 #if 1 //We are unlikely to ever get anything more out of this connection, so bail out diff --git a/dbcon/execplan/predicateoperator.cpp b/dbcon/execplan/predicateoperator.cpp index 3e2b907c4..f7e8bd826 100644 --- a/dbcon/execplan/predicateoperator.cpp +++ b/dbcon/execplan/predicateoperator.cpp @@ -21,10 +21,6 @@ * * ***********************************************************************/ -#include -#undef set_bits // mariadb.h defines set_bits, which is incompatible with boost -#include -#include #include @@ -33,6 +29,12 @@ #include "objectreader.h" #include "liboamcpp.h" + +#include +#undef set_bits // mariadb.h defines set_bits, which is incompatible with boost +#include +#include + using namespace oam; using namespace std; diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index 52b93fb58..afd8014a4 100755 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -17,10 +17,6 @@ MA 02110-1301, USA. */ //#define DEBUG_WALK_COND -#include -#include -#undef set_bits // mariadb.h defines set_bits, which is incompatible with boost -#include #include #include @@ -90,6 +86,10 @@ using namespace execplan; #include "functor.h" using namespace funcexp; +#include +#undef set_bits // mariadb.h defines set_bits, which is incompatible with boost +#include + const uint64_t AGG_BIT = 0x01; const uint64_t SUB_BIT = 0x02; const uint64_t AF_BIT = 0x04; diff --git a/primitives/linux-port/dictionary.cpp b/primitives/linux-port/dictionary.cpp index dd46c9739..e4325c65c 100644 --- a/primitives/linux-port/dictionary.cpp +++ b/primitives/linux-port/dictionary.cpp @@ -19,11 +19,6 @@ * $Id: dictionary.cpp 2122 2013-07-08 16:33:50Z bpaul $ */ -#include -#undef set_bits // mariadb.h defines set_bits, which is incompatible with boost -#include -#include - #include #include #include @@ -39,6 +34,11 @@ using namespace std; #include "dataconvert.h" #include +#include +#undef set_bits // mariadb.h defines set_bits, which is incompatible with boost +#include +#include + using namespace logging; const char* nullString = " "; // this is not NULL to preempt segfaults. diff --git a/utils/funcexp/func_concat.cpp b/utils/funcexp/func_concat.cpp index de77d6007..e2415f7d5 100644 --- a/utils/funcexp/func_concat.cpp +++ b/utils/funcexp/func_concat.cpp @@ -35,8 +35,6 @@ using namespace rowgroup; #include "dataconvert.h" using namespace dataconvert; -#define STRCOLL_ENH__ - namespace funcexp { diff --git a/utils/funcexp/func_concat_ws.cpp b/utils/funcexp/func_concat_ws.cpp index bb177e4fe..0fe0c06f8 100644 --- a/utils/funcexp/func_concat_ws.cpp +++ b/utils/funcexp/func_concat_ws.cpp @@ -35,8 +35,6 @@ using namespace execplan; #include "rowgroup.h" using namespace rowgroup; -#define STRCOLL_ENH__ - namespace funcexp { diff --git a/utils/funcexp/func_insert.cpp b/utils/funcexp/func_insert.cpp index 774d7c58d..a3326bb68 100644 --- a/utils/funcexp/func_insert.cpp +++ b/utils/funcexp/func_insert.cpp @@ -40,8 +40,6 @@ using namespace joblist; #include "utf8.h" using namespace utf8; -#define STRCOLL_ENH__ - namespace funcexp { diff --git a/utils/funcexp/func_lpad.cpp b/utils/funcexp/func_lpad.cpp index 4d75a3c5a..fad05e360 100644 --- a/utils/funcexp/func_lpad.cpp +++ b/utils/funcexp/func_lpad.cpp @@ -39,8 +39,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#define STRCOLL_ENH__ - namespace funcexp { const string Func_lpad::fPad = " "; @@ -90,7 +88,7 @@ std::string Func_lpad::getStrVal(rowgroup::Row& row, } // The pad characters. - const string* pad = &fPad; + const string* pad = &fPad; // Defaults to space if (fp.size() > 2) { pad = &fp[2]->data()->getStrVal(row, isNull); @@ -100,7 +98,7 @@ std::string Func_lpad::getStrVal(rowgroup::Row& row, const char* posP = pad->c_str(); // plen = the number of characters in pad size_t plen = cs->numchars(posP, posP+binPLen); - if (plen == 0 || plen > strLen) + if (plen == 0) return src; size_t byteCount = (padLength+1) * cs->mbmaxlen; // absolute maximun number of bytes @@ -112,15 +110,15 @@ std::string Func_lpad::getStrVal(rowgroup::Row& row, while (padLength >= plen) { - memcpy(pBuf, posP, plen); + memcpy(pBuf, posP, binPLen); padLength -= plen; - byteCount += plen; - pBuf += plen; + byteCount += binPLen; + pBuf += binPLen; } // Sometimes, in a case with multi-char pad, we need to add a partial pad if (padLength > 0) { - size_t partialSize = cs->charpos(posP, posP+plen, padLength); + size_t partialSize = cs->charpos(posP, posP+binPLen, padLength); memcpy(pBuf, posP, partialSize); byteCount += partialSize; pBuf += partialSize; diff --git a/utils/funcexp/func_reverse.cpp b/utils/funcexp/func_reverse.cpp index 6ef4fcf1f..848da8041 100644 --- a/utils/funcexp/func_reverse.cpp +++ b/utils/funcexp/func_reverse.cpp @@ -34,8 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#define STRCOLL_ENH__ - namespace { diff --git a/utils/funcexp/func_substring_index.cpp b/utils/funcexp/func_substring_index.cpp index a9f346b65..2bcad60eb 100644 --- a/utils/funcexp/func_substring_index.cpp +++ b/utils/funcexp/func_substring_index.cpp @@ -38,8 +38,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#define STRCOLL_ENH__ - namespace funcexp {