]> jfr.im git - irc/kvirc/KVIrc.git/commitdiff
support for dcc file size up to 4GB (before there was a limit of 2.4GB)
authorFabio Bas <redacted>
Thu, 2 Oct 2008 17:37:07 +0000 (17:37 +0000)
committerFabio Bas <redacted>
Thu, 2 Oct 2008 17:37:07 +0000 (17:37 +0000)
git-svn-id: https://svn.kvirc.de/svn/branches/kvirc/3.4@2619 17fca916-40b9-46aa-a4ea-0a15b648b75c

src/kvilib/core/kvi_qstring.cpp
src/modules/dcc/broker.cpp
src/modules/dcc/broker.h
src/modules/dcc/requests.cpp
src/modules/dcc/send.cpp
src/modules/dcc/send.h

index 63de320ea2e1a84fb20fb77112cb4e171a08832c..59431ab1dcd95355fcb1ca9462c73879740a6f81 100644 (file)
@@ -165,7 +165,7 @@ namespace KviQString
        {
                double size = bytes;
                if(size<900)
-                       return QString(__tr2qs("%1 bytes")).arg(size,0,'f',3);
+                       return QString(__tr2qs("%1 bytes")).arg(size,0,'f',0);
 
                size/=1024;
                if(size<900)
index 0212adac4b845989f085021287bc2dc092916eb8..99710495dfcea67e66f68486170c4f5579244b5f 100644 (file)
@@ -481,7 +481,7 @@ void KviDccBroker::recvFileManage(KviDccDescriptor * dcc)
        if(dcc->bIsIncomingAvatar)
        {
                bool bOk;
-               uint size = dcc->szFileSize.toUInt(&bOk);
+               unsigned long size = dcc->szFileSize.toULong(&bOk);
                if(bOk) {
                        if(size>=KVI_OPTION_UINT(KviOption_uintMaximumRequestedAvatarSize)) {
                                cancelDcc(0,dcc);
@@ -506,7 +506,7 @@ void KviDccBroker::recvFileManage(KviDccDescriptor * dcc)
                                                "The connection target will be host <b>%6</b> on port <b>%7</b><br>" \
                                        ,"dcc" \
                                ).arg(dcc->szNick).arg(dcc->szUser).arg(dcc->szHost).arg(
-                               dcc->szFileName).arg(KviQString::makeSizeReadable(dcc->szFileSize.toInt())).arg(
+                               dcc->szFileName).arg(KviQString::makeSizeReadable(dcc->szFileSize.toULong())).arg(
                                        dcc->szIp).arg(dcc->szPort);
 
                } else {
@@ -519,7 +519,7 @@ void KviDccBroker::recvFileManage(KviDccDescriptor * dcc)
                                                "You will be the passive side of the connection.<br>" \
                                        ,"dcc" \
                                ).arg(dcc->szNick).arg(dcc->szUser).arg(dcc->szHost).arg(
-                                       dcc->szFileName).arg(KviQString::makeSizeReadable(dcc->szFileSize.toInt()));
+                                       dcc->szFileName).arg(KviQString::makeSizeReadable(dcc->szFileSize.toULong()));
                }
 
                if(dcc->bIsIncomingAvatar)
@@ -641,13 +641,13 @@ void KviDccBroker::renameOverwriteResume(KviDccBox *box,KviDccDescriptor * dcc)
        if(box)box->forgetDescriptor();
 
        // Check if file exists
