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
This commit is contained in:
tomas@whalegate.ndb.mysql.com 2007-05-09 14:31:22 +02:00
parent aaeca5bda8
commit 9b1157537b
2 changed files with 33 additions and 5 deletions

View File

@ -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()

View File

@ -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;