Silence more compile warnings, fix compilation on MacOS

This commit is contained in:
Thulinma 2022-10-26 16:13:27 +02:00
parent 0a13ec1119
commit 4181b52857
34 changed files with 61 additions and 73 deletions

View file

@ -40,7 +40,6 @@ void Bit::setMSB(char *pointer, unsigned int offsetBits, unsigned int dataBits,
pointer += (offsetBits + dataBits) >> 3;
// The offset is now guaranteed less than a whole byte.
offsetBits = (offsetBits + dataBits) & 0x07;
unsigned long long retVal = 0;
// Now we set the remaining bytes
while (dataBits){
// Calculate how many bits we're setting in this byte
@ -49,7 +48,6 @@ void Bit::setMSB(char *pointer, unsigned int offsetBits, unsigned int dataBits,
// If that is too much, we use the remainder instead
if (curBits > dataBits){curBits = dataBits;}
// Set the current pointer position at the correct offset, increasing the pointer by one
retVal |= ((int)(*(pointer++)) << offsetBits) >> (8 - curBits);
*pointer = (((*pointer) << offsetBits) >> offsetBits) | ((value & 0xFF) << (8 - offsetBits));
--pointer;
// Finally, shift the current value by the amount of bits we're adding

View file

@ -407,7 +407,7 @@ namespace Comms{
setConnector(protocol);
setHost(ip);
setStream(streamName);
VERYHIGH_MSG("Reloading connection. Claimed record %lu", index);
VERYHIGH_MSG("Reloading connection. Claimed record %" PRIu64, index);
}
}

View file

@ -2836,8 +2836,8 @@ namespace DTSC{
trackJSON["codec"] = getCodec(*it);
trackJSON["type"] = type;
trackJSON["idx"] = *it;
trackJSON["trackid"] = getID(*it);
trackJSON["idx"] = (uint64_t)*it;
trackJSON["trackid"] = (uint64_t)getID(*it);
trackJSON["init"] = getInit(*it);
trackJSON["firstms"] = getFirstms(*it);
trackJSON["lastms"] = getLastms(*it);
@ -3288,7 +3288,7 @@ namespace DTSC{
if (trackValid(srcTrk)){
track["source"] = getTrackIdentifier(srcTrk);
}else{
track["source"] = "Invalid track " + JSON::Value(srcTrk).asString();
track["source"] = "Invalid track " + JSON::Value((uint64_t)srcTrk).asString();
}
}else{
if (jitter < minKeep){jitter = minKeep;}

View file

@ -114,7 +114,7 @@ namespace HLS{
uint64_t lastFragmentDur = getLastFragDur(M, userSelect, trackData, hlsMsnNr, fragments, keys);
std::ldiv_t res = std::ldiv(lastFragmentDur, partDurationMaxMs);
DEBUG_MSG(5, "req MSN %" PRIu64 " fin MSN %zu, req Part %" PRIu64 " fin Part %zu", hlsMsnNr,
DEBUG_MSG(5, "req MSN %" PRIu64 " fin MSN %zu, req Part %" PRIu64 " fin Part %ld", hlsMsnNr,
(fragments.getEndValid() - 2), hlsPartNr, res.quot);
// BPR Time limit = 3x Target Duration (per HLS spec)
@ -300,13 +300,7 @@ namespace HLS{
/// Appends result with prependStr and timestamp calculated from current time in ms
void addDateTimeTag(std::stringstream &result, const std::string &prependStr,
const uint64_t unixMs){
time_t uSecs = unixMs / 1000;
struct tm *ptm = gmtime(&uSecs);
char dt_iso_8601[25];
snprintf(dt_iso_8601, 25, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3dZ", ptm->tm_year + 1900,
ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec,
(int)(unixMs % 1000));
result << prependStr << dt_iso_8601 << "\r\n";
result << prependStr << Util::getUTCStringMillis(unixMs) << "\r\n";
}
/// Add segment tag to LLHLS playlist

View file

@ -1273,7 +1273,7 @@ namespace RTP{
WARN_MSG("Ignoring invalid PPS packet! (%" PRIu32 "b)", len-4);
return;
}
HIGH_MSG("Updated PPS with ID %li from RTP data", PPS.picParameterSetId);
HIGH_MSG("Updated PPS with ID %" PRIu64 " from RTP data", PPS.picParameterSetId);
ppsData[PPS.picParameterSetId].assign(buffer + 4, len - 4);
}
}

View file

@ -877,7 +877,7 @@ namespace SDP{
for (std::map<uint64_t, Track>::iterator it = tracks.begin(); it != tracks.end(); it++) {
trackID = myMeta->getID(it->first);
INFO_MSG("Removing track %zu:%s", it->first, myMeta->getTrackIdentifier(it->first).c_str());
INFO_MSG("Removing track %" PRIu64 ":%s", it->first, myMeta->getTrackIdentifier(it->first).c_str());
if (trackID == INVALID_TRACK_ID){
WARN_MSG("TrackID was invalid");
}

View file

@ -1626,6 +1626,7 @@ void Socket::UDPConnection::checkRecvBuf(){
setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, sizeof(recvbuf));
slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
#ifdef __linux__
#ifndef __CYGWIN__
if (recvbuf < 1024*1024){
recvbuf = 1024*1024;
@ -1633,12 +1634,14 @@ void Socket::UDPConnection::checkRecvBuf(){
slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
}
#endif
#endif
if (recvbuf < 200*1024){
recvbuf = 200*1024;
setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, sizeof(recvbuf));
slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
#ifdef __linux__
#ifndef __CYGWIN__
if (recvbuf < 200*1024){
recvbuf = 200*1024;
@ -1646,6 +1649,7 @@ void Socket::UDPConnection::checkRecvBuf(){
slen = sizeof(recvbuf);
getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void*)&recvbuf, &slen);
}
#endif
#endif
}
if (recvbuf < 200*1024){

View file

@ -622,7 +622,7 @@ JSON::Value Util::getInputBySource(const std::string &filename, bool isProvider)
// Abort if not available
if (!inputs){
FAIL_MSG("Capabilities not available, aborting! Is MistController running?");
return false;
return JSON::Value();
}
// check in curConf for <naam>-priority/source_match
@ -863,7 +863,7 @@ std::set<size_t> Util::pickTracks(const DTSC::Meta &M, const std::set<size_t> tr
//Literal track ID, does not check against trackList
size_t idx = JSON::Value(trackVal).asInt();
if (trackVal == JSON::Value(idx).asString()){
if (trackVal == JSON::Value((uint64_t)idx).asString()){
if (!M.trackValid(idx)){
WARN_MSG("Track %zu does not exist in stream, cannot select", idx);
return result;

View file

@ -11,8 +11,6 @@
#if defined(__APPLE__) || defined(__MACH__)
#include <mach/clock.h>
#include <mach/mach.h>
#define CLOCK_REALTIME CALENDAR_CLOCK
#define CLOCK_MONOTONIC SYSTEM_CLOCK
void clock_gettime(int ign, struct timespec *ts){
clock_serv_t cclock;
mach_timespec_t mts;

View file

@ -26,6 +26,7 @@ namespace Util{
virtual void dataCallback(const char *ptr, size_t size){
INFO_MSG("default callback, size: %zu", size);
}
virtual ~DataCallback(){};
};
extern Util::DataCallback defaultDataCallback;