From 76b014b8bb3bb75ddde433b67b2daf3b98671c11 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 23 Mar 2015 23:00:51 +0100 Subject: [PATCH] Cleanup minor warnings --- src/nanosvg.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/nanosvg.h b/src/nanosvg.h index 41c5571..c3eb04d 100644 --- a/src/nanosvg.h +++ b/src/nanosvg.h @@ -717,7 +717,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f NSVGgradientData* ref = NULL; NSVGgradientStop* stops = NULL; NSVGgradient* grad; - float dx, dy, d; + float dx, dy; int nstops = 0; NSVG_NOTUSED(bounds); @@ -745,7 +745,6 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f // Calculate transform aligned to the line dx = data->linear.x2 - data->linear.x1; dy = data->linear.y2 - data->linear.y1; - d = sqrtf(dx*dx + dy*dy); grad->xform[0] = dy; grad->xform[1] = -dx; grad->xform[2] = dx; grad->xform[3] = dy; grad->xform[4] = data->linear.x1; grad->xform[5] = data->linear.y1; @@ -1659,10 +1658,8 @@ static void nsvg__pathVLineTo(NSVGparser* p, float* cpx, float* cpy, float* args static void nsvg__pathCubicBezTo(NSVGparser* p, float* cpx, float* cpy, float* cpx2, float* cpy2, float* args, int rel) { - float x1, y1, x2, y2, cx1, cy1, cx2, cy2; + float x2, y2, cx1, cy1, cx2, cy2; - x1 = *cpx; - y1 = *cpy; if (rel) { cx1 = *cpx + args[0]; cy1 = *cpy + args[1]; @@ -1947,6 +1944,7 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) if (s) { nsvg__resetPath(p); cpx = 0; cpy = 0; + cpx2 = 0; cpy2 = 0; closedFlag = 0; nargs = 0; @@ -2458,7 +2456,10 @@ static void nsvg__imageBounds(NSVGparser* p, float* bounds) { NSVGshape* shape; shape = p->image->shapes; - if (shape == NULL) return; + if (shape == NULL) { + bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; + return; + } bounds[0] = shape->bounds[0]; bounds[1] = shape->bounds[1]; bounds[2] = shape->bounds[2];