diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index f8e1da59..64936162 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -5,17 +5,20 @@ include_directories(${CMAKE_SOURCE_DIR}/src) include_directories(${CMAKE_SOURCE_DIR}/example) find_package(PkgConfig REQUIRED) -pkg_search_module(GLFW REQUIRED glfw3) -include_directories(${GLFW_INCLUDE_DIRS}) +#pkg_search_module(GLFW REQUIRED glfw3) +# add_compile_options(-O2 -Wall) +find_package(OpenGL REQUIRED) +find_package(glfw3 3.3 REQUIRED) +include_directories(${GLFW_INCLUDE_DIRS}) add_executable(dump dump.c) add_executable(example1 example1.c) add_executable(example2 example2.c) target_link_libraries(dump m ) -target_link_libraries(example1 m GL ${GLFW_STATIC_LIBRARIES}) -target_link_libraries(example2 m GL ${GLFW_STATIC_LIBRARIES}) +target_link_libraries(example1 m ${OPENGL_LIBRARIES} glfw) +target_link_libraries(example2 m ${OPENGL_LIBRARIES} glfw) # # if fuzzing is enabled diff --git a/example/example1.c b/example/example1.c index 582e4ccb..0de4de44 100644 --- a/example/example1.c +++ b/example/example1.c @@ -244,7 +244,7 @@ int main(int argc, char *argv[]) filename = argv[1]; g_image = nsvgParseFromFile(filename, "px", 96.0f); if (g_image == NULL) { - printf("Could not open SVG image.\n"); + printf("Could not open SVG image '%s'.\n", filename); glfwTerminate(); return -1; } diff --git a/src/nanosvg.h b/src/nanosvg.h index 4797afd9..971e6e29 100644 --- a/src/nanosvg.h +++ b/src/nanosvg.h @@ -1153,10 +1153,16 @@ static const char* nsvg__parseNumber(const char* s, char* it, const int size) s++; } // integer part - while (*s && nsvg__isdigit(*s)) { + // leading zero + if (*s && *s == '0') { if (i < last) it[i++] = *s; s++; } + else + while (*s && nsvg__isdigit(*s)) { + if (i < last) it[i++] = *s; + s++; + } if (*s == '.') { // decimal point if (i < last) it[i++] = *s;