File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1537,24 +1537,21 @@ _path_module::convert_to_svg(const Py::Tuple& args)
15371537 clipped_t clipped (nan_removed, do_clip, clip_rect);
15381538 simplify_t simplified (clipped, simplify, path.simplify_threshold ());
15391539
1540- size_t buffersize = path.total_vertices () * (precision + 5 ) * 2 ;
1540+ size_t buffersize = path.total_vertices () * (precision + 5 ) * 4 ;
15411541 char * buffer = (char *)malloc (buffersize);
15421542 char * p = buffer;
15431543
15441544 const char codes[] = {' M' , ' L' , ' Q' , ' C' };
1545- const int waits[] = {1 , 1 , 2 , 3 };
1545+ const int waits[] = { 1 , 1 , 2 , 3 };
15461546
15471547 int wait = 0 ;
15481548 unsigned code;
15491549 double x = 0 , y = 0 ;
1550- while (code = simplified.vertex (&x, &y))
1550+ while (( code = simplified.vertex (&x, &y)) != agg::path_cmd_stop )
15511551 {
15521552 if (wait == 0 )
15531553 {
1554- if (p != buffer)
1555- {
1556- *p++ = ' \n ' ;
1557- }
1554+ *p++ = ' \n ' ;
15581555
15591556 if (code == 0x4f )
15601557 {
@@ -1575,11 +1572,9 @@ _path_module::convert_to_svg(const Py::Tuple& args)
15751572 *p++ = ' ' ;
15761573 p += snprintf (p, buffersize - (p - buffer), format, y);
15771574
1578- wait-- ;
1575+ --wait ;
15791576 }
15801577
1581- *p = 0 ;
1582-
15831578 PyObject* result = PyString_FromStringAndSize (buffer, p - buffer);
15841579 free (buffer);
15851580
You can’t perform that action at this time.
0 commit comments