mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 16:53:33 +08:00
Removing all dirty 'using namespace std' that were used as C++ library compatibility work-around
This commit is contained in:
@@ -123,7 +123,6 @@
|
||||
|
||||
#if UAVCAN_TOSTRING
|
||||
# include <string>
|
||||
# include <cstdio>
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/transport/transfer.hpp>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define UAVCAN_DRIVER_CAN_HPP_INCLUDED
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/driver/system_clock.hpp>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef UAVCAN_DRIVER_SYSTEM_CLOCK_HPP_INCLUDED
|
||||
#define UAVCAN_DRIVER_SYSTEM_CLOCK_HPP_INCLUDED
|
||||
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/time.hpp>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/util/templates.hpp>
|
||||
#include <uavcan/util/placement_new.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
@@ -157,7 +157,6 @@ bool PoolManager<MaxPools>::addPool(IPoolAllocator* pool)
|
||||
}
|
||||
}
|
||||
// We need to keep the pools in order, so that smallest blocks go first
|
||||
using namespace std; // for qsort()
|
||||
qsort(pools_, MaxPools, sizeof(IPoolAllocator*), &PoolManager::qsortComparePoolAllocators);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define UAVCAN_ERROR_HPP_INCLUDED
|
||||
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define UAVCAN_HELPERS_COMPONENT_STATUS_MANAGER_HPP_INCLUDED
|
||||
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/protocol/NodeStatus.hpp>
|
||||
|
||||
namespace uavcan
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/marshal/type_util.hpp>
|
||||
#include <uavcan/marshal/integer_spec.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
|
||||
#ifndef UAVCAN_CPP_VERSION
|
||||
# error UAVCAN_CPP_VERSION
|
||||
@@ -729,10 +730,9 @@ public:
|
||||
const SizeType max_size = SizeType(capacity() - size());
|
||||
|
||||
// We have one extra byte for the null terminator, hence +1
|
||||
using namespace std; // For snprintf()
|
||||
const int ret = snprintf(reinterpret_cast<char*>(ptr), SizeType(max_size + 1U), format, value);
|
||||
|
||||
for (int i = 0; i < ::uavcan::min(ret, int(max_size)); i++)
|
||||
for (int i = 0; i < min(ret, int(max_size)); i++)
|
||||
{
|
||||
Base::grow();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define UAVCAN_MARSHAL_BIT_STREAM_HPP_INCLUDED
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/util/templates.hpp>
|
||||
#include <uavcan/transport/abstract_transfer_buffer.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define UAVCAN_MARSHAL_FLOAT_SPEC_HPP_INCLUDED
|
||||
|
||||
#include <cmath>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/data_type.hpp>
|
||||
#include <uavcan/util/templates.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef UAVCAN_MARSHAL_INTEGER_SPEC_HPP_INCLUDED
|
||||
#define UAVCAN_MARSHAL_INTEGER_SPEC_HPP_INCLUDED
|
||||
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/data_type.hpp>
|
||||
#include <uavcan/util/templates.hpp>
|
||||
#include <uavcan/marshal/scalar_codec.hpp>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define UAVCAN_MARSHAL_SCALAR_CODEC_HPP_INCLUDED
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/util/templates.hpp>
|
||||
#include <uavcan/marshal/bit_stream.hpp>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/error.hpp>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/data_type.hpp>
|
||||
#include <uavcan/util/bitset.hpp>
|
||||
#include <uavcan/util/templates.hpp>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef UAVCAN_NODE_TIMER_HPP_INCLUDED
|
||||
#define UAVCAN_NODE_TIMER_HPP_INCLUDED
|
||||
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/error.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/util/linked_list.hpp>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define UAVCAN_STDINT_HPP_INCLUDED
|
||||
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <cstdio>
|
||||
|
||||
#if !defined(UAVCAN_CPP_VERSION) || !defined(UAVCAN_CPP11)
|
||||
# error UAVCAN_CPP_VERSION
|
||||
@@ -14,10 +15,13 @@
|
||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||
|
||||
# include <cstdint>
|
||||
# include <cstdio>
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
using std::snprintf; // Can be used to replace standard snprintf() with a user-provided one.
|
||||
|
||||
typedef std::uint8_t uint8_t;
|
||||
typedef std::uint16_t uint16_t;
|
||||
typedef std::uint32_t uint32_t;
|
||||
@@ -32,14 +36,14 @@ typedef std::int64_t int64_t;
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* C++03 doesn't define standard integer types, so we pull it from the C library as a workaround.
|
||||
*/
|
||||
# include <stdint.h>
|
||||
# include <stdint.h> // Standard integer types from C library
|
||||
# include <stdio.h> // snprintf() from the C library
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
using ::snprintf;
|
||||
|
||||
typedef ::uint8_t uint8_t;
|
||||
typedef ::uint16_t uint16_t;
|
||||
typedef ::uint32_t uint32_t;
|
||||
@@ -6,7 +6,7 @@
|
||||
#define UAVCAN_TIME_HPP_INCLUDED
|
||||
|
||||
#include <cstdio>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/util/templates.hpp>
|
||||
#include <uavcan/Timestamp.hpp>
|
||||
@@ -223,7 +223,6 @@ const unsigned TimeBase<T, D>::StringBufSize;
|
||||
template <typename D>
|
||||
void DurationBase<D>::toString(char buf[StringBufSize]) const
|
||||
{
|
||||
using namespace std; // For snprintf()
|
||||
char* ptr = buf;
|
||||
if (isNegative())
|
||||
{
|
||||
@@ -238,7 +237,6 @@ void DurationBase<D>::toString(char buf[StringBufSize]) const
|
||||
template <typename T, typename D>
|
||||
void TimeBase<T, D>::toString(char buf[StringBufSize]) const
|
||||
{
|
||||
using namespace std; // For snprintf()
|
||||
(void)snprintf(buf, StringBufSize, "%llu.%06lu",
|
||||
static_cast<unsigned long long>(toUSec() / 1000000UL),
|
||||
static_cast<unsigned long>(toUSec() % 1000000UL));
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define UAVCAN_TRANSPORT_ABSTRACT_TRANSFER_BUFFER_HPP_INCLUDED
|
||||
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/error.hpp>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/util/linked_list.hpp>
|
||||
#include <uavcan/dynamic_memory.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define UAVCAN_TRANSPORT_CRC_HPP_INCLUDED
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
|
||||
namespace uavcan
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/error.hpp>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/transport/perf_counter.hpp>
|
||||
#include <uavcan/transport/transfer_listener.hpp>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define UAVCAN_TRANSPORT_OUTGOING_TRANSFER_REGISTRY_HPP_INCLUDED
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/util/map.hpp>
|
||||
#include <uavcan/debug.hpp>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef UAVCAN_TRANSPORT_PERF_COUNTER_HPP_INCLUDED
|
||||
#define UAVCAN_TRANSPORT_PERF_COUNTER_HPP_INCLUDED
|
||||
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
|
||||
namespace uavcan
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef UAVCAN_TRANSPORT_TRANSFER_BUFFER_HPP_INCLUDED
|
||||
#define UAVCAN_TRANSPORT_TRANSFER_BUFFER_HPP_INCLUDED
|
||||
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/error.hpp>
|
||||
#include <uavcan/transport/frame.hpp>
|
||||
#include <uavcan/transport/abstract_transfer_buffer.hpp>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <uavcan/error.hpp>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/transport/transfer_receiver.hpp>
|
||||
#include <uavcan/transport/perf_counter.hpp>
|
||||
#include <uavcan/util/linked_list.hpp>
|
||||
|
||||
Reference in New Issue
Block a user