Skip to content

Commit

Permalink
Fix swapping key numeric values on Big Endian machines.
Browse files Browse the repository at this point in the history
Change the preprocessor variable used from BIG_ENDIAN_ORDER
(only used by taoscript) to WORDS_BIGENDIAN.
  modified:   storage/connect/connect.cc
  • Loading branch information
Buggynours committed Jun 3, 2015
1 parent 70d8030 commit 65ed254
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions storage/connect/connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
return (tdbp->To_Kindex->IsMul()) ? 2 : 1;
} // end of CntIndexInit

#if defined(BIG_ENDIAN_ORDER)
#if defined(WORDS_BIGENDIAN)
/***********************************************************************/
/* Swap bytes of the key that are written in little endian order. */
/***********************************************************************/
Expand All @@ -729,7 +729,7 @@ static void SetSwapValue(PVAL valp, char *kp)
valp->SetBinValue((void*)kp);

} // end of SetSwapValue
#endif //LITTLE ENDIAN
#endif // WORDS_BIGENDIAN

/***********************************************************************/
/* IndexRead: fetch a record having the index value. */
Expand Down Expand Up @@ -819,11 +819,11 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
} // endif b

} else
#if defined(BIG_ENDIAN_ORDER)
#if defined(WORDS_BIGENDIAN)
SetSwapValue(valp, kp);
#else // LITTLE ENDIAN
#else // !WORDS_BIGENDIAN
valp->SetBinValue((void*)kp);
#endif //LITTLE ENDIAN
#endif //!WORDS_BIGENDIAN

kp+= valp->GetClen();

Expand Down Expand Up @@ -938,11 +938,11 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
} // endif b

} else
#if defined(BIG_ENDIAN_ORDER)
#if defined(WORDS_BIGENDIAN)
SetSwapValue(valp, (char*)kp);
#else // LITTLE ENDIAN
#else // !WORDS_BIGENDIAN
valp->SetBinValue((void*)kp);
#endif //LITTLE ENDIAN
#endif // !WORDS_BIGENDIAN

if (trace) {
char bf[32];
Expand Down

0 comments on commit 65ed254

Please sign in to comment.