Browse Source

stb_truetype: GCC warning fix

GCC warns about a potentially uninitialized variable here. It's
not (or at least I don't see how), but fix it anyway.
Fabian Giesen 4 years ago
parent
commit
e590505492
1 changed files with 2 additions and 1 deletions
  1. 2 1
      stb_truetype.h

+ 2 - 1
stb_truetype.h

@@ -4624,7 +4624,8 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc
                      float ax = x1-x0, ay = y1-y0;
                      float ax = x1-x0, ay = y1-y0;
                      float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2;
                      float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2;
                      float mx = x0 - sx, my = y0 - sy;
                      float mx = x0 - sx, my = y0 - sy;
-                     float res[3],px,py,t,it,dist2;
+                     float res[3] = {0.f,0.f,0.f};
+                     float px,py,t,it,dist2;
                      float a_inv = precompute[i];
                      float a_inv = precompute[i];
                      if (a_inv == 0.0) { // if a_inv is 0, it's 2nd degree so use quadratic formula
                      if (a_inv == 0.0) { // if a_inv is 0, it's 2nd degree so use quadratic formula
                         float a = 3*(ax*bx + ay*by);
                         float a = 3*(ax*bx + ay*by);