Skip to content
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

Bug fixes #115

Merged
merged 8 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2010-2020, Florent Lamiraux, Thomas Moulard, Olivier Stasse, Guilhem
# Saurel, JRL, CNRS/AIST, LAAS-CNRS

cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.10)

# Project properties
set(PROJECT_ORG stack-of-tasks)
Expand Down
2 changes: 0 additions & 2 deletions include/dynamic-graph/python/interpreter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ class DYNAMIC_GRAPH_PYTHON_DLLAPI Interpreter {
PyThreadState* _pyState;
/// Pointer to the dictionary of global variables
PyObject* globals_;
/// Pointer to the dictionary of local variables
PyObject* locals_;
PyObject* mainmod_;
};
} // namespace python
Expand Down
5 changes: 3 additions & 2 deletions src/dynamic_graph/convert-dg-to-py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <boost/python.hpp>
#include <boost/python/stl_iterator.hpp>
#include <cstdint>
#include <iostream>
#include <sstream>

Expand All @@ -30,11 +31,11 @@ command::Value toValue(bp::object o, const command::Value::Type& valueType) {
case (Value::UNSIGNED):
return Value(bp::extract<unsigned>(o));
case (Value::UNSIGNEDLONGINT):
return Value(bp::extract<unsigned long int>(o));
return Value(bp::extract<std::uint64_t>(o));
olivier-stasse marked this conversation as resolved.
Show resolved Hide resolved
case (Value::INT):
return Value(bp::extract<int>(o));
case (Value::LONGINT):
return Value(bp::extract<long int>(o));
return Value(bp::extract<std::int64_t>(o));
case (Value::FLOAT):
return Value(bp::extract<float>(o));
case (Value::DOUBLE):
Expand Down
7 changes: 5 additions & 2 deletions src/dynamic_graph/entity-py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ bp::object executeCmd(bp::tuple args, bp::dict) {
throw std::out_of_range("Wrong number of arguments");
std::vector<Value> values;
values.reserve(command.valueTypes().size());
for (int i = 1; i < bp::len(args); ++i)
values.push_back(convert::toValue(args[i], command.valueTypes()[i - 1]));
for (bp::ssize_t i = 1; i < bp::len(args); ++i)
values.push_back(convert::toValue(
args[i],
command
.valueTypes()[static_cast<std::vector<Value>::size_type>(i - 1)]));
command.setParameterValues(values);
return convert::fromValue(command.execute());
}
Expand Down
4 changes: 2 additions & 2 deletions src/interpreter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ void Interpreter::runMain(void) {

std::string Interpreter::processStream(std::istream& stream, std::ostream& os) {
char line[10000];
sprintf(line, "%s", "\n");
std::string command;
std::streamsize maxSize = 10000;
snprintf(line, static_cast<size_t>(maxSize), "%s", "\n");
std::string command;
#if 0
while (line != std::string("")) {
stream.getline(line, maxSize, '\n');
Expand Down