Skip to content

Fix compiler warning #3781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 11, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/py_adaptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ class PathIterator

inline unsigned vertex(double *x, double *y)
{
if (m_iterator >= m_total_vertices)
if (m_iterator >= m_total_vertices) {
*x = 0.0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting the last vertex to 0 was the source of those 3D polygon bugs, is something similar going to come up here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. When the code returned is agg::path_cmd_stop, the x and y values are actually meaningless and should be ignored by the caller. This fix is only to silence a compiler warning that it is theoretically possible to get a vertex where the x y values were never set (if it were a 0-length path), since the compiler doesn't understand the semantics of the vertex codes.

*y = 0.0;
return agg::path_cmd_stop;
}

const size_t idx = m_iterator++;

Expand Down