Fossil SCM

Added a pedantic catch for a corner case which never happens (for porting's sake).

stephan 2014-03-17 21:05 UTC trunk
Commit 7413229200e8c816e0f31b8024944b1381909e1c
1 file changed +1
+1
--- src/diff.c
+++ src/diff.c
@@ -2142,10 +2142,11 @@
21422142
*/
21432143
unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){
21442144
unsigned c; /* Result color */
21452145
unsigned x1, x2;
21462146
if( i==0 || n==0 ) return c1;
2147
+ else if(i>=n) return c2;
21472148
x1 = (c1>>16)&0xff;
21482149
x2 = (c2>>16)&0xff;
21492150
c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000;
21502151
x1 = (c1>>8)&0xff;
21512152
x2 = (c2>>8)&0xff;
21522153
--- src/diff.c
+++ src/diff.c
@@ -2142,10 +2142,11 @@
2142 */
2143 unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){
2144 unsigned c; /* Result color */
2145 unsigned x1, x2;
2146 if( i==0 || n==0 ) return c1;
 
2147 x1 = (c1>>16)&0xff;
2148 x2 = (c2>>16)&0xff;
2149 c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000;
2150 x1 = (c1>>8)&0xff;
2151 x2 = (c2>>8)&0xff;
2152
--- src/diff.c
+++ src/diff.c
@@ -2142,10 +2142,11 @@
2142 */
2143 unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){
2144 unsigned c; /* Result color */
2145 unsigned x1, x2;
2146 if( i==0 || n==0 ) return c1;
2147 else if(i>=n) return c2;
2148 x1 = (c1>>16)&0xff;
2149 x2 = (c2>>16)&0xff;
2150 c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000;
2151 x1 = (c1>>8)&0xff;
2152 x2 = (c2>>8)&0xff;
2153

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button