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

[3.2] fix compile warnings in trace_api_plugin #35

Merged
merged 6 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions plugins/trace_api_plugin/compressed_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ struct compressed_file_impl {
}
}

void seek( long loc, fc::cfile& file ) {
void seek( uint64_t loc, fc::cfile& file ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to change the long remaining = loc to uint64_t remaining = loc? It's not a warning but it may be worthwhile keeping the types the same as they were before

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is even better. Will change it to auto remaining = loc;

if (initialized) {
inflateEnd(&strm);
initialized = false;
Expand All @@ -130,7 +130,7 @@ struct compressed_file_impl {
file.read(reinterpret_cast<char*>(seek_point_map.data()), seek_point_map.size() * sizeof(seek_point_entry));

// seek to the neareast seek point
auto iter = std::lower_bound(seek_point_map.begin(), seek_point_map.end(), (uint64_t)loc, []( const auto& lhs, const auto& rhs ){
auto iter = std::lower_bound(seek_point_map.begin(), seek_point_map.end(), loc, []( const auto& lhs, const auto& rhs ){
return std::get<0>(lhs) < rhs;
});

Expand Down Expand Up @@ -179,7 +179,7 @@ compressed_file::compressed_file( fc::path file_path )
compressed_file::~compressed_file()
{}

void compressed_file::seek( long loc ) {
void compressed_file::seek( uint64_t loc ) {
impl->seek(loc, *file_ptr);

}
Expand Down Expand Up @@ -233,7 +233,7 @@ bool compressed_file::process( const fc::path& input_path, const fc::path& outpu
auto output_buffer = std::vector<uint8_t>(buffer_size);

auto bytes_remaining_before_sync = seek_point_stride;
int next_sync_point = 0;
size_t next_sync_point = 0;

// process a single chunk of input completely,
// this may sometime loop multiple times if the compressor state combined with input data creates more than a
Expand Down Expand Up @@ -312,4 +312,4 @@ bool compressed_file::process( const fc::path& input_path, const fc::path& outpu
return true;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace eosio::trace_api {
* @throws std::ios_base::failure if this would seek past the end of the file
* @throws compressed_file_error if the compressed data stream is corrupt or unreadable
*/
void seek( long loc );
void seek( uint64_t loc );

/**
* Read a given number of uncompressed bytes to the buffer pointed to by `d`.
Expand Down Expand Up @@ -165,4 +165,4 @@ namespace eosio::trace_api {
using std::runtime_error::runtime_error;
};

}
}
2 changes: 1 addition & 1 deletion plugins/trace_api_plugin/trace_api_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ struct trace_api_plugin_impl {
:common(common) {}

static void set_program_options(appbase::options_description& cli, appbase::options_description& cfg) {
auto cfg_options = cfg.add_options();
cfg.add_options();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this line just be entirely removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The whole function trace_api_plugin_impl::trace_api_plugin_impl can be removed.

}

void plugin_initialize(const appbase::variables_map& options) {
Expand Down