32-bit fixes

This commit is contained in:
Thulinma 2023-02-27 10:34:58 +01:00
parent dc0ec77f26
commit e9ea839996
4 changed files with 13 additions and 13 deletions

View file

@ -254,7 +254,7 @@ std::string Util::Procs::getOutputOf(char *const *argv, uint64_t maxWait){
} }
}else{ }else{
if (maxWait && waitedFor > maxWait){ if (maxWait && waitedFor > maxWait){
WARN_MSG("Timeout while getting output of '%s', returning %luB of data", (char *)argv, ret.size()); WARN_MSG("Timeout while getting output of '%s', returning %zuB of data", (char *)argv, ret.size());
break; break;
} }
else if(maxWait){ else if(maxWait){
@ -297,7 +297,7 @@ std::string Util::Procs::getLimitedOutputOf(char *const *argv, uint64_t maxWait,
} }
}else{ }else{
if (waitedFor > maxWait){ if (waitedFor > maxWait){
WARN_MSG("Reached timeout of %lu ms. Killing process with command %s...", maxWait, fullCmd.c_str()); WARN_MSG("Reached timeout of %" PRIu64 " ms. Killing process with command %s...", maxWait, fullCmd.c_str());
break; break;
} }
else { else {
@ -307,7 +307,7 @@ std::string Util::Procs::getLimitedOutputOf(char *const *argv, uint64_t maxWait,
} }
} }
if (ret.size() > maxValBytes){ if (ret.size() > maxValBytes){
WARN_MSG("Have a limit of %uB, but received %luB of data. Killing process with command %s...", maxValBytes, ret.size(), fullCmd.c_str()); WARN_MSG("Have a limit of %" PRIu32 "B, but received %zuB of data. Killing process with command %s...", maxValBytes, ret.size(), fullCmd.c_str());
break; break;
} }
} }

View file

