Fixed issue #11

- fixed compiler warnings
- supper single and double quotes
This commit is contained in:
Mikko Mononen 2014-06-12 20:01:28 +03:00
parent 0e41b5d029
commit 1acb9f0c9b
2 changed files with 12 additions and 4 deletions

View File

@ -93,7 +93,7 @@ void drawPath(float* pts, int npts, char closed, float tol)
glEnd();
}
void drawControlPts(float* pts, int npts, char closed)
void drawControlPts(float* pts, int npts)
{
int i;
@ -200,7 +200,7 @@ void drawframe(GLFWwindow* window)
for (shape = g_image->shapes; shape != NULL; shape = shape->next) {
for (path = shape->paths; path != NULL; path = path->next) {
drawPath(path->pts, path->npts, path->closed, px * 1.5f);
drawControlPts(path->pts, path->npts, path->closed);
drawControlPts(path->pts, path->npts);
}
}
@ -210,6 +210,8 @@ void drawframe(GLFWwindow* window)
void resizecb(GLFWwindow* window, int width, int height)
{
// Update and render
NSVG_NOTUSED(width);
NSVG_NOTUSED(height);
drawframe(window);
}

View File

@ -157,6 +157,7 @@ void nsvgDelete(struct NSVGimage* image);
#define NSVG_ALIGN_MEET 1
#define NSVG_ALIGN_SLICE 2
#define NSVG_NOTUSED(v) for(;;) { (void)(1 ? (void)0 : ( (void)(v) ) ); }
#define NSVG_RGB(r, g, b) (((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16))
#ifdef _MSC_VER
@ -219,6 +220,7 @@ static void nsvg__parseElement(char* s,
char* name;
int start = 0;
int end = 0;
char quote;
// Skip white space after the '<'
while (*s && nsvg__isspace(*s)) s++;
@ -254,12 +256,13 @@ static void nsvg__parseElement(char* s,
while (*s && !nsvg__isspace(*s) && *s != '=') s++;
if (*s) { *s++ = '\0'; }
// Skip until the beginning of the value.
while (*s && *s != '\"') s++;
while (*s && *s != '\"' && *s != '\'') s++;
if (!*s) break;
quote = *s;
s++;
// Store value and find the end of it.
attr[nattr++] = s;
while (*s && *s != '\"') s++;
while (*s && *s != quote) s++;
if (*s) { *s++ = '\0'; }
}
@ -686,6 +689,7 @@ static struct NSVGgradient* nsvg__createGradient(struct NSVGparser* p, const cha
struct NSVGgradient* grad;
float dx, dy, d;
int nstops = 0;
NSVG_NOTUSED(bounds);
data = nsvg__findGradientData(p, id);
if (data == NULL) return NULL;
@ -2356,6 +2360,8 @@ static void nsvg__endElement(void* ud, const char* el)
static void nsvg__content(void*, const char*)
{
NSVG_NOTUSED(ud);
NSVG_NOTUSED(s);
// empty
}