8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 00:03:02 +01:00

postfix for CORE-4760: take care about RISC CPUs

This commit is contained in:
alexpeshkoff 2015-04-30 14:42:57 +00:00
parent 0ac40f77be
commit 3921d436ad
2 changed files with 25 additions and 3 deletions

View File

@ -81,6 +81,24 @@ public:
}
};
// Align in/out parameter.
template <typename C>
class BiAligner : public OutAligner<C>
{
public:
BiAligner(UCHAR* buf, ULONG len)
: OutAligner<C>(buf, len)
{
#ifdef RISC_ALIGNMENT
C* ptr = this->operator C*();
if (buf != reinterpret_cast<UCHAR*>(ptr))
{
memcpy(ptr, buf, len);
}
#endif
}
};
// Aligns input parameter.
template <typename C>
class Aligner

View File

@ -54,6 +54,7 @@
#include "../common/config/config.h"
#include "../common/config/dir_list.h"
#include "../common/classes/init.h"
#include "../common/classes/Aligner.h"
#include "../common/utils_proto.h"
#include "../common/os/os_utils.h"
@ -1708,9 +1709,12 @@ void ISC_utf8Upper(Firebird::AbstractString& str)
#ifdef HAVE_ICONV_H
iConv().utf8ToUnicode.convert(str);
unsigned short* const end = (unsigned short*)(str.end());
for (unsigned short* begin = (unsigned short*)(str.begin()); begin < end; ++begin)
*begin = unicodeUpper(*begin);
{ // aligner scope
Firebird::BiAligner<unsigned short> alignedStr(reinterpret_cast<UCHAR*>(str.begin()), str.length());
unsigned short* const end = alignedStr + (str.length() / 2);
for (unsigned short* begin = alignedStr; begin < end; ++begin)
*begin = unicodeUpper(*begin);
}
iConv().unicodeToUtf8.convert(str);
#endif // HAVE_ICONV_H