Skip to content

Commit

Permalink
Merge pull request #115 from olivier-stasse/devel
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
nim65s authored Oct 25, 2023
2 parents 380360b + f683732 commit 5330bd0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
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));
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

0 comments on commit 5330bd0

Please sign in to comment.