FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix compiler warning by mdboom · Pull Request #3781 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .h  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
5 changes: 4 additions & 1 deletion src/py_adaptors.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Back | FazBrowse Home | New Git URL