Skip to content

Commit 0fb3294

Browse files
committed
Fix conversion warnings in utils
+ constexpr + misc changes
1 parent 78c7937 commit 0fb3294

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/common/utils.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,8 +1130,8 @@ void exactNumericToStr(SINT64 value, int scale, Firebird::string& target, bool a
11301130
return;
11311131
}
11321132

1133-
const int MAX_SCALE = 25;
1134-
const int MAX_BUFFER = 50;
1133+
constexpr int MAX_SCALE = 25;
1134+
constexpr int MAX_BUFFER = 50;
11351135

11361136
if (scale < -MAX_SCALE || scale > MAX_SCALE)
11371137
{
@@ -1233,7 +1233,7 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
12331233
#else
12341234
char tmp[MAXPATHLEN];
12351235

1236-
const char* configDir[] = {
1236+
static constexpr const char* configDir[] = {
12371237
FB_BINDIR, FB_SBINDIR, FB_CONFDIR, FB_LIBDIR, FB_INCDIR, FB_DOCDIR, "", FB_SAMPLEDIR,
12381238
FB_SAMPLEDBDIR, "", FB_INTLDIR, FB_MISCDIR, FB_SECDBDIR, FB_MSGDIR, FB_LOGDIR,
12391239
FB_GUARDDIR, FB_PLUGDIR, FB_TZDATADIR
@@ -1470,10 +1470,10 @@ bool cmpStatus(unsigned int len, const ISC_STATUS* a, const ISC_STATUS* b) noexc
14701470
if (i > len) // arg does not fit
14711471
return false;
14721472

1473-
unsigned l1, l2;
1474-
const char *s1, *s2;
14751473
if (isStr(*op1))
14761474
{
1475+
FB_SIZE_T l1, l2;
1476+
const char* s1, * s2;
14771477
if (*op1 == isc_arg_cstring)
14781478
{
14791479
l1 = op1[1];
@@ -1485,8 +1485,8 @@ bool cmpStatus(unsigned int len, const ISC_STATUS* a, const ISC_STATUS* b) noexc
14851485
{
14861486
s1 = (const char*)(op1[1]);
14871487
s2 = (const char*)(op2[1]);
1488-
l1 = strlen(s1);
1489-
l2 = strlen(s2);
1488+
l1 = fb_strlen(s1);
1489+
l2 = fb_strlen(s2);
14901490
}
14911491

14921492
if (l1 != l2)
@@ -1520,7 +1520,7 @@ unsigned int subStatus(const ISC_STATUS* in, unsigned int cin,
15201520

15211521
if (isStr(*op1))
15221522
{
1523-
unsigned l1, l2;
1523+
FB_SIZE_T l1, l2;
15241524
const char *s1, *s2;
15251525
if (*op1 == isc_arg_cstring)
15261526
{
@@ -1533,8 +1533,8 @@ unsigned int subStatus(const ISC_STATUS* in, unsigned int cin,
15331533
{
15341534
s1 = (const char*) (op1[1]);
15351535
s2 = (const char*) (op2[1]);
1536-
l1 = strlen(s1);
1537-
l2 = strlen(s2);
1536+
l1 = fb_strlen(s1);
1537+
l2 = fb_strlen(s2);
15381538
}
15391539

15401540
if (l1 != l2)

src/common/utils_proto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ namespace fb_utils
225225
bool bootBuild();
226226

227227
// Add appropriate file prefix.
228-
Firebird::PathName getPrefix(unsigned prefType, const char* name);
228+
Firebird::PathName getPrefix(unsigned int prefType, const char* name);
229229

230230
// moves DB path information (from limbo transaction) to another buffer
231231
void getDbPathInfo(unsigned int& itemsLength, const unsigned char*& items,

0 commit comments

Comments
 (0)