Skip to content

Commit

Permalink
make linters happy
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
ahcorde committed Aug 21, 2023
1 parent 65be04f commit 80b607b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
11 changes: 6 additions & 5 deletions zstd_point_cloud_transport/src/zstd_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include <zstd.h>

#include <memory>
#include <string>
#include <utility>
#include <vector>

#include <zstd_point_cloud_transport/zstd_publisher.hpp>

#include "zstd.h"

namespace zstd_point_cloud_transport
{

Expand Down Expand Up @@ -96,8 +96,9 @@ ZstdPublisher::TypedEncodeResult ZstdPublisher::encodeTyped(
std::string comp_buffer{};
comp_buffer.resize(est_compress_size);
auto compress_size =
ZSTD_compress((void*)comp_buffer.data(), est_compress_size, &raw.data[0],
raw.data.size(), this->encode_level_);
ZSTD_compress(
static_cast<void *>(omp_buffer.data()), est_compress_size, &raw.data[0],
raw.data.size(), this->encode_level_);

comp_buffer.resize(compress_size);
comp_buffer.shrink_to_fit();
Expand All @@ -119,4 +120,4 @@ ZstdPublisher::TypedEncodeResult ZstdPublisher::encodeTyped(
return compressed;
}

} // namespace zlib_point_cloud_transport
} // namespace zstd_point_cloud_transport
14 changes: 7 additions & 7 deletions zstd_point_cloud_transport/src/zstd_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include <zstd.h>

#include <list>
#include <memory>
#include <string>
Expand All @@ -38,8 +40,6 @@

#include <zstd_point_cloud_transport/zstd_subscriber.hpp>

#include "zstd.h"

namespace zstd_point_cloud_transport
{
void ZstdSubscriber::declareParameters()
Expand All @@ -62,16 +62,16 @@ ZstdSubscriber::DecodeResult ZstdSubscriber::decodeTyped(
auto result = std::make_shared<sensor_msgs::msg::PointCloud2>();

auto const est_decomp_size =
ZSTD_getDecompressedSize(&msg.compressed_data[0], msg.compressed_data.size());
ZSTD_getDecompressedSize(&msg.compressed_data[0], msg.compressed_data.size());

std::string decomp_buffer{};
decomp_buffer.resize(est_decomp_size);

size_t const decomp_size = ZSTD_decompress(
(void*)decomp_buffer.data(),
est_decomp_size,
&msg.compressed_data[0],
msg.compressed_data.size());
static_cast<void *>(decomp_buffer.data()),
est_decomp_size,
&msg.compressed_data[0],
msg.compressed_data.size());

decomp_buffer.resize(decomp_size);
decomp_buffer.shrink_to_fit();
Expand Down

0 comments on commit 80b607b

Please sign in to comment.