@@ -96,7 +96,7 @@ struct sort_record
9696
9797};
9898
99- const ULONG MAX_SORT_RECORD = 1024 * 1024 ; // 1MB
99+ inline constexpr ULONG MAX_SORT_RECORD = 1024 * 1024 ; // 1MB
100100
101101// the record struct actually contains the keyids etc, and the back_pointer
102102// which points to the sort_record structure.
@@ -129,32 +129,32 @@ until we are out of records to sort or memory.
129129
130130// skd_dtype
131131
132- const int SKD_long = 1 ;
133- const int SKD_ulong = 2 ;
134- const int SKD_short = 3 ;
135- const int SKD_ushort = 4 ;
136- const int SKD_text = 5 ;
137- const int SKD_float = 6 ;
138- const int SKD_double = 7 ;
139- const int SKD_quad = 8 ;
140- const int SKD_timestamp = 9 ;
141- const int SKD_bytes = 10 ;
142- const int SKD_varying = 11 ; // non-international
143- const int SKD_cstring = 12 ; // non-international
144- const int SKD_sql_time = 13 ;
145- const int SKD_sql_date = 14 ;
146- const int SKD_int64 = 15 ;
147- const int SKD_dec64 = 16 ;
148- const int SKD_dec128 = 17 ;
149- const int SKD_sql_time_tz = 18 ;
150- const int SKD_timestamp_tz = 19 ;
151- const int SKD_int128 = 20 ;
132+ inline constexpr int SKD_long = 1 ;
133+ inline constexpr int SKD_ulong = 2 ;
134+ inline constexpr int SKD_short = 3 ;
135+ inline constexpr int SKD_ushort = 4 ;
136+ inline constexpr int SKD_text = 5 ;
137+ inline constexpr int SKD_float = 6 ;
138+ inline constexpr int SKD_double = 7 ;
139+ inline constexpr int SKD_quad = 8 ;
140+ inline constexpr int SKD_timestamp = 9 ;
141+ inline constexpr int SKD_bytes = 10 ;
142+ inline constexpr int SKD_varying = 11 ; // non-international
143+ inline constexpr int SKD_cstring = 12 ; // non-international
144+ inline constexpr int SKD_sql_time = 13 ;
145+ inline constexpr int SKD_sql_date = 14 ;
146+ inline constexpr int SKD_int64 = 15 ;
147+ inline constexpr int SKD_dec64 = 16 ;
148+ inline constexpr int SKD_dec128 = 17 ;
149+ inline constexpr int SKD_sql_time_tz = 18 ;
150+ inline constexpr int SKD_timestamp_tz = 19 ;
151+ inline constexpr int SKD_int128 = 20 ;
152152
153153// skd_flags
154- const UCHAR SKD_ascending = 0 ; // default initializer
155- const UCHAR SKD_descending = 1 ;
156- const UCHAR SKD_binary = 2 ;
157- const UCHAR SKD_separate_data = 4 ;
154+ inline constexpr UCHAR SKD_ascending = 0 ; // default initializer
155+ inline constexpr UCHAR SKD_descending = 1 ;
156+ inline constexpr UCHAR SKD_binary = 2 ;
157+ inline constexpr UCHAR SKD_separate_data = 4 ;
158158
159159// Sort key definition block
160160
@@ -170,9 +170,9 @@ struct sort_key_def
170170public:
171171 ULONG skd_vary_offset; // Offset to varying/cstring length
172172
173- USHORT getSkdLength () const { return skd_length; }
173+ USHORT getSkdLength () const noexcept { return skd_length; }
174174
175- void setSkdLength (UCHAR dtype, USHORT dscLength)
175+ void setSkdLength (UCHAR dtype, USHORT dscLength) noexcept
176176 {
177177 skd_dtype = dtype;
178178
@@ -191,9 +191,9 @@ struct sort_key_def
191191 }
192192 }
193193
194- ULONG getSkdOffset () const { return skd_offset; }
194+ ULONG getSkdOffset () const noexcept { return skd_offset; }
195195
196- void setSkdOffset (const sort_key_def* prev = nullptr , dsc* desc = nullptr )
196+ void setSkdOffset (const sort_key_def* prev = nullptr , dsc* desc = nullptr ) noexcept
197197 {
198198 skd_offset = 0 ;
199199 if (prev)
@@ -220,9 +220,9 @@ struct run_merge_hdr
220220
221221// rmh_type
222222
223- const int RMH_TYPE_RUN = 0 ;
224- const int RMH_TYPE_MRG = 1 ;
225- const int RMH_TYPE_SORT = 2 ;
223+ inline constexpr int RMH_TYPE_RUN = 0 ;
224+ inline constexpr int RMH_TYPE_MRG = 1 ;
225+ inline constexpr int RMH_TYPE_SORT = 2 ;
226226
227227
228228// Run control block
@@ -270,8 +270,8 @@ typedef bool (*FPTR_REJECT_DUP_CALLBACK)(const UCHAR*, const UCHAR*, void*);
270270
271271// flags as set in m_flags
272272
273- const int scb_sorted = 1 ; // stream has been sorted
274- const int scb_reuse_buffer = 2 ; // reuse buffer if possible
273+ inline constexpr int scb_sorted = 1 ; // stream has been sorted
274+ inline constexpr int scb_reuse_buffer = 2 ; // reuse buffer if possible
275275
276276class Sort
277277{
@@ -286,7 +286,7 @@ class Sort
286286 void put (Jrd::thread_db*, ULONG**);
287287 void sort (Jrd::thread_db*);
288288
289- bool isSorted () const
289+ bool isSorted () const noexcept
290290 {
291291 return m_flags & scb_sorted;
292292 }
@@ -298,7 +298,7 @@ class Sort
298298 return seek + bytes;
299299 }
300300
301- static FB_UINT64 writeBlock (TempSpace* space, FB_UINT64 seek, UCHAR* address, ULONG length)
301+ static FB_UINT64 writeBlock (TempSpace* space, FB_UINT64 seek, const UCHAR* address, ULONG length)
302302 {
303303 const size_t bytes = space->write (seek, address, length);
304304 fb_assert (bytes == length);
@@ -325,7 +325,7 @@ class Sort
325325 void checkFile (const run_control*);
326326#endif
327327
328- static void quick (SLONG, SORTP**, ULONG);
328+ static void quick (SLONG, SORTP**, ULONG) noexcept ;
329329
330330 Database* m_dbb; // Database
331331 SortOwner* m_owner; // Sort owner
@@ -421,7 +421,7 @@ class SortOwner
421421 }
422422 }
423423
424- MemoryPool& getPool () const
424+ MemoryPool& getPool () const noexcept
425425 {
426426 return pool;
427427 }
0 commit comments