diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-01 03:43:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-01 03:43:07 +0000 |
commit | 70b9eea2ba01c3691497f49e4c45cb070c16193c (patch) | |
tree | 9a6df61aa247a27275aad9c5245e419e89c2c640 /kradio3/src/fileringbuffer.cpp | |
parent | 998c1384ace4ae4655997c181fa33242148cd0a4 (diff) | |
download | tderadio-70b9eea2ba01c3691497f49e4c45cb070c16193c.tar.gz tderadio-70b9eea2ba01c3691497f49e4c45cb070c16193c.zip |
TQt4 port kradio
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kradio@1238952 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kradio3/src/fileringbuffer.cpp')
-rw-r--r-- | kradio3/src/fileringbuffer.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/kradio3/src/fileringbuffer.cpp b/kradio3/src/fileringbuffer.cpp index beea2b4..584b8c2 100644 --- a/kradio3/src/fileringbuffer.cpp +++ b/kradio3/src/fileringbuffer.cpp @@ -17,22 +17,22 @@ #include "include/fileringbuffer.h" -#include <qstring.h> +#include <tqstring.h> #include <unistd.h> #include <klocale.h> -FileRingBuffer::FileRingBuffer(const QString &filename, Q_UINT64 max_size) +FileRingBuffer::FileRingBuffer(const TQString &filename, TQ_UINT64 max_size) { m_BaseFileName = filename; m_FileIdx = 0; - m_FileName = m_BaseFileName + "_" + QString::number(++m_FileIdx); + m_FileName = m_BaseFileName + "_" + TQString::number(++m_FileIdx); m_File = fopen(m_FileName.ascii(), "w+"); m_MaxSize = max_size; m_RealSize = 0; m_FillSize = 0; m_Start = 0; m_error = m_File == NULL; - m_errorString = m_File ? QString::null : i18n("cannot open buffer file %1").arg(filename); + m_errorString = m_File ? TQString() : i18n("cannot open buffer file %1").tqarg(filename); } @@ -43,17 +43,17 @@ FileRingBuffer::~FileRingBuffer() unlink (m_FileName.ascii()); } m_File = NULL; - m_FileName = QString::null; + m_FileName = TQString(); m_MaxSize = 0; m_RealSize = 0; m_FillSize = 0; m_Start = 0; m_error = false; - m_errorString = QString::null; + m_errorString = TQString(); } -bool FileRingBuffer::resize(const QString &filename, Q_UINT64 new_max_size) +bool FileRingBuffer::resize(const TQString &filename, TQ_UINT64 new_max_size) { if (filename != m_BaseFileName) { clear(); @@ -62,10 +62,10 @@ bool FileRingBuffer::resize(const QString &filename, Q_UINT64 new_max_size) unlink (m_FileName.ascii()); } m_BaseFileName = filename; - m_FileName = m_BaseFileName + "_" + QString::number(++m_FileIdx); + m_FileName = m_BaseFileName + "_" + TQString::number(++m_FileIdx); m_File = fopen(m_FileName.ascii(), "w+"); m_error = m_File == NULL; - m_errorString = m_File ? QString::null : i18n("cannot open buffer file %1").arg(filename); + m_errorString = m_File ? TQString() : i18n("cannot open buffer file %1").tqarg(filename); } if (new_max_size >= m_RealSize) { @@ -79,9 +79,9 @@ bool FileRingBuffer::resize(const QString &filename, Q_UINT64 new_max_size) const size_t buffer_size = 65536; char buffer[buffer_size]; - QString tmp_file_name = m_BaseFileName + "_" + QString::number(++m_FileIdx); + TQString tmp_file_name = m_BaseFileName + "_" + TQString::number(++m_FileIdx); FILE *tmp_file = fopen (tmp_file_name.ascii(), "w+"); - Q_UINT64 newFill = 0; + TQ_UINT64 newFill = 0; if (tmp_file) { while (!m_error && m_FillSize > 0) { int tmp_size = takeData(buffer, buffer_size); @@ -90,13 +90,13 @@ bool FileRingBuffer::resize(const QString &filename, Q_UINT64 new_max_size) newFill += tmp_size; } else { m_error = true; - m_errorString += i18n("FileRingbuffer::resize: Writing to tmpfile %1 failed. ").arg(tmp_file_name); + m_errorString += i18n("FileRingbuffer::resize: Writing to tmpfile %1 failed. ").tqarg(tmp_file_name); } } } } else { m_error = true; - m_errorString += i18n("FileRingbuffer::resize: Opening tmpfile %1 failed. ").arg(tmp_file_name); + m_errorString += i18n("FileRingbuffer::resize: Opening tmpfile %1 failed. ").tqarg(tmp_file_name); } if (!m_error) { @@ -118,13 +118,13 @@ size_t FileRingBuffer::addData (const char *src, size_t size) { size_t written = 0; if (m_Start + m_FillSize <= m_RealSize) { - Q_UINT64 rest = m_MaxSize - (m_Start + m_FillSize); + TQ_UINT64 rest = m_MaxSize - (m_Start + m_FillSize); if (rest > size) rest = size; fseek(m_File, m_Start + m_FillSize, SEEK_SET); if (rest > 0 && fwrite(src, rest, 1, m_File) <= 0) { m_error = true; - m_errorString += i18n("FileRingBuffer::addData: failed writing data to file %1.").arg(m_FileName); + m_errorString += i18n("FileRingBuffer::addData: failed writing data to file %1.").tqarg(m_FileName); } else { m_FillSize += rest; if (m_Start + m_FillSize > m_RealSize) @@ -142,7 +142,7 @@ size_t FileRingBuffer::addData (const char *src, size_t size) fseek(m_File, m_Start + m_FillSize - m_RealSize, SEEK_SET); if (fwrite(src, rest, 1, m_File) <= 0) { m_error = true; - m_errorString += i18n("FileRingBuffer::addData: failed writing data to file %1.").arg(m_FileName); + m_errorString += i18n("FileRingBuffer::addData: failed writing data to file %1.").tqarg(m_FileName); } else { m_FillSize += rest; written += rest; @@ -165,7 +165,7 @@ size_t FileRingBuffer::takeData(char *dst, size_t size) fseek(m_File, m_Start, SEEK_SET); if (fread(dst+read, n, 1, m_File) <= 0) { m_error = true; - m_errorString += i18n("FileRingBuffer::takeData: failed reading data to file %1.").arg(m_FileName); + m_errorString += i18n("FileRingBuffer::takeData: failed reading data to file %1.").tqarg(m_FileName); } else { m_FillSize -= n; m_Start += n; @@ -180,7 +180,7 @@ size_t FileRingBuffer::takeData(char *dst, size_t size) } -Q_UINT64 FileRingBuffer::getFreeSpace(Q_UINT64 &size) +TQ_UINT64 FileRingBuffer::getFreeSpace(TQ_UINT64 &size) { if (m_FillSize == m_RealSize) { size = 0; @@ -197,7 +197,7 @@ Q_UINT64 FileRingBuffer::getFreeSpace(Q_UINT64 &size) } -Q_UINT64 FileRingBuffer::removeFreeSpace(Q_UINT64 size) +TQ_UINT64 FileRingBuffer::removeFreeSpace(TQ_UINT64 size) { if (m_FillSize == m_RealSize) return 0; @@ -216,7 +216,7 @@ Q_UINT64 FileRingBuffer::removeFreeSpace(Q_UINT64 size) } -Q_UINT64 FileRingBuffer::getData(Q_UINT64 &size) +TQ_UINT64 FileRingBuffer::getData(TQ_UINT64 &size) { if (m_Start + m_FillSize >= m_RealSize) { size = m_RealSize - m_Start; @@ -227,7 +227,7 @@ Q_UINT64 FileRingBuffer::getData(Q_UINT64 &size) } -Q_UINT64 FileRingBuffer::removeData(Q_UINT64 size) +TQ_UINT64 FileRingBuffer::removeData(TQ_UINT64 size) { if (size > m_FillSize) size = m_FillSize; |