summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2004-10-25 20:35:46 +0000
committerunknown <tomas@poseidon.ndb.mysql.com>2004-10-25 20:35:46 +0000
commitc436a91c768c44b7ec98bf5e50632829d52ad106 (patch)
tree3d886ca5e1b199aa796291fc776e5074ee013566
parent8fb29e5d00e578c351ae6b65521a47cc8998bdec (diff)
downloadmariadb-git-c436a91c768c44b7ec98bf5e50632829d52ad106.tar.gz
fix for alignment bug on solaris 64 bit
removed compiler warning ndb/src/ndbapi/NdbIndexOperation.cpp: fix for alignment bug on solaris 64 bit ndb/src/ndbapi/NdbOperationSearch.cpp: fix for alignment bug on solaris 64 bit sql/ha_ndbcluster.cc: removed compiler warning
-rw-r--r--ndb/src/ndbapi/NdbIndexOperation.cpp35
-rw-r--r--ndb/src/ndbapi/NdbOperationSearch.cpp36
-rw-r--r--sql/ha_ndbcluster.cc8
3 files changed, 43 insertions, 36 deletions
diff --git a/ndb/src/ndbapi/NdbIndexOperation.cpp b/ndb/src/ndbapi/NdbIndexOperation.cpp
index 83de6d9ef87..9abde639914 100644
--- a/ndb/src/ndbapi/NdbIndexOperation.cpp
+++ b/ndb/src/ndbapi/NdbIndexOperation.cpp
@@ -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)) {
;
diff --git a/ndb/src/ndbapi/NdbOperationSearch.cpp b/ndb/src/ndbapi/NdbOperationSearch.cpp
index 0d3130fffd0..69b4e803acd 100644
--- a/ndb/src/ndbapi/NdbOperationSearch.cpp
+++ b/ndb/src/ndbapi/NdbOperationSearch.cpp
@@ -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)) {
;
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 145fd23ff43..044cb85b913 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -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);
}