Skip to content

Commit a9fbe22

Browse files
committed
CPP: Try to make the predicate names and qldoc a bit more consistent.
1 parent dff21e0 commit a9fbe22

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

cpp/ql/src/semmle/code/cpp/commons/Printf.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ class FormattingFunctionCall extends Expr {
137137
exists(FormatLiteral fl |
138138
fl = this.getFormat() and
139139
(
140-
result = this.getFormatArgument(fl.getParameterFieldPositional(n))
140+
result = this.getFormatArgument(fl.getParameterFieldValue(n))
141141
or
142142
result = this.getFormatArgument(fl.getFormatArgumentIndexFor(n, 2)) and
143-
not exists(fl.getParameterFieldPositional(n))
143+
not exists(fl.getParameterFieldValue(n))
144144
)
145145
)
146146
}
@@ -154,10 +154,10 @@ class FormattingFunctionCall extends Expr {
154154
exists(FormatLiteral fl |
155155
fl = this.getFormat() and
156156
(
157-
result = this.getFormatArgument(fl.getMinFieldWidthPositional(n))
157+
result = this.getFormatArgument(fl.getMinFieldWidthParameterFieldValue(n))
158158
or
159159
result = this.getFormatArgument(fl.getFormatArgumentIndexFor(n, 0)) and
160-
not exists(fl.getMinFieldWidthPositional(n))
160+
not exists(fl.getMinFieldWidthParameterFieldValue(n))
161161
)
162162
)
163163
}
@@ -171,10 +171,10 @@ class FormattingFunctionCall extends Expr {
171171
exists(FormatLiteral fl |
172172
fl = this.getFormat() and
173173
(
174-
result = this.getFormatArgument(fl.getPrecisionPositional(n))
174+
result = this.getFormatArgument(fl.getPrecisionParameterFieldValue(n))
175175
or
176176
result = this.getFormatArgument(fl.getFormatArgumentIndexFor(n, 1)) and
177-
not exists(fl.getPrecisionPositional(n))
177+
not exists(fl.getPrecisionParameterFieldValue(n))
178178
)
179179
)
180180
}
@@ -379,7 +379,7 @@ class FormatLiteral extends Literal {
379379
* Gets the parameter field of the nth conversion specifier (if it has one) as a
380380
* zero-based number.
381381
*/
382-
int getParameterFieldPositional(int n) {
382+
int getParameterFieldValue(int n) {
383383
result = this.getParameterField(n).regexpCapture("([0-9]*)\\$", 1).toInt() - 1
384384
}
385385

@@ -454,9 +454,9 @@ class FormatLiteral extends Literal {
454454

455455
/**
456456
* Gets the zero-based parameter number of the minimum field width of the nth
457-
* conversion specifier, if it is implicit and uses a positional parameter.
457+
* conversion specifier, if it is implicit and uses a parameter field (such as `*1$`).
458458
*/
459-
int getMinFieldWidthPositional(int n) {
459+
int getMinFieldWidthParameterFieldValue(int n) {
460460
result = this.getMinFieldWidthOpt(n).regexpCapture("\\*([0-9]*)\\$", 1).toInt() - 1
461461
}
462462

@@ -492,9 +492,9 @@ class FormatLiteral extends Literal {
492492

493493
/**
494494
* Gets the zero-based parameter number of the precision of the nth conversion
495-
* specifier, if it is implicit and uses a positional parameter.
495+
* specifier, if it is implicit and uses a parameter field (such as `*1$`).
496496
*/
497-
int getPrecisionPositional(int n) {
497+
int getPrecisionParameterFieldValue(int n) {
498498
result = this.getPrecisionOpt(n).regexpCapture("\\.\\*([0-9]*)\\$", 1).toInt() - 1
499499
}
500500

@@ -837,8 +837,8 @@ class FormatLiteral extends Literal {
837837
}
838838

839839
/**
840-
* Gets the format argument index for the nth conversion specifier of this format
841-
* string (if `mode = 2`), it's minimum field width (if `mode = 0`) or it's
840+
* Gets the computed format argument index for the nth conversion specifier of this
841+
* format string (if `mode = 2`), it's minimum field width (if `mode = 0`) or it's
842842
* precision (if `mode = 1`). Has no result if that element is not present. Does
843843
* not account for positional arguments (`$`).
844844
*/

0 commit comments

Comments
 (0)