Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce code deprecation and virtual methods #1629

Merged
merged 17 commits into from
Feb 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sming/SmingCore/HardwareTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class HardwareTimer
* @retval bool True if timer started
* @note Timer starts and will run for configured period then stop
*/
bool __forceinline IRAM_ATTR startOnce()
__forceinline bool IRAM_ATTR startOnce()
{
return start(false);
}
Expand Down Expand Up @@ -126,7 +126,7 @@ class HardwareTimer
/** @brief Call timer callback
* @note Calls the timer callback function
*/
void __forceinline IRAM_ATTR call()
__forceinline void IRAM_ATTR call()
{
if(callback) {
callback();
Expand Down
16 changes: 0 additions & 16 deletions Sming/SmingCore/Network/Http/HttpRequestAuth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,13 @@
#include "HttpRequest.h"
#include "../Services/WebHelpers/base64.h"

HttpBasicAuth::HttpBasicAuth(const String& username, const String& password)
{
this->username = username;
this->password = password;
}

// Basic Auth
void HttpBasicAuth::setRequest(HttpRequest* request)
{
request->headers[HTTP_HEADER_AUTHORIZATION] = F("Basic ") + base64_encode(username + ':' + password);
}

// Digest Auth
HttpDigestAuth::HttpDigestAuth(const String& username, const String& password)
{
this->username = username;
this->password = password;
}

void HttpDigestAuth::setRequest(HttpRequest* request)
{
this->request = request;
}

void HttpDigestAuth::setResponse(HttpResponse* response)
{
Expand Down
26 changes: 18 additions & 8 deletions Sming/SmingCore/Network/Http/HttpRequestAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,25 @@ class HttpRequest;
class AuthAdapter
{
public:
virtual void setRequest(HttpRequest* request) = 0;

__forceinline virtual void setResponse(HttpResponse* response)
virtual ~AuthAdapter()
{
return;
}

virtual ~AuthAdapter()
virtual void setRequest(HttpRequest* request) = 0;

virtual void setResponse(HttpResponse* response)
{
}
};

class HttpBasicAuth : public AuthAdapter
{
public:
HttpBasicAuth(const String& username, const String& password);
HttpBasicAuth(const String& username, const String& password)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikee47 You can initialize the variables in initialization list

image

{
this->username = username;
this->password = password;
}

void setRequest(HttpRequest* request);

Expand All @@ -47,9 +50,16 @@ class HttpBasicAuth : public AuthAdapter
class HttpDigestAuth : public AuthAdapter
{
public:
HttpDigestAuth(const String& username, const String& password);
HttpDigestAuth(const String& username, const String& password)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too: variables in initialization list

{
this->username = username;
this->password = password;
}

void setRequest(HttpRequest* request);
void setRequest(HttpRequest* request)
{
this->request = request;
}

void setResponse(HttpResponse* response);

Expand Down
2 changes: 1 addition & 1 deletion Sming/SmingCore/Network/TcpConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class TcpConnection

int write(IDataSourceStream* stream);

__forceinline uint16_t getAvailableWriteSize()
uint16_t getAvailableWriteSize()
{
return (canSend && tcp) ? tcp_sndbuf(tcp) : 0;
}
Expand Down
2 changes: 1 addition & 1 deletion Sming/SmingCore/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Timer
/** @brief Start one-shot timer running
* @note Will start timer and trigger once after configured duration.
*/
void __forceinline IRAM_ATTR startOnce()
__forceinline void IRAM_ATTR startOnce()
{
start(false);
}
Expand Down