32
32
33
33
using namespace Firebird ;
34
34
35
- const FB_SIZE_T SERVICE_SIZE = 256 ;
36
- const FB_SIZE_T SERVER_PART = 200 ;
37
- const FB_SIZE_T RESULT_BUF_SIZE = 512 ;
35
+ constexpr FB_SIZE_T SERVICE_SIZE = 256 ;
36
+ constexpr FB_SIZE_T SERVER_PART = 200 ;
37
+ constexpr FB_SIZE_T RESULT_BUF_SIZE = 512 ;
38
38
39
39
/* *
40
40
41
41
isValidServer
42
42
43
43
@brief Validates server name for non-local protocol.
44
- Replaces the original ugly macro.
45
- Now the function that calls isValidServer is responsible
46
- for returning NULL to its invoker in turn. It simply makes
44
+ The function that calls isValidServer is responsible
45
+ for returning NULL to its invoker in turn. It makes
47
46
sure there's something in the string containing the server's name;
48
47
otherwise it fills the status vector with an error.
49
48
@@ -52,7 +51,7 @@ const FB_SIZE_T RESULT_BUF_SIZE = 512;
52
51
@param server
53
52
54
53
**/
55
- static bool isValidServer (ISC_STATUS* status, const TEXT* server)
54
+ static bool isValidServer (ISC_STATUS* status, const TEXT* server) noexcept
56
55
{
57
56
if (!server || !*server)
58
57
{
@@ -101,22 +100,22 @@ static int typeBuffer(ISC_STATUS*, char*, int, Auth::UserData&, Firebird::IListU
101
100
// all this spb-writing functions should be gone
102
101
// as soon as we create SvcClumpletWriter
103
102
104
- inline void stuffSpbByte (char *& spb, char data)
103
+ inline void stuffSpbByte (char *& spb, char data) noexcept
105
104
{
106
105
*spb++ = data;
107
106
}
108
107
109
- inline void stuffSpbShort (char *& spb, short data)
108
+ inline void stuffSpbShort (char *& spb, short data) noexcept
110
109
{
111
110
ADD_SPB_LENGTH (spb, data);
112
111
}
113
112
114
- inline void stuffSpbLong (char *& spb, SLONG data)
113
+ inline void stuffSpbLong (char *& spb, SLONG data) noexcept
115
114
{
116
115
ADD_SPB_NUMERIC (spb, data);
117
116
}
118
117
119
- static void stuffSpb (char *& spb, char param, const TEXT* value)
118
+ static void stuffSpb (char *& spb, char param, const TEXT* value) noexcept
120
119
{
121
120
stuffSpbByte (spb, param);
122
121
int l = static_cast <int >(strlen (value));
@@ -126,7 +125,7 @@ static void stuffSpb(char*& spb, char param, const TEXT* value)
126
125
spb += l;
127
126
}
128
127
129
- static void stuffSpb2 (char *& spb, char param, const TEXT* value)
128
+ static void stuffSpb2 (char *& spb, char param, const TEXT* value) noexcept
130
129
{
131
130
stuffSpbByte (spb, param);
132
131
int l = static_cast <int >(strlen (value));
@@ -496,7 +495,7 @@ void callRemoteServiceManager(ISC_STATUS* status,
496
495
}
497
496
else
498
497
{
499
- const char request = isc_info_svc_line;
498
+ constexpr char request = isc_info_svc_line;
500
499
for (;;)
501
500
{
502
501
isc_resv_handle reserved = 0 ;
@@ -591,7 +590,7 @@ static void parseLong(const char*& p, Auth::IntField& f, FB_SIZE_T& loop)
591
590
f.setEntered (&statusWrapper, 1 );
592
591
check (&statusWrapper);
593
592
594
- const FB_SIZE_T len2 = sizeof (ULONG) + 1 ;
593
+ constexpr FB_SIZE_T len2 = sizeof (ULONG) + 1 ;
595
594
if (len2 > loop)
596
595
{
597
596
throw loop;
@@ -705,7 +704,7 @@ static int typeBuffer(ISC_STATUS* status, char* buf, int offset,
705
704
return -1 ;
706
705
}
707
706
}
708
- catch (FB_SIZE_T newOffset)
707
+ catch (const FB_SIZE_T newOffset)
709
708
{
710
709
memmove (buf, --p, newOffset);
711
710
return newOffset;
@@ -747,7 +746,7 @@ static void checkServerUsersVersion(isc_svc_handle svc_handle, char& server_user
747
746
{
748
747
case isc_info_svc_server_version:
749
748
{
750
- USHORT length = (USHORT) isc_vax_integer (p, sizeof (USHORT));
749
+ const USHORT length = (USHORT) isc_vax_integer (p, sizeof (USHORT));
751
750
p += sizeof (length);
752
751
version.assign (p, length);
753
752
p += length;
@@ -770,7 +769,7 @@ static void checkServerUsersVersion(isc_svc_handle svc_handle, char& server_user
770
769
if (isdigit (version[pos]))
771
770
{
772
771
version.erase (0 , pos);
773
- double f = atof (version.c_str ());
772
+ const double f = atof (version.c_str ());
774
773
if (f > 2.45 ) // need 2.5, but take into an account it's float
775
774
{
776
775
server_users = isc_action_svc_display_user_adm;
0 commit comments