зеркало из https://github.com/github/codeql.git
CPP: Correct overuse of 'matches'.
This commit is contained in:
Родитель
ab543aa0eb
Коммит
bc5fb24371
|
@ -168,14 +168,14 @@ abstract class LeapYearFieldAccess extends YearFieldAccess {
|
|||
* `YearFieldAccess` for the `SYSTEMTIME` struct.
|
||||
*/
|
||||
class StructSystemTimeLeapYearFieldAccess extends LeapYearFieldAccess {
|
||||
StructSystemTimeLeapYearFieldAccess() { this.toString().matches("wYear") }
|
||||
StructSystemTimeLeapYearFieldAccess() { this.toString() = "wYear" }
|
||||
}
|
||||
|
||||
/**
|
||||
* `YearFieldAccess` for `struct tm`.
|
||||
*/
|
||||
class StructTmLeapYearFieldAccess extends LeapYearFieldAccess {
|
||||
StructTmLeapYearFieldAccess() { this.toString().matches("tm_year") }
|
||||
StructTmLeapYearFieldAccess() { this.toString() = "tm_year" }
|
||||
|
||||
override predicate isUsedInCorrectLeapYearCheck() {
|
||||
this.isUsedInMod4Operation() and
|
||||
|
|
|
@ -37,9 +37,9 @@ class DateStructModifiedFieldAccess extends LeapYearFieldAccess {
|
|||
*/
|
||||
class SafeTimeGatheringFunction extends Function {
|
||||
SafeTimeGatheringFunction() {
|
||||
this.getQualifiedName().matches("GetFileTime") or
|
||||
this.getQualifiedName().matches("GetSystemTime") or
|
||||
this.getQualifiedName().matches("NtQuerySystemTime")
|
||||
this.getQualifiedName() = "GetFileTime" or
|
||||
this.getQualifiedName() = "GetSystemTime" or
|
||||
this.getQualifiedName() = "NtQuerySystemTime"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,15 +48,15 @@ class SafeTimeGatheringFunction extends Function {
|
|||
*/
|
||||
class TimeConversionFunction extends Function {
|
||||
TimeConversionFunction() {
|
||||
this.getQualifiedName().matches("FileTimeToSystemTime") or
|
||||
this.getQualifiedName().matches("SystemTimeToFileTime") or
|
||||
this.getQualifiedName().matches("SystemTimeToTzSpecificLocalTime") or
|
||||
this.getQualifiedName().matches("SystemTimeToTzSpecificLocalTimeEx") or
|
||||
this.getQualifiedName().matches("TzSpecificLocalTimeToSystemTime") or
|
||||
this.getQualifiedName().matches("TzSpecificLocalTimeToSystemTimeEx") or
|
||||
this.getQualifiedName().matches("RtlLocalTimeToSystemTime") or
|
||||
this.getQualifiedName().matches("RtlTimeToSecondsSince1970") or
|
||||
this.getQualifiedName().matches("_mkgmtime")
|
||||
this.getQualifiedName() = "FileTimeToSystemTime" or
|
||||
this.getQualifiedName() = "SystemTimeToFileTime" or
|
||||
this.getQualifiedName() = "SystemTimeToTzSpecificLocalTime" or
|
||||
this.getQualifiedName() = "SystemTimeToTzSpecificLocalTimeEx" or
|
||||
this.getQualifiedName() = "TzSpecificLocalTimeToSystemTime" or
|
||||
this.getQualifiedName() = "TzSpecificLocalTimeToSystemTimeEx" or
|
||||
this.getQualifiedName() = "RtlLocalTimeToSystemTime" or
|
||||
this.getQualifiedName() = "RtlTimeToSecondsSince1970" or
|
||||
this.getQualifiedName() = "_mkgmtime"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import cpp
|
|||
*/
|
||||
class FileTimeStruct extends Type {
|
||||
FileTimeStruct() {
|
||||
this.toString().matches("_FILETIME")
|
||||
this.toString() = "_FILETIME"
|
||||
or this.toString().matches("_FILETIME %")
|
||||
}
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ class FileTimeStruct extends Type {
|
|||
*/
|
||||
class DateDataStruct extends Type {
|
||||
DateDataStruct() {
|
||||
this.toString().matches("_SYSTEMTIME")
|
||||
or this.toString().matches("SYSTEMTIME")
|
||||
or this.toString().matches("tm")
|
||||
this.toString() = "_SYSTEMTIME"
|
||||
or this.toString() = "SYSTEMTIME"
|
||||
or this.toString() = "tm"
|
||||
or this.toString().matches("_SYSTEMTIME %")
|
||||
or this.toString().matches("SYSTEMTIME %")
|
||||
or this.toString().matches("tm %")
|
||||
|
@ -61,7 +61,7 @@ abstract class YearFieldAccess extends StructFieldAccess {}
|
|||
*/
|
||||
class SystemTimeDayFieldAccess extends DayFieldAccess {
|
||||
SystemTimeDayFieldAccess () {
|
||||
this.toString().matches("wDay")
|
||||
this.toString() = "wDay"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class SystemTimeDayFieldAccess extends DayFieldAccess {
|
|||
*/
|
||||
class SystemTimeMonthFieldAccess extends MonthFieldAccess {
|
||||
SystemTimeMonthFieldAccess () {
|
||||
this.toString().matches("wMonth")
|
||||
this.toString() = "wMonth"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ class SystemTimeMonthFieldAccess extends MonthFieldAccess {
|
|||
*/
|
||||
class StructSystemTimeYearFieldAccess extends YearFieldAccess {
|
||||
StructSystemTimeYearFieldAccess() {
|
||||
this.toString().matches("wYear")
|
||||
this.toString() = "wYear"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ class StructSystemTimeYearFieldAccess extends YearFieldAccess {
|
|||
*/
|
||||
class StructTmDayFieldAccess extends DayFieldAccess {
|
||||
StructTmDayFieldAccess() {
|
||||
this.toString().matches("tm_mday")
|
||||
this.toString() = "tm_mday"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class StructTmDayFieldAccess extends DayFieldAccess {
|
|||
*/
|
||||
class StructTmMonthFieldAccess extends MonthFieldAccess {
|
||||
StructTmMonthFieldAccess() {
|
||||
this.toString().matches("tm_mon")
|
||||
this.toString() = "tm_mon"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,6 @@ class StructTmMonthFieldAccess extends MonthFieldAccess {
|
|||
*/
|
||||
class StructTmYearFieldAccess extends YearFieldAccess {
|
||||
StructTmYearFieldAccess() {
|
||||
this.toString().matches("tm_year")
|
||||
this.toString() = "tm_year"
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче