Skip to content

Commit 7068e8e

Browse files
committed
Use constexpr instead of const
1 parent fe7d830 commit 7068e8e

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

src/remote/protocol.h

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -49,75 +49,75 @@ class RemBlobBuffer; // see remote.h
4949
// separate the protocol from the transport layer.
5050

5151
// p_cnct_cversion
52-
const USHORT CONNECT_VERSION3 = 3;
52+
constexpr USHORT CONNECT_VERSION3 = 3;
5353

5454
// Protocol 10 includes support for warnings and removes the requirement for
5555
// encoding and decoding status codes
5656

57-
const USHORT PROTOCOL_VERSION10 = 10;
57+
constexpr USHORT PROTOCOL_VERSION10 = 10;
5858

5959
// Since protocol 11 we must be separated from Borland Interbase.
6060
// Therefore always set highmost bit in protocol version to 1.
6161
// For unsigned protocol version this does not break version's compare.
6262

63-
const USHORT FB_PROTOCOL_FLAG = 0x8000;
64-
const USHORT FB_PROTOCOL_MASK = static_cast<USHORT>(~FB_PROTOCOL_FLAG);
63+
constexpr USHORT FB_PROTOCOL_FLAG = 0x8000;
64+
constexpr USHORT FB_PROTOCOL_MASK = ~FB_PROTOCOL_FLAG;
6565

6666
// Protocol 11 has support for user authentication related
6767
// operations (op_update_account_info, op_authenticate_user and
6868
// op_trusted_auth). When specific operation is not supported,
6969
// we say "sorry".
7070

71-
const USHORT PROTOCOL_VERSION11 = (FB_PROTOCOL_FLAG | 11);
71+
constexpr USHORT PROTOCOL_VERSION11 = (FB_PROTOCOL_FLAG | 11);
7272

7373
// Protocol 12 has support for asynchronous call op_cancel.
7474
// Currently implemented asynchronously only for TCP/IP.
7575

76-
const USHORT PROTOCOL_VERSION12 = (FB_PROTOCOL_FLAG | 12);
76+
constexpr USHORT PROTOCOL_VERSION12 = (FB_PROTOCOL_FLAG | 12);
7777

7878
// Protocol 13 has support for authentication plugins (op_cont_auth).
7979
// It also transfers SQL messages in the packed (null aware) format.
8080

81-
const USHORT PROTOCOL_VERSION13 = (FB_PROTOCOL_FLAG | 13);
81+
constexpr USHORT PROTOCOL_VERSION13 = (FB_PROTOCOL_FLAG | 13);
8282

8383
// Protocol 14:
8484
// - fixes a bug in database crypt key callback
8585

86-
const USHORT PROTOCOL_VERSION14 = (FB_PROTOCOL_FLAG | 14);
86+
constexpr USHORT PROTOCOL_VERSION14 = (FB_PROTOCOL_FLAG | 14);
8787

8888
// Protocol 15:
8989
// - supports crypt key callback at connect phase
9090

91-
const USHORT PROTOCOL_VERSION15 = (FB_PROTOCOL_FLAG | 15);
91+
constexpr USHORT PROTOCOL_VERSION15 = (FB_PROTOCOL_FLAG | 15);
9292

9393
// Protocol 16:
9494
// - supports statement timeouts
9595

96-
const USHORT PROTOCOL_VERSION16 = (FB_PROTOCOL_FLAG | 16);
97-
const USHORT PROTOCOL_STMT_TOUT = PROTOCOL_VERSION16;
96+
constexpr USHORT PROTOCOL_VERSION16 = (FB_PROTOCOL_FLAG | 16);
97+
constexpr USHORT PROTOCOL_STMT_TOUT = PROTOCOL_VERSION16;
9898

9999
// Protocol 17:
100100
// - supports op_batch_sync, op_info_batch
101101

102-
const USHORT PROTOCOL_VERSION17 = (FB_PROTOCOL_FLAG | 17);
102+
constexpr USHORT PROTOCOL_VERSION17 = (FB_PROTOCOL_FLAG | 17);
103103

104104
// Protocol 18:
105105
// - supports op_fetch_scroll
106106

107-
const USHORT PROTOCOL_VERSION18 = (FB_PROTOCOL_FLAG | 18);
108-
const USHORT PROTOCOL_FETCH_SCROLL = PROTOCOL_VERSION18;
107+
constexpr USHORT PROTOCOL_VERSION18 = (FB_PROTOCOL_FLAG | 18);
108+
constexpr USHORT PROTOCOL_FETCH_SCROLL = PROTOCOL_VERSION18;
109109

110110
// Protocol 19:
111111
// - supports op_inline_blob
112112

113-
const USHORT PROTOCOL_VERSION19 = (FB_PROTOCOL_FLAG | 19);
114-
const USHORT PROTOCOL_INLINE_BLOB = PROTOCOL_VERSION19;
113+
constexpr USHORT PROTOCOL_VERSION19 = (FB_PROTOCOL_FLAG | 19);
114+
constexpr USHORT PROTOCOL_INLINE_BLOB = PROTOCOL_VERSION19;
115115

116116
// Protocol 20:
117117
// - supports passing flags to IStatement::prepare
118118

119-
const USHORT PROTOCOL_VERSION20 = (FB_PROTOCOL_FLAG | 20);
120-
const USHORT PROTOCOL_PREPARE_FLAG = PROTOCOL_VERSION20;
119+
constexpr USHORT PROTOCOL_VERSION20 = (FB_PROTOCOL_FLAG | 20);
120+
constexpr USHORT PROTOCOL_PREPARE_FLAG = PROTOCOL_VERSION20;
121121

