summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 22f081b)
raw | patch | inline | side by side (parent: 22f081b)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 12 Jul 2008 14:28:25 +0000 (14:28 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 12 Jul 2008 14:28:25 +0000 (14:28 +0000) |
For now shows unsafe debug message about where the path was truncated.
src/svg/svg-path.cpp | patch | blob | history |
diff --git a/src/svg/svg-path.cpp b/src/svg/svg-path.cpp
index 1ab70d10177a3ae1cd948c4f3d80196918c2e951..3deb6105c6cb9de869fbb6c0fb595cc44306b8eb 100644 (file)
--- a/src/svg/svg-path.cpp
+++ b/src/svg/svg-path.cpp
#include "libnr/n-art-bpath.h"
#include "gnome-canvas-bpath-util.h"
+#include "svg/svg.h"
#include "svg/path-string.h"
#include <2geom/pathvector.h>
return bpath;
}
+/*
+ * Parses the path in str. When an error is found in the pathstring, this method
+ * returns a truncated path up to where the error was found in the pathstring.
+ * Returns an empty PathVector when str==NULL
+ */
Geom::PathVector sp_svg_read_pathv(char const * str)
{
- std::vector<Geom::Path> pathv;
+ Geom::PathVector pathv;
if (!str)
return pathv; // return empty pathvector when str == NULL
+
+ typedef std::back_insert_iterator<Geom::PathVector> Inserter;
+ Inserter iter(pathv);
+ Geom::SVGPathGenerator<Inserter> generator(iter);
+
try {
- pathv = Geom::parse_svg_path(str);
+ Geom::parse_svg_path(str, generator);
}
catch (Geom::SVGPathParseError e) {
- g_warning("SVGPathParseError: %s", e.what());
- g_warning("svgd str: %s", str);
- throw Geom::SVGPathParseError(); // rethrow, maybe not necessary, can instead return empty path?
- return std::vector<Geom::Path>();
+ generator.finish();
+ g_warning("Malformed SVG path, truncated path up to where error was found.\n Input path=\"%s\"\n Parsed path=\"%s\"", str, sp_svg_write_path(pathv));
}
return pathv;