Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <mjcarroll@intrinsic.ai>
  • Loading branch information
mjcarroll committed May 22, 2023
1 parent 9266513 commit 1254728
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 31 deletions.
13 changes: 6 additions & 7 deletions av/src/VideoEncoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -394,20 +394,19 @@ bool VideoEncoder::Start(
if (this->dataPtr->format.compare(outputFormat->name) == 0)
{
// Allocate the context using the correct outputFormat
auto result = avformat_alloc_output_context2(&this->dataPtr->formatCtx,
auto result = avformat_alloc_output_context2(
&this->dataPtr->formatCtx,
outputFormat, nullptr, this->dataPtr->filename.c_str());
if (result < 0)
{
gzerr << "Failed to allocate AV context [" << av_err2str_cpp(result)
<< "]" << std::endl;
gzerr << "Failed to allocate AV context ["
<< av_err2str_cpp(result)
<< "]" << std::endl;
}
break;
}
}
}
while (outputFormat);


} while (outputFormat);
#endif
}
else
Expand Down
1 change: 1 addition & 0 deletions events/src/Event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "gz/common/Console.hh"
#include "gz/common/Event.hh"
#include "gz/common/Util.hh"

using namespace gz;
using namespace common;
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ add_executable(logging_performance logging_performance.cc)
target_link_libraries(logging_performance gz-common${GZ_COMMON_VER}::core)

add_executable(util_example util.cc)
target_link_libraries(util_example ignition-common${GZ_COMMON_VER}::core)
target_link_libraries(util_example gz-common${GZ_COMMON_VER}::core)
3 changes: 2 additions & 1 deletion examples/logging_performance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@

/* This code is originally from:
* https://gist.github.com/KjellKod/0fde0d2564e2eb1b3560
* For testing worst-case console logging latency with a variable number of
* For testing worst-case console logging latency with a variable number of
* threads.
*/

#include <atomic>
#include <map>
#include <thread>
#include <vector>

#include <gz/common/Console.hh>

Expand Down
2 changes: 1 addition & 1 deletion geospatial/src/Dem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Dem::~Dem()
void Dem::SetSphericalCoordinates(
const math::SphericalCoordinates &_worldSphericalCoordinates)
{
this->dataPtr->sphericalCoordinates =_worldSphericalCoordinates;
this->dataPtr->sphericalCoordinates = _worldSphericalCoordinates;
}

