3131
3232namespace {
3333
34- static const UCHAR CpuIntel = 0 ;
35- static const UCHAR CpuAmd = 1 ;
36- static const UCHAR CpuUltraSparc = 2 ;
37- static const UCHAR CpuPowerPc = 3 ;
38- static const UCHAR CpuPowerPc64 = 4 ;
39- static const UCHAR CpuMipsel = 5 ;
40- static const UCHAR CpuMips = 6 ;
41- static const UCHAR CpuArm = 7 ;
42- static const UCHAR CpuIa64 = 8 ;
43- static const UCHAR CpuS390 = 9 ;
44- static const UCHAR CpuS390x = 10 ;
45- static const UCHAR CpuSh = 11 ;
46- static const UCHAR CpuSheb = 12 ;
47- static const UCHAR CpuHppa = 13 ;
48- static const UCHAR CpuAlpha = 14 ;
49- static const UCHAR CpuArm64 = 15 ;
50- static const UCHAR CpuPowerPc64el = 16 ;
51- static const UCHAR CpuM68k = 17 ;
52- static const UCHAR CpuRiscV64 = 18 ;
53- static const UCHAR CpuMips64el = 19 ;
54- static const UCHAR CpuLoongArch = 20 ;
55-
56- static const UCHAR OsWindows = 0 ;
57- static const UCHAR OsLinux = 1 ;
58- static const UCHAR OsDarwin = 2 ;
59- static const UCHAR OsSolaris = 3 ;
60- static const UCHAR OsHpux = 4 ;
61- static const UCHAR OsAix = 5 ;
62- static const UCHAR OsMms = 6 ;
63- static const UCHAR OsFreeBsd = 7 ;
64- static const UCHAR OsNetBsd = 8 ;
65-
66- static const UCHAR CcMsvc = 0 ;
67- static const UCHAR CcGcc = 1 ;
68- static const UCHAR CcXlc = 2 ;
69- static const UCHAR CcAcc = 3 ;
70- static const UCHAR CcSunStudio = 4 ;
71- static const UCHAR CcIcc = 5 ;
72-
73- static const UCHAR EndianLittle = 0 ;
74- static const UCHAR EndianBig = 1 ;
75- static const UCHAR EndianMask = 1 ;
34+ static constexpr UCHAR CpuIntel = 0 ;
35+ static constexpr UCHAR CpuAmd = 1 ;
36+ static constexpr UCHAR CpuUltraSparc = 2 ;
37+ static constexpr UCHAR CpuPowerPc = 3 ;
38+ static constexpr UCHAR CpuPowerPc64 = 4 ;
39+ static constexpr UCHAR CpuMipsel = 5 ;
40+ static constexpr UCHAR CpuMips = 6 ;
41+ static constexpr UCHAR CpuArm = 7 ;
42+ static constexpr UCHAR CpuIa64 = 8 ;
43+ static constexpr UCHAR CpuS390 = 9 ;
44+ static constexpr UCHAR CpuS390x = 10 ;
45+ static constexpr UCHAR CpuSh = 11 ;
46+ static constexpr UCHAR CpuSheb = 12 ;
47+ static constexpr UCHAR CpuHppa = 13 ;
48+ static constexpr UCHAR CpuAlpha = 14 ;
49+ static constexpr UCHAR CpuArm64 = 15 ;
50+ static constexpr UCHAR CpuPowerPc64el = 16 ;
51+ static constexpr UCHAR CpuM68k = 17 ;
52+ static constexpr UCHAR CpuRiscV64 = 18 ;
53+ static constexpr UCHAR CpuMips64el = 19 ;
54+ static constexpr UCHAR CpuLoongArch = 20 ;
55+
56+ static constexpr UCHAR OsWindows = 0 ;
57+ static constexpr UCHAR OsLinux = 1 ;
58+ static constexpr UCHAR OsDarwin = 2 ;
59+ static constexpr UCHAR OsSolaris = 3 ;
60+ static constexpr UCHAR OsHpux = 4 ;
61+ static constexpr UCHAR OsAix = 5 ;
62+ static constexpr UCHAR OsMms = 6 ;
63+ static constexpr UCHAR OsFreeBsd = 7 ;
64+ static constexpr UCHAR OsNetBsd = 8 ;
65+
66+ static constexpr UCHAR CcMsvc = 0 ;
67+ static constexpr UCHAR CcGcc = 1 ;
68+ static constexpr UCHAR CcXlc = 2 ;
69+ static constexpr UCHAR CcAcc = 3 ;
70+ static constexpr UCHAR CcSunStudio = 4 ;
71+ static constexpr UCHAR CcIcc = 5 ;
72+
73+ static constexpr UCHAR EndianLittle = 0 ;
74+ static constexpr UCHAR EndianBig = 1 ;
75+ static constexpr UCHAR EndianMask = 1 ;
7676
7777const char * hardware[] = {
7878 " Intel/i386" ,
@@ -120,7 +120,7 @@ const char* compiler[] = {
120120};
121121
122122// This table lists pre-fb3 implementation codes
123- const UCHAR backwardTable[FB_NELEM(hardware) * FB_NELEM (operatingSystem)] =
123+ constexpr UCHAR backwardTable[FB_NELEM(hardware) * FB_NELEM (operatingSystem)] =
124124{
125125// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PPC64el M68k RiscV64 MIPS64EL LoongArch
126126/* Windows */ 50 , 68 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
@@ -135,7 +135,7 @@ const UCHAR backwardTable[FB_NELEM(hardware) * FB_NELEM(operatingSystem)] =
135135};
136136
137137
138- const UCHAR backEndianess[FB_NELEM(hardware)] =
138+ constexpr UCHAR backEndianess[FB_NELEM(hardware)] =
139139{
140140// Intel AMD Sparc PPC PPC64 MIPSEL MIPS ARM IA64 s390 s390x SH SHEB HPPA Alpha ARM64 PPC64el M68k RiscV64 MIPS64EL LoongArch
141141 0 , 0 , 1 , 1 , 1 , 0 , 1 , 0 , 0 , 1 , 1 , 0 , 1 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 ,
@@ -145,25 +145,25 @@ const UCHAR backEndianess[FB_NELEM(hardware)] =
145145
146146namespace Firebird {
147147
148- DbImplementation::DbImplementation (const Ods::header_page* h)
148+ DbImplementation::DbImplementation (const Ods::header_page* h) noexcept
149149 : di_cpu(h->hdr_db_impl.hdr_cpu), di_os(h->hdr_db_impl.hdr_os),
150150 di_cc (h->hdr_db_impl.hdr_cc), di_flags(h->hdr_db_impl.hdr_compat)
151151{
152152}
153153
154154#define GET_ARRAY_ELEMENT (array, elem ) ((elem) < FB_NELEM(array) ? array[(elem)] : " ** Unknown **" )
155155
156- const char * DbImplementation::cpu () const
156+ const char * DbImplementation::cpu () const noexcept
157157{
158158 return GET_ARRAY_ELEMENT (hardware, di_cpu);
159159}
160160
161- const char * DbImplementation::os () const
161+ const char * DbImplementation::os () const noexcept
162162{
163163 return GET_ARRAY_ELEMENT (operatingSystem, di_os);
164164}
165165
166- const char * DbImplementation::cc () const
166+ const char * DbImplementation::cc () const noexcept
167167{
168168 return GET_ARRAY_ELEMENT (compiler, di_cc);
169169}
@@ -177,7 +177,7 @@ string DbImplementation::implementation() const
177177 return rc;
178178}
179179
180- const char * DbImplementation::endianess () const
180+ const char * DbImplementation::endianess () const noexcept
181181{
182182 return (di_flags & EndianMask) == EndianBig ? " big" : " little" ;
183183}
@@ -190,20 +190,20 @@ const DbImplementation DbImplementation::current(
190190 EndianLittle);
191191#endif
192192
193- bool DbImplementation::compatible (const DbImplementation& v) const
193+ bool DbImplementation::compatible (const DbImplementation& v) const noexcept
194194{
195195 return di_flags == v.di_flags ;
196196}
197197
198- void DbImplementation::store (Ods::header_page* h) const
198+ void DbImplementation::store (Ods::header_page* h) const noexcept
199199{
200200 h->hdr_db_impl .hdr_cpu = di_cpu;
201201 h->hdr_db_impl .hdr_os = di_os;
202202 h->hdr_db_impl .hdr_cc = di_cc;
203203 h->hdr_db_impl .hdr_compat = di_flags;
204204}
205205
206- void DbImplementation::stuff (UCHAR** info) const
206+ void DbImplementation::stuff (UCHAR** info) const noexcept
207207{
208208 UCHAR* p = *info;
209209 *p++ = di_cpu;
@@ -213,13 +213,13 @@ void DbImplementation::stuff(UCHAR** info) const
213213 *info = p;
214214}
215215
216- DbImplementation DbImplementation::pick (const UCHAR* info)
216+ DbImplementation DbImplementation::pick (const UCHAR* info) noexcept
217217{
218218 // DbImplementation(UCHAR p_cpu, UCHAR p_os, UCHAR p_cc, UCHAR p_flags)
219219 return DbImplementation (info[0 ], info[1 ], info[2 ], info[3 ]);
220220}
221221
222- DbImplementation DbImplementation::fromBackwardCompatibleByte (UCHAR bcImpl)
222+ DbImplementation DbImplementation::fromBackwardCompatibleByte (UCHAR bcImpl) noexcept
223223{
224224 for (UCHAR os = 0 ; os < FB_NELEM (operatingSystem); ++os)
225225 {
@@ -236,7 +236,7 @@ DbImplementation DbImplementation::fromBackwardCompatibleByte(UCHAR bcImpl)
236236 return DbImplementation (0xFF , 0xFF , 0xFF , 0x80 );
237237}
238238
239- UCHAR DbImplementation::backwardCompatibleImplementation () const
239+ UCHAR DbImplementation::backwardCompatibleImplementation () const noexcept
240240{
241241 if (di_cpu >= FB_NELEM (hardware) || di_os >= FB_NELEM (operatingSystem))
242242 {
0 commit comments