fix for alignment bug on solaris 64 bit

removed compiler warning
parent c766cb4c
......@@ -242,6 +242,24 @@ int NdbIndexOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
m_theIndexDefined[i][2] = true;
Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize;
{
/*************************************************************************
* Check if the pointer of the value passed is aligned on a 4 byte
* boundary. If so only assign the pointer to the internal variable
* aValue. If it is not aligned then we start by copying the value to
* tempData and use this as aValue instead.
*************************************************************************/
const int attributeSize = sizeInBytes;
const int slack = sizeInBytes & 3;
if ((((UintPtr)aValue & 3) != 0) || (slack != 0)){
memcpy(&tempData[0], aValue, attributeSize);
aValue = (char*)&tempData[0];
if(slack != 0) {
char * tmp = (char*)&tempData[0];
memset(&tmp[attributeSize], 0, (4 - slack));
}//if
}//if
}
const char* aValueToWrite = aValue;
CHARSET_INFO* cs = tAttrInfo->m_cs;
......@@ -294,25 +312,8 @@ int NdbIndexOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
m_theIndexLen = m_theIndexLen + tAttrLenInWords;
}//if
#endif
/*************************************************************************
* Check if the pointer of the value passed is aligned on a 4 byte
* boundary. If so only assign the pointer to the internal variable
* aValue. If it is not aligned then we start by copying the value to
* tempData and use this as aValue instead.
*************************************************************************/
const int attributeSize = sizeInBytes;
const int slack = sizeInBytes & 3;
int tDistrKey = tAttrInfo->m_distributionKey;
int tDistrGroup = tAttrInfo->m_distributionGroup;
if ((((UintPtr)aValue & 3) != 0) || (slack != 0)){
memcpy(&tempData[0], aValue, attributeSize);
aValue = (char*)&tempData[0];
if(slack != 0) {
char * tmp = (char*)&tempData[0];
memset(&tmp[attributeSize], 0, (4 - slack));
}//if
}//if
OperationType tOpType = theOperationType;
if ((tDistrKey != 1) && (tDistrGroup != 1)) {
;
......
......@@ -118,6 +118,25 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
theTupleKeyDefined[i][2] = true;
Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize;
{
/***************************************************************************
* Check if the pointer of the value passed is aligned on a 4 byte
* boundary. If so only assign the pointer to the internal variable
* aValue. If it is not aligned then we start by copying the value to
* tempData and use this as aValue instead.
*****************************************************************************/
const int attributeSize = sizeInBytes;
const int slack = sizeInBytes & 3;
if ((((UintPtr)aValue & 3) != 0) || (slack != 0)){
memcpy(&tempData[0], aValue, attributeSize);
aValue = (char*)&tempData[0];
if(slack != 0) {
char * tmp = (char*)&tempData[0];
memset(&tmp[attributeSize], 0, (4 - slack));
}//if
}//if
}
const char* aValueToWrite = aValue;
CHARSET_INFO* cs = tAttrInfo->m_cs;
......@@ -170,24 +189,9 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
theTupKeyLen = theTupKeyLen + tAttrLenInWords;
}//if
#endif
/***************************************************************************
* Check if the pointer of the value passed is aligned on a 4 byte
* boundary. If so only assign the pointer to the internal variable
* aValue. If it is not aligned then we start by copying the value to
* tempData and use this as aValue instead.
*****************************************************************************/
const int attributeSize = sizeInBytes;
const int slack = sizeInBytes & 3;
int tDistrKey = tAttrInfo->m_distributionKey;
int tDistrGroup = tAttrInfo->m_distributionGroup;
if ((((UintPtr)aValue & 3) != 0) || (slack != 0)){
memcpy(&tempData[0], aValue, attributeSize);
aValue = (char*)&tempData[0];
if(slack != 0) {
char * tmp = (char*)&tempData[0];
memset(&tmp[attributeSize], 0, (4 - slack));
}//if
}//if
OperationType tOpType = theOperationType;
if ((tDistrKey != 1) && (tDistrGroup != 1)) {
;
......
......@@ -1261,7 +1261,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
const uint key_parts= key_info->key_parts;
uint key_tot_len[2];
uint tot_len;
int i, j;
uint i, j;
DBUG_ENTER("set_bounds");
DBUG_PRINT("info", ("key_parts=%d", key_parts));
......@@ -3877,13 +3877,14 @@ extern "C" byte* tables_get_key(const char *entry, uint *length,
int ndbcluster_find_files(THD *thd,const char *db,const char *path,
const char *wild, bool dir, List<char> *files)
{
DBUG_ENTER("ndbcluster_find_files");
DBUG_PRINT("enter", ("db: %s", db));
{ // extra bracket to avoid gcc 2.95.3 warning
uint i;
Ndb* ndb;
char name[FN_REFLEN];
HASH ndb_tables, ok_tables;
NdbDictionary::Dictionary::List list;
DBUG_ENTER("ndbcluster_find_files");
DBUG_PRINT("enter", ("db: %s", db));
if (!(ndb= check_ndb_in_thd(thd)))
DBUG_RETURN(HA_ERR_NO_CONNECTION);
......@@ -4023,6 +4024,7 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path,
hash_free(&ok_tables);
hash_free(&ndb_tables);
} // extra bracket to avoid gcc 2.95.3 warning
DBUG_RETURN(0);
}
......
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