//////////////////////////////////////////////////
Expand Down
3 changes: 1 addition & 2 deletions graphics/src/Image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void Image::SetFromData(const unsigned char *_data,
{
bpp = 8;
scanlineBytes = _width;
}
}
else
{
gzerr << "Unable to handle format[" << _format << "]\n";
Expand Down Expand Up @@ -613,7 +613,6 @@ math::Color Image::MaxColor() const

if (this->dataPtr->PixelIndex(
this->dataPtr->bitmap, x, y, clr) == FALSE)

{
gzerr << "Image: Coordinates out of range ["
<< x << " " << y << "] \n";
Expand Down
2 changes: 2 additions & 0 deletions include/ignition/common/SpecializedPlugin.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <ignition/common/config.hh>
#include "ignition/common/Plugin.hh"

#include <memory>

namespace gz
{
namespace common
Expand Down
5 changes: 3 additions & 2 deletions io/include/gz/common/DataFrame.hh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace gz
public: const std::vector<K> Keys() const
{
std::vector<K> keyList;
for (auto &[k, _]: this->storage)
for (auto &[k, _] : this->storage)
{
keyList.push_back(k);
}
Expand All @@ -84,7 +84,8 @@ namespace gz
private: std::unordered_map<K, V> storage;
};

/// \brief Traits for IO of data frames comprised of time varying volumetric grids.
/// \brief Traits for IO of data frames comprised of time varying
/// volumetric grids.
///
/// \tparam K Data frame key type.
/// \tparam T Time coordinate type.
Expand Down
2 changes: 2 additions & 0 deletions src/Plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#define SUPPRESS_IGNITION_HEADER_DEPRECATION

#include <cassert>

#include "gz/utils/SuppressWarning.hh"
#include "ignition/common/Console.hh"

Expand Down
6 changes: 3 additions & 3 deletions testing/include/gz/common/testing/AutoLogFixture.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
#ifndef GZ_COMMON_TESTING_AUTOLOGFIXTURE_HH_
#define GZ_COMMON_TESTING_AUTOLOGFIXTURE_HH_

/// Protect to guarantee that gtest is included before this header.
#ifdef GTEST_API_

#include <memory>
#include <string>

/// Protect to guarantee that gtest is included before this header.
#ifdef GTEST_API_

#include <gz/utils/ImplPtr.hh>

namespace gz::common::testing
Expand Down
10 changes: 5 additions & 5 deletions testing/include/gz/common/testing/RedirectConsoleStream.hh
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ enum class StreamSource

class GZ_COMMON_TESTING_VISIBLE RedirectConsoleStream
{
/// \brief Constructor
/// \brief Constructor
///
/// Redirect a choosen stream to a temporary file that can be read back.
/// Upon destruction, any redirection will be removed.
/// Upon destruction, the temporary file will be removed.
/// Access contents before destruction using GetString
///
/// \param[in] _source Console source to redirect (eg stdout or stderr)
/// \param[in] _destination Destination filename
public: RedirectConsoleStream(const StreamSource &_source,
/// \param[in] _destination Destination filename
public: RedirectConsoleStream(const StreamSource &_source,
const std::string &_destination);

/// \brief Get the contents of the redirected console output
Expand All @@ -60,14 +60,14 @@ class GZ_COMMON_TESTING_VISIBLE RedirectConsoleStream
};

/// \brief Redirect standard out to a test-specific temporary path
inline RedirectConsoleStream RedirectStdout()
inline RedirectConsoleStream RedirectStdout()
{
auto path = gz::common::testing::TempPath("stdout.out");
return RedirectConsoleStream(StreamSource::STDOUT, path);
}

/// \brief Redirect standard error to a test-specific temporary path
inline RedirectConsoleStream RedirectStderr()
inline RedirectConsoleStream RedirectStderr()
{
auto path = gz::common::testing::TempPath("stderr.out");
return RedirectConsoleStream(StreamSource::STDERR, path);
Expand Down
6 changes: 3 additions & 3 deletions testing/include/gz/common/testing/detail/AutoLogFixture.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#ifndef GZ_COMMON_TESTING_DETAIL_AUTOLOGFIXTURE_HH_
#define GZ_COMMON_TESTING_DETAIL_AUTOLOGFIXTURE_HH_

#include <memory>
#include <string>

/// Protect to guarantee that gtest is included before this header.
///
/// While downstream users should never directly include the detail
Expand All @@ -25,9 +28,6 @@

#include "gz/common/testing/AutoLogFixture.hh"

#include <memory>
#include <string>

#include <gz/common/Console.hh>
#include <gz/common/Filesystem.hh>
#include <gz/common/TempDirectory.hh>
Expand Down
10 changes: 5 additions & 5 deletions testing/src/RedirectConsoleStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace gz::common::testing

class RedirectConsoleStream::Implementation
{
/// \brief Console source being redirected
/// \brief Console source being redirected
public: StreamSource source;

/// \brief Filename to write console output to
Expand Down Expand Up @@ -129,14 +129,14 @@ RedirectConsoleStream::RedirectConsoleStream(const StreamSource &_source,
}

this->dataPtr->fd = GetSourceFd(_source);

// Store the fd so that it can be restored upon destruction
this->dataPtr->originalFd = dup(this->dataPtr->fd);

int sinkFd;
// Create a file with read/write permissions and exclusive access
if ((sinkFd = open(this->dataPtr->sink.c_str(),
O_EXCL | O_RDWR | O_CREAT,
if ((sinkFd = open(this->dataPtr->sink.c_str(),
O_EXCL | O_RDWR | O_CREAT,
S_IREAD | S_IWRITE)) < 0)
{
gzerr << "Failed to open sink file, console redirection disabled"
Expand All @@ -153,7 +153,7 @@ RedirectConsoleStream::RedirectConsoleStream(const StreamSource &_source,
}

//////////////////////////////////////////////////
std::string RedirectConsoleStream::GetString()
std::string RedirectConsoleStream::GetString()
{
this->dataPtr->RemoveRedirection();

Expand Down
1 change: 0 additions & 1 deletion testing/src/RedirectConsoleStream_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,3 @@ TEST(RedirectConsoleStream, Console)
EXPECT_EQ(err.find("message"), std::string::npos);
EXPECT_EQ(err.find("debug"), std::string::npos);
}

0 comments on commit 1254728

Please sign in to comment.