Skip to content

Commit

Permalink
use std::string instead of char *
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Aug 19, 2024
1 parent 7f6bf88 commit 7100482
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions inc/HTTPServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class HTTPServer : public RTSPServer
};

public:
static HTTPServer* createNew(UsageEnvironment& env, Port rtspPort, UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds, unsigned int hlsSegment, const std::string webroot, const char* sslCert)
static HTTPServer* createNew(UsageEnvironment& env, Port rtspPort, UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds, unsigned int hlsSegment, const std::string & webroot, const std::string & sslCert)
{
HTTPServer* httpServer = NULL;
#if LIVEMEDIA_LIBRARY_VERSION_INT < 1610928000
Expand All @@ -184,10 +184,10 @@ class HTTPServer : public RTSPServer
}

#if LIVEMEDIA_LIBRARY_VERSION_INT < 1611187200
HTTPServer(UsageEnvironment& env, int ourSocketIPv4, int ourSocketIPv6, Port rtspPort, UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds, unsigned int hlsSegment, const std::string & webroot, const char* sslCert)
HTTPServer(UsageEnvironment& env, int ourSocketIPv4, int ourSocketIPv6, Port rtspPort, UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds, unsigned int hlsSegment, const std::string & webroot, const std::string & sslCert)
: RTSPServer(env, ourSocketIPv4, rtspPort, authDatabase, reclamationTestSeconds), m_hlsSegment(hlsSegment), m_webroot(webroot), m_sslCert(sslCert)
#else
HTTPServer(UsageEnvironment& env, int ourSocketIPv4, int ourSocketIPv6, Port rtspPort, UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds, unsigned int hlsSegment, const std::string & webroot, const char* sslCert)
HTTPServer(UsageEnvironment& env, int ourSocketIPv4, int ourSocketIPv6, Port rtspPort, UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds, unsigned int hlsSegment, const std::string & webroot, const std::string & sslCert)
: RTSPServer(env, ourSocketIPv4, ourSocketIPv6, rtspPort, authDatabase, reclamationTestSeconds), m_hlsSegment(hlsSegment), m_webroot(webroot), m_sslCert(sslCert)
#endif
{
Expand All @@ -196,7 +196,7 @@ class HTTPServer : public RTSPServer
}
#if LIVEMEDIA_LIBRARY_VERSION_INT >= 1642723200
if (this->isSSL()) {
this->setTLSState(m_sslCert, m_sslCert, true, true);
this->setTLSState(m_sslCert.c_str(), m_sslCert.c_str(), true, true);
}
#endif
}
Expand All @@ -210,11 +210,11 @@ class HTTPServer : public RTSPServer
return new HTTPClientSession(*this, sessionId);
}

bool isSSL() { return (m_sslCert != NULL); }
bool isSSL() { return (!m_sslCert.empty()); }

private:
const unsigned int m_hlsSegment;
std::string m_webroot;
const char* m_sslCert;
std::string m_sslCert;
};

2 changes: 1 addition & 1 deletion inc/V4l2RTSPServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class V4l2RTSPServer {
public:
V4l2RTSPServer(unsigned short rtspPort, unsigned short rtspOverHTTPPort = 0, int timeout = 10, unsigned int hlsSegment = 0, const std::list<std::string> & userPasswordList = std::list<std::string>(), const char* realm = NULL, const std::string & webroot = "", const char *sslkeycert = NULL)
V4l2RTSPServer(unsigned short rtspPort, unsigned short rtspOverHTTPPort = 0, int timeout = 10, unsigned int hlsSegment = 0, const std::list<std::string> & userPasswordList = std::list<std::string>(), const char* realm = NULL, const std::string & webroot = "", const std::string & sslkeycert = "")
: m_stop(0)
, m_env(BasicUsageEnvironment::createNew(*BasicTaskScheduler::createNew()))
, m_rtspPort(rtspPort)
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int main(int argc, char** argv)
int timeout = 65;
int defaultHlsSegment = 2;
unsigned int hlsSegment = 0;
const char* sslKeyCert = NULL;
std::string sslKeyCert;
const char* realm = NULL;
std::list<std::string> userPasswordList;
std::string webroot;
Expand Down

0 comments on commit 7100482

Please sign in to comment.