Skip to content

Commit

Permalink
Refine initialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaZhu authored and vinjiang committed May 10, 2019
1 parent 45e6eb7 commit 91878b1
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 10 deletions.
4 changes: 4 additions & 0 deletions Microsoft.WindowsAzure.Storage/includes/was/blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,10 @@ namespace azure { namespace storage {
m_server_encrypted(false),
m_is_incremental_copy(false)
{
m_standard_blob_tier = azure::storage::standard_blob_tier::unknown;
m_premium_blob_tier = azure::storage::premium_blob_tier::unknown;
m_archive_status = azure::storage::archive_status::unknown;
m_access_tier_inferred = false;
}

#if defined(_MSC_VER) && _MSC_VER < 1900
Expand Down
6 changes: 3 additions & 3 deletions Microsoft.WindowsAzure.Storage/includes/was/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ namespace azure { namespace storage {
/// Initializes a new instance of the <see cref="azure::storage::service_properties::metrics_properties" /> class.
/// </summary>
metrics_properties()
: m_include_apis(false), m_retention_enabled(false), m_retention_days(0)
: m_enabled(false), m_include_apis(false), m_retention_enabled(false), m_retention_days(0)
{
}

Expand Down Expand Up @@ -953,7 +953,7 @@ namespace azure { namespace storage {
/// <summary>
/// Initializes a new instance of the <see cref="azure::storage::service_properties::cors_rule" /> class.
/// </summary>
cors_rule()
cors_rule() : m_max_age(0)
{
}

Expand Down Expand Up @@ -1736,7 +1736,7 @@ namespace azure { namespace storage {
web::http::http_headers m_user_headers;
utility::datetime m_start_time;
utility::datetime m_end_time;
client_log_level m_log_level;
client_log_level m_log_level = client_log_level::log_level_off;
web::web_proxy m_proxy;
std::vector<request_result> m_request_results;
pplx::extensibility::critical_section_t m_request_results_lock;
Expand Down
6 changes: 4 additions & 2 deletions Microsoft.WindowsAzure.Storage/includes/was/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,8 @@ namespace azure { namespace storage {
: m_is_response_available(false),
m_target_location(storage_location::unspecified),
m_http_status_code(0),
m_content_length(std::numeric_limits<utility::size64_t>::max())
m_content_length(std::numeric_limits<utility::size64_t>::max()),
m_request_server_encrypted(false)
{
}

Expand All @@ -610,7 +611,8 @@ namespace azure { namespace storage {
m_target_location(target_location),
m_end_time(utility::datetime::utc_now()),
m_http_status_code(0),
m_content_length(std::numeric_limits<utility::size64_t>::max())
m_content_length(std::numeric_limits<utility::size64_t>::max()),
m_request_server_encrypted(false)
{
}

Expand Down
2 changes: 1 addition & 1 deletion Microsoft.WindowsAzure.Storage/includes/wascore/executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace azure { namespace storage { namespace core {

explicit storage_command_base(const storage_uri& request_uri, const pplx::cancellation_token& cancellation_token, const bool use_timeout, std::shared_ptr<core::timer_handler> timer_handler)
: m_request_uri(request_uri), m_location_mode(command_location_mode::primary_only),
m_cancellation_token(cancellation_token), m_use_timeout(use_timeout), m_timer_handler(timer_handler)
m_cancellation_token(cancellation_token), m_calculate_response_body_md5(false), m_use_timeout(use_timeout), m_timer_handler(timer_handler)
{
if (m_use_timeout)
{
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.WindowsAzure.Storage/includes/wascore/streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace azure { namespace storage { namespace core {
public:
basic_cloud_ostreambuf()
: basic_ostreambuf<concurrency::streams::ostream::traits::char_type>(),
m_current_streambuf_offset(0), m_committed(false)
m_current_streambuf_offset(0), m_committed(false), m_buffer_size(0), m_next_buffer_size(0)
{
}

Expand Down
5 changes: 5 additions & 0 deletions Microsoft.WindowsAzure.Storage/includes/wascore/xmlhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,12 @@ class xml_writer
virtual ~xml_writer() {}

protected:

#ifdef _WIN32
xml_writer()
#else // LINUX
xml_writer() :m_stream(nullptr)
#endif
{
}

Expand Down
12 changes: 12 additions & 0 deletions Microsoft.WindowsAzure.Storage/src/timer_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,19 @@ namespace azure { namespace storage { namespace core {
{
m_cancellation_token.deregister_callback(m_cancellation_token_registration);
}

#ifdef _WIN32
stop_timer();
#else // LINUX
try
{
stop_timer();
}
catch (boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> > &e)

This comment has been minimized.

Copy link
@Jinming-Hu

Jinming-Hu Oct 10, 2019

Member

@EmmaZhu Hi, can you remember, under what circumstances, this exception will be thrown?

{
}
#endif

}

void timer_handler::start_timer(const std::chrono::milliseconds& time)
Expand Down
9 changes: 7 additions & 2 deletions Microsoft.WindowsAzure.Storage/src/xml_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,25 @@ bool xml_text_reader_wrapper::is_empty_element()
std::string xml_text_reader_wrapper::get_local_name()
{
auto xml_char = xmlTextReaderLocalName(m_reader);
auto result = xml_char_to_string(xml_char);
std::string result;

if (xml_char != nullptr)
{
result = xml_char_to_string(xml_char);
xmlFree(xml_char);
}

return result;
}

std::string xml_text_reader_wrapper::get_value()
{
auto xml_char = xmlTextReaderValue(m_reader);
auto result = xml_char_to_string(xml_char);
std::string result;

if (xml_char != nullptr)
{
result = xml_char_to_string(xml_char);
xmlFree(xml_char);
}
return result;
Expand Down
3 changes: 2 additions & 1 deletion Microsoft.WindowsAzure.Storage/src/xmlhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ namespace azure { namespace storage { namespace core { namespace xml {
}
#else // LINUX
auto result = m_document->write_to_string();
*m_stream << reinterpret_cast<const char *>(result.c_str());
if (m_stream != nullptr)
*m_stream << reinterpret_cast<const char *>(result.c_str());

#endif
}
Expand Down

0 comments on commit 91878b1

Please sign in to comment.