From b550a4e4dcf8f953a32111f9e7f79598108e6a2a Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 12 May 2015 21:56:57 -0700 Subject: [PATCH] Fixed explicit initialization and constructor for HttpContext --- src/core/hle/service/http/http.cpp | 14 ++++++++++++-- src/core/hle/service/http/http.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/http/http.cpp b/src/core/hle/service/http/http.cpp index aeb4fcf1b..b89ce2b13 100644 --- a/src/core/hle/service/http/http.cpp +++ b/src/core/hle/service/http/http.cpp @@ -24,6 +24,16 @@ static int BufWriter(u8 *data, size_t size, size_t nmemb, std::vector* out_b return static_cast(size * nmemb); } +HttpContext::HttpContext() { + state = REQUEST_STATE_NONE; + cancel_request = false; + req_type = REQUEST_TYPE_NONE; + request_hdrs = nullptr; + response_code = 0; + content_length = 0.0; + downloaded_size = 0.0; +} + HttpContext::~HttpContext() { curl_slist_free_all(request_hdrs); } @@ -68,8 +78,8 @@ void MakeRequest(HttpContext* context) { mres = curl_multi_add_handle(manager, connection); - int still_running; - int repeats; + int still_running = 0; + int repeats = 0; mres = curl_multi_perform(manager, &still_running); do { diff --git a/src/core/hle/service/http/http.h b/src/core/hle/service/http/http.h index ea9d13737..59a3ffee3 100644 --- a/src/core/hle/service/http/http.h +++ b/src/core/hle/service/http/http.h @@ -34,6 +34,7 @@ enum RequestType : u32 { /// Current state of the HTTP request (API-exposed). enum RequestState : u32 { + REQUEST_STATE_NONE = 0, // TODO: Verify REQUEST_STATE_IN_PROGRESS = 5, REQUEST_STATE_READY = 8, }; @@ -63,6 +64,7 @@ struct HttpContext { double content_length; //< The total size in bytes that will be downloaded this request. double downloaded_size; //< The amount in bytes that has been downloaded so far. + HttpContext(); ~HttpContext(); };