Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Commit 60c5b9b

Browse files
Jinming-Huvinjiang
authored andcommitted
Fix some warnings
1 parent 289d9f4 commit 60c5b9b

File tree

11 files changed

+25
-47
lines changed

11 files changed

+25
-47
lines changed

Microsoft.WindowsAzure.Storage/includes/wascore/xml_wrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ namespace azure { namespace storage { namespace core { namespace xml {
183183
private:
184184
xmlDocPtr m_doc;
185185
};
186-
}}}};// namespace azure::storage::core::xml
186+
}}}} // namespace azure::storage::core::xml
187187
#endif //#ifdef _WIN32
188188

189189
#endif //#ifndef _XML_WRAPPER_H

Microsoft.WindowsAzure.Storage/samples/JsonPayloadFormat/Application.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace azure { namespace storage { namespace samples {
4141
azure::storage::table_batch_operation batch_operation;
4242
for (int i = 0; i < 10; ++i)
4343
{
44-
utility::string_t row_key = _XPLATSTR("MyRowKey") + utility::conversions::print_string(i);
44+
utility::string_t row_key = _XPLATSTR("MyRowKey") + utility::conversions::to_string_t(std::to_string(i));
4545
azure::storage::table_entity entity(_XPLATSTR("MyPartitionKey"), row_key);
4646
azure::storage::table_entity::properties_type& properties = entity.properties();
4747
properties.reserve(8);

Microsoft.WindowsAzure.Storage/samples/TablesGettingStarted/Application.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ namespace azure { namespace storage { namespace samples {
6262
azure::storage::table_batch_operation batch_operation;
6363
for (int i = 0; i < 10; ++i)
6464
{
65-
utility::string_t row_key = _XPLATSTR("MyRowKey") + utility::conversions::print_string(i);
65+
utility::string_t row_key = _XPLATSTR("MyRowKey") + utility::conversions::to_string_t(std::to_string(i));
6666
azure::storage::table_entity entity2(_XPLATSTR("MyPartitionKey"), row_key);
6767
azure::storage::table_entity::properties_type& properties2 = entity2.properties();
6868
properties2.reserve(3);

Microsoft.WindowsAzure.Storage/src/cloud_block_blob.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ namespace azure { namespace storage {
235235
// Otherwise, throws a storage_exception if the default value has been changed or if the blob size exceeds the maximum capacity.
236236
if (length != std::numeric_limits<utility::size64_t>::max())
237237
{
238-
auto totalBlocks = std::ceil(static_cast<double>(length) / modified_options.stream_write_size_in_bytes());
238+
auto totalBlocks = std::ceil(static_cast<double>(length) / static_cast<double>(modified_options.stream_write_size_in_bytes()));
239239

240240
// Check if the total required blocks for the upload exceeds the maximum allowable block limit.
241241
if (totalBlocks > protocol::max_block_number)

Microsoft.WindowsAzure.Storage/src/executor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ namespace azure { namespace storage { namespace core {
243243
{
244244
utility::size64_t current_total_downloaded = instance->m_response_streambuf.total_written();
245245
utility::size64_t content_length = instance->m_request_result.content_length();
246-
if (content_length != -1 && current_total_downloaded != content_length)
246+
if (content_length != std::numeric_limits<utility::size64_t>::max() && current_total_downloaded != content_length)
247247
{
248248
// The download was interrupted before it could complete
249249
instance->assert_canceled();

Microsoft.WindowsAzure.Storage/src/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ namespace azure { namespace storage { namespace core {
543543
if (config.get_ssl_context_callback() != nullptr)
544544
{
545545
char buf[16];
546-
sprintf(buf, "%p", (void*)&(config.get_ssl_context_callback()));
546+
sprintf(buf, "%p", (const void*)&(config.get_ssl_context_callback()));
547547
key.append(buf);
548548
key.append(_XPLATSTR("#"));
549549
}

Microsoft.WindowsAzure.Storage/src/xml_wrapper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void xml_element_wrapper::set_namespace_declaration(const std::string & uri, con
150150

151151
void xml_element_wrapper::set_namespace(const std::string & prefix)
152152
{
153-
xmlNs* ns = xmlSearchNs(m_ele->doc, m_ele, (xmlChar*)(prefix.empty() ? nullptr : prefix.c_str()));
153+
xmlNs* ns = xmlSearchNs(m_ele->doc, m_ele, (const xmlChar*)(prefix.empty() ? nullptr : prefix.c_str()));
154154
if (ns)
155155
{
156156
xmlSetNs(m_ele, ns);
@@ -200,7 +200,7 @@ void xml_element_wrapper::set_child_text(const std::string & text)
200200
{
201201
if (node->m_ele->type != xmlElementType::XML_ELEMENT_NODE)
202202
{
203-
xmlNodeSetContent(node->m_ele, (xmlChar*)text.c_str());
203+
xmlNodeSetContent(node->m_ele, (const xmlChar*)text.c_str());
204204
}
205205
}
206206
else {
@@ -309,6 +309,6 @@ xml_element_wrapper* xml_document_wrapper::get_root_node() const
309309
return nullptr;
310310
}
311311

312-
}}}};// namespace azure::storage::core::xml
312+
}}}} // namespace azure::storage::core::xml
313313

314314
#endif //#ifdef _WIN32

Microsoft.WindowsAzure.Storage/tests/blob_test_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void blob_service_test_base::fill_buffer(std::vector<uint8_t>& buffer, size_t of
3232
{
3333
std::generate_n(buffer.begin() + offset, count, []() -> uint8_t
3434
{
35-
return std::rand();
35+
return uint8_t(std::rand());
3636
});
3737
}
3838

Microsoft.WindowsAzure.Storage/tests/cloud_blob_test.cpp

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,9 @@ SUITE(Blob)
331331
{
332332
auto same_blob = m_container.get_page_blob_reference(blob.name());
333333
auto stream = concurrency::streams::container_stream<std::vector<uint8_t>>::open_ostream();
334-
azure::storage::blob_request_options options;
335-
options.set_use_transactional_md5(true);
336-
same_blob.download_range_to_stream(stream, 0, 128, azure::storage::access_condition(), options, azure::storage::operation_context());
334+
azure::storage::blob_request_options local_options;
335+
local_options.set_use_transactional_md5(true);
336+
same_blob.download_range_to_stream(stream, 0, 128, azure::storage::access_condition(), local_options, azure::storage::operation_context());
337337
check_blob_properties_equal(blob.properties(), same_blob.properties(), true);
338338
}
339339

@@ -348,9 +348,9 @@ SUITE(Blob)
348348

349349
auto same_blob = m_container.get_page_blob_reference(blob.name());
350350
auto stream = concurrency::streams::container_stream<std::vector<uint8_t>>::open_ostream();
351-
azure::storage::blob_request_options options;
352-
options.set_use_transactional_md5(true);
353-
same_blob.download_range_to_stream(stream, 0, 128, azure::storage::access_condition(), options, azure::storage::operation_context());
351+
azure::storage::blob_request_options local_options;
352+
local_options.set_use_transactional_md5(true);
353+
same_blob.download_range_to_stream(stream, 0, 128, azure::storage::access_condition(), local_options, azure::storage::operation_context());
354354
check_blob_properties_equal(blob.properties(), same_blob.properties(), true);
355355
}
356356
}
@@ -829,10 +829,7 @@ SUITE(Blob)
829829
option.set_parallelism_factor(2);
830830
std::vector<uint8_t> data;
831831
data.resize(target_length);
832-
for (size_t i = 0; i < target_length; ++i)
833-
{
834-
data[i] = i % 255;
835-
}
832+
fill_buffer(data);
836833
concurrency::streams::container_buffer<std::vector<uint8_t>> upload_buffer(data);
837834
blob.upload_from_stream(upload_buffer.create_istream(), azure::storage::access_condition(), option, m_context);
838835

@@ -856,10 +853,7 @@ SUITE(Blob)
856853
option.set_parallelism_factor(2);
857854
std::vector<uint8_t> data;
858855
data.resize(target_length);
859-
for (size_t i = 0; i < target_length; ++i)
860-
{
861-
data[i] = i % 255;
862-
}
856+
fill_buffer(data);
863857
concurrency::streams::container_buffer<std::vector<uint8_t>> upload_buffer(data);
864858
blob.upload_from_stream(upload_buffer.create_istream(), azure::storage::access_condition(), option, m_context);
865859

@@ -890,10 +884,7 @@ SUITE(Blob)
890884
option.set_parallelism_factor(2);
891885
std::vector<uint8_t> data;
892886
data.resize(target_length);
893-
for (size_t i = 0; i < target_length; ++i)
894-
{
895-
data[i] = i % 255;
896-
}
887+
fill_buffer(data);
897888
concurrency::streams::container_buffer<std::vector<uint8_t>> upload_buffer(data);
898889
blob.upload_from_stream(upload_buffer.create_istream(), azure::storage::access_condition(), option, m_context);
899890

@@ -921,10 +912,7 @@ SUITE(Blob)
921912
option.set_parallelism_factor(2);
922913
std::vector<uint8_t> data;
923914
data.resize(target_length);
924-
for (size_t i = 0; i < target_length; ++i)
925-
{
926-
data[i] = i % 255;
927-
}
915+
fill_buffer(data);
928916
concurrency::streams::container_buffer<std::vector<uint8_t>> upload_buffer(data);
929917
blob.upload_from_stream(upload_buffer.create_istream(), azure::storage::access_condition(), option, m_context);
930918

@@ -958,10 +946,7 @@ SUITE(Blob)
958946
option.set_parallelism_factor(10);
959947
std::vector<uint8_t> data;
960948
data.resize(target_length);
961-
for (size_t i = 0; i < target_length; ++i)
962-
{
963-
data[i] = i % 255;
964-
}
949+
fill_buffer(data);
965950
concurrency::streams::container_buffer<std::vector<uint8_t>> upload_buffer(data);
966951
blob.upload_from_stream(upload_buffer.create_istream(), azure::storage::access_condition(), option, m_context);
967952

@@ -993,10 +978,7 @@ SUITE(Blob)
993978
option.set_use_transactional_md5(true);
994979
std::vector<uint8_t> data;
995980
data.resize(target_length);
996-
for (size_t i = 0; i < target_length; ++i)
997-
{
998-
data[i] = i % 255;
999-
}
981+
fill_buffer(data);
1000982
concurrency::streams::container_buffer<std::vector<uint8_t>> upload_buffer(data);
1001983
blob.upload_from_stream(upload_buffer.create_istream(), azure::storage::access_condition(), option, m_context);
1002984

@@ -1021,10 +1003,7 @@ SUITE(Blob)
10211003
option.set_use_transactional_md5(true);
10221004
std::vector<uint8_t> data;
10231005
data.resize(target_length);
1024-
for (size_t i = 0; i < target_length; ++i)
1025-
{
1026-
data[i] = i % 255;
1027-
}
1006+
fill_buffer(data);
10281007
concurrency::streams::container_buffer<std::vector<uint8_t>> upload_buffer(data);
10291008
blob.upload_from_stream(upload_buffer.create_istream(), azure::storage::access_condition(), option, m_context);
10301009

Microsoft.WindowsAzure.Storage/tests/cloud_file_share_test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ SUITE(File)
260260
m_share.create_if_not_exists(quota, azure::storage::file_request_options(), m_context);
261261
auto file = m_share.get_root_directory_reference().get_file_reference(_XPLATSTR("test"));
262262
utility::string_t content = _XPLATSTR("testtargetfile");
263-
auto content_length = content.length();
264263
file.create_if_not_exists(content.length());
265264
file.upload_text(content, azure::storage::file_access_condition(), azure::storage::file_request_options(), m_context);
266265
file.download_attributes(azure::storage::file_access_condition(), azure::storage::file_request_options(), m_context);
@@ -274,4 +273,4 @@ SUITE(File)
274273
utility::string_t permission_key2 = m_share.upload_file_permission(permission);
275274
CHECK(!permission_key2.empty());
276275
}
277-
}
276+
}

0 commit comments

Comments
 (0)