mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: Fix mixed tabs and spaces in non-test code
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
typedef struct Names {
|
||||
char first[100];
|
||||
char last[100];
|
||||
char first[100];
|
||||
char last[100];
|
||||
} Names;
|
||||
|
||||
int doFoo(Names n) { //wrong: n is passed by value (meaning the entire structure
|
||||
//is copied onto the stack, instead of just a pointer)
|
||||
...
|
||||
...
|
||||
}
|
||||
|
||||
int doBar(Names &n) { //better, only a reference is passed
|
||||
...
|
||||
...
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
Record records[SIZE] = ...;
|
||||
|
||||
int f() {
|
||||
int recordIdx = 0;
|
||||
recordIdx = readUserInput(); //recordIdx is returned from a function
|
||||
int recordIdx = 0;
|
||||
recordIdx = readUserInput(); //recordIdx is returned from a function
|
||||
// there is no check so it could be negative
|
||||
doFoo(&(records[recordIdx])); //but is not checked before use as an array offset
|
||||
doFoo(&(records[recordIdx])); //but is not checked before use as an array offset
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user