@@ -54,20 +54,19 @@ ColumnEncryptionProperties::Builder* ColumnEncryptionProperties::Builder::key(
5454 if (column_key.empty ()) return this ;
5555
5656 DCHECK (key_.empty ());
57- key_ = column_key;
57+ key_ = std::move ( column_key) ;
5858 return this ;
5959}
6060
6161ColumnEncryptionProperties::Builder* ColumnEncryptionProperties::Builder::key_metadata (
62- const std::string& key_metadata) {
62+ std::string key_metadata) {
6363 DCHECK (!key_metadata.empty ());
64- DCHECK (key_metadata_.empty ());
65- key_metadata_ = key_metadata;
64+ key_metadata_ = std::move (key_metadata);
6665 return this ;
6766}
6867
6968ColumnEncryptionProperties::Builder* ColumnEncryptionProperties::Builder::key_id (
70- const std::string& key_id) {
69+ std::string key_id) {
7170 // key_id is expected to be in UTF8 encoding
7271 ::arrow::util::InitializeUTF8 ();
7372 const uint8_t * data = reinterpret_cast <const uint8_t *>(key_id.c_str ());
@@ -76,47 +75,47 @@ ColumnEncryptionProperties::Builder* ColumnEncryptionProperties::Builder::key_id
7675 }
7776
7877 DCHECK (!key_id.empty ());
79- this ->key_metadata (key_id);
78+ this ->key_metadata (std::move ( key_id) );
8079 return this ;
8180}
8281
8382FileDecryptionProperties::Builder* FileDecryptionProperties::Builder::column_keys (
84- const ColumnPathToDecryptionPropertiesMap& column_decryption_properties) {
83+ ColumnPathToDecryptionPropertiesMap column_decryption_properties) {
8584 if (column_decryption_properties.size () == 0 ) return this ;
8685
8786 if (column_decryption_properties_.size () != 0 )
8887 throw ParquetException (" Column properties already set" );
8988
90- column_decryption_properties_ = column_decryption_properties;
89+ column_decryption_properties_ = std::move ( column_decryption_properties) ;
9190 return this ;
9291}
9392
9493FileDecryptionProperties::Builder* FileDecryptionProperties::Builder::footer_key (
95- const std::string footer_key) {
94+ std::string footer_key) {
9695 if (footer_key.empty ()) {
9796 return this ;
9897 }
9998 DCHECK (footer_key_.empty ());
100- footer_key_ = footer_key;
99+ footer_key_ = std::move ( footer_key) ;
101100 return this ;
102101}
103102
104103FileDecryptionProperties::Builder* FileDecryptionProperties::Builder::key_retriever (
105- const std::shared_ptr<DecryptionKeyRetriever>& key_retriever) {
104+ std::shared_ptr<DecryptionKeyRetriever> key_retriever) {
106105 if (key_retriever == nullptr ) return this ;
107106
108107 DCHECK (key_retriever_ == nullptr );
109- key_retriever_ = key_retriever;
108+ key_retriever_ = std::move ( key_retriever) ;
110109 return this ;
111110}
112111
113112FileDecryptionProperties::Builder* FileDecryptionProperties::Builder::aad_prefix (
114- const std::string& aad_prefix) {
113+ std::string aad_prefix) {
115114 if (aad_prefix.empty ()) {
116115 return this ;
117116 }
118117 DCHECK (aad_prefix_.empty ());
119- aad_prefix_ = aad_prefix;
118+ aad_prefix_ = std::move ( aad_prefix) ;
120119 return this ;
121120}
122121
@@ -130,11 +129,11 @@ FileDecryptionProperties::Builder* FileDecryptionProperties::Builder::aad_prefix
130129}
131130
132131ColumnDecryptionProperties::Builder* ColumnDecryptionProperties::Builder::key (
133- const std::string& key) {
132+ std::string key) {
134133 if (key.empty ()) return this ;
135134
136135 DCHECK (!key.empty ());
137- key_ = key;
136+ key_ = std::move ( key) ;
138137 return this ;
139138}
140139
@@ -144,31 +143,31 @@ std::shared_ptr<ColumnDecryptionProperties> ColumnDecryptionProperties::Builder:
144143}
145144
146145FileEncryptionProperties::Builder* FileEncryptionProperties::Builder::footer_key_metadata (
147- const std::string& footer_key_metadata) {
146+ std::string footer_key_metadata) {
148147 if (footer_key_metadata.empty ()) return this ;
149148
150149 DCHECK (footer_key_metadata_.empty ());
151- footer_key_metadata_ = footer_key_metadata;
150+ footer_key_metadata_ = std::move ( footer_key_metadata) ;
152151 return this ;
153152}
154153
155154FileEncryptionProperties::Builder* FileEncryptionProperties::Builder::encrypted_columns (
156- const ColumnPathToEncryptionPropertiesMap& encrypted_columns) {
155+ ColumnPathToEncryptionPropertiesMap encrypted_columns) {
157156 if (encrypted_columns.size () == 0 ) return this ;
158157
159158 if (encrypted_columns_.size () != 0 )
160159 throw ParquetException (" Column properties already set" );
161160
162- encrypted_columns_ = encrypted_columns;
161+ encrypted_columns_ = std::move ( encrypted_columns) ;
163162 return this ;
164163}
165164
166165FileEncryptionProperties::Builder* FileEncryptionProperties::Builder::aad_prefix (
167- const std::string& aad_prefix) {
166+ std::string aad_prefix) {
168167 if (aad_prefix.empty ()) return this ;
169168
170169 DCHECK (aad_prefix_.empty ());
171- aad_prefix_ = aad_prefix;
170+ aad_prefix_ = std::move ( aad_prefix) ;
172171 store_aad_prefix_in_file_ = true ;
173172 return this ;
174173}
@@ -182,11 +181,11 @@ FileEncryptionProperties::Builder::disable_aad_prefix_storage() {
182181}
183182
184183ColumnEncryptionProperties::ColumnEncryptionProperties (bool encrypted,
185- const std::string& column_path,
186- const std::string& key,
187- const std::string& key_metadata)
188- : column_path_(column_path) {
184+ std::string column_path,
185+ std::string key,
186+ std::string key_metadata) {
189187 DCHECK (!column_path.empty ());
188+ column_path_ = std::move (column_path);
190189 if (!encrypted) {
191190 DCHECK (key.empty () && key_metadata.empty ());
192191 }
@@ -201,20 +200,20 @@ ColumnEncryptionProperties::ColumnEncryptionProperties(bool encrypted,
201200 }
202201
203202 encrypted_ = encrypted;
204- key_metadata_ = key_metadata;
205- key_ = key;
203+ key_metadata_ = std::move ( key_metadata) ;
204+ key_ = std::move ( key) ;
206205}
207206
208- ColumnDecryptionProperties::ColumnDecryptionProperties (const std::string& column_path,
209- const std::string& key)
210- : column_path_(column_path) {
207+ ColumnDecryptionProperties::ColumnDecryptionProperties (std::string column_path,
208+ std::string key) {
211209 DCHECK (!column_path.empty ());
210+ column_path_ = std::move (column_path);
212211
213212 if (!key.empty ()) {
214213 DCHECK (key.length () == 16 || key.length () == 24 || key.length () == 32 );
215214 }
216215
217- key_ = key;
216+ key_ = std::move ( key) ;
218217}
219218
220219std::string FileDecryptionProperties::column_key (const std::string& column_path) const {
@@ -225,14 +224,14 @@ std::string FileDecryptionProperties::column_key(const std::string& column_path)
225224 return column_prop->key ();
226225 }
227226 }
228- return empty_string_ ;
227+ return {} ;
229228}
230229
231230FileDecryptionProperties::FileDecryptionProperties (
232- const std::string& footer_key, std::shared_ptr<DecryptionKeyRetriever> key_retriever,
233- bool check_plaintext_footer_integrity, const std::string& aad_prefix,
231+ std::string footer_key, std::shared_ptr<DecryptionKeyRetriever> key_retriever,
232+ bool check_plaintext_footer_integrity, std::string aad_prefix,
234233 std::shared_ptr<AADPrefixVerifier> aad_prefix_verifier,
235- const ColumnPathToDecryptionPropertiesMap& column_decryption_properties,
234+ ColumnPathToDecryptionPropertiesMap column_decryption_properties,
236235 bool plaintext_files_allowed) {
237236 DCHECK (!footer_key.empty () || nullptr != key_retriever ||
238237 0 != column_decryption_properties.size ());
@@ -245,16 +244,16 @@ FileDecryptionProperties::FileDecryptionProperties(
245244 DCHECK (nullptr != key_retriever);
246245 }
247246 aad_prefix_verifier_ = std::move (aad_prefix_verifier);
248- footer_key_ = footer_key;
247+ footer_key_ = std::move ( footer_key) ;
249248 check_plaintext_footer_integrity_ = check_plaintext_footer_integrity;
250249 key_retriever_ = std::move (key_retriever);
251- aad_prefix_ = aad_prefix;
252- column_decryption_properties_ = column_decryption_properties;
250+ aad_prefix_ = std::move ( aad_prefix) ;
251+ column_decryption_properties_ = std::move ( column_decryption_properties) ;
253252 plaintext_files_allowed_ = plaintext_files_allowed;
254253}
255254
256255FileEncryptionProperties::Builder* FileEncryptionProperties::Builder::footer_key_id (
257- const std::string& key_id) {
256+ std::string key_id) {
258257 // key_id is expected to be in UTF8 encoding
259258 ::arrow::util::InitializeUTF8 ();
260259 const uint8_t * data = reinterpret_cast <const uint8_t *>(key_id.c_str ());
@@ -266,7 +265,7 @@ FileEncryptionProperties::Builder* FileEncryptionProperties::Builder::footer_key
266265 return this ;
267266 }
268267
269- return footer_key_metadata (key_id);
268+ return footer_key_metadata (std::move ( key_id) );
270269}
271270
272271std::shared_ptr<ColumnEncryptionProperties>
@@ -283,38 +282,37 @@ FileEncryptionProperties::column_encryption_properties(const std::string& column
283282}
284283
285284FileEncryptionProperties::FileEncryptionProperties (
286- ParquetCipher::type cipher, const std::string& footer_key,
287- const std::string& footer_key_metadata, bool encrypted_footer,
288- const std::string& aad_prefix, bool store_aad_prefix_in_file,
289- const ColumnPathToEncryptionPropertiesMap& encrypted_columns)
290- : footer_key_(footer_key),
291- footer_key_metadata_ (footer_key_metadata),
285+ ParquetCipher::type cipher, std::string footer_key, std::string footer_key_metadata,
286+ bool encrypted_footer, std::string aad_prefix, bool store_aad_prefix_in_file,
287+ ColumnPathToEncryptionPropertiesMap encrypted_columns)
288+ : footer_key_(std::move(footer_key)),
289+ footer_key_metadata_ (std::move(footer_key_metadata)),
292290 encrypted_footer_(encrypted_footer),
293- aad_prefix_(aad_prefix),
291+ aad_prefix_(std::move( aad_prefix) ),
294292 store_aad_prefix_in_file_(store_aad_prefix_in_file),
295- encrypted_columns_(encrypted_columns) {
296- DCHECK (!footer_key .empty ());
293+ encrypted_columns_(std::move( encrypted_columns) ) {
294+ DCHECK (!footer_key_ .empty ());
297295 // footer_key must be either 16, 24 or 32 bytes.
298- DCHECK (footer_key .length () == 16 || footer_key .length () == 24 ||
299- footer_key .length () == 32 );
296+ DCHECK (footer_key_ .length () == 16 || footer_key_ .length () == 24 ||
297+ footer_key_ .length () == 32 );
300298
301299 uint8_t aad_file_unique[kAadFileUniqueLength ];
302300 encryption::RandBytes (aad_file_unique, kAadFileUniqueLength );
303301 std::string aad_file_unique_str (reinterpret_cast <char const *>(aad_file_unique),
304302 kAadFileUniqueLength );
305303
306304 bool supply_aad_prefix = false ;
307- if (aad_prefix .empty ()) {
305+ if (aad_prefix_ .empty ()) {
308306 file_aad_ = aad_file_unique_str;
309307 } else {
310- file_aad_ = aad_prefix + aad_file_unique_str;
308+ file_aad_ = aad_prefix_ + aad_file_unique_str;
311309 if (!store_aad_prefix_in_file_) supply_aad_prefix = true ;
312310 }
313311 algorithm_.algorithm = cipher;
314312 algorithm_.aad .aad_file_unique = aad_file_unique_str;
315313 algorithm_.aad .supply_aad_prefix = supply_aad_prefix;
316- if (!aad_prefix .empty () && store_aad_prefix_in_file_) {
317- algorithm_.aad .aad_prefix = aad_prefix ;
314+ if (!aad_prefix_ .empty () && store_aad_prefix_in_file_) {
315+ algorithm_.aad .aad_prefix = aad_prefix_ ;
318316 }
319317}
320318
0 commit comments