Skip to content

Commit e6fe824

Browse files
r-barnesfacebook-github-bot
authored andcommitted
Fix shadowed variable in fbpcf/mpc_std_lib/unified_data_process/data_processor/test/DataProcessorTest.cpp (#528)
Summary: Pull Request resolved: #528 Our upcoming compiler upgrade will require us not to have shadowed variables. Such variables have a _high_ bug rate and reduce readability, so we would like to avoid them even if the compiler was not forcing us to do so. This codemod attempts to fix an instance of a shadowed variable. Please review with care: if it's failed the result will be a silent bug. **What's a shadowed variable?** Shadowed variables are variables in an inner scope with the same name as another variable in an outer scope. Having the same name for both variables might be semantically correct, but it can make the code confusing to read! It can also hide subtle bugs. This diff fixes such an issue by renaming the variable. - If you approve of this diff, please use the "Accept & Ship" button :-) Reviewed By: palmje Differential Revision: D52582932 fbshipit-source-id: 1d166c3f35a1c4765acc9d64089318f38671d948
1 parent 942bf31 commit e6fe824

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fbpcf/mpc_std_lib/unified_data_process/data_processor/test/DataProcessorTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void testUdpEncryptionAndDecryptionObjects(
188188
plaintextDataInShards,
189189
size_t dataWidth,
190190
size_t outputSize,
191-
const std::vector<uint64_t>& indexes,
191+
const std::vector<uint64_t>& indexes_2,
192192
const std::vector<size_t>& sizes) {
193193
udpEnc->prepareToProcessMyData(dataWidth);
194194
size_t myDataIndexOffset = 0;
@@ -199,7 +199,7 @@ void testUdpEncryptionAndDecryptionObjects(
199199
myDataIndexOffset += plaintextDataInShards.at(i).size();
200200
udpEnc->processMyData(plaintextDataInShards.at(i), u64indexes);
201201
};
202-
udpEnc->prepareToProcessPeerData(dataWidth, indexes);
202+
udpEnc->prepareToProcessPeerData(dataWidth, indexes_2);
203203
for (size_t i = 0; i < sizes.size(); i++) {
204204
udpEnc->processPeerData(sizes.at(i));
205205
}
@@ -244,12 +244,12 @@ void testUdpEncryptionAndDecryptionObjects(
244244
auto task1 = [](std::unique_ptr<UdpEncryption> udpEnc,
245245
std::unique_ptr<UdpDecryption<1>> udpDec0,
246246
std::unique_ptr<UdpDecryption<3>> udpDec1,
247-
const std::vector<uint64_t>& indexes,
247+
const std::vector<uint64_t>& indexes_2,
248248
const std::vector<size_t>& sizes,
249249
const std::vector<std::vector<std::vector<unsigned char>>>&
250250
plaintextDataInShards,
251251
size_t dataWidth) {
252-
udpEnc->prepareToProcessPeerData(dataWidth, indexes);
252+
udpEnc->prepareToProcessPeerData(dataWidth, indexes_2);
253253
for (size_t i = 0; i < sizes.size(); i++) {
254254
udpEnc->processPeerData(sizes.at(i));
255255
}

0 commit comments

Comments
 (0)