From 9b476e140d981281b47995fc6c98815c7feba507 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 14 Jul 2015 12:23:40 -0300 Subject: [PATCH] Path: Several fixes suggested by wmayer --- src/Mod/Path/App/Command.cpp | 8 ++++---- src/Mod/Path/App/Command.h | 6 +++--- src/Mod/Path/App/TooltablePyImp.cpp | 1 - src/Mod/Path/Gui/DlgProcessorChooser.cpp | 4 +++- src/Mod/Path/Gui/DlgSettingsPathColor.cpp | 2 +- src/Mod/Path/Gui/ViewProviderPath.cpp | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Mod/Path/App/Command.cpp b/src/Mod/Path/App/Command.cpp index 53496c6dd3b4..96156065e79b 100644 --- a/src/Mod/Path/App/Command.cpp +++ b/src/Mod/Path/App/Command.cpp @@ -109,7 +109,7 @@ Vector3d Command::getCenter (void) return vec; } -const double Command::getValue(const std::string attr) +const double Command::getValue(const std::string& attr) { std::string a(attr); boost::to_upper(a); @@ -119,11 +119,11 @@ const double Command::getValue(const std::string attr) return val; } -const bool Command::has(const std::string attr) +const bool Command::has(const std::string& attr) { std::string a(attr); boost::to_upper(a); - return (bool)Parameters.count(a); + return Parameters.count(a) > 0; } std::string Command::toGCode (void) const @@ -139,7 +139,7 @@ std::string Command::toGCode (void) const return str.str(); } -void Command::setFromGCode (std::string str) +void Command::setFromGCode (const std::string& str) { Parameters.clear(); std::string mode = "none"; diff --git a/src/Mod/Path/App/Command.h b/src/Mod/Path/App/Command.h index 0b02a149457c..8adf6c613334 100644 --- a/src/Mod/Path/App/Command.h +++ b/src/Mod/Path/App/Command.h @@ -53,11 +53,11 @@ namespace Path Base::Vector3d getCenter (void); // returns a 3d vector from the i,j,k parameters void setCenter(const Base::Vector3d&, bool clockwise=true); // sets the center coordinates and the command name std::string toGCode (void) const; // returns a GCode string representation of the command - void setFromGCode (std::string); // sets the parameters from the contents of the given GCode string + void setFromGCode (const std::string&); // sets the parameters from the contents of the given GCode string void setFromPlacement (const Base::Placement&); // sets the parameters from the contents of the given placement - const bool has(const std::string); // returns true if the given string exists in the parameters + const bool has(const std::string&); // returns true if the given string exists in the parameters Command transform(const Base::Placement); // returns a transformed copy of this command - const double getValue(const std::string); // returns the value of a given parameter + const double getValue(const std::string&); // returns the value of a given parameter // attributes std::string Name; diff --git a/src/Mod/Path/App/TooltablePyImp.cpp b/src/Mod/Path/App/TooltablePyImp.cpp index dc05df498f99..8aa3d148f07a 100644 --- a/src/Mod/Path/App/TooltablePyImp.cpp +++ b/src/Mod/Path/App/TooltablePyImp.cpp @@ -58,7 +58,6 @@ PyObject *ToolPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Pytho // constructor method int ToolPy::PyInit(PyObject* args, PyObject* kwd) { - PyObject *pos; char *name="Default tool"; char *type = "Undefined"; char *mat = "Undefined"; diff --git a/src/Mod/Path/Gui/DlgProcessorChooser.cpp b/src/Mod/Path/Gui/DlgProcessorChooser.cpp index 34f04c08147d..7b41c8643180 100644 --- a/src/Mod/Path/Gui/DlgProcessorChooser.cpp +++ b/src/Mod/Path/Gui/DlgProcessorChooser.cpp @@ -40,6 +40,8 @@ using namespace PathGui; +/* TRANSLATOR PathGui::DlgProcessorChooser */ + DlgProcessorChooser::DlgProcessorChooser(std::vector &scriptnames) : QDialog(Gui::getMainWindow()), ui(new Ui_DlgProcessorChooser) { @@ -64,7 +66,7 @@ void DlgProcessorChooser::accept() if (ui->comboBox->currentText() == tr("None")) entry = ""; else - entry = ui->comboBox->currentText().toStdString(); + entry = ui->comboBox->currentText().toUtf8().data(); QDialog::accept(); } #include "moc_DlgProcessorChooser.cpp" diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp index ee4b1b4fd6e9..7e301ee596bb 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp @@ -30,7 +30,7 @@ using namespace PathGui; -/* TRANSLATOR PartGui::DlgSettingsPathColor */ +/* TRANSLATOR PathGui::DlgSettingsPathColor */ /** * Constructs a DlgSettingsObjectColor which is a child of 'parent', with the diff --git a/src/Mod/Path/Gui/ViewProviderPath.cpp b/src/Mod/Path/Gui/ViewProviderPath.cpp index 955ec11c2dac..dadf6a09c035 100644 --- a/src/Mod/Path/Gui/ViewProviderPath.cpp +++ b/src/Mod/Path/Gui/ViewProviderPath.cpp @@ -231,7 +231,7 @@ void ViewProviderPath::updateData(const App::Property* prop) bool absolute = true; bool first = true; - for (int i = 0; i < tp.getSize(); i++) { + for (unsigned int i = 0; i < tp.getSize(); i++) { Path::Command cmd = tp.getCommand(i); std::string name = cmd.Name; Base::Vector3d next = cmd.getPlacement().getPosition();