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

Replace 'octets' word and avoid some casts

This commit is contained in:
hvlad 2018-06-19 12:49:40 +03:00
parent b9da7ba014
commit 287b8300de
3 changed files with 11 additions and 11 deletions

View File

@ -5948,7 +5948,7 @@ string print_key(thread_db* tdbb, jrd_rel* relation, index_desc* idx, Record* re
MET_scan_relation(tdbb, relation);
}
const int MAX_KEY_STRING_LEN = 250;
const FB_SIZE_T MAX_KEY_STRING_LEN = 250;
string key, value;
try

View File

@ -491,7 +491,7 @@ DecimalFixed MOV_get_dec_fixed(Jrd::thread_db* tdbb, const dsc* desc, SSHORT sca
namespace Jrd
{
DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, int mLen)
DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, FB_SIZE_T mLen)
: maxLen(mLen)
{
const char* const NULL_KEY_STRING = "NULL";
@ -504,8 +504,8 @@ DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, int mLen)
fb_assert(!desc->isBlob());
const bool octets = (desc->isText() && desc->getTextType() == ttype_binary);
value = MOV_make_string2(tdbb, desc, octets ? ttype_binary : ttype_dynamic);
const bool isBinary = (desc->isText() && desc->getTextType() == ttype_binary);
value = MOV_make_string2(tdbb, desc, isBinary ? ttype_binary : ttype_dynamic);
const char* const str = value.c_str();
@ -517,18 +517,18 @@ DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, int mLen)
value.rtrim(pad);
}
if (octets)
if (isBinary)
{
Firebird::string hex;
string hex;
int len = (int) value.length();
FB_SIZE_T len = value.length();
const bool cut = (len > (maxLen - 3) / 2);
if (cut)
len = (maxLen - 5) / 2;
char* s = hex.getBuffer(2 * len);
for (int i = 0; i < len; i++)
for (FB_SIZE_T i = 0; i < len; i++)
{
sprintf(s, "%02X", (int)(unsigned char) str[i]);
s += 2;
@ -539,7 +539,7 @@ DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, int mLen)
value = "'" + value + "'";
}
if (value.length() > (FB_SIZE_T) maxLen)
if (value.length() > maxLen)
{
fb_assert(desc->isText());

View File

@ -61,7 +61,7 @@ namespace Jrd
class DescPrinter
{
public:
DescPrinter(thread_db* tdbb, const dsc* desc, int mLen);
DescPrinter(thread_db* tdbb, const dsc* desc, FB_SIZE_T mLen);
const Firebird::string& get() const
{
@ -70,7 +70,7 @@ public:
private:
Firebird::string value;
int maxLen;
FB_SIZE_T maxLen;
};
} // namespace Jrd