Repository: FreeCAD/FreeCAD
File: src/Mod/Sketcher/Gui/DrawSketchHandlerScale.h (C/C++)

Code before:
        if (listOfFacadeIds.empty()) {
            return;
        }

        std::stringstream stream;
        int geoId = getHighestCurveIndex() - listOfFacadeIds.size() + 1;
        for (size_t j = 0; j < listOfFacadeIds.size() - 1; j++) {
            stream << "(" << geoId << "," << listOfFacadeIds[j] << "),";
            geoId++;
        }
        stream << "(" << geoId << "," << listOfFacadeIds.back() << ")";
        try {
            Gui::cmdAppObjectArgs(sketchgui->getObject(), "setGeometryIds([%s])", stream.str().c_str());
        }
        catch (const Base::Exception& e) {
            Base::Console().error("%s\n", e.what());
        }
    }
    void scaleLabels(size_t constraintIndexOffset)
    {
        SketchObject* sketch = sketchgui->getSketchObject();

        for (auto toScale : listOfLabelsToScale) {
            int constrId = toScale.constrId + constraintIndexOffset;

            sketch->setLabelDistance(constrId, toScale.distance * scaleFactor);

            // Label position or radii and diameters represent an angle, so
            // they should not be scaled
            Sketcher::ConstraintType type = sketch->Constraints[constrId]->Type;
            if (type == Sketcher::ConstraintType::Radius
                || type == Sketcher::ConstraintType::Diameter) {
                sketch->setLabelPosition(constrId, toScale.position);
            }
            else {
                sketch->setLabelPosition(constrId, toScale.position * scaleFactor);
            }
        }
    }

    void createShape(bool onlyeditoutline) override
    {
        SketchObject* Obj = sketchgui->getSketchObject();

        ShapeGeometry.clear();

        if (state() == SelectMode::SeekSecond) {
            if (refLength > Precision::Confusion()) {
                addLineToShapeGeometry(toVector3d(referencePoint), toVector3d(startPoint), true);
            }
            return;

Review comment (bug):
Can you fix these issues?

`narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]`
`narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]`

Code after:
        if (listOfFacadeIds.empty()) {
            return;
        }

        std::stringstream stream;
        int geoId = getHighestCurveIndex() - listOfFacadeIds.size() + 1;
        for (size_t j = 0; j < listOfFacadeIds.size() - 1; j++) {
            stream << "(" << geoId << "," << listOfFacadeIds[j] << "),";
            geoId++;
        }
        stream << "(" << geoId << "," << listOfFacadeIds.back() << ")";
        try {
            Gui::cmdAppObjectArgs(sketchgui->getObject(), "setGeometryIds([%s])", stream.str().c_str());
        }
        catch (const Base::Exception& e) {
            Base::Console().error("%s\n", e.what());
        }
    }
    void scaleLabels(int constraintIndexOffset)
    {
        SketchObject* sketch = sketchgui->getSketchObject();

        for (auto toScale : listOfLabelsToScale) {
            int constrId = toScale.constrId + constraintIndexOffset;

            sketch->setLabelDistance(constrId, toScale.distance * static_cast<float>(scaleFactor));

            // Label position or radii anddiameters represent an angle, so
            // they should not be scaled
            Sketcher::ConstraintType type = sketch->Constraints[constrId]->Type;
            if (type == Sketcher::ConstraintType::Radius
                || type == Sketcher::ConstraintType::Diameter) {
                sketch->setLabelPosition(constrId, toScale.position);
            }
            else {
                sketch->setLabelPosition(constrId, toScale.position * static_cast<float>(scaleFactor));
            }
        }
    }

    void createShape(bool onlyeditoutline) override
    {
        SketchObject* Obj = sketchgui->getSketchObject();

        ShapeGeometry.clear();

        if (state() == SelectMode::SeekSecond) {
            if (refLength > Precision::Confusion()) {
                addLineToShapeGeometry(toVector3d(referencePoint), toVector3d(startPoint), true);
            }
            return;