Bug #28287 Sign problem in test "ndb_restore_print"

  - corrected previous patch
  - some platforms do strange things with char... use Int8 to be sure of signedness
parent aaeca5bd
......@@ -164,7 +164,14 @@ public:
*
* @return Char value.
*/
Int8 char_value() const;
char char_value() const;
/**
* Get value stored in NdbRecAttr object.
*
* @return Int8 value.
*/
Int8 int8_value() const;
/**
* Get value stored in NdbRecAttr object.
......@@ -201,6 +208,13 @@ public:
*/
Uint8 u_char_value() const;
/**
* Get value stored in NdbRecAttr object.
*
* @return Uint8 value.
*/
Uint8 u_8_value() const;
/**
* Get value stored in NdbRecAttr object.
*
......@@ -340,8 +354,15 @@ NdbRecAttr::short_value() const
}
inline
Int8
char
NdbRecAttr::char_value() const
{
return *(char*)theRef;
}
inline
Int8
NdbRecAttr::int8_value() const
{
return *(Int8*)theRef;
}
......@@ -367,6 +388,13 @@ NdbRecAttr::u_char_value() const
return *(Uint8*)theRef;
}
inline
Uint8
NdbRecAttr::u_8_value() const
{
return *(Uint8*)theRef;
}
inline
void
NdbRecAttr::release()
......
......@@ -272,7 +272,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
out << r.u_short_value();
break;
case NdbDictionary::Column::Tinyunsigned:
out << (unsigned) r.u_char_value();
out << (unsigned) r.u_8_value();
break;
case NdbDictionary::Column::Bigint:
out << r.int64_value();
......@@ -287,7 +287,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
out << r.short_value();
break;
case NdbDictionary::Column::Tinyint:
out << (int) r.char_value();
out << (int) r.int8_value();
break;
case NdbDictionary::Column::Binary:
if (!f.hex_format)
......@@ -413,7 +413,7 @@ ndbrecattr_print_formatted(NdbOut& out, const NdbRecAttr &r,
break;
case NdbDictionary::Column::Year:
{
uint year = 1900 + r.u_char_value();
uint year = 1900 + r.u_8_value();
char buf[40];
sprintf(buf, "%04d", year);
out << buf;
......
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