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

Misc: use sizeof instead.

This commit is contained in:
robocop 2008-06-26 12:02:21 +00:00
parent 83a5935273
commit f9fe3a771b

View File

@ -132,7 +132,7 @@ void ClumpletWriter::toVaxInteger(UCHAR* ptr, size_t length, SINT64 value)
void ClumpletWriter::insertInt(UCHAR tag, SLONG value) void ClumpletWriter::insertInt(UCHAR tag, SLONG value)
{ {
UCHAR bytes[4]; UCHAR bytes[sizeof(SLONG)];
toVaxInteger(bytes, sizeof(bytes), value); toVaxInteger(bytes, sizeof(bytes), value);
insertBytesLengthCheck(tag, bytes, sizeof(bytes)); insertBytesLengthCheck(tag, bytes, sizeof(bytes));
@ -140,7 +140,7 @@ void ClumpletWriter::insertInt(UCHAR tag, SLONG value)
void ClumpletWriter::insertBigInt(UCHAR tag, SINT64 value) void ClumpletWriter::insertBigInt(UCHAR tag, SINT64 value)
{ {
UCHAR bytes[8]; UCHAR bytes[sizeof(SINT64)];
toVaxInteger(bytes, sizeof(bytes), value); toVaxInteger(bytes, sizeof(bytes), value);
insertBytesLengthCheck(tag, bytes, sizeof(bytes)); insertBytesLengthCheck(tag, bytes, sizeof(bytes));
@ -156,7 +156,7 @@ void ClumpletWriter::insertDouble(UCHAR tag, double value)
fb_assert(sizeof(double) == sizeof(temp)); fb_assert(sizeof(double) == sizeof(temp));
temp.temp_double = value; temp.temp_double = value;
UCHAR bytes[8]; UCHAR bytes[sizeof(double)];
toVaxInteger(bytes, sizeof(SLONG), temp.temp_long[FB_LONG_DOUBLE_FIRST]); toVaxInteger(bytes, sizeof(SLONG), temp.temp_long[FB_LONG_DOUBLE_FIRST]);
toVaxInteger(bytes + sizeof(SLONG), sizeof(SLONG), temp.temp_long[FB_LONG_DOUBLE_SECOND]); toVaxInteger(bytes + sizeof(SLONG), sizeof(SLONG), temp.temp_long[FB_LONG_DOUBLE_SECOND]);
insertBytesLengthCheck(tag, bytes, sizeof(bytes)); insertBytesLengthCheck(tag, bytes, sizeof(bytes));
@ -164,7 +164,7 @@ void ClumpletWriter::insertDouble(UCHAR tag, double value)
void ClumpletWriter::insertTimeStamp(UCHAR tag, ISC_TIMESTAMP value) void ClumpletWriter::insertTimeStamp(UCHAR tag, ISC_TIMESTAMP value)
{ {
UCHAR bytes[8]; UCHAR bytes[sizeof(ISC_TIMESTAMP)];
toVaxInteger(bytes, sizeof(SLONG), value.timestamp_date); toVaxInteger(bytes, sizeof(SLONG), value.timestamp_date);
toVaxInteger(bytes + sizeof(SLONG), sizeof(SLONG), value.timestamp_time); toVaxInteger(bytes + sizeof(SLONG), sizeof(SLONG), value.timestamp_time);
insertBytesLengthCheck(tag, bytes, sizeof(bytes)); insertBytesLengthCheck(tag, bytes, sizeof(bytes));