use compatible type max definitions

UINT8_MAX/UINT16_MAX only work on osx and glibc builds with certain
defines.
This commit is contained in:
Matt Broadstone 2014-08-05 15:28:19 -04:00
parent fdb8dddc14
commit 3ce39c273f
1 changed files with 4 additions and 4 deletions

View File

@ -90,9 +90,9 @@ void Table::writeFieldValue(QDataStream &stream, const QVariant &value)
case QMetaType::Int:
{
int i = qAbs(value.toInt());
if (i <= qint8(UINT8_MAX)) {
if (i <= qint8(SCHAR_MAX)) {
type = ShortShortInt;
} else if (i <= qint16(UINT16_MAX)) {
} else if (i <= qint16(SHRT_MAX)) {
type = ShortInt;
} else {
type = LongInt;
@ -105,9 +105,9 @@ void Table::writeFieldValue(QDataStream &stream, const QVariant &value)
case QMetaType::UInt:
{
int i = value.toInt();
if (i <= qint8(UINT8_MAX)) {
if (i <= qint8(SCHAR_MAX)) {
type = ShortShortInt;
} else if (i <= qint16(UINT16_MAX)) {
} else if (i <= qint16(SHRT_MAX)) {
type = ShortInt;
} else {
type = LongInt;