3232
3333using namespace Firebird ;
3434
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 ;
3838
3939/* *
4040
4141 isValidServer
4242
4343 @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
4746 sure there's something in the string containing the server's name;
4847 otherwise it fills the status vector with an error.
4948
@@ -52,7 +51,7 @@ const FB_SIZE_T RESULT_BUF_SIZE = 512;
5251 @param server
5352
5453 **/
55- static bool isValidServer (ISC_STATUS* status, const TEXT* server)
54+ static bool isValidServer (ISC_STATUS* status, const TEXT* server) noexcept
5655{
5756 if (!server || !*server)
5857 {
@@ -101,22 +100,22 @@ static int typeBuffer(ISC_STATUS*, char*, int, Auth::UserData&, Firebird::IListU
101100// all this spb-writing functions should be gone
102101// as soon as we create SvcClumpletWriter
103102
104- inline void stuffSpbByte (char *& spb, char data)
103+ inline void stuffSpbByte (char *& spb, char data) noexcept
105104{
106105 *spb++ = data;
107106}
108107
109- inline void stuffSpbShort (char *& spb, short data)
108+ inline void stuffSpbShort (char *& spb, short data) noexcept
110109{
111110 ADD_SPB_LENGTH (spb, data);
112111}
113112
114- inline void stuffSpbLong (char *& spb, SLONG data)
113+ inline void stuffSpbLong (char *& spb, SLONG data) noexcept
115114{
116115 ADD_SPB_NUMERIC (spb, data);
117116}
118117
119- static void stuffSpb (char *& spb, char param, const TEXT* value)
118+ static void stuffSpb (char *& spb, char param, const TEXT* value) noexcept
120119{
121120 stuffSpbByte (spb, param);
122121 int l = static_cast <int >(strlen (value));
@@ -126,7 +125,7 @@ static void stuffSpb(char*& spb, char param, const TEXT* value)
126125 spb += l;
127126}
128127
129- static void stuffSpb2 (char *& spb, char param, const TEXT* value)
128+ static void stuffSpb2 (char *& spb, char param, const TEXT* value) noexcept
130129{
131130 stuffSpbByte (spb, param);
132131 int l = static_cast <int >(strlen (value));
@@ -496,7 +495,7 @@ void callRemoteServiceManager(ISC_STATUS* status,
496495 }
497496 else
498497 {
499- const char request = isc_info_svc_line;
498+ constexpr char request = isc_info_svc_line;
500499 for (;;)
501500 {
502501 isc_resv_handle reserved = 0 ;
@@ -591,7 +590,7 @@ static void parseLong(const char*& p, Auth::IntField& f, FB_SIZE_T& loop)
591590 f.setEntered (&statusWrapper, 1 );
592591 check (&statusWrapper);
593592
594- const FB_SIZE_T len2 = sizeof (ULONG) + 1 ;
593+ constexpr FB_SIZE_T len2 = sizeof (ULONG) + 1 ;
595594 if (len2 > loop)
596595 {
597596 throw loop;
@@ -705,7 +704,7 @@ static int typeBuffer(ISC_STATUS* status, char* buf, int offset,
705704 return -1 ;
706705 }
707706 }
708- catch (FB_SIZE_T newOffset)
707+ catch (const FB_SIZE_T newOffset)
709708 {
710709 memmove (buf, --p, newOffset);
711710 return newOffset;
@@ -747,7 +746,7 @@ static void checkServerUsersVersion(isc_svc_handle svc_handle, char& server_user
747746 {
748747 case isc_info_svc_server_version:
749748 {
750- USHORT length = (USHORT) isc_vax_integer (p, sizeof (USHORT));
749+ const USHORT length = (USHORT) isc_vax_integer (p, sizeof (USHORT));
751750 p += sizeof (length);
752751 version.assign (p, length);
753752 p += length;
@@ -770,7 +769,7 @@ static void checkServerUsersVersion(isc_svc_handle svc_handle, char& server_user
770769 if (isdigit (version[pos]))
771770 {
772771 version.erase (0 , pos);
773- double f = atof (version.c_str ());
772+ const double f = atof (version.c_str ());
774773 if (f > 2.45 ) // need 2.5, but take into an account it's float
775774 {
776775 server_users = isc_action_svc_display_user_adm;
0 commit comments