122122
// Architecture types
123123

@@ -143,28 +143,28 @@ enum P_ARCH
143143

144144
// Protocol Types
145145
// p_acpt_type
146-
//const USHORT ptype_page = 1; // Page server protocol
147-
//const USHORT ptype_rpc = 2; // Simple remote procedure call
148-
const USHORT ptype_batch_send = 3; // Batch sends, no asynchrony
149-
const USHORT ptype_out_of_band = 4; // Batch sends w/ out of band notification
150-
const USHORT ptype_lazy_send = 5; // Deferred packets delivery
151-
const USHORT ptype_MASK = 0xFF; // Mask - up to 255 types of protocol
146+
//constexpr USHORT ptype_page = 1; // Page server protocol
147+
//constexpr USHORT ptype_rpc = 2; // Simple remote procedure call
148+
constexpr USHORT ptype_batch_send = 3; // Batch sends, no asynchrony
149+
constexpr USHORT ptype_out_of_band = 4; // Batch sends w/ out of band notification
150+
constexpr USHORT ptype_lazy_send = 5; // Deferred packets delivery
151+
constexpr USHORT ptype_MASK = 0xFF; // Mask - up to 255 types of protocol
152152
//
153153
// upper byte is used for protocol flags
154-
const USHORT pflag_compress = 0x100; // Turn on compression if possible
155-
const USHORT pflag_win_sspi_nego = 0x200; // Win_SSPI supports Negotiate security package
154+
constexpr USHORT pflag_compress = 0x100; // Turn on compression if possible
155+
constexpr USHORT pflag_win_sspi_nego = 0x200; // Win_SSPI supports Negotiate security package
156156

157157
// Generic object id
158158

159159
typedef USHORT OBJCT;
160-
const int MAX_OBJCT_HANDLES = 65000;
161-
const int INVALID_OBJECT = MAX_USHORT;
160+
constexpr int MAX_OBJCT_HANDLES = 65000;
161+
constexpr int INVALID_OBJECT = MAX_USHORT;
162162

163163
// Statement flags
164164

165-
//const USHORT STMT_BLOB = 1;
166-
const USHORT STMT_NO_BATCH = 2;
167-
const USHORT STMT_DEFER_EXECUTE = 4;
165+
//constexpr USHORT STMT_BLOB = 1;
166+
constexpr USHORT STMT_NO_BATCH = 2;
167+
constexpr USHORT STMT_DEFER_EXECUTE = 4;
168168

169169
enum P_FETCH
170170
{
@@ -176,7 +176,7 @@ enum P_FETCH
176176
fetch_relative = 5
177177
};
178178

179-
const P_FETCH fetch_execute = fetch_next;
179+
constexpr P_FETCH fetch_execute = fetch_next;
180180

181181
// Operation (packet) types
182182

@@ -371,7 +371,7 @@ typedef struct cstring_const
371371

372372
// Debug xdr memory allocations
373373

374-
const USHORT P_MALLOC_SIZE = 64; // Xdr memory allocations per packet
374+
constexpr USHORT P_MALLOC_SIZE = 64; // Xdr memory allocations per packet
375375

376376
typedef struct p_malloc
377377
{
@@ -427,18 +427,18 @@ where
427427
428428
*/
429429

430-
const UCHAR CNCT_user = 1; // User name
431-
const UCHAR CNCT_passwd = 2;
432-
//const UCHAR CNCT_ppo = 3; // Apollo person, project, organization. OBSOLETE.
433-
const UCHAR CNCT_host = 4;
434-
const UCHAR CNCT_group = 5; // Effective Unix group id
435-
const UCHAR CNCT_user_verification = 6; // Attach/create using this connection
436-
// will use user verification
437-
const UCHAR CNCT_specific_data = 7; // Some data, needed for user verification on server
438-
const UCHAR CNCT_plugin_name = 8; // Name of plugin, which generated that data
439-
const UCHAR CNCT_login = 9; // Same data as isc_dpb_user_name
440-
const UCHAR CNCT_plugin_list = 10; // List of plugins, available on client
441-
const UCHAR CNCT_client_crypt = 11; // Client encryption level (DISABLED/ENABLED/REQUIRED)
430+
constexpr UCHAR CNCT_user = 1; // User name
431+
constexpr UCHAR CNCT_passwd = 2;
432+
//constexpr UCHAR CNCT_ppo = 3; // Apollo person, project, organization. OBSOLETE.
433+
constexpr UCHAR CNCT_host = 4;
434+
constexpr UCHAR CNCT_group = 5; // Effective Unix group id
435+
constexpr UCHAR CNCT_user_verification = 6; // Attach/create using this connection
436+
// will use user verification
437+
constexpr UCHAR CNCT_specific_data = 7; // Some data, needed for user verification on server
438+
constexpr UCHAR CNCT_plugin_name = 8; // Name of plugin, which generated that data
439+
constexpr UCHAR CNCT_login = 9; // Same data as isc_dpb_user_name
440+
constexpr UCHAR CNCT_plugin_list = 10; // List of plugins, available on client
441+
constexpr UCHAR CNCT_client_crypt = 11; // Client encryption level (DISABLED/ENABLED/REQUIRED)
442442

443443
// Accept Block (Server response to connect block)
444444

@@ -588,7 +588,7 @@ typedef struct p_req
588588
} P_REQ;
589589

590590
// p_req_type
591-
const USHORT P_REQ_async = 1; // Auxiliary asynchronous port
591+
constexpr USHORT P_REQ_async = 1; // Auxiliary asynchronous port
592592

593593
// DDL request
594594

0 commit comments

Comments
 (0)