@ -372,7 +372,7 @@ namespace Controller{
uint64_t lastRun = Util::epoch(); uint64_t lastRun = Util::epoch();
Util::stringTrim(newVal); Util::stringTrim(newVal);
if (newVal.size() > 127){ if (newVal.size() > 127){
WARN_MSG("Truncating response of custom variable %s to 127 bytes (received %lu bytes)", name.c_str(), newVal.size()); WARN_MSG("Truncating response of custom variable %s to 127 bytes (received %zu bytes)", name.c_str(), newVal.size());
newVal = newVal.substr(0, 127); newVal = newVal.substr(0, 127);
} }
// Modify config // Modify config

View file

@ -1538,14 +1538,14 @@ namespace Mist{
std::string fileName = config->getString("input") + ".dtsh"; std::string fileName = config->getString("input") + ".dtsh";
HIGH_MSG("Loading metadata for stream '%s' from file '%s'", streamName.c_str(), fileName.c_str()); HIGH_MSG("Loading metadata for stream '%s' from file '%s'", streamName.c_str(), fileName.c_str());
char *scanBuf; char *scanBuf;
uint64_t fileSize; size_t fileSize;
HTTP::URIReader inFile(fileName); HTTP::URIReader inFile(fileName);
if (!inFile){return false;} if (!inFile){return false;}
inFile.readAll(scanBuf, fileSize); inFile.readAll(scanBuf, fileSize);
inFile.close(); inFile.close();
if (!fileSize){return false;} if (!fileSize){return false;}
DTSC::Packet pkt(scanBuf, fileSize, true); DTSC::Packet pkt(scanBuf, fileSize, true);
HIGH_MSG("Retrieved header of %lu bytes", fileSize); HIGH_MSG("Retrieved header of %zu bytes", fileSize);
meta.reInit(config->getBool("realtime") ? "" : streamName, pkt.getScan()); meta.reInit(config->getBool("realtime") ? "" : streamName, pkt.getScan());
if (meta.version != DTSH_VERSION){ if (meta.version != DTSH_VERSION){

View file

@ -575,7 +575,7 @@ namespace Mist{
// The current line should be a segment path at this point // The current line should be a segment path at this point
// If we are above the max segment count or age, ignore this segment and reset info fields // If we are above the max segment count or age, ignore this segment and reset info fields
if (maxEntries && (segmentCount - segmentsRemoved >= maxEntries)){ if (maxEntries && (segmentCount - segmentsRemoved >= maxEntries)){
HIGH_MSG("Dropping segment #%lu from the playlist due to the playlist reaching it's max size of %lu segments", segmentsRemoved, maxEntries); HIGH_MSG("Dropping segment #%" PRIu64 " from the playlist due to the playlist reaching it's max size of %" PRIu64 " segments", segmentsRemoved, maxEntries);
curDateString = ""; curDateString = "";
curDurationString = ""; curDurationString = "";
segmentsRemoved++; segmentsRemoved++;
@ -590,7 +590,7 @@ namespace Mist{
if (targetAge && curDateString.size() > 25){ if (targetAge && curDateString.size() > 25){
uint64_t segmentDiff = Util::getUTCTimeDiff(curDateString.substr(25), curTime); uint64_t segmentDiff = Util::getUTCTimeDiff(curDateString.substr(25), curTime);
if (segmentDiff > targetAge){ if (segmentDiff > targetAge){
HIGH_MSG("Dropping segment #%lu from the playlist due to old age (%lu s)", segmentsRemoved, segmentDiff); HIGH_MSG("Dropping segment #%" PRIu64 " from the playlist due to old age (%" PRIu64 " s)", segmentsRemoved, segmentDiff);
// If the segment is too old, ignore and reset fields // If the segment is too old, ignore and reset fields
curDurationString = ""; curDurationString = "";
curDateString = ""; curDateString = "";
@ -1425,7 +1425,7 @@ namespace Mist{
} }
playlistBuffer += "#EXT-X-DISCONTINUITY\n"; playlistBuffer += "#EXT-X-DISCONTINUITY\n";
INFO_MSG("Appending to existing local playlist file '%s'", playlistLocationString.c_str()); INFO_MSG("Appending to existing local playlist file '%s'", playlistLocationString.c_str());
INFO_MSG("Found %lu prior segments", segmentCount); INFO_MSG("Found %" PRIu64 " prior segments", segmentCount);
}else{ }else{
// Remove all segments referenced in the playlist // Remove all segments referenced in the playlist
while (std::getline(inFile, line)) { while (std::getline(inFile, line)) {
@ -1475,7 +1475,7 @@ namespace Mist{
playlistBuffer += line + '\n'; playlistBuffer += line + '\n';
} }
playlistBuffer += "#EXT-X-DISCONTINUITY\n"; playlistBuffer += "#EXT-X-DISCONTINUITY\n";
INFO_MSG("Found %lu prior segments", segmentCount); INFO_MSG("Found %" PRIu64 " prior segments", segmentCount);
INFO_MSG("Appending to existing remote playlist file '%s'", playlistLocationString.c_str()); INFO_MSG("Appending to existing remote playlist file '%s'", playlistLocationString.c_str());
}else{ }else{
WARN_MSG("Overwriting existing remote playlist file '%s'", playlistLocationString.c_str()); WARN_MSG("Overwriting existing remote playlist file '%s'", playlistLocationString.c_str());
@ -1660,7 +1660,7 @@ namespace Mist{
uint64_t unixMs = M.getBootMsOffset() + systemBoot + currentStartTime; uint64_t unixMs = M.getBootMsOffset() + systemBoot + currentStartTime;
playlistBuffer += "#EXT-X-PROGRAM-DATE-TIME:" + Util::getUTCStringMillis(unixMs) + "\n"; playlistBuffer += "#EXT-X-PROGRAM-DATE-TIME:" + Util::getUTCStringMillis(unixMs) + "\n";
} }
INFO_MSG("Adding new segment `%s` of %lums to playlist '%s'", segment.c_str(), lastPacketTime - currentStartTime, playlistLocationString.c_str()); INFO_MSG("Adding new segment `%s` of %" PRIu64 "ms to playlist '%s'", segment.c_str(), lastPacketTime - currentStartTime, playlistLocationString.c_str());
// Append duration & TS filename to playlist file // Append duration & TS filename to playlist file
std::stringstream tmp; std::stringstream tmp;
double segmentDuration = (lastPacketTime - currentStartTime) / 1000.0; double segmentDuration = (lastPacketTime - currentStartTime) / 1000.0;
@ -1670,7 +1670,7 @@ namespace Mist{
if (segmentDuration > atoll(targetDuration.c_str())){ if (segmentDuration > atoll(targetDuration.c_str())){
// Set the new targetDuration to the ceil of the segment duration // Set the new targetDuration to the ceil of the segment duration
targetDuration = JSON::Value(uint64_t(segmentDuration) + 1).asString(); targetDuration = JSON::Value(uint64_t(segmentDuration) + 1).asString();
WARN_MSG("Segment #%lu has a longer duration than the target duration. Adjusting the targetDuration to %s seconds", segmentCount, targetDuration.c_str()); WARN_MSG("Segment #%" PRIu64 " has a longer duration than the target duration. Adjusting the targetDuration to %s seconds", segmentCount, targetDuration.c_str());
// Round the target split time down to ensure we split on the keyframe for very long keyframe intervals // Round the target split time down to ensure we split on the keyframe for very long keyframe intervals
targetParams["split"] = JSON::Value(uint64_t(segmentDuration)).asString(); targetParams["split"] = JSON::Value(uint64_t(segmentDuration)).asString();
// Modify the buffer to contain the new targetDuration // Modify the buffer to contain the new targetDuration
@ -1790,7 +1790,7 @@ namespace Mist{
uint64_t unixMs = M.getBootMsOffset() + systemBoot + currentStartTime; uint64_t unixMs = M.getBootMsOffset() + systemBoot + currentStartTime;
playlistBuffer += "#EXT-X-PROGRAM-DATE-TIME:" + Util::getUTCStringMillis(unixMs) + "\n"; playlistBuffer += "#EXT-X-PROGRAM-DATE-TIME:" + Util::getUTCStringMillis(unixMs) + "\n";
} }
INFO_MSG("Adding final segment `%s` of %lums to playlist '%s'", segment.c_str(), lastPacketTime - currentStartTime, playlistLocationString.c_str()); INFO_MSG("Adding final segment `%s` of %" PRIu64 "ms to playlist '%s'", segment.c_str(), lastPacketTime - currentStartTime, playlistLocationString.c_str());
// Append duration & TS filename to playlist file // Append duration & TS filename to playlist file
std::stringstream tmp; std::stringstream tmp;
tmp << "#EXTINF:" << std::fixed << std::setprecision(3) << (lastPacketTime - currentStartTime) / 1000.0 << ",\n"+ segment + "\n"; tmp << "#EXTINF:" << std::fixed << std::setprecision(3) << (lastPacketTime - currentStartTime) / 1000.0 << ",\n"+ segment + "\n";