Skip to content

Commit 4af0da0

Browse files
committed
OcdFileImport: Process coords with std::accumulate
... accumulating the actual number of accepted coords. Preparation for improved state handling and bug fixes. No observable change of behavior intented.
1 parent 5d92a58 commit 4af0da0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/fileformats/ocd_file_import.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,9 +2122,7 @@ void OcdFileImport::fillPathCoords(OcdImportedPathObject *object, bool is_area,
21222122
{
21232123
object->coords.resize(num_points);
21242124
quint32 ignore_hole_points = 2;
2125-
for (auto i = 0u; i < num_points; i++)
2126-
{
2127-
const auto& ocd_point = ocd_points[i];
2125+
auto count = std::accumulate(ocd_points, ocd_points + num_points, 0, [this, object, is_area, &ignore_hole_points](auto i, auto& ocd_point) {
21282126
object->coords[i] = convertOcdPoint(ocd_point);
21292127
if ((ocd_point.y & Ocd::OcdPoint32::FlagDash) || (ocd_point.y & Ocd::OcdPoint32::FlagCorner))
21302128
{
@@ -2150,7 +2148,9 @@ void OcdFileImport::fillPathCoords(OcdImportedPathObject *object, bool is_area,
21502148
object->coords[i-1].setHolePoint(true);
21512149
}
21522150
}
2153-
};
2151+
return ++i;
2152+
});
2153+
Q_ASSERT(object->coords.size() == count);
21542154

21552155
// For path objects, create closed parts where the position of the last point is equal to that of the first point
21562156
if (object->getType() == Object::Path)

0 commit comments

Comments
 (0)