36
36
#include " ../common/prett_proto.h"
37
37
#include " ../yvalve/gds_proto.h"
38
38
39
- static inline void ADVANCE_PTR (TEXT*& ptr)
39
+ static inline void ADVANCE_PTR (TEXT*& ptr) noexcept
40
40
{
41
41
while (*ptr)
42
42
ptr++;
@@ -77,45 +77,45 @@ struct ctl
77
77
78
78
static int blr_format (ctl*, const char *, ...);
79
79
static int error (ctl*, SSHORT, const TEXT *, int );
80
- static int indent (ctl*, SSHORT);
80
+ static int indent (ctl*, SSHORT) noexcept ;
81
81
static int print_blr_dtype (ctl*, bool );
82
- static void print_blr_line (void *, SSHORT, const char *);
82
+ static void print_blr_line (void *, SSHORT, const char *) noexcept ;
83
83
static int print_byte (ctl*);
84
84
static int print_char (ctl*, SSHORT);
85
85
static int print_dyn_verb (ctl*, SSHORT);
86
- static int print_line (ctl*, SSHORT);
86
+ static int print_line (ctl*, SSHORT) noexcept ;
87
87
static SLONG print_long (ctl*);
88
88
static int print_sdl_verb (ctl*, SSHORT);
89
89
static int print_string (ctl*, SSHORT);
90
90
static int print_word (ctl*);
91
91
92
92
93
- static inline void CHECK_BUFFER (ctl* control, SSHORT offset)
93
+ static inline void CHECK_BUFFER (ctl* control, SSHORT offset) noexcept
94
94
{
95
95
if (control->remaining () < 20 )
96
96
print_line (control, offset);
97
97
}
98
98
99
99
100
- const char *dyn_table[] =
100
+ constexpr const char *dyn_table[] =
101
101
{
102
102
#include " ../common/dyntable.h"
103
103
NULL
104
104
};
105
105
106
- const char *cdb_table[] =
106
+ constexpr const char *cdb_table[] =
107
107
{
108
108
#include " ../common/cdbtable.h"
109
109
NULL
110
110
};
111
111
112
- const char *sdl_table[] =
112
+ constexpr const char *sdl_table[] =
113
113
{
114
114
#include " ../common/sdltable.h"
115
115
NULL
116
116
};
117
117
118
- const char *map_strings[] =
118
+ constexpr const char *map_strings[] =
119
119
{
120
120
" FIELD2" ,
121
121
" FIELD1" ,
@@ -153,7 +153,7 @@ int PRETTY_print_cdb(const UCHAR* blr, FPTR_PRINT_CALLBACK routine, void* user_a
153
153
control->ctl_language = language;
154
154
control->reset ();
155
155
156
- SSHORT level = 0 ;
156
+ constexpr SSHORT level = 0 ;
157
157
indent (control, level);
158
158
const SSHORT i = BLR_BYTE;
159
159
@@ -164,11 +164,11 @@ int PRETTY_print_cdb(const UCHAR* blr, FPTR_PRINT_CALLBACK routine, void* user_a
164
164
snprintf (temp, sizeof (temp), " gds__dpb_version%d" , i);
165
165
blr_format (control, temp);
166
166
167
- SSHORT offset = 0 ;
167
+ constexpr SSHORT offset = 0 ;
168
168
print_line (control, offset);
169
169
170
170
SSHORT parameter;
171
- while (parameter = BLR_BYTE)
171
+ while (( parameter = BLR_BYTE) )
172
172
{
173
173
const char * p;
174
174
if (parameter > static_cast <FB_SSIZE_T>(FB_NELEM (cdb_table)) || !(p = cdb_table[parameter]))
@@ -216,13 +216,13 @@ int PRETTY_print_dyn(const UCHAR* blr, FPTR_PRINT_CALLBACK routine, void* user_a
216
216
217
217
const SSHORT version = BLR_BYTE;
218
218
219
- SSHORT offset = 0 ;
219
+ constexpr SSHORT offset = 0 ;
220
220
if (version != isc_dyn_version_1)
221
221
return error (control, offset, " *** dyn version %d is not supported ***\n " , version);
222
222
223
223
blr_format (control, " gds__dyn_version_1, " );
224
224
print_line (control, offset);
225
- SSHORT level = 1 ;
225
+ constexpr SSHORT level = 1 ;
226
226
PRINT_DYN_VERB;
227
227
228
228
if (BLR_BYTE != isc_dyn_eoc)
@@ -264,7 +264,7 @@ int PRETTY_print_sdl(const UCHAR* blr, FPTR_PRINT_CALLBACK routine, void *user_a
264
264
265
265
blr_format (control, " gds__sdl_version1, " );
266
266
print_line (control, offset);
267
- SSHORT level = 1 ;
267
+ constexpr SSHORT level = 1 ;
268
268
269
269
while (NEXT_BYTE != isc_sdl_eoc)
270
270
PRINT_SDL_VERB;
@@ -318,7 +318,7 @@ static int error( ctl* control, SSHORT offset, const TEXT* string, int arg)
318
318
// Indent for pretty printing.
319
319
//
320
320
321
- static int indent ( ctl* control, SSHORT level)
321
+ static int indent ( ctl* control, SSHORT level) noexcept
322
322
{
323
323
324
324
level *= 3 ;
@@ -493,15 +493,15 @@ static int print_blr_dtype(ctl* control, bool print_object)
493
493
// Print a line of pretty-printed BLR.
494
494
//
495
495
496
- static void print_blr_line (void * arg, SSHORT offset, const char * line)
496
+ static void print_blr_line (void * arg, SSHORT offset, const char * line) noexcept
497
497
{
498
498
ctl* control = static_cast <ctl*>(arg);
499
499
bool comma = false ;
500
500
char c;
501
501
502
502
indent (control, control->ctl_level );
503
503
504
- while (c = *line++)
504
+ while (( c = *line++) )
505
505
{
506
506
PUT_BYTE (c);
507
507
if (c == ' ,' )
@@ -565,8 +565,8 @@ static int print_dyn_verb( ctl* control, SSHORT level)
565
565
const UCHAR dyn_operator = BLR_BYTE;
566
566
567
567
const char * p;
568
- const int size = FB_NELEM (dyn_table);
569
- if (dyn_operator > size || dyn_operator <= 0 || !(p = dyn_table[dyn_operator])) {
568
+ constexpr int size = FB_NELEM (dyn_table);
569
+ if (dyn_operator >= size || dyn_operator <= 0 || !(p = dyn_table[dyn_operator])) {
570
570
return error (control, offset, " *** dyn operator %d is undefined ***\n " , (int ) dyn_operator);
571
571
}
572
572
@@ -634,7 +634,7 @@ static int print_dyn_verb( ctl* control, SSHORT level)
634
634
return 0 ;
635
635
636
636
case isc_dyn_del_exception:
637
- if (length = print_word (control))
637
+ if (( length = print_word (control) ))
638
638
do {
639
639
print_char (control, offset);
640
640
} while (--length);
@@ -668,7 +668,7 @@ static int print_dyn_verb( ctl* control, SSHORT level)
668
668
return 0 ;
669
669
}
670
670
671
- if (length = print_word (control))
671
+ if (( length = print_word (control) ))
672
672
do {
673
673
print_char (control, offset);
674
674
} while (--length);
@@ -743,7 +743,7 @@ static int print_dyn_verb( ctl* control, SSHORT level)
743
743
// Invoke callback routine to print (or do something with) a line.
744
744
//
745
745
746
- static int print_line ( ctl* control, SSHORT offset)
746
+ static int print_line ( ctl* control, SSHORT offset) noexcept
747
747
{
748
748
*control->ctl_ptr = 0 ;
749
749
(*control->ctl_routine ) (control->ctl_user_arg , offset, control->ctl_buffer );
@@ -818,7 +818,7 @@ static int print_sdl_verb( ctl* control, SSHORT level)
818
818
819
819
case isc_sdl_scalar:
820
820
print_byte (control);
821
-
821
+ [[fallthrough]];
822
822
case isc_sdl_element:
823
823
n = print_byte (control);
824
824
print_line (control, offset);
@@ -863,8 +863,10 @@ static int print_sdl_verb( ctl* control, SSHORT level)
863
863
864
864
case isc_sdl_do3:
865
865
n++;
866
+ [[fallthrough]];
866
867
case isc_sdl_do2:
867
868
n++;
869
+ [[fallthrough]];
868
870
case isc_sdl_do1:
869
871
n += 2 ;
870
872
print_byte (control);
0 commit comments