Fix compile warnings

Co-authored-by: Thulinma <jaron@vietors.com>
This commit is contained in:
Ivan Tivonenko 2022-01-13 10:11:35 +02:00 committed by Thulinma
parent 055fb18270
commit 0a13ec1119
14 changed files with 52 additions and 54 deletions

View file

@ -46,7 +46,7 @@ namespace Comms{
class Comms{
public:
Comms();
~Comms();
virtual ~Comms();
operator bool() const;
void reload(const std::string & prefix, size_t baseSize, bool _master = false, bool reIssue = false);
virtual void addFields();

View file

@ -743,7 +743,7 @@ std::string Util::getMyPath(){
#ifdef __APPLE__
memset(mypath, 0, 500);
unsigned int refSize = 500;
int ret = _NSGetExecutablePath(mypath, &refSize);
_NSGetExecutablePath(mypath, &refSize);
#else
int ret = readlink("/proc/self/exe", mypath, 500);
if (ret != -1){

View file

@ -2124,7 +2124,7 @@ namespace DTSC{
uint64_t Meta::getBufferWindow() const{return stream.getInt(streamBufferWindowField);}
void Meta::setBootMsOffset(int64_t bootMsOffset){
DONTEVEN_MSG("Setting streamBootMsOffsetField to '%ld'", bootMsOffset);
DONTEVEN_MSG("Setting streamBootMsOffsetField to %" PRId64, bootMsOffset);
stream.setInt(streamBootMsOffsetField, bootMsOffset);
}
int64_t Meta::getBootMsOffset() const{return stream.getInt(streamBootMsOffsetField);}
@ -3190,7 +3190,7 @@ namespace DTSC{
if (pages.getInt(firsttime, i) > time){break;}
res = i;
}
DONTEVEN_MSG("Page number for time %" PRIu64 " on track %" PRIu32 " can be found on page %zu", time, idx, pages.getInt("firstkey", res));
DONTEVEN_MSG("Page number for time %" PRIu64 " on track %" PRIu32 " can be found on page %" PRIu64, time, idx, pages.getInt("firstkey", res));
return pages.getInt("firstkey", res);
}

View file

@ -170,6 +170,7 @@ namespace RTP{
class toDTSC{
public:
toDTSC();
virtual ~toDTSC(){}
void setProperties(const uint64_t track, const std::string &codec, const std::string &type,
const std::string &init, const double multiplier);
void setProperties(const DTSC::Meta &M, size_t tid);

View file

@ -110,8 +110,17 @@ std::string Util::getUTCString(uint64_t epoch){
struct tm *ptm;
ptm = gmtime(&rawtime);
char result[20];
snprintf(result, 20, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d", ptm->tm_year + 1900, ptm->tm_mon + 1,
ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
snprintf(result, 20, "%.4u-%.2u-%.2uT%.2u:%.2u:%.2u", (ptm->tm_year + 1900)%10000, (ptm->tm_mon + 1)%100, ptm->tm_mday%100, ptm->tm_hour%100, ptm->tm_min%100, ptm->tm_sec%100);
return std::string(result);
}
std::string Util::getUTCStringMillis(uint64_t epoch_millis){
if (!epoch_millis){epoch_millis = unixMS();}
time_t rawtime = epoch_millis/1000;
struct tm *ptm;
ptm = gmtime(&rawtime);
char result[25];
snprintf(result, 25, "%.4u-%.2u-%.2uT%.2u:%.2u:%.2u.%.3uZ", (ptm->tm_year + 1900)%10000, (ptm->tm_mon + 1)%100, ptm->tm_mday%100, ptm->tm_hour%100, ptm->tm_min%100, ptm->tm_sec%100, (unsigned int)(epoch_millis%1000));
return std::string(result);
}

View file

@ -17,5 +17,6 @@ namespace Util{
uint64_t getNTP();
uint64_t epoch(); ///< Gets the amount of seconds since 01/01/1970.
std::string getUTCString(uint64_t epoch = 0);
std::string getUTCStringMillis(uint64_t epoch_millis = 0);
std::string getDateString(uint64_t epoch = 0);
}// namespace Util

View file

@ -151,13 +151,13 @@ HTTP::URL::URL(const std::string &url){
}
/// Returns the port in numeric format
uint32_t HTTP::URL::getPort() const{
uint16_t HTTP::URL::getPort() const{
if (!port.size()){return getDefaultPort();}
return atoi(port.c_str());
}
/// Returns the default port for the protocol in numeric format
uint32_t HTTP::URL::getDefaultPort() const{
uint16_t HTTP::URL::getDefaultPort() const{
if (protocol == "http"){return 80;}
if (protocol == "https"){return 443;}
if (protocol == "ws"){return 80;}

View file

@ -13,8 +13,8 @@ namespace HTTP{
class URL{
public:
URL(const std::string &url = "");
uint32_t getPort() const;
uint32_t getDefaultPort() const;
uint16_t getPort() const;
uint16_t getDefaultPort() const;
std::string getExt() const;
std::string getUrl() const;
std::string getFilePath() const;