1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-24 14:20:59 +03:00

Another try to cope with warnings under gcc 8.2.

This commit is contained in:
Roman Nozdrin
2018-11-30 13:24:58 +03:00
parent cbbf267e88
commit 9dc33c4e82
37 changed files with 145 additions and 100 deletions

View File

@@ -803,7 +803,8 @@ int Dctnry::insertDctnry(const char* buf,
while (startPos < totalRow)
{
found = false;
memset(&curSig, 0, sizeof(curSig));
void *curSigPtr = static_cast<void*>(&curSig);
memset(curSigPtr, 0, sizeof(curSig));
curSig.size = pos[startPos][col].offset;
// Strip trailing null bytes '\0' (by adjusting curSig.size) if import-
@@ -1317,7 +1318,8 @@ void Dctnry::preLoadStringCache( const DataBlock& fileBlock )
int op = 1; // ordinal position of the string within the block
Signature aSig;
memset( &aSig, 0, sizeof(Signature));
void *aSigPtr = static_cast<void*>(&aSig);
memset(aSigPtr, 0, sizeof(aSig));
while ((offBeg != DCTNRY_END_HEADER) &&
(op <= MAX_STRING_CACHE_SIZE))
@@ -1361,8 +1363,10 @@ void Dctnry::preLoadStringCache( const DataBlock& fileBlock )
******************************************************************************/
void Dctnry::addToStringCache( const Signature& newSig )
{
// We better add constructors that sets everything to 0;
Signature asig;
memset(&asig, 0, sizeof(Signature));
void *aSigPtr = static_cast<void*>(&asig);
memset(aSigPtr, 0, sizeof(asig));
asig.signature = new unsigned char[newSig.size];
memcpy(asig.signature, newSig.signature, newSig.size );
asig.size = newSig.size;

View File

@@ -2469,7 +2469,8 @@ uint8_t WE_DDLCommandProc::updateSyscolumnTablename(ByteStream& bs, std::string&
//It's the same string for each column, so we just need one dictionary struct
memset(&dictTuple, 0, sizeof(dictTuple));
void *dictTuplePtr = static_cast<void*>(&dictTuple);
memset(dictTuplePtr, 0, sizeof(dictTuple));
dictTuple.sigValue = (unsigned char*)newTablename.c_str();
dictTuple.sigSize = newTablename.length();
dictTuple.isNull = false;
@@ -3292,7 +3293,8 @@ uint8_t WE_DDLCommandProc::updateSystablesTablename(ByteStream& bs, std::string&
//It's the same string for each column, so we just need one dictionary struct
memset(&dictTuple, 0, sizeof(dictTuple));
void *dictTuplePtr = static_cast<void*>(&dictTuple);
memset(dictTuplePtr, 0, sizeof(dictTuple));
dictTuple.sigValue = (unsigned char*)newTablename.c_str();
dictTuple.sigSize = newTablename.length();
dictTuple.isNull = false;

View File

@@ -332,12 +332,15 @@ int FileOp::deleteFile( FID fid ) const
std::vector<std::string> dbRootPathList;
Config::getDBRootPathList( dbRootPathList );
int rc;
for (unsigned i = 0; i < dbRootPathList.size(); i++)
{
char rootOidDirName[FILE_NAME_SIZE];
sprintf(rootOidDirName, "%s/%s", dbRootPathList[i].c_str(), oidDirName);
rc = snprintf(rootOidDirName, FILE_NAME_SIZE, "%s/%s",
dbRootPathList[i].c_str(), oidDirName);
if ( IDBPolicy::remove( rootOidDirName ) != 0 )
if ( rc == FILE_NAME_SIZE || IDBPolicy::remove( rootOidDirName ) != 0 )
{
ostringstream oss;
oss << "Unable to remove " << rootOidDirName;
@@ -365,6 +368,7 @@ int FileOp::deleteFiles( const std::vector<int32_t>& fids ) const
char dbDir [MAX_DB_DIR_LEVEL][MAX_DB_DIR_NAME_SIZE];
std::vector<std::string> dbRootPathList;
Config::getDBRootPathList( dbRootPathList );
int rc;
for ( unsigned n = 0; n < fids.size(); n++ )
{
@@ -378,10 +382,10 @@ int FileOp::deleteFiles( const std::vector<int32_t>& fids ) const
for (unsigned i = 0; i < dbRootPathList.size(); i++)
{
char rootOidDirName[FILE_NAME_SIZE];
sprintf(rootOidDirName, "%s/%s", dbRootPathList[i].c_str(),
rc = snprintf(rootOidDirName, FILE_NAME_SIZE, "%s/%s", dbRootPathList[i].c_str(),
oidDirName);
if ( IDBPolicy::remove( rootOidDirName ) != 0 )
if ( rc == FILE_NAME_SIZE || IDBPolicy::remove( rootOidDirName ) != 0 )
{
ostringstream oss;
oss << "Unable to remove " << rootOidDirName;
@@ -412,6 +416,7 @@ int FileOp::deletePartitions( const std::vector<OID>& fids,
char dbDir [MAX_DB_DIR_LEVEL][MAX_DB_DIR_NAME_SIZE];
char rootOidDirName[FILE_NAME_SIZE];
char partitionDirName[FILE_NAME_SIZE];
int rcd, rcp;
for (uint32_t i = 0; i < partitions.size(); i++)
{
@@ -422,12 +427,13 @@ int FileOp::deletePartitions( const std::vector<OID>& fids,
dbDir[0], dbDir[1], dbDir[2], dbDir[3], dbDir[4]);
// config expects dbroot starting from 0
std::string rt( Config::getDBRootByNum(partitions[i].lp.dbroot) );
sprintf(rootOidDirName, "%s/%s",
rcd = snprintf(rootOidDirName, FILE_NAME_SIZE, "%s/%s",
rt.c_str(), tempFileName);
sprintf(partitionDirName, "%s/%s",
rcp = snprintf(partitionDirName, FILE_NAME_SIZE, "%s/%s",
rt.c_str(), oidDirName);
if ( IDBPolicy::remove( rootOidDirName ) != 0 )
if ( rcd == FILE_NAME_SIZE || rcp == FILE_NAME_SIZE
|| IDBPolicy::remove( rootOidDirName ) != 0 )
{
ostringstream oss;
oss << "Unable to remove " << rootOidDirName;

View File

@@ -393,7 +393,7 @@ struct IdxMultiColKey
curMask.reset();
curLevel = maxLevel = 0;
totalBit = 0;
memset( testbitArray, 0, IDX_MAX_MULTI_COL_IDX_LEVEL);
memset( testbitArray, 0, IDX_MAX_MULTI_COL_IDX_LEVEL * sizeof(testbitArray[0]));
memset( keyBuf, 0, IDX_MAX_MULTI_COL_BIT / 8 );
curMask = 0x1F;
curMask = curMask << (IDX_MAX_MULTI_COL_BIT - 5);

View File

@@ -487,7 +487,7 @@ struct CacheControl /** @brief Cache control structure */
int checkInterval; /** @brief A check point interval in seconds */
CacheControl()
{
totalBlock = pctFree = checkInterval; /** @brief constructor */
totalBlock = pctFree = checkInterval = 0; /** @brief constructor */
}
};

View File

@@ -356,7 +356,7 @@ unsigned int WEFileReadThread::readDataFile(messageqcpp::SBS& Sbs)
//char aBuff[1024*1024]; // TODO May have to change it later
//char*pStart = aBuff;
unsigned int aIdx = 0;
unsigned int aLen = 0;
int aLen = 0;
*Sbs << (ByteStream::byte)(WE_CLT_SRV_DATA);
while ((!fInFile.eof()) && (aIdx < getBatchQty()))

View File

@@ -238,7 +238,8 @@ int ColumnOp::allocRowId(const TxnID& txnid, bool useStartingExtent,
for (i = 0; i < dbRootExtentTrackers.size(); i++)
{
if (i != (int) column.colNo)
uint32_t colNo = column.colNo;
if (i != colNo)
dbRootExtentTrackers[i]->nextSegFile(dbRoot, partition, segment, newHwm, startLbid);
// Round up HWM to the end of the current extent