-       QFileInfo fi(dcc->szLocalFileName);
+       QFile fi(dcc->szLocalFileName);
        if(fi.exists() && (fi.size() > 0)) // 0 byte files are senseless for us
        {
                dcc->szLocalFileSize.setNum(fi.size());
                
                bool bOk;
-               int iRemoteSize = dcc->szFileSize.toInt(&bOk);
+               unsigned long iRemoteSize = dcc->szFileSize.toULong(&bOk);
                if(!bOk)iRemoteSize = -1;
 
                // FIXME: Files downloaded succesfully shouldn't be resumed
@@ -659,7 +659,7 @@ void KviDccBroker::renameOverwriteResume(KviDccBox *box,KviDccDescriptor * dcc)
                        bool bDisableResume = false;
                        
                        if((iRemoteSize > -1) || // remote size is unknown
-                               (iRemoteSize > ((int)(fi.size())))) // or it is larger than the actual size on disk
+                               (iRemoteSize > (fi.size()))) // or it is larger than the actual size on disk
                        {
                                tmp = __tr2qs_ctx( \
                                                        "The file '<b>%1</b>' already exists " \
@@ -697,7 +697,7 @@ void KviDccBroker::renameOverwriteResume(KviDccBox *box,KviDccDescriptor * dcc)
                        // auto resume ?
                        if(KVI_OPTION_BOOL(KviOption_boolAutoResumeDccSendWhenAutoAccepted) &&
                                (iRemoteSize > -1) && // only if the remote size is really known
-                               (iRemoteSize > ((int)(fi.size()))) && // only if the remote size is larger than the local size
+                               (iRemoteSize > (fi.size())) && // only if the remote size is larger than the local size
                                (!KviDccFileTransfer::nonFailedTransferWithLocalFileName(dcc->szLocalFileName.utf8().data()))) // only if there is no transfer with this local file name yet
                        {
                                // yep, auto resume...
@@ -827,7 +827,7 @@ void KviDccBroker::sendFileExecute(KviDccBox * box,KviDccDescriptor *dcc)
        dcc->szFileName = dcc->szLocalFileName;
        dcc->szFileName = QFileInfo(dcc->szFileName).fileName();
 
-       dcc->szLocalFileSize.setNum(fi.size());
+       dcc->szLocalFileSize.setNum(QFile(dcc->szLocalFileName).size());
 
        KviDccFileTransfer * send = new KviDccFileTransfer(dcc);
 
@@ -852,7 +852,7 @@ bool KviDccBroker::handleResumeAccepted(const char * filename,const char * port,
        return KviDccFileTransfer::handleResumeAccepted(filename,port,szZeroPortTag);
 }
 
-bool KviDccBroker::handleResumeRequest(KviDccRequest * dcc,const char * filename,const char * port,unsigned int filePos,const char * szZeroPortTag)
+bool KviDccBroker::handleResumeRequest(KviDccRequest * dcc,const char * filename,const char * port,unsigned long filePos,const char * szZeroPortTag)
 {
        //debug("HANDLE %s %s %u %s",filename,port,filePos,szZeroPortTag);
        // the zeroPOrtTag is nonempty here only if port == 0
index dd61cbd6fa8172ef32eaeb8a6a2ed7afe884404e..27ac13ad3c2d3e5f9ea15819b8a5f6d8c7534606 100644 (file)
@@ -94,7 +94,7 @@ public:
        void sendFileManage(KviDccDescriptor * dcc);
 
        bool handleResumeAccepted(const char * filename,const char * port,const char * szZeroPortTag);
-       bool handleResumeRequest(KviDccRequest * dcc,const char * filename,const char * port,unsigned int filePos,const char * szZeroPortTag);
+       bool handleResumeRequest(KviDccRequest * dcc,const char * filename,const char * port,unsigned long filePos,const char * szZeroPortTag);
 
 public slots:
        void rsendExecute(KviDccBox * box,KviDccDescriptor * dcc);
index db8fb3e72be9c70215facd0dd7bc893f3ae0c9aa..5310dfabbdc637a1a340c2f6fffa37f86902dca4 100644 (file)
@@ -545,7 +545,7 @@ static void dccModuleParseDccResume(KviDccRequest *dcc)
        //      DCC SEND <filename> <remoteip> <remoteport> <filesize> <tag>
 
        bool bOk;
-       unsigned int filePos = dcc->szParam3.toUInt(&bOk);
+       unsigned long filePos = dcc->szParam3.toULong(&bOk);
        if(!bOk)
        {
                if(!dcc->ctcpMsg->msg->haltOutput())
@@ -621,7 +621,7 @@ static void dccModuleParseDccRecv(KviDccRequest * dcc)
        if(o)
        {
 
-               unsigned int uResumeSize = dcc->szParam4.toUInt(); // this will NEVER fail
+               unsigned long uResumeSize = dcc->szParam4.toULong(); // this will NEVER fail
                if(uResumeSize >= o->fileSize())
                {
                        // senseless request
@@ -817,7 +817,7 @@ static void dccModuleParseDccGet(KviDccRequest *dcc)
        // ...
        dcc->szParam1=dcc->pConsole->decodeText(dcc->szParam1);
        bool bOk;
-       unsigned int uSize = dcc->szParam2.toUInt(&bOk);
+       unsigned long uSize = dcc->szParam2.toULong(&bOk);
        if(!bOk)uSize = 0;
 
        if(!dcc_module_check_limits(dcc))return;
index 292162798c2441ec42c46ebb11a161c36ae200c2..e620576a35a9045b37aa686d37e11998eebe13fd 100644 (file)
@@ -97,8 +97,8 @@ KviDccRecvThread::KviDccRecvThread(QObject * par,kvi_socket_t fd,KviDccRecvThrea
 : KviDccThread(par,fd)
 {
        m_pOpt                  = opt;
-       m_iAverageSpeed         = -1;
-       m_iInstantSpeed         = -1;
+       m_iAverageSpeed         = 0;
+       m_iInstantSpeed         = 0;
        m_iFilePosition         = 0;
 
        m_iTotalReceivedBytes   = 0;
@@ -116,9 +116,9 @@ KviDccRecvThread::~KviDccRecvThread()
        delete m_pTimeInterval;
 }
 
-bool KviDccRecvThread::sendAck(int filePos)
+bool KviDccRecvThread::sendAck(unsigned long filePos)
 {
-       int size = htonl(filePos);
+       unsigned long size = htonl(filePos);
        if(kvi_socket_send(m_fd,(void *)(&size),4) != 4)
        {
                postErrorEvent(KviError_acknowledgeError);
@@ -141,7 +141,7 @@ void KviDccRecvThread::updateStats()
 
        if(m_uInstantSpeedInterval > INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_MSECS)
        {
-               unsigned int uMSecsOfTheNextInterval = 0;
+               unsigned long uMSecsOfTheNextInterval = 0;
                if(m_uInstantSpeedInterval < (INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_MSECS + (INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_MSECS / 2)))
                        uMSecsOfTheNextInterval = m_uInstantSpeedInterval - INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_MSECS;
                m_iInstantSpeed = (m_iInstantReceivedBytes * 1000) / m_uInstantSpeedInterval;
@@ -243,14 +243,14 @@ void KviDccRecvThread::run()
                                char buffer[KVI_DCC_RECV_BLOCK_SIZE];
 
                                m_pMutex->lock(); // FIXME: how to remove this lock ?
-                               unsigned int uMaxPossible = (m_pOpt->uMaxBandwidth < MAX_DCC_BANDWIDTH_LIMIT) ? m_pOpt->uMaxBandwidth * INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_SECS : MAX_DCC_BANDWIDTH_LIMIT * INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_SECS;
+                               unsigned long uMaxPossible = (m_pOpt->uMaxBandwidth < MAX_DCC_BANDWIDTH_LIMIT) ? m_pOpt->uMaxBandwidth * INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_SECS : MAX_DCC_BANDWIDTH_LIMIT * INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_SECS;
                                m_pMutex->unlock();
-                               unsigned int uToRead = uMaxPossible > ((unsigned int)(m_iInstantReceivedBytes)) ? uMaxPossible - m_iInstantReceivedBytes : 0;
+                               unsigned long uToRead = uMaxPossible > m_iInstantReceivedBytes ? uMaxPossible - m_iInstantReceivedBytes : 0;
                                if(uToRead > KVI_DCC_RECV_BLOCK_SIZE)uToRead = KVI_DCC_RECV_BLOCK_SIZE;
 
                                if(uToRead > 0)
                                {
-                                       int readLen = kvi_socket_recv(m_fd,buffer,uToRead);
+                                       long readLen = kvi_socket_recv(m_fd,buffer,uToRead);
 
                                        if(readLen > 0)
                                        {
@@ -288,7 +288,7 @@ void KviDccRecvThread::run()
                                                        // Interrupt if the whole file has been received
                                                        if(m_pOpt->iTotalFileSize > 0)
                                                        {
-                                                               if(((int)(m_pFile->at())) == m_pOpt->iTotalFileSize)
+                                                               if(m_pFile->at() == m_pOpt->iTotalFileSize)
                                                                {
                                                                        // Received the whole file...die
                                                                        KviThreadEvent * e = new KviThreadEvent(KVI_DCC_THREAD_EVENT_SUCCESS);
@@ -323,7 +323,7 @@ void KviDccRecvThread::run()
                                                if(readLen == 0)
                                                {
                                                        // readed EOF..
-                                                       if((((int)(m_pFile->at())) == m_pOpt->iTotalFileSize) || (m_pOpt->iTotalFileSize < 0))
+                                                       if((m_pFile->at() == m_pOpt->iTotalFileSize) || (m_pOpt->iTotalFileSize < 0))
                                                        {
                                                                // success if we got the whole file or if we don't know the file size (we trust the peer)
                                                                KviThreadEvent * e = new KviThreadEvent(KVI_DCC_THREAD_EVENT_SUCCESS);
@@ -352,7 +352,7 @@ void KviDccRecvThread::run()
                                if(iFailedSelects > 3)
                                        msleep(3 * iFailedSelects);
 
-                               if(((int)(m_pFile->at())) == m_pOpt->iTotalFileSize)
+                               if(m_pFile->at() == m_pOpt->iTotalFileSize)
                                {
                                        // Wait for the peer to close the connection
                                        if(iProbableTerminationTime == 0)
@@ -486,7 +486,7 @@ void KviDccSendThread::run()
        int iFailedSelects        = 0;
        char ackbuffer[4];
        int iBytesInAckBuffer     = 0;
-       Q_UINT32 iLastAck         = 0;
+       unsigned long iLastAck    = 0;
 
        if(m_pOpt->iPacketSize < 32)m_pOpt->iPacketSize = 32;
        char * buffer = (char *)kvi_malloc(m_pOpt->iPacketSize * sizeof(char));
@@ -550,9 +550,11 @@ void KviDccSendThread::run()
                                                iBytesInAckBuffer += readLen;
                                                if(iBytesInAckBuffer == 4)
                                                {
-                                                       Q_UINT32 iNewAck = ntohl(*((Q_UINT32 *)ackbuffer));
+                                                       unsigned long iNewAck = ntohl(*((unsigned long *)ackbuffer));
                                                        if((iNewAck > pFile->at()) || (iNewAck < iLastAck))
                                                        {
+
+                                                               if(iLastAck > (2^32))
                                                                // the peer is drunk or is trying to fool us
                                                                postErrorEvent(KviError_acknowledgeError);
                                                                break;
@@ -612,10 +614,10 @@ void KviDccSendThread::run()
                                        if(m_pOpt->bFastSend || m_pOpt->bNoAcks || (iLastAck == pFile->at()))
                                        {
                                                // maximum readable size
-                                               int toRead = pFile->size() - pFile->at();
+                                               unsigned long toRead = pFile->size() - pFile->at();
                                                // the max number of bytes we can send in this interval (bandwidth limit)
                                                m_pMutex->lock(); // FIXME: how to remove this lock ?
-                                               int iMaxPossible = m_pOpt->uMaxBandwidth < MAX_DCC_BANDWIDTH_LIMIT ? m_pOpt->uMaxBandwidth * INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_SECS : MAX_DCC_BANDWIDTH_LIMIT * INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_SECS;
+                                               unsigned long iMaxPossible = m_pOpt->uMaxBandwidth < MAX_DCC_BANDWIDTH_LIMIT ? m_pOpt->uMaxBandwidth * INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_SECS : MAX_DCC_BANDWIDTH_LIMIT * INSTANT_BANDWIDTH_CHECK_INTERVAL_IN_SECS;
                                                m_pMutex->unlock();
                                                if(iMaxPossible < m_iInstantSentBytes)toRead = 0; // already sent too much!
                                                else {
@@ -625,11 +627,11 @@ void KviDccSendThread::run()
                                                // limit to packet size
                                                if(toRead > m_pOpt->iPacketSize)toRead = m_pOpt->iPacketSize;
 
-                                               int written = 0;
+                                               unsigned long written = 0;
                                                if(toRead > 0)
                                                {
                                                        // read data
-                                                       int readed = pFile->readBlock(buffer,toRead);
+                                                       unsigned long readed = pFile->readBlock(buffer,toRead);
                                                        if(readed < toRead)
                                                        {
                                                                postErrorEvent(KviError_fileIOError);
@@ -756,7 +758,7 @@ KviDccFileTransfer::KviDccFileTransfer(KviDccDescriptor * dcc)
        m_eGeneralStatus = Connecting;
 
        bool bOk;
-       m_uTotalFileSize = dcc->bRecvFile ? dcc->szFileSize.toUInt(&bOk) :  dcc->szLocalFileSize.toUInt(&bOk);
+       m_uTotalFileSize = dcc->bRecvFile ? dcc->szFileSize.toULong(&bOk) :  dcc->szLocalFileSize.toULong(&bOk);
        if(!bOk)m_uTotalFileSize = 0;
 
        if(m_pDescriptor->bRecvFile)
@@ -1010,34 +1012,34 @@ bool KviDccFileTransfer::active()
        return ((m_eGeneralStatus == Connecting) || (m_eGeneralStatus == Transferring));
 }
 
-int KviDccFileTransfer::bandwidthLimit()
+unsigned long KviDccFileTransfer::bandwidthLimit()
 {
-       int iLimit = m_uMaxBandwidth; // we have the cached value anyway...
+       unsigned long iLimit = m_uMaxBandwidth; // we have the cached value anyway...
        if(m_pDescriptor->bRecvFile)
        {
                if(m_pSlaveRecvThread)
                {
                        m_pSlaveRecvThread->initGetInfo();
-                       iLimit = (int)m_pSlaveRecvThread->bandwidthLimit();
+                       iLimit = m_pSlaveRecvThread->bandwidthLimit();
                        m_pSlaveRecvThread->doneGetInfo();
-                       if(iLimit < 0)iLimit = MAX_DCC_BANDWIDTH_LIMIT;
+                       if(iLimit == 0)iLimit = MAX_DCC_BANDWIDTH_LIMIT;
                }
        } else {
                if(m_pSlaveSendThread)
                {
                        m_pSlaveSendThread->initGetInfo();
-                       iLimit = (int)m_pSlaveSendThread->bandwidthLimit();
+                       iLimit = m_pSlaveSendThread->bandwidthLimit();
                        m_pSlaveSendThread->doneGetInfo();
-                       if(iLimit < 0)iLimit = MAX_DCC_BANDWIDTH_LIMIT;
+                       if(iLimit == 0)iLimit = MAX_DCC_BANDWIDTH_LIMIT;
                }
        }
        return iLimit;
 }
 
-void KviDccFileTransfer::setBandwidthLimit(int iVal)
+void KviDccFileTransfer::setBandwidthLimit(unsigned long iVal)
 {
-       if(iVal < 0)iVal = MAX_DCC_BANDWIDTH_LIMIT;
-       if(iVal > MAX_DCC_BANDWIDTH_LIMIT)iVal = MAX_DCC_BANDWIDTH_LIMIT;
+       if(iVal == 0 || iVal > MAX_DCC_BANDWIDTH_LIMIT)
+               iVal = MAX_DCC_BANDWIDTH_LIMIT;
        m_uMaxBandwidth = iVal;
        if(m_pDescriptor->bRecvFile)
        {
@@ -1057,31 +1059,31 @@ void KviDccFileTransfer::setBandwidthLimit(int iVal)
        }
 }
 
-unsigned int KviDccFileTransfer::averageSpeed()
+unsigned long KviDccFileTransfer::averageSpeed()
 {
-       unsigned int iAvgBandwidth = 0;
+       unsigned long iAvgBandwidth = 0;
        if(m_pDescriptor->bRecvFile)
        {
                if(m_pSlaveRecvThread)
                {
                        m_pSlaveRecvThread->initGetInfo();
-                       iAvgBandwidth = (unsigned int)m_pSlaveRecvThread->averageSpeed();
+                       iAvgBandwidth = m_pSlaveRecvThread->averageSpeed();
                        m_pSlaveRecvThread->doneGetInfo();
                }
        } else {
                if(m_pSlaveSendThread)
                {
                        m_pSlaveSendThread->initGetInfo();
-                       iAvgBandwidth = (unsigned int)m_pSlaveSendThread->averageSpeed();
+                       iAvgBandwidth = m_pSlaveSendThread->averageSpeed();
                        m_pSlaveSendThread->doneGetInfo();
                }
        }
        return iAvgBandwidth;
 }
 
-unsigned int KviDccFileTransfer::transferredBytes()
+unsigned long KviDccFileTransfer::transferredBytes()
 {
-       unsigned int uTransferred = 0;
+       unsigned long uTransferred = 0;
        if(m_pDescriptor->bRecvFile)
        {
                if(m_pSlaveRecvThread)
@@ -1178,13 +1180,13 @@ void KviDccFileTransfer::displayPaint(QPainter * p,int column,int width,int heig
                        QFontMetrics fm(p->font());
 
                        int iW = width - 8;
-                       int iAvgBandwidth = -1;
-                       int iInstantSpeed = -1;
-                       int iAckedBytes = -1;
+                       unsigned long iAvgBandwidth = 0;
+                       unsigned long iInstantSpeed = 0;
+                       unsigned long iAckedBytes = 0;
 
                        int iEta = -1;
 
-                       unsigned int uTransferred = 0;
+                       unsigned long uTransferred = 0;
 
                        if(m_pDescriptor->bRecvFile)
                        {
@@ -1217,7 +1219,7 @@ void KviDccFileTransfer::displayPaint(QPainter * p,int column,int width,int heig
                        {
                                if(iAvgBandwidth > 0)
                                {
-                                       unsigned int uRemaining = m_uTotalFileSize - uTransferred;
+                                       unsigned long uRemaining = m_uTotalFileSize - uTransferred;
                                        iEta = uRemaining / iAvgBandwidth;
                                }
 
@@ -1424,7 +1426,7 @@ bool KviDccFileTransfer::handleResumeAccepted(const char * filename,const char *
        return false;
 }
 
-bool KviDccFileTransfer::handleResumeRequest(const char * filename,const char * port,unsigned int filePos)
+bool KviDccFileTransfer::handleResumeRequest(const char * filename,const char * port,unsigned long filePos)
 {
        if(!g_pDccFileTransfers)return false;
 
@@ -1701,8 +1703,8 @@ void KviDccFileTransfer::connected()
                KviDccRecvThreadOptions * o = new KviDccRecvThreadOptions;
                o->szFileName      = m_pDescriptor->szLocalFileName.utf8().data();
                bool bOk;
-               o->iTotalFileSize  = m_pDescriptor->szFileSize.toInt(&bOk);
-               if(!bOk)o->iTotalFileSize = -1;
+               o->iTotalFileSize  = m_pDescriptor->szFileSize.toULong(&bOk);
+               if(!bOk)o->iTotalFileSize = 0;
                o->bResume         = m_pDescriptor->bResume;
                o->iIdleStepLengthInMSec = KVI_OPTION_BOOL(KviOption_boolDccSendForceIdleStep) ? KVI_OPTION_UINT(KviOption_uintDccSendIdleStepInMSec) : 0;
                o->bIsTdcc         = m_pDescriptor->bIsTdcc;
@@ -1718,8 +1720,9 @@ void KviDccFileTransfer::connected()
                o->iIdleStepLengthInMSec = KVI_OPTION_BOOL(KviOption_boolDccSendForceIdleStep) ? KVI_OPTION_UINT(KviOption_uintDccSendIdleStepInMSec) : 0;
                bool bOk;
                o->bIsTdcc         = m_pDescriptor->bIsTdcc;
-               o->iStartPosition  = m_pDescriptor->szFileSize.toInt(&bOk);
-               if(!bOk || (o->iStartPosition < 0))o->iStartPosition = 0;
+               o->iStartPosition  = m_pDescriptor->szFileSize.toULong(&bOk);
+               if(!bOk)
+                       o->iStartPosition = 0;
                o->iPacketSize     = KVI_OPTION_UINT(KviOption_uintDccSendPacketSize);
                if(o->iPacketSize < 32)o->iPacketSize = 32;
                o->uMaxBandwidth   = m_uMaxBandwidth;
@@ -1774,7 +1777,7 @@ bool KviDccFileTransfer::resumeAccepted(const char *filename,const char *port,co
        return true;
 }
 
-bool KviDccFileTransfer::doResume(const char * filename,const char * port,unsigned int filePos)
+bool KviDccFileTransfer::doResume(const char * filename,const char * port,unsigned long filePos)
 {
        if(KviQString::equalCI(port,m_pMarshal->dccPort()) &&
                (!m_pSlaveRecvThread) && (!m_pDescriptor->bRecvFile))
@@ -1782,7 +1785,7 @@ bool KviDccFileTransfer::doResume(const char * filename,const char * port,unsign
                if(KviQString::equalCI(filename,m_pDescriptor->szFileName) || KVI_OPTION_BOOL(KviOption_boolAcceptBrokenFileNameDccResumeRequests))
                {
                        bool bOk;
-                       unsigned int iLocalFileSize = m_pDescriptor->szLocalFileSize.toUInt(&bOk);
+                       unsigned long iLocalFileSize = m_pDescriptor->szLocalFileSize.toULong(&bOk);
                        if(!bOk)
                        {
                                // ops...internal error
index c083ce4af1c33c4afe47e91b14500aae38802b14..538379db2970f5e6660c691b7008abc74bf0cd26 100644 (file)
 
 typedef struct _KviDccSendThreadOptions
 {
-       KviStr       szFileName;
-       int          iStartPosition;
-       int          iPacketSize;
-       int          iIdleStepLengthInMSec;
-       bool         bFastSend;
-       bool         bNoAcks;
-       bool         bIsTdcc;
-       unsigned int uMaxBandwidth;
+       KviStr        szFileName;
+       unsigned long iStartPosition;
+       unsigned int  iPacketSize;
+       unsigned int  iIdleStepLengthInMSec;
+       bool          bFastSend;
+       bool          bNoAcks;
+       bool          bIsTdcc;
+       unsigned long uMaxBandwidth;
 } KviDccSendThreadOptions;
 
 
@@ -66,27 +66,27 @@ public:
        ~KviDccSendThread();
 private:
        // stats: SHARED!!!
-       int            m_iAverageSpeed;
-       int            m_iInstantSpeed;
-       int            m_iFilePosition;
-       int            m_iAckedBytes;
-       int            m_iTotalSentBytes;
+       unsigned long  m_iAverageSpeed;
+       unsigned long  m_iInstantSpeed;
+       unsigned long  m_iFilePosition;
+       unsigned long  m_iAckedBytes;
+       unsigned long  m_iTotalSentBytes;
        // internal
        unsigned long  m_uStartTime;
        unsigned long  m_uInstantSpeedInterval;
-       int            m_iInstantSentBytes;
+       unsigned long  m_iInstantSentBytes;
        KviDccSendThreadOptions * m_pOpt;
        KviMSecTimeInterval * m_pTimeInterval;             // used for computing the instant bandwidth but not only
 public:
        void initGetInfo();
-       int averageSpeed(){ return m_iAverageSpeed; };
-       int instantSpeed(){ return m_iInstantSpeed; };
-       int filePosition(){ return m_iFilePosition; };
+       unsigned long averageSpeed(){ return m_iAverageSpeed; };
+       unsigned long instantSpeed(){ return m_iInstantSpeed; };
+       unsigned long filePosition(){ return m_iFilePosition; };
        // sent ONLY in this session
-       int sentBytes(){ return m_iTotalSentBytes; };
-       int ackedBytes(){ return m_iAckedBytes; };
-       unsigned int bandwidthLimit(){ return m_pOpt->uMaxBandwidth; };
-       void setBandwidthLimit(unsigned int uMaxBandwidth){ m_pOpt->uMaxBandwidth = uMaxBandwidth; };
+       unsigned long sentBytes(){ return m_iTotalSentBytes; };
+       unsigned long ackedBytes(){ return m_iAckedBytes; };
+       unsigned long bandwidthLimit(){ return m_pOpt->uMaxBandwidth; };
+       void setBandwidthLimit(unsigned long uMaxBandwidth){ m_pOpt->uMaxBandwidth = uMaxBandwidth; };
        void doneGetInfo();
 protected:
        void updateStats();
@@ -95,14 +95,14 @@ protected:
 
 typedef struct _KviDccRecvThreadOptions
 {
-       bool         bResume;
-       KviStr       szFileName;
-       int          iTotalFileSize;
-       int          iIdleStepLengthInMSec;
-       bool         bSendZeroAck;
-       bool         bNoAcks;
-       bool         bIsTdcc;
-       unsigned int uMaxBandwidth;
+       bool          bResume;
+       KviStr        szFileName;
+       unsigned long iTotalFileSize;
+       unsigned int  iIdleStepLengthInMSec;
+       bool          bSendZeroAck;
+       bool          bNoAcks;
+       bool          bIsTdcc;
+       unsigned long uMaxBandwidth;
 } KviDccRecvThreadOptions;
 
 class KviDccRecvThread : public KviDccThread
@@ -114,31 +114,31 @@ protected:
        KviDccRecvThreadOptions * m_pOpt;
 
        // stats: SHARED!
-       int                   m_iAverageSpeed;
-       int                   m_iInstantSpeed;
-       int                   m_iFilePosition;
-       int                   m_iTotalReceivedBytes;
+       unsigned long m_iAverageSpeed;
+       unsigned long m_iInstantSpeed;
+       unsigned long m_iFilePosition;
+       unsigned long m_iTotalReceivedBytes;
 
        // internal
        unsigned long         m_uStartTime;
        KviMSecTimeInterval * m_pTimeInterval;             // used for computing the instant bandwidth
-       int                   m_iInstantReceivedBytes;
+       unsigned long         m_iInstantReceivedBytes;
        unsigned long         m_uInstantSpeedInterval;
        QFile               * m_pFile;
 public:
        void initGetInfo();
-       int averageSpeed(){ return m_iAverageSpeed; };
-       int instantSpeed(){ return m_iInstantSpeed; };
-       int filePosition(){ return m_iFilePosition; };
+       unsigned long averageSpeed(){ return m_iAverageSpeed; };
+       unsigned long instantSpeed(){ return m_iInstantSpeed; };
+       unsigned long filePosition(){ return m_iFilePosition; };
        // received ONLY in this session
-       int receivedBytes(){ return m_iTotalReceivedBytes; };
-       unsigned int bandwidthLimit(){ return m_pOpt->uMaxBandwidth; };
+       unsigned long receivedBytes(){ return m_iTotalReceivedBytes; };
+       unsigned long bandwidthLimit(){ return m_pOpt->uMaxBandwidth; };
        void setBandwidthLimit(unsigned int uMaxBandwidth){ m_pOpt->uMaxBandwidth = uMaxBandwidth; };
        void doneGetInfo();
 protected:
        void postMessageEvent(const char * msg);
        void updateStats();
-       bool sendAck(int filePos);
+       bool sendAck(unsigned long filePos);
        virtual void run();
 };
 
@@ -195,15 +195,15 @@ private:
        kvi_time_t               m_tTransferStartTime;
        kvi_time_t               m_tTransferEndTime;
        // cached stats
-       unsigned int             m_uTotalFileSize; // total file size to transfer
+       unsigned long            m_uTotalFileSize; // total file size to transfer
        
-       unsigned int             m_uMaxBandwidth;
+       unsigned long            m_uMaxBandwidth;
        KviDccFileTransferBandwidthDialog * m_pBandwidthDialog;
        
        QTimer                 * m_pResumeTimer; // used to signal resume timeout
 public:
        bool resumeAccepted(const char * filename,const char * port,const char *szZeroPortTag);
-       bool doResume(const char * filename,const char * port,unsigned int filePos);
+       bool doResume(const char * filename,const char * port,unsigned long filePos);
 
        static void init();
        static void done();
@@ -211,7 +211,7 @@ public:
        static KviDccFileTransfer * nonFailedTransferWithLocalFileName(const QString &szLocalFileName);
        static unsigned int transferCount();
        static bool handleResumeAccepted(const char * filename,const char * port,const char * szZeroPortTag);
-       static bool handleResumeRequest(const char * filename,const char * port,unsigned int filePos);
+       static bool handleResumeRequest(const char * filename,const char * port,unsigned long filePos);
 
        virtual bool event(QEvent *e);
 
@@ -229,11 +229,11 @@ public:
        
        bool isFileUpload(){ return m_pDescriptor->isFileUpload(); };
 
-       unsigned int averageSpeed();
-       unsigned int transferredBytes();
+       unsigned long averageSpeed();
+       unsigned long transferredBytes();
        
-       int bandwidthLimit();
-       void setBandwidthLimit(int iVal);
+       unsigned long bandwidthLimit();
+       void setBandwidthLimit(unsigned long iVal);
 protected:
        void startConnection();
        void listenOrConnect();