Skip to content

Commit d0497a5

Browse files
authored
Merge pull request #106 from dave-bartolomeo/dave/LF
Force LF line endings for .ql, .qll, .qlref, and .dbscheme
2 parents dc0f3be + 2af82d9 commit d0497a5

File tree

111 files changed

+7331
-7312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+7331
-7312
lines changed

.editorconfig

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[*.{ql,qll,qlref,dbscheme,qhelp}]
2+
end_of_line = lf

.gitattributes

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# The following file types will be normalized to LF line endings in the Git
2+
# database, and will keep those LF line endings in the working tree even on
3+
# Windows. Any other files will have whatever line endings they had when they
4+
# were committed. If you add new entries below, you should renormalize the
5+
# affected files by running the following from the root of this repo (requires
6+
# Git 2.16 or greater):
7+
#
8+
# git add --renormalize .
9+
# git status [just to show what files were renormalized]
10+
# git commit -m "Normalize line endings"
11+
#
12+
# Also, please update .editorconfig to handle any new entries as well.
13+
*.ql eol=lf
14+
*.qll eol=lf
15+
*.qlref eol=lf
16+
*.dbscheme eol=lf
17+
*.qhelp eol=lf
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
<!DOCTYPE qhelp PUBLIC
2-
"-//Semmle//qhelp//EN"
3-
"qhelp.dtd">
4-
<qhelp>
5-
<overview>
6-
<p>In a loop condition, comparison of a value of a narrow type with a value of a wide type may
7-
result in unexpected behavior if the wider value is sufficiently large (or small). This is because
8-
the narrower value may overflow. This can lead to an infinite loop.</p>
9-
10-
</overview>
11-
<recommendation>
12-
13-
<p>Change the types of the compared values so that the value on the narrower side of the
14-
comparison is at least as wide as the value it is being compared with.</p>
15-
16-
</recommendation>
17-
<example>
18-
19-
<p>In this example, <code>bytes_received</code> is compared against <code>max_get</code> in a
20-
<code>while</code> loop. However, <code>bytes_received</code> is an <code>int16_t</code>, and
21-
<code>max_get</code> is an <code>int32_t</code>. Because <code>max_get</code> is larger than
22-
<code>INT16_MAX</code>, the loop condition is always <code>true</code>, so the loop never
23-
terminates.</p>
24-
25-
<p>This problem is avoided in the 'GOOD' case because <code>bytes_received2</code> is an
26-
<code>int32_t</code>, which is as wide as the type of <code>max_get</code>.</p>
27-
28-
<sample src="ComparisonWithWiderType.c" />
29-
30-
</example>
31-
32-
<references>
33-
<li>
34-
<a href="https://docs.microsoft.com/en-us/cpp/cpp/data-type-ranges">Data type ranges</a>
35-
</li>
36-
37-
<li>
38-
<a href="https://wiki.sei.cmu.edu/confluence/display/c/INT18-C.+Evaluate+integer+expressions+in+a+larger+size+before+comparing+or+assigning+to+that+size">INT18-C. Evaluate integer expressions in a larger size before comparing or assigning to that size </a>
39-
</li>
40-
</references>
1+
<!DOCTYPE qhelp PUBLIC
2+
"-//Semmle//qhelp//EN"
3+
"qhelp.dtd">
4+
<qhelp>
5+
<overview>
6+
<p>In a loop condition, comparison of a value of a narrow type with a value of a wide type may
7+
result in unexpected behavior if the wider value is sufficiently large (or small). This is because
8+
the narrower value may overflow. This can lead to an infinite loop.</p>
9+
10+
</overview>
11+
<recommendation>
12+
13+
<p>Change the types of the compared values so that the value on the narrower side of the
14+
comparison is at least as wide as the value it is being compared with.</p>
15+
16+
</recommendation>
17+
<example>
18+
19+
<p>In this example, <code>bytes_received</code> is compared against <code>max_get</code> in a
20+
<code>while</code> loop. However, <code>bytes_received</code> is an <code>int16_t</code>, and
21+
<code>max_get</code> is an <code>int32_t</code>. Because <code>max_get</code> is larger than
22+
<code>INT16_MAX</code>, the loop condition is always <code>true</code>, so the loop never
23+
terminates.</p>
24+
25+
<p>This problem is avoided in the 'GOOD' case because <code>bytes_received2</code> is an
26+
<code>int32_t</code>, which is as wide as the type of <code>max_get</code>.</p>
27+
28+
<sample src="ComparisonWithWiderType.c" />
29+
30+
</example>
31+
32+
<references>
33+
<li>
34+
<a href="https://docs.microsoft.com/en-us/cpp/cpp/data-type-ranges">Data type ranges</a>
35+
</li>
36+
37+
<li>
38+
<a href="https://wiki.sei.cmu.edu/confluence/display/c/INT18-C.+Evaluate+integer+expressions+in+a+larger+size+before+comparing+or+assigning+to+that+size">INT18-C. Evaluate integer expressions in a larger size before comparing or assigning to that size </a>
39+
</li>
40+
</references>
4141
</qhelp>
+9-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/**
2-
* @name Print AST
3-
* @description Outputs a representation of the Abstract Syntax Tree.
4-
* @id cpp/print-ast
5-
* @kind graph
6-
*/
7-
8-
import cpp
9-
import PrintAST
1+
/**
2+
* @name Print AST
3+
* @description Outputs a representation of the Abstract Syntax Tree.
4+
* @id cpp/print-ast
5+
* @kind graph
6+
*/
7+
8+
import cpp
9+
import PrintAST

0 commit comments

Comments
 (0)