-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Fix compilation errors for 32bits/LITE/ios build. #5220
Fix compilation errors for 32bits/LITE/ios build. #5220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! It looks good, except a formatting comment.
table/block_based_table_builder.cc
Outdated
@@ -1064,7 +1064,7 @@ void BlockBasedTableBuilder::EnterUnbuffered() { | |||
if (!r->data_block_and_keys_buffers.empty()) { | |||
while (compression_dict_samples.size() < kSampleBytes) { | |||
size_t rand_idx = | |||
generator.Uniform(r->data_block_and_keys_buffers.size()); | |||
(size_t)generator.Uniform(r->data_block_and_keys_buffers.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use C++ style casting static_cast<>
. Same in other places.
We are following Google C++ Style and it is the suggestion there: https://google.github.io/styleguide/cppguide.html#Casting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have updated the coding style.
table/block_based_table_builder.cc
Outdated
@@ -1064,7 +1064,7 @@ void BlockBasedTableBuilder::EnterUnbuffered() { | |||
if (!r->data_block_and_keys_buffers.empty()) { | |||
while (compression_dict_samples.size() < kSampleBytes) { | |||
size_t rand_idx = | |||
generator.Uniform(r->data_block_and_keys_buffers.size()); | |||
static_cast<size_t>(generator.Uniform(r->data_block_and_keys_buffers.size())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you wrap the line into 80-char?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siying has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siying is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: When I build RocksDB for 32bits/LITE/iOS environment, some errors like the following. ` table/block_based_table_reader.cc:971:44: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned long') [-Werror,-Wshorten-64-to-32] size_t block_size = props_block_handle.size(); ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~^~~~~~ ./util/file_reader_writer.h:177:8: error: private field 'env_' is not used [-Werror,-Wunused-private-field] Env* env_; ^ ` Pull Request resolved: facebook#5220 Differential Revision: D15023481 Pulled By: siying fbshipit-source-id: 1b5d121d3016f2b0a8a9a2cc1bd638479357f9f7
When I build RocksDB for 32bits/LITE/iOS environment, some errors like the following.
`
table/block_based_table_reader.cc:971:44: error: implicit conversion loses integer precision: 'uint64_t'
(aka 'unsigned long long') to 'size_t' (aka 'unsigned long') [-Werror,-Wshorten-64-to-32]
size_t block_size = props_block_handle.size();
~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~^~~~~~
./util/file_reader_writer.h:177:8: error: private field 'env_' is not used [-Werror,-Wunused-private-field]
Env* env_;
^
`