From 9632652c23690f0c2bfe9b06f9c694fb64b1de46 Mon Sep 17 00:00:00 2001 From: Sergey Pisarchik Date: Sun, 4 May 2014 21:53:37 +0300 Subject: [PATCH] [Tizen] Fixed code style --- platform/http_thread_tizen.cpp | 50 ++++++++++++++++------------------ platform/http_thread_tizen.hpp | 34 +++++++++++------------ 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/platform/http_thread_tizen.cpp b/platform/http_thread_tizen.cpp index 80e905d01e..8bf0406468 100644 --- a/platform/http_thread_tizen.cpp +++ b/platform/http_thread_tizen.cpp @@ -96,10 +96,10 @@ HttpThread::HttpThread(std::string const & url, { pRequest->SetMethod(NET_HTTP_METHOD_POST); pHeader->AddField("Content-Type", "application/json"); - int64_t sz = m_pb.size(); - String lenght; - lenght.Append(sz); - pHeader->AddField("Content-Length", lenght); + int64_t const sz = m_pb.size(); + String length; + length.Append(sz); + pHeader->AddField("Content-Length", length); ByteBuffer body; body.Construct((const byte *)m_pb.c_str(), 0, sz, sz); pRequest->WriteBody(body); @@ -120,8 +120,8 @@ HttpThread::~HttpThread() void HttpThread::OnTransactionHeaderCompleted(HttpSession & httpSession, - HttpTransaction & httpTransaction, - int headerLen, bool bAuthRequired) + HttpTransaction & httpTransaction, + int headerLen, bool bAuthRequired) { result r = E_SUCCESS; HttpResponse * pResponse = httpTransaction.GetResponse(); @@ -143,7 +143,7 @@ void HttpThread::OnTransactionHeaderCompleted(HttpSession & httpSession, LOG(LWARNING, ("Http request to", m_url, " aborted with HTTP code", httpStatusCode)); httpSession.CancelTransaction(httpTransaction); r = httpSession.CloseTransaction(httpTransaction); - m_callback.OnFinish(-4, m_begRange, m_endRange); + m_callback.OnFinish(-4, m_begRange, m_endRange); LOG(LDEBUG, ("CloseTransaction result", r)); return; } @@ -172,7 +172,7 @@ void HttpThread::OnTransactionHeaderCompleted(HttpSession & httpSession, if (value != m_expectedSize) { LOG(LWARNING, ("Http request to", m_url, - "aborted - invalid Content-Range:", value, " expected:" ,m_expectedSize )); + "aborted - invalid Content-Range:", value, " expected:", m_expectedSize )); httpSession.CancelTransaction(httpTransaction); r = httpSession.CloseTransaction(httpTransaction); m_callback.OnFinish(-2, m_begRange, m_endRange); @@ -182,14 +182,12 @@ void HttpThread::OnTransactionHeaderCompleted(HttpSession & httpSession, } else { - pValues = pHeader->GetFieldValuesN("Content-Length"); if (GetLastResult() == E_SUCCESS) { bGoodSize = true; pValues->MoveNext(); // strange, but works String const * pString = dynamic_cast(pValues->GetCurrent()); - if (pString) { int64_t value = -1; @@ -197,10 +195,10 @@ void HttpThread::OnTransactionHeaderCompleted(HttpSession & httpSession, if (value != m_expectedSize) { LOG(LWARNING, ("Http request to", m_url, - "aborted - invalid Content-Length:", value, " expected:" ,m_expectedSize )); + "aborted - invalid Content-Length:", value, " expected:", m_expectedSize)); httpSession.CancelTransaction(httpTransaction); r = httpSession.CloseTransaction(httpTransaction); - m_callback.OnFinish(-2, m_begRange, m_endRange); + m_callback.OnFinish(-2, m_begRange, m_endRange); LOG(LDEBUG, ("CloseTransaction result", r)); } } @@ -209,12 +207,11 @@ void HttpThread::OnTransactionHeaderCompleted(HttpSession & httpSession, if (!bGoodSize) { - LOG(LWARNING, ("Http request to", m_url, "aborted, server didn't send any valid file size")); httpSession.CancelTransaction(httpTransaction); r = httpSession.CloseTransaction(httpTransaction); - m_callback.OnFinish(-2, m_begRange, m_endRange); + m_callback.OnFinish(-2, m_begRange, m_endRange); LOG(LDEBUG, ("CloseTransaction result", r)); } } @@ -226,7 +223,6 @@ void HttpThread::OnHttpDownloadInProgress(HttpSession & /*httpSession*/, int64_t totalLength) { HttpResponse * pResponse = httpTransaction.GetResponse(); - if (pResponse->GetHttpStatusCode() == HTTP_STATUS_OK || pResponse->GetHttpStatusCode() == HTTP_STATUS_PARTIAL_CONTENT) { ByteBuffer * pBuffer = 0; @@ -240,7 +236,7 @@ void HttpThread::OnHttpDownloadInProgress(HttpSession & /*httpSession*/, LOG(LERROR, ("OnHttpDownloadInProgress ERROR", FromTizenString(pResponse->GetStatusText()))); } -void HttpThread::OnTransactionCompleted (HttpSession &/*httpSession*/, +void HttpThread::OnTransactionCompleted(HttpSession & /*httpSession*/, HttpTransaction & httpTransaction) { HttpResponse * pResponse = httpTransaction.GetResponse(); @@ -258,35 +254,35 @@ void HttpThread::OnTransactionCompleted (HttpSession &/*httpSession*/, } void HttpThread::OnTransactionAborted(HttpSession & /*httpSession*/, - HttpTransaction & /*httpTransaction*/, - result r) + HttpTransaction & /*httpTransaction*/, + result r) { LOG(LINFO, ("OnTransactionAborted result:", r)); m_callback.OnFinish(-100, m_begRange, m_endRange); } void HttpThread::OnTransactionCertVerificationRequiredN(HttpSession & /*httpSession*/, - HttpTransaction & /*httpTransaction*/, - String * /*pCert*/) + HttpTransaction & /*httpTransaction*/, + String * /*pCert*/) { LOG(LERROR, ("OnTransactionCertVerificationRequiredN")); } void HttpThread::OnTransactionReadyToRead(HttpSession & /*httpSession*/, - HttpTransaction & /*httpTransaction*/, - int /*availableBodyLen*/) + HttpTransaction & /*httpTransaction*/, + int /*availableBodyLen*/) { } void HttpThread::OnTransactionReadyToWrite(HttpSession & /*httpSession*/, - HttpTransaction & /*httpTransaction*/, - int /*recommendedChunkSize*/) + HttpTransaction & /*httpTransaction*/, + int /*recommendedChunkSize*/) { } void HttpThread::OnHttpUploadInProgress(Tizen::Net::Http::HttpSession & /*httpSession*/, - Tizen::Net::Http::HttpTransaction & /*httpTransaction*/, - int64_t /*currentLength*/, - int64_t /*totalLength*/) + Tizen::Net::Http::HttpTransaction & /*httpTransaction*/, + int64_t /*currentLength*/, + int64_t /*totalLength*/) { } diff --git a/platform/http_thread_tizen.hpp b/platform/http_thread_tizen.hpp index aa1d2aae59..6d3f9b17b1 100644 --- a/platform/http_thread_tizen.hpp +++ b/platform/http_thread_tizen.hpp @@ -14,7 +14,7 @@ class IHttpThreadCallback; using namespace Tizen::Net::Http; class HttpThread - : public Tizen::Net::Http::IHttpTransactionEventListener + : public Tizen::Net::Http::IHttpTransactionEventListener , public Tizen::Net::Http::IHttpProgressEventListener , noncopyable { @@ -32,33 +32,33 @@ public: /// ///Tizen::Net::Http::IHttpTransactionEventListener /// - virtual void OnTransactionAborted (HttpSession &httpSession, - HttpTransaction &httpTransaction, + virtual void OnTransactionAborted (HttpSession & httpSession, + HttpTransaction & httpTransaction, result r); - virtual void OnTransactionCertVerificationRequiredN (HttpSession &httpSession, - HttpTransaction &httpTransaction, + virtual void OnTransactionCertVerificationRequiredN (HttpSession & httpSession, + HttpTransaction & httpTransaction, Tizen::Base::String *pCert); - virtual void OnTransactionCompleted (HttpSession &httpSession, - HttpTransaction &httpTransaction); - virtual void OnTransactionHeaderCompleted (HttpSession &httpSession, - HttpTransaction &httpTransaction, + virtual void OnTransactionCompleted (HttpSession & httpSession, + HttpTransaction & httpTransaction); + virtual void OnTransactionHeaderCompleted (HttpSession & httpSession, + HttpTransaction & httpTransaction, int headerLen, bool bAuthRequired); - virtual void OnTransactionReadyToRead (HttpSession &httpSession, - HttpTransaction &httpTransaction, + virtual void OnTransactionReadyToRead (HttpSession & httpSession, + HttpTransaction & httpTransaction, int availableBodyLen); - virtual void OnTransactionReadyToWrite (HttpSession &httpSession, - HttpTransaction &httpTransaction, + virtual void OnTransactionReadyToWrite (HttpSession & httpSession, + HttpTransaction & httpTransaction, int recommendedChunkSize); /// ///Tizen::Net::Http::IHttpProgressEventListener /// - virtual void OnHttpDownloadInProgress (HttpSession &httpSession, - HttpTransaction &httpTransaction, + virtual void OnHttpDownloadInProgress (HttpSession & httpSession, + HttpTransaction & httpTransaction, int64_t currentLength, int64_t totalLength); - virtual void OnHttpUploadInProgress (HttpSession &httpSession, - HttpTransaction &httpTransaction, + virtual void OnHttpUploadInProgress (HttpSession & httpSession, + HttpTransaction & httpTransaction, int64_t currentLength, int64_t totalLength);