summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsaac Richards <irichards@mythtv.org>2011-05-25 00:22:30 (GMT)
committer Gavin Hurlbut <ghurlbut@mythtv.org>2011-05-27 03:06:05 (GMT)
commit1508085eb3cf5f5b88afdfb92465507a0e669a81 (patch)
tree3105a9e71a26b276eb7787681838dbc1bc76611d
parent1b1d0a9cd02b2be79e0d91a1b26c9b4daaaf13c2 (diff)
Remove 64-bit helper functions as Qt4 does it already
Refs #6256 This has been languishing in the ticket for 2 years. I have reapplied the patch, and gotten rid of the new users of the helpers. 90+% of this is Isaac's work, so he's getting the credit. Still need to update bindings/mythweb and bump proto version Signed-off-by: Gavin Hurlbut <ghurlbut@mythtv.org>
-rw-r--r--mythtv/libs/libmyth/remoteutil.cpp5
-rw-r--r--mythtv/libs/libmythbase/decodeencode.cpp124
-rw-r--r--mythtv/libs/libmythbase/decodeencode.h17
-rw-r--r--mythtv/libs/libmythbase/libmythbase.pro4
-rw-r--r--mythtv/libs/libmythbase/remotefile.cpp15
-rw-r--r--mythtv/libs/libmythtv/mythplayer.cpp1
-rw-r--r--mythtv/libs/libmythtv/previewgenerator.cpp3
-rw-r--r--mythtv/libs/libmythtv/remoteencoder.cpp27
-rw-r--r--mythtv/libs/libmythtv/tvremoteutil.cpp1
-rw-r--r--mythtv/programs/mythbackend/autoexpire.cpp3
-rw-r--r--mythtv/programs/mythbackend/httpstatus.cpp5
-rw-r--r--mythtv/programs/mythbackend/mainserver.cpp92
-rw-r--r--mythtv/programs/mythbackend/playbacksock.cpp7
-rw-r--r--mythtv/programs/mythcommflag/BlankFrameDetector.cpp9
14 files changed, 78 insertions, 235 deletions
diff --git a/mythtv/libs/libmyth/remoteutil.cpp b/mythtv/libs/libmyth/remoteutil.cpp
index 5d94c50..1dc496e 100644
--- a/mythtv/libs/libmyth/remoteutil.cpp
+++ b/mythtv/libs/libmyth/remoteutil.cpp
@@ -8,7 +8,6 @@
#include "remoteutil.h"
#include "programinfo.h"
#include "mythcorecontext.h"
-#include "decodeencode.h"
#include "storagegroup.h"
#include "mythevent.h"
@@ -55,8 +54,8 @@ vector<FileSystemInfo> RemoteGetFreeSpace(void)
fsInfo.fsID = (*(it++)).toInt();
fsInfo.dirID = (*(it++)).toInt();
fsInfo.blocksize = (*(it++)).toInt();
- fsInfo.totalSpaceKB = decodeLongLong(strlist, it);
- fsInfo.usedSpaceKB = decodeLongLong(strlist, it);
+ fsInfo.totalSpaceKB = (*(it++)).toLongLong();
+ fsInfo.usedSpaceKB = (*(it++)).toLongLong();
fsInfos.push_back(fsInfo);
}
}
diff --git a/mythtv/libs/libmythbase/decodeencode.cpp b/mythtv/libs/libmythbase/decodeencode.cpp
deleted file mode 100644
index ad271ec..0000000
--- a/mythtv/libs/libmythbase/decodeencode.cpp
+++ b/dev/null
@@ -1,124 +0,0 @@
-// C++ headers
-#include <iostream>
-
-using namespace std;
-
-// C headers
-#include <cerrno>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <time.h>
-
-// System specific C headers
-#include "compat.h"
-
-// Qt headers
-#include <QImage>
-#include <QPainter>
-#include <QPixmap>
-#include <QFont>
-#include <QFile>
-#include <QDir>
-#include <QFileInfo>
-
-#include "compat.h"
-#include "mythverbose.h"
-
-#include "decodeencode.h"
-
-/** \fn encodeLongLong(QStringList&,long long)
- * \brief Encodes a long for streaming in the MythTV protocol.
- *
- * We need this for Qt3.1 compatibility, since it will not
- * print or read a 64 bit number directly.
- * We encode the long long as strings representing two signed
- * 32 bit integers.
- *
- * \sa decodeLongLong(QStringList&,uint)
- * decodeLongLong(QStringList&,QStringList::const_iterator&)
- */
-void encodeLongLong(QStringList &list, long long num)
-{
- list << QString::number((int)(num >> 32));
- list << QString::number((int)(num & 0xffffffffLL));
-}
-
-/** \fn decodeLongLong(QStringList&,uint)
- * \brief Inefficiently decodes a long encoded for streaming in the MythTV protocol.
- *
- * We need this for Qt3.1 compatibility, since it will not
- * print or read a 64 bit number directly.
- *
- * The long long is represented as two signed 32 bit integers.
- *
- * Note: This decode performs two O(n) linear searches of the list,
- * The iterator decode function is much more efficient.
- *
- * \param list List to search for offset and offset+1 in.
- * \param offset Offset in list where to find first 32 bits of
- * long long.
- * \sa encodeLongLong(QStringList&,long long),
- * decodeLongLong(QStringList&,QStringList::const_iterator&)
- */
-long long decodeLongLong(QStringList &list, uint offset)
-{
- long long retval = 0;
- if (offset >= (uint)list.size())
- {
- VERBOSE(VB_IMPORTANT,
- "decodeLongLong() called with offset >= list size.");
- return retval;
- }
-
- int l1 = list[offset].toInt();
- int l2 = list[offset + 1].toInt();
-
- retval = ((long long)(l2) & 0xffffffffLL) | ((long long)(l1) << 32);
-
- return retval;
-}
-
-/** \fn decodeLongLong(QStringList&,QStringList::const_iterator&)
- * \brief Decodes a long encoded for streaming in the MythTV protocol.
- *
- * We need this for Qt3.1 compatibility, since it will not
- * print or read a 64 bit number directly.
- *
- * The long long is represented as two signed 32 bit integers.
- *
- * \param list List to search for offset and offset+1 in.
- * \param it Iterator pointing to first 32 bits of long long.
- * \sa encodeLongLong(QStringList&,long long),
- * decodeLongLong(QStringList&,uint)
- */
-long long decodeLongLong(QStringList &list, QStringList::const_iterator &it)
-{
- (void)list;
-
- long long retval = 0;
-
- bool ok = true;
- int l1=0, l2=0;
-
- if (it == list.end())
- ok = false;
- else
- l1 = (*(it++)).toInt();
-
- if (it == list.end())
- ok = false;
- else
- l2 = (*(it++)).toInt();
-
- if (!ok)
- {
- VERBOSE(VB_IMPORTANT,
- "decodeLongLong() called with the iterator too close "
- "to the end of the list.");
- return 0;
- }
-
- retval = ((long long)(l2) & 0xffffffffLL) | ((long long)(l1) << 32);
-
- return retval;
-}
diff --git a/mythtv/libs/libmythbase/decodeencode.h b/mythtv/libs/libmythbase/decodeencode.h
deleted file mode 100644
index 44f4f63..0000000
--- a/mythtv/libs/libmythbase/decodeencode.h
+++ b/dev/null
@@ -1,17 +0,0 @@
-#ifndef DECODEENCODE_H_
-#define DECODEENCODE_H_
-
-#include <algorithm>
-using namespace std;
-
-#include <QStringList>
-
-// This is necessary for GCC 3.3, which has llabs(long long)
-// // but not abs(long long) or std::llabs(long long)
- MBASE_PUBLIC inline long long absLongLong(long long n) { return n >= 0 ? n : -n; }
-
- MBASE_PUBLIC void encodeLongLong(QStringList &list, long long num);
- MBASE_PUBLIC long long decodeLongLong(QStringList &list, uint offset);
- MBASE_PUBLIC long long decodeLongLong(QStringList &list, QStringList::const_iterator &it);
-
-#endif // DECODEENCODE_H_
diff --git a/mythtv/libs/libmythbase/libmythbase.pro b/mythtv/libs/libmythbase/libmythbase.pro
index c04c5d7..6c4d35c 100644
--- a/mythtv/libs/libmythbase/libmythbase.pro
+++ b/mythtv/libs/libmythbase/libmythbase.pro
@@ -15,7 +15,7 @@ HEADERS += mythbaseexp.h mythdbcon.h mythdb.h mythdbparams.h oldsettings.h
HEADERS += mythverbose.h mythversion.h compat.h mythconfig.h
HEADERS += mythobservable.h mythevent.h httpcomms.h mcodecs.h
HEADERS += mythtimer.h mythsignalingtimer.h mythdirs.h exitcodes.h
-HEADERS += lcddevice.h mythstorage.h remotefile.h decodeencode.h
+HEADERS += lcddevice.h mythstorage.h remotefile.h
HEADERS += mythcorecontext.h mythsystem.h mythlocale.h storagegroup.h
HEADERS += mythcoreutil.h mythdownloadmanager.h mythtranslation.h
HEADERS += unzip.h unzip_p.h zipentry_p.h iso639.h iso3166.h mythmedia.h
@@ -27,7 +27,7 @@ SOURCES += mythsocket.cpp mythsocketthread.cpp msocketdevice.cpp
SOURCES += mythdbcon.cpp mythdb.cpp oldsettings.cpp mythverbose.cpp
SOURCES += mythobservable.cpp mythevent.cpp httpcomms.cpp mcodecs.cpp
SOURCES += mythdirs.cpp mythsignalingtimer.cpp
-SOURCES += lcddevice.cpp mythstorage.cpp remotefile.cpp decodeencode.cpp
+SOURCES += lcddevice.cpp mythstorage.cpp remotefile.cpp
SOURCES += mythcorecontext.cpp mythsystem.cpp mythlocale.cpp storagegroup.cpp
SOURCES += mythcoreutil.cpp mythdownloadmanager.cpp mythtranslation.cpp
SOURCES += unzip.cpp iso639.cpp iso3166.cpp mythmedia.cpp util.cpp
diff --git a/mythtv/libs/libmythbase/remotefile.cpp b/mythtv/libs/libmythbase/remotefile.cpp
index 55e25a6..cfc274e 100644
--- a/mythtv/libs/libmythbase/remotefile.cpp
+++ b/mythtv/libs/libmythbase/remotefile.cpp
@@ -6,7 +6,6 @@ using namespace std;
#include "mythconfig.h"
#include "mythdb.h"
#include "remotefile.h"
-#include "decodeencode.h"
#include "mythcorecontext.h"
#include "mythsocket.h"
#include "compat.h"
@@ -128,15 +127,15 @@ MythSocket *RemoteFile::openSocket(bool control)
strlist.push_back("invalid response");
}
- if (strlist.size() >= 4)
+ if (strlist.size() >= 3)
{
it = strlist.begin(); ++it;
recordernum = (*it).toInt(); ++it;
- filesize = decodeLongLong(strlist, it);
+ filesize = (*(it)).toLongLong(); ++it;
for (; it != strlist.end(); ++it)
auxfiles << *it;
}
- else if (0 < strlist.size() && strlist.size() < 4 &&
+ else if (0 < strlist.size() && strlist.size() < 3 &&
strlist[0] != "ERROR")
{
VERBOSE(VB_IMPORTANT, loc_err +
@@ -373,18 +372,18 @@ long long RemoteFile::Seek(long long pos, int whence, long long curpos)
QStringList strlist( QString(query).arg(recordernum) );
strlist << "SEEK";
- encodeLongLong(strlist, pos);
+ strlist << QString::number(pos);
strlist << QString::number(whence);
if (curpos > 0)
- encodeLongLong(strlist, curpos);
+ strlist << QString::number(curpos);
else
- encodeLongLong(strlist, readposition);
+ strlist << QString::number(readposition);
controlSock->writeStringList(strlist);
controlSock->readStringList(strlist);
lock.unlock();
- long long retval = decodeLongLong(strlist, 0);
+ long long retval = strlist[0].toLongLong();
readposition = retval;
Reset();
diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index 1525a29..87cf4cf 100644
--- a/mythtv/libs/libmythtv/mythplayer.cpp
+++ b/mythtv/libs/libmythtv/mythplayer.cpp
@@ -44,7 +44,6 @@ using namespace std;
#include "fifowriter.h"
#include "filtermanager.h"
#include "util.h"
-#include "decodeencode.h"
#include "livetvchain.h"
#include "decoderbase.h"
#include "nuppeldecoder.h"
diff --git a/mythtv/libs/libmythtv/previewgenerator.cpp b/mythtv/libs/libmythtv/previewgenerator.cpp
index 57c994a..2e8ca50 100644
--- a/mythtv/libs/libmythtv/previewgenerator.cpp
+++ b/mythtv/libs/libmythtv/previewgenerator.cpp
@@ -28,7 +28,6 @@
#include "remotefile.h"
#include "storagegroup.h"
#include "util.h"
-#include "decodeencode.h"
#include "playercontext.h"
#include "mythdirs.h"
#include "mythverbose.h"
@@ -341,7 +340,7 @@ bool PreviewGenerator::RemotePreviewRun(void)
strlist.push_back(token);
programInfo.ToStringList(strlist);
strlist.push_back(timeInSeconds ? "s" : "f");
- encodeLongLong(strlist, captureTime);
+ strlist.push_back(QString::number(captureTime));
if (outFileName.isEmpty())
{
strlist.push_back("<EMPTY>");
diff --git a/mythtv/libs/libmythtv/remoteencoder.cpp b/mythtv/libs/libmythtv/remoteencoder.cpp
index 0a6a402..6c6c538 100644
--- a/mythtv/libs/libmythtv/remoteencoder.cpp
+++ b/mythtv/libs/libmythtv/remoteencoder.cpp
@@ -5,7 +5,6 @@
#include "remoteencoder.h"
#include "programinfo.h"
#include "util.h"
-#include "decodeencode.h"
#include "mythcorecontext.h"
#include "signalmonitor.h"
#include "videooutbase.h"
@@ -206,21 +205,13 @@ long long RemoteEncoder::GetFramesWritten(void)
QStringList strlist( QString("QUERY_RECORDER %1").arg(recordernum));
strlist << "GET_FRAMES_WRITTEN";
- if (!SendReceiveStringList(strlist, 2))
+ if (!SendReceiveStringList(strlist, 1))
{
VERBOSE(VB_IMPORTANT, LOC_ERR + "GetFramesWritten() -- network error");
return -1;
}
- if (1 == strlist.size())
- {
- VERBOSE(VB_IMPORTANT, LOC_ERR +
- QString("GetFramesWritten() -- server ret: %1")
- .arg(strlist[0]));
- return -1;
- }
-
- cachedFramesWritten = decodeLongLong(strlist, 0);
+ cachedFramesWritten = strlist[0].toLongLong();
return cachedFramesWritten;
}
@@ -235,8 +226,8 @@ long long RemoteEncoder::GetFilePosition(void)
QStringList strlist( QString("QUERY_RECORDER %1").arg(recordernum));
strlist << "GET_FILE_POSITION";
- if (SendReceiveStringList(strlist, 2))
- return decodeLongLong(strlist, 0);
+ if (SendReceiveStringList(strlist, 1))
+ return strlist[0].toLongLong();
return -1;
}
@@ -250,8 +241,8 @@ long long RemoteEncoder::GetMaxBitrate(void)
QStringList strlist( QString("QUERY_RECORDER %1").arg(recordernum));
strlist << "GET_MAX_BITRATE";
- if (SendReceiveStringList(strlist, 2))
- return decodeLongLong(strlist, 0);
+ if (SendReceiveStringList(strlist, 1))
+ return strlist[0].toLongLong();
return 20200000LL; // Peek bit rate for HD-PVR
}
@@ -267,10 +258,10 @@ int64_t RemoteEncoder::GetKeyframePosition(uint64_t desired)
{
QStringList strlist( QString("QUERY_RECORDER %1").arg(recordernum) );
strlist << "GET_KEYFRAME_POS";
- encodeLongLong(strlist, desired);
+ strlist << QString::number(desired);
- if (SendReceiveStringList(strlist, 2))
- return decodeLongLong(strlist, 0);
+ if (SendReceiveStringList(strlist, 1))
+ return strlist[0].toLongLong();
return -1;
}
diff --git a/mythtv/libs/libmythtv/tvremoteutil.cpp b/mythtv/libs/libmythtv/tvremoteutil.cpp
index 72bdba8..d003964 100644
--- a/mythtv/libs/libmythtv/tvremoteutil.cpp
+++ b/mythtv/libs/libmythtv/tvremoteutil.cpp
@@ -7,7 +7,6 @@
#include "inputinfo.h"
#include "programinfo.h"
#include "mythcorecontext.h"
-#include "decodeencode.h"
#include "remoteencoder.h"
#include "tv_rec.h"
diff --git a/mythtv/programs/mythbackend/autoexpire.cpp b/mythtv/programs/mythbackend/autoexpire.cpp
index a059730..9dbfd4d 100644
--- a/mythtv/programs/mythbackend/autoexpire.cpp
+++ b/mythtv/programs/mythbackend/autoexpire.cpp
@@ -707,8 +707,7 @@ void AutoExpire::ExpireEpisodesOverMax(void)
(!episodeParts.contains(episodeKey)) &&
(found > *maxIter))
{
- long long spaceFreed =
- query.value(5).toLongLong() >> 20;
+ long long spaceFreed = query.value(5).toLongLong() >> 20;
QString msg =
QString("Expiring %1 MBytes for %2 at %3 => %4. Too "
"many episodes, we only want to keep %5.")
diff --git a/mythtv/programs/mythbackend/httpstatus.cpp b/mythtv/programs/mythbackend/httpstatus.cpp
index bc04e53..7ec07f8 100644
--- a/mythtv/programs/mythbackend/httpstatus.cpp
+++ b/mythtv/programs/mythbackend/httpstatus.cpp
@@ -26,7 +26,6 @@
#include "mythcorecontext.h"
#include "mythversion.h"
-#include "decodeencode.h"
#include "mythdbcon.h"
#include "compat.h"
#include "mythconfig.h"
@@ -454,8 +453,8 @@ void HttpStatus::FillStatusXML( QDomDocument *pDoc )
fsID = *(sit++);
sit++; // ignore dirID
sit++; // ignore blocksize
- iTotal = decodeLongLong(strlist, sit);
- iUsed = decodeLongLong(strlist, sit);
+ iTotal = (*(sit++)).toLongLong();
+ iUsed = (*(sit++)).toLongLong();;
iAvail = iTotal - iUsed;
if (fsID == "-2")
diff --git a/mythtv/programs/mythbackend/mainserver.cpp b/mythtv/programs/mythbackend/mainserver.cpp
index 77d34cf..22a63e3 100644
--- a/mythtv/programs/mythbackend/mainserver.cpp
+++ b/mythtv/programs/mythbackend/mainserver.cpp
@@ -43,7 +43,6 @@ using namespace std;
#include "mythcontext.h"
#include "mythverbose.h"
#include "mythversion.h"
-#include "decodeencode.h"
#include "mythdb.h"
#include "mainserver.h"
#include "server.h"
@@ -1486,7 +1485,7 @@ void MainServer::HandleAnnounce(QStringList &slist, QStringList commands,
retlist << QString::number(socket->socket());
ft->UpRef();
- encodeLongLong(retlist, ft->GetFileSize());
+ retlist << QString::number(ft->GetFileSize());
ft->DownRef();
if (checkfiles.size())
@@ -3599,18 +3598,15 @@ void MainServer::HandleRecorderQuery(QStringList &slist, QStringList &commands,
}
else if (command == "GET_FRAMES_WRITTEN")
{
- long long value = enc->GetFramesWritten();
- encodeLongLong(retlist, value);
+ retlist << QString::number(enc->GetFramesWritten());
}
else if (command == "GET_FILE_POSITION")
{
- long long value = enc->GetFilePosition();
- encodeLongLong(retlist, value);
+ retlist << QString::number(enc->GetFilePosition());
}
else if (command == "GET_MAX_BITRATE")
{
- long long value = enc->GetMaxBitrate();
- encodeLongLong(retlist, value);
+ retlist << QString::number(enc->GetMaxBitrate());
}
else if (command == "GET_CURRENT_RECORDING")
{
@@ -3628,10 +3624,8 @@ void MainServer::HandleRecorderQuery(QStringList &slist, QStringList &commands,
}
else if (command == "GET_KEYFRAME_POS")
{
- long long desired = decodeLongLong(slist, 2);
-
- long long value = enc->GetKeyframePosition(desired);
- encodeLongLong(retlist, value);
+ long long desired = slist[2].toLongLong();
+ retlist << QString::number(enc->GetKeyframePosition(desired));
}
else if (command == "FILL_POSITION_MAP")
{
@@ -4063,8 +4057,7 @@ void MainServer::HandleRemoteEncoder(QStringList &slist, QStringList &commands,
}
else if (command == "GET_MAX_BITRATE")
{
- long long value = enc->GetMaxBitrate();
- encodeLongLong(retlist, value);
+ retlist << QString::number(enc->GetMaxBitrate());
}
else if (command == "GET_CURRENT_RECORDING")
{
@@ -4246,8 +4239,8 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated,
strlist << "-1"; // Ignore fsID
strlist << dirID;
strlist << QString::number(bSize);
- encodeLongLong(strlist, totalKB);
- encodeLongLong(strlist, usedKB);
+ strlist << QString::number(totalKB);
+ strlist << QString::number(usedKB);
foundDirs[currentDir] = true;
}
@@ -4307,8 +4300,8 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated,
fsInfo.fsID = (*(it++)).toInt();
fsInfo.dirID = (*(it++)).toInt();
fsInfo.blocksize = (*(it++)).toInt();
- fsInfo.totalSpaceKB = decodeLongLong(strlist, it);
- fsInfo.usedSpaceKB = decodeLongLong(strlist, it);
+ fsInfo.totalSpaceKB = (*(it++)).toLongLong();
+ fsInfo.usedSpaceKB = (*(it++)).toLongLong();
fsInfo.freeSpaceKB = fsInfo.totalSpaceKB - fsInfo.usedSpaceKB;
fsInfos.push_back(fsInfo);
}
@@ -4333,10 +4326,15 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated,
// our fuzzy comparison uses the maximum of the two block sizes
// or 32, whichever is greater
bSize = max(32, max(it1->blocksize, it2->blocksize) / 1024);
- if (it2->fsID == -1 &&
- (absLongLong(it1->totalSpaceKB - it2->totalSpaceKB) <= bSize) &&
- ((size_t)absLongLong(it1->usedSpaceKB - it2->usedSpaceKB)
- <= maxWriteFiveSec))
+ long long diffSize = it1->totalSpaceKB - it2->totalSpaceKB;
+ long long diffUsed = it1->usedSpaceKB - it2->usedSpaceKB;
+ if (diffSize < 0)
+ diffSize = 0 - diffSize;
+ if (diffUsed < 0)
+ diffUsed = 0 - diffUsed;
+
+ if (it2->fsID == -1 && (diffSize <= bSize) &&
+ ((size_t)diffUsed <= maxWriteFiveSec))
{
if (!it1->hostname.contains(it2->hostname))
it1->hostname = it1->hostname + "," + it2->hostname;
@@ -4359,8 +4357,8 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated,
strlist << QString::number(it1->fsID);
strlist << QString::number(it1->dirID);
strlist << QString::number(it1->blocksize);
- encodeLongLong(strlist, it1->totalSpaceKB);
- encodeLongLong(strlist, it1->usedSpaceKB);
+ strlist << QString::number(it1->totalSpaceKB);
+ strlist << QString::number(it1->usedSpaceKB);
totalKB += it1->totalSpaceKB;
usedKB += it1->usedSpaceKB;
@@ -4374,8 +4372,8 @@ void MainServer::BackendQueryDiskSpace(QStringList &strlist, bool consolidated,
strlist << "-2";
strlist << "-2";
strlist << "0";
- encodeLongLong(strlist, totalKB);
- encodeLongLong(strlist, usedKB);
+ strlist << QString::number(totalKB);
+ strlist << QString::number(usedKB);
}
}
@@ -4398,8 +4396,8 @@ void MainServer::GetFilesystemInfos(vector <FileSystemInfo> &fsInfos)
it++;
fsInfo.dirID = (*(it++)).toInt();
fsInfo.blocksize = (*(it++)).toInt();
- fsInfo.totalSpaceKB = decodeLongLong(strlist, it);
- fsInfo.usedSpaceKB = decodeLongLong(strlist, it);
+ fsInfo.totalSpaceKB = (*(it++)).toLongLong();
+ fsInfo.usedSpaceKB = (*(it++)).toLongLong();
fsInfo.freeSpaceKB = fsInfo.totalSpaceKB - fsInfo.usedSpaceKB;
fsInfo.weight = 0;
fsInfos.push_back(fsInfo);
@@ -4429,23 +4427,26 @@ void MainServer::GetFilesystemInfos(vector <FileSystemInfo> &fsInfos)
// our fuzzy comparison uses the maximum of the two block sizes
// or 32, whichever is greater
bSize = max(32, max(it1->blocksize, it2->blocksize) / 1024);
+ long long diffSize = it1->totalSpaceKB - it2->totalSpaceKB;
+ long long diffUsed = it1->usedSpaceKB - it2->usedSpaceKB;
+ if (diffSize < 0)
+ diffSize = 0 - diffSize;
+ if (diffUsed < 0)
+ diffUsed = 0 - diffUsed;
+
VERBOSE(VB_SCHEDULE+VB_FILE+VB_EXTRA,
QString(" Checking %1:%2 (dirID %3) using %4 of %5 KB")
.arg(it2->hostname).arg(it2->directory).arg(it2->dirID)
.arg(it2->usedSpaceKB).arg(it2->totalSpaceKB));
VERBOSE(VB_SCHEDULE+VB_FILE+VB_EXTRA,
QString(" Total KB Diff: %1 (want <= %2)")
- .arg((long)absLongLong(it1->totalSpaceKB - it2->totalSpaceKB))
- .arg(bSize));
+ .arg((long)diffSize).arg(bSize));
VERBOSE(VB_SCHEDULE+VB_FILE+VB_EXTRA,
QString(" Used KB Diff: %1 (want <= %2)")
- .arg((size_t)absLongLong(it1->usedSpaceKB - it2->usedSpaceKB))
- .arg(maxWriteFiveSec));
+ .arg((long)diffUsed).arg(maxWriteFiveSec));
- if (it2->fsID == -1 &&
- (absLongLong(it1->totalSpaceKB - it2->totalSpaceKB) <= bSize) &&
- ((size_t)absLongLong(it1->usedSpaceKB - it2->usedSpaceKB)
- <= maxWriteFiveSec))
+ if (it2->fsID == -1 && (diffSize <= bSize) &&
+ ((size_t)diffUsed <= maxWriteFiveSec))
{
it2->fsID = it1->fsID;
@@ -4616,7 +4617,7 @@ void MainServer::HandleCutMapQuery(const QString &chanid,
rowcnt++;
QString intstr = QString("%1").arg(*it);
retlist << intstr;
- encodeLongLong(retlist,it.key());
+ retlist << QString::number(it.key());
}
}
@@ -4683,7 +4684,7 @@ void MainServer::HandleBookmarkQuery(const QString &chanid,
chanid.toUInt(), recstartts);
QStringList retlist;
- encodeLongLong(retlist,bookmark);
+ retlist << QString::number(bookmark);
if (pbssock)
SendResponse(pbssock, retlist);
@@ -4708,14 +4709,11 @@ void MainServer::HandleSetBookmark(QStringList &tokens,
QString chanid = tokens[1];
QString starttime = tokens[2];
- QStringList bookmarklist;
- bookmarklist << tokens[3];
- bookmarklist << tokens[4];
+ long long bookmark = tokens[3].toLongLong();
QDateTime recstartts;
recstartts.setTime_t(starttime.toULongLong());
QStringList retlist;
- long long bookmark = decodeLongLong(bookmarklist, 0);
ProgramInfo pginfo(chanid.toUInt(), recstartts);
@@ -4936,12 +4934,12 @@ void MainServer::HandleFileTransferQuery(QStringList &slist,
}
else if (command == "SEEK")
{
- long long pos = decodeLongLong(slist, 2);
- int whence = slist[4].toInt();
- long long curpos = decodeLongLong(slist, 5);
+ long long pos = slist[2].toLongLong();
+ int whence = slist[3].toInt();
+ long long curpos = slist[4].toLongLong();
long long ret = ft->Seek(curpos, pos, whence);
- encodeLongLong(retlist, ret);
+ retlist << QString::number(ret);
}
else if (command == "SET_TIMEOUT")
{
@@ -5185,7 +5183,7 @@ void MainServer::HandleGenPreviewPixmap(QStringList &slist, PlaybackSock *pbs)
if (it != slist.end())
(time_fmt_sec = ((*it).toLower() == "s")), it++;
if (it != slist.end())
- time = decodeLongLong(slist, it);
+ (time = (*it).toLongLong()), it++;
if (it != slist.end())
(outputfile = *it), it++;
outputfile = (outputfile == "<EMPTY>") ? QString::null : outputfile;
diff --git a/mythtv/programs/mythbackend/playbacksock.cpp b/mythtv/programs/mythbackend/playbacksock.cpp
index 4cb7c8d..ca1307f 100644
--- a/mythtv/programs/mythbackend/playbacksock.cpp
+++ b/mythtv/programs/mythbackend/playbacksock.cpp
@@ -10,7 +10,6 @@ using namespace std;
#include "mythcorecontext.h"
#include "util.h"
#include "inputinfo.h"
-#include "decodeencode.h"
#define LOC QString("PlaybackSock: ")
#define LOC_ERR QString("PlaybackSock, Error: ")
@@ -286,7 +285,7 @@ QStringList PlaybackSock::GenPreviewPixmap(const QString &token,
strlist += token;
pginfo->ToStringList(strlist);
strlist.push_back(time_fmt_sec ? "s" : "f");
- encodeLongLong(strlist, time);
+ strlist.push_back(QString::number(time));
strlist.push_back((outputFile.isEmpty()) ? "<EMPTY>" : outputFile);
strlist.push_back(QString::number(outputSize.width()));
strlist.push_back(QString::number(outputSize.height()));
@@ -392,9 +391,9 @@ long long PlaybackSock::GetMaxBitrate(int capturecardnum)
strlist << "GET_MAX_BITRATE";
if (SendReceiveStringList(strlist, 2))
- return decodeLongLong(strlist, 0);
+ return strlist[0].toLongLong();
- return 20200000LL; // Peek bit rate for HD-PVR
+ return 20200000LL; // Peak bit rate for HD-PVR
}
/** \brief Returns the ProgramInfo being used by any current recording.
diff --git a/mythtv/programs/mythcommflag/BlankFrameDetector.cpp b/mythtv/programs/mythcommflag/BlankFrameDetector.cpp
index 984dbc2..afa3b7b 100644
--- a/mythtv/programs/mythcommflag/BlankFrameDetector.cpp
+++ b/mythtv/programs/mythcommflag/BlankFrameDetector.cpp
@@ -4,7 +4,6 @@
// MythTV headers
#include "mythcorecontext.h" /* gContext */
-#include "decodeencode.h" /* for absLongLong */
#include "mythplayer.h"
// Commercial Flagging headers
@@ -255,8 +254,12 @@ computeBreakMap(FrameAnalyzer::FrameMap *breakMap,
long long testlen = (long long)roundf((end - start) / fps);
if (testlen > breaktype[ii].len + breaktype[ii].delta)
break; /* Too far ahead; break to next break length. */
- if (absLongLong(testlen - breaktype[ii].len)
- > breaktype[ii].delta)
+
+ long long delta = testlen - breaktype[ii].len;
+ if (delta < 0)
+ delta = 0 - delta;
+
+ if (delta > breaktype[ii].delta)
continue; /* Outside delta range; try next end-blank. */
/* Mark this commercial break. */