Commit 65ed2544 authored by Olivier Bertrand's avatar Olivier Bertrand

Fix swapping key numeric values on Big Endian machines.

Change the preprocessor variable used from BIG_ENDIAN_ORDER
(only used by taoscript) to WORDS_BIGENDIAN.
  modified:   storage/connect/connect.cc
parent 70d80305
...@@ -709,7 +709,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) ...@@ -709,7 +709,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
return (tdbp->To_Kindex->IsMul()) ? 2 : 1; return (tdbp->To_Kindex->IsMul()) ? 2 : 1;
} // end of CntIndexInit } // end of CntIndexInit
#if defined(BIG_ENDIAN_ORDER) #if defined(WORDS_BIGENDIAN)
/***********************************************************************/ /***********************************************************************/
/* Swap bytes of the key that are written in little endian order. */ /* Swap bytes of the key that are written in little endian order. */
/***********************************************************************/ /***********************************************************************/
...@@ -729,7 +729,7 @@ static void SetSwapValue(PVAL valp, char *kp) ...@@ -729,7 +729,7 @@ static void SetSwapValue(PVAL valp, char *kp)
valp->SetBinValue((void*)kp); valp->SetBinValue((void*)kp);
} // end of SetSwapValue } // end of SetSwapValue
#endif //LITTLE ENDIAN #endif // WORDS_BIGENDIAN
/***********************************************************************/ /***********************************************************************/
/* IndexRead: fetch a record having the index value. */ /* IndexRead: fetch a record having the index value. */
...@@ -819,11 +819,11 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, ...@@ -819,11 +819,11 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
} // endif b } // endif b
} else } else
#if defined(BIG_ENDIAN_ORDER) #if defined(WORDS_BIGENDIAN)
SetSwapValue(valp, kp); SetSwapValue(valp, kp);
#else // LITTLE ENDIAN #else // !WORDS_BIGENDIAN
valp->SetBinValue((void*)kp); valp->SetBinValue((void*)kp);
#endif //LITTLE ENDIAN #endif //!WORDS_BIGENDIAN
kp+= valp->GetClen(); kp+= valp->GetClen();
...@@ -938,11 +938,11 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, ...@@ -938,11 +938,11 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
} // endif b } // endif b
} else } else
#if defined(BIG_ENDIAN_ORDER) #if defined(WORDS_BIGENDIAN)
SetSwapValue(valp, (char*)kp); SetSwapValue(valp, (char*)kp);
#else // LITTLE ENDIAN #else // !WORDS_BIGENDIAN
valp->SetBinValue((void*)kp); valp->SetBinValue((void*)kp);
#endif //LITTLE ENDIAN #endif // !WORDS_BIGENDIAN
if (trace) { if (trace) {
char bf[32]; char bf[32];
......
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