summaryrefslogtreecommitdiff
path: root/downloadprovider.cpp
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2022-01-27 22:43:28 -0500
committerKyleMiles <krm504@nyu.edu>2022-01-28 00:24:06 -0500
commit6812c973c9fa9b4ad642ab81856c05f87bd6fcc4 (patch)
treedace4156d03148bcaf02df138ab4e0d93e61bc6f /downloadprovider.cpp
parent519c9db22367f2659d1a54599fab47e6313be06e (diff)
Format All Files
Diffstat (limited to 'downloadprovider.cpp')
-rw-r--r--downloadprovider.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/downloadprovider.cpp b/downloadprovider.cpp
index 5e0e46bd..bd99fe51 100644
--- a/downloadprovider.cpp
+++ b/downloadprovider.cpp
@@ -57,11 +57,13 @@ int DownloadInstance::PerformRequestCallback(void* ctxt, const char* url)
}
-int DownloadInstance::PerformCustomRequestCallback(void* ctxt, const char* method, const char* url, uint64_t headerCount, const char* const* headerKeys, const char* const* headerValues, BNDownloadInstanceResponse** response)
+int DownloadInstance::PerformCustomRequestCallback(void* ctxt, const char* method, const char* url,
+ uint64_t headerCount, const char* const* headerKeys, const char* const* headerValues,
+ BNDownloadInstanceResponse** response)
{
DownloadInstance* instance = (DownloadInstance*)ctxt;
unordered_map<string, string> headers;
- for (uint64_t i = 0; i < headerCount; i ++)
+ for (uint64_t i = 0; i < headerCount; i++)
{
headers[headerKeys[i]] = headerValues[i];
}
@@ -77,7 +79,7 @@ int DownloadInstance::PerformCustomRequestCallback(void* ctxt, const char* metho
{
keys[i] = BNAllocString(pair.first.c_str());
values[i] = BNAllocString(pair.second.c_str());
- i ++;
+ i++;
}
*response = new BNDownloadInstanceResponse;
@@ -92,14 +94,14 @@ int DownloadInstance::PerformCustomRequestCallback(void* ctxt, const char* metho
void DownloadInstance::PerformFreeResponse(void* ctxt, BNDownloadInstanceResponse* response)
{
- for (uint64_t i = 0; i < response->headerCount; i ++)
+ for (uint64_t i = 0; i < response->headerCount; i++)
{
BNFreeString(response->headerKeys[i]);
BNFreeString(response->headerValues[i]);
}
- delete [] response->headerKeys;
- delete [] response->headerValues;
+ delete[] response->headerKeys;
+ delete[] response->headerValues;
delete response;
}
@@ -144,7 +146,9 @@ int DownloadInstance::PerformRequest(const string& url, BNDownloadInstanceOutput
}
-int DownloadInstance::PerformCustomRequest(const string& method, const string& url, const std::unordered_map<std::string, std::string>& headers, Response& response, BNDownloadInstanceInputOutputCallbacks* callbacks)
+int DownloadInstance::PerformCustomRequest(const string& method, const string& url,
+ const std::unordered_map<std::string, std::string>& headers, Response& response,
+ BNDownloadInstanceInputOutputCallbacks* callbacks)
{
const char** headerKeys = new const char*[headers.size()];
const char** headerValues = new const char*[headers.size()];
@@ -154,23 +158,24 @@ int DownloadInstance::PerformCustomRequest(const string& method, const string& u
{
headerKeys[i] = it->first.c_str();
headerValues[i] = it->second.c_str();
- i ++;
+ i++;
}
BNDownloadInstanceResponse* bnResponse;
- int result = BNPerformCustomRequest(m_object, method.c_str(), url.c_str(), headers.size(), headerKeys, headerValues, &bnResponse, callbacks);
+ int result = BNPerformCustomRequest(
+ m_object, method.c_str(), url.c_str(), headers.size(), headerKeys, headerValues, &bnResponse, callbacks);
response.statusCode = bnResponse->statusCode;
- for (uint64_t i = 0; i < bnResponse->headerCount; i ++)
+ for (uint64_t i = 0; i < bnResponse->headerCount; i++)
{
response.headers[bnResponse->headerKeys[i]] = bnResponse->headerValues[i];
}
BNFreeDownloadInstanceResponse(bnResponse);
- delete [] headerKeys;
- delete [] headerValues;
+ delete[] headerKeys;
+ delete[] headerValues;
return result;
}
@@ -182,9 +187,7 @@ void DownloadInstance::DestroyInstance()
}
-CoreDownloadInstance::CoreDownloadInstance(BNDownloadInstance* instance): DownloadInstance(instance)
-{
-}
+CoreDownloadInstance::CoreDownloadInstance(BNDownloadInstance* instance) : DownloadInstance(instance) {}
int CoreDownloadInstance::PerformRequest(const std::string& url)
@@ -194,7 +197,8 @@ int CoreDownloadInstance::PerformRequest(const std::string& url)
}
-int CoreDownloadInstance::PerformCustomRequest(const std::string& method, const std::string& url, const std::unordered_map<std::string, std::string>& headers, Response& response)
+int CoreDownloadInstance::PerformCustomRequest(const std::string& method, const std::string& url,
+ const std::unordered_map<std::string, std::string>& headers, Response& response)
{
(void)method;
(void)url;
@@ -204,9 +208,7 @@ int CoreDownloadInstance::PerformCustomRequest(const std::string& method, const
}
-DownloadProvider::DownloadProvider(const string& name): m_nameForRegister(name)
-{
-}
+DownloadProvider::DownloadProvider(const string& name) : m_nameForRegister(name) {}
DownloadProvider::DownloadProvider(BNDownloadProvider* provider)
@@ -253,9 +255,7 @@ void DownloadProvider::Register(DownloadProvider* provider)
}
-CoreDownloadProvider::CoreDownloadProvider(BNDownloadProvider* provider): DownloadProvider(provider)
-{
-}
+CoreDownloadProvider::CoreDownloadProvider(BNDownloadProvider* provider) : DownloadProvider(provider) {}
Ref<DownloadInstance> CoreDownloadProvider::CreateNewInstance()