ClumpletReader.cpp (Firebird-3.0.2.32703-0.tar.bz2) | : | ClumpletReader.cpp (Firebird-3.0.4.33054-0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 705 | skipping to change at line 705 | |||
const UCHAR* ClumpletReader::getBytes() const | const UCHAR* ClumpletReader::getBytes() const | |||
{ | { | |||
return getBuffer() + cur_offset + getClumpletSize(true, true, false); | return getBuffer() + cur_offset + getClumpletSize(true, true, false); | |||
} | } | |||
SINT64 ClumpletReader::fromVaxInteger(const UCHAR* ptr, FB_SIZE_T length) | SINT64 ClumpletReader::fromVaxInteger(const UCHAR* ptr, FB_SIZE_T length) | |||
{ | { | |||
// We can't handle numbers bigger than int64. Some cases use length == 0. | // We can't handle numbers bigger than int64. Some cases use length == 0. | |||
fb_assert(ptr && length >= 0 && length < 9); | fb_assert(ptr && length >= 0 && length < 9); | |||
// This code is taken from gds__vax_integer | ||||
// This code is taken from isc_portable_integer() | ||||
// Be ready to parse buffer made by hand instead of ClumpletWriter | ||||
if (!ptr || length <= 0 || length > 8) | ||||
return 0; | ||||
SINT64 value = 0; | SINT64 value = 0; | |||
int shift = 0; | int shift = 0; | |||
while (length > 0) | ||||
while (--length > 0) | ||||
{ | { | |||
--length; | ||||
value += ((SINT64) *ptr++) << shift; | value += ((SINT64) *ptr++) << shift; | |||
shift += 8; | shift += 8; | |||
} | } | |||
value += ((SINT64)(SCHAR)*ptr) << shift; | ||||
return value; | return value; | |||
} | } | |||
SLONG ClumpletReader::getInt() const | SLONG ClumpletReader::getInt() const | |||
{ | { | |||
const FB_SIZE_T length = getClumpLength(); | const FB_SIZE_T length = getClumpLength(); | |||
if (length > 4) | if (length > 4) | |||
{ | { | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 9 lines changed or added |