Ticket #216: UNCOMMITTED-warnings-fixes.patch
| File UNCOMMITTED-warnings-fixes.patch, 57.4 kB (added by valerio, 5 months ago) |
|---|
-
src/notification/newemailnotification.cpp
43 43 44 44 45 45 // Notify the user about this event (a new email has arrived) 46 void NewEmailNotification::notify( QString sender, QString subject, bool inInbox, QString command, QString folder, QString url)46 void NewEmailNotification::notify( QString sender, QString subject, bool inInbox, QString folder ) 47 47 { 48 48 currentAccount_ = CurrentAccount::instance(); 49 49 -
src/notification/newemailnotification.h
49 49 50 50 public slots: 51 51 // Notify the user about this event (a new email has arrived) 52 void notify( QString sender, QString subject, bool inInbox, QString command, QString folder, QString url);52 void notify( QString sender, QString subject, bool inInbox, QString folder ); 53 53 54 54 private slots: 55 55 // Trigger this event's action (Open the mailbox where the new mail is) -
src/network/upnp/igdcontrolpoint.cpp
37 37 38 38 39 39 // The constructor 40 IgdControlPoint::IgdControlPoint(const QString &hostname, intport, const QString &rootUrl)40 IgdControlPoint::IgdControlPoint(const QString &hostname, quint16 port, const QString &rootUrl) 41 41 : QObject() 42 42 , forwardingService_(0) 43 43 , gatewayAvailable_(false) -
src/network/upnp/ssdpconnection.h
52 52 virtual ~SsdpConnection(); 53 53 54 54 // Send a broadcast to detect all devices 55 void queryDevices( int bindPort = 1500);55 void queryDevices( quint16 bindPort = 1500 ); 56 56 57 57 private slots: 58 58 // Data was received by the socket -
src/network/upnp/manager.h
64 64 // The broadcast failed 65 65 void slotBroadcastTimeout(); 66 66 // A device was discovered by the SSDP broadcast 67 void slotDeviceFound(const QString &hostname, intport, const QString &rootUrl);67 void slotDeviceFound(const QString &hostname, quint16 port, const QString &rootUrl); 68 68 69 69 70 70 private: // private methods -
src/network/upnp/service.cpp
42 42 43 43 44 44 // The constructor for information services 45 Service::Service(const QString &hostname, intport, const QString &informationUrl)45 Service::Service(const QString &hostname, quint16 port, const QString &informationUrl) 46 46 : informationUrl_(informationUrl) 47 47 , pendingRequests_(0) 48 48 { -
src/network/upnp/igdcontrolpoint.h
47 47 public: // public methods 48 48 49 49 // The constructor 50 IgdControlPoint(const QString &hostname, intport, const QString &rootUrl);50 IgdControlPoint(const QString &hostname, quint16 port, const QString &rootUrl); 51 51 // The destructor 52 52 virtual ~IgdControlPoint(); 53 53 … … 74 74 // The host of the gateway 75 75 QString igdHostname_; 76 76 // The port of the gateway 77 intigdPort_;77 quint16 igdPort_; 78 78 // The root service 79 79 RootService *rootService_; 80 80 // The wan connection service -
src/network/upnp/rootservice.cpp
126 126 127 127 128 128 // The contructor 129 RootService::RootService(const QString &hostname, intport,129 RootService::RootService(const QString &hostname, quint16 port, 130 130 const QString &rootUrl) 131 131 : Service(hostname, port, rootUrl) 132 132 , hostname_(hostname) -
src/network/upnp/service.h
36 36 struct ServiceParameters 37 37 { 38 38 QString hostname; 39 intport;39 quint16 port; 40 40 QString scdpUrl; 41 41 QString controlUrl; 42 42 QString serviceId; … … 60 60 61 61 public: // public methods 62 62 // The constructor for the root service 63 Service(const QString &hostname, intport,63 Service(const QString &hostname, quint16 port, 64 64 const QString &informationUrl); 65 65 // The constructor for action services 66 66 Service(const ServiceParameters ¶ms); -
src/network/upnp/rootservice.h
38 38 public: // public methods 39 39 40 40 // The constructor 41 RootService(const QString &hostname, intport, const QString &rootUrl);41 RootService(const QString &hostname, quint16 port, const QString &rootUrl); 42 42 // The destructor 43 43 virtual ~RootService(); 44 44 … … 76 76 // The hostname of the device 77 77 QString hostname_; 78 78 // The port of the device 79 intport_;79 quint16 port_; 80 80 // The udn of the root device 81 81 QString rootUdn_; 82 82 }; -
src/network/upnp/ssdpconnection.cpp
82 82 while( socket_->hasPendingDatagrams() ) 83 83 { 84 84 datagram.clear(); 85 datagram.resize( socket_->pendingDatagramSize() );85 datagram.resize( (int)socket_->pendingDatagramSize() ); 86 86 87 87 // Get the HTTP-like content 88 88 socket_->readDatagram( datagram.data(), datagram.size() ); … … 106 106 107 107 108 108 // Send a broadcast to detect all devices 109 void SsdpConnection::queryDevices( int bindPort)109 void SsdpConnection::queryDevices( quint16 bindPort ) 110 110 { 111 111 #ifdef KMESSDEBUG_UPNP_GENERAL 112 112 kDebug() << "Sending broadcast packet."; … … 134 134 } 135 135 136 136 // Send the data 137 intbytesWritten = socket_->writeDatagram( data.toAscii(), address, 1900 );137 qint64 bytesWritten = socket_->writeDatagram( data.toAscii(), address, 1900 ); 138 138 139 139 if(bytesWritten == -1) 140 140 { -
src/network/upnp/manager.cpp
137 137 138 138 139 139 // A device was discovered by the SSDP broadcast 140 void Manager::slotDeviceFound(const QString &hostname, intport, const QString &rootUrl)140 void Manager::slotDeviceFound(const QString &hostname, quint16 port, const QString &rootUrl) 141 141 { 142 142 #ifdef KMESSDEBUG_UPNP_GENERAL 143 143 kDebug() << "Device found, initializing IgdControlPoint to query it."; -
src/network/extra/directconnectionpool.cpp
66 66 * Add a connection to the list, tells the object to connect to the given ipaddress/port. 67 67 * Returns true when the connection could be added to the pending list (e.g. it's openConnection() method didn't fail). 68 68 */ 69 bool DirectConnectionPool::addConnection(DirectConnectionBase *connection, const QString &ipAddress, const intport)69 bool DirectConnectionPool::addConnection(DirectConnectionBase *connection, const QString &ipAddress, const quint16 port) 70 70 { 71 71 // Refuse if there is already an active connection 72 72 if( activeConnection_ != 0 ) -
src/network/extra/directconnectionbase.cpp
32 32 #endif 33 33 34 34 35 int DirectConnectionBase::nextServerPort_(-1);35 quint16 DirectConnectionBase::nextServerPort_( 0 ); 36 36 37 37 38 38 … … 53 53 54 54 // Read the interval of ports which we'll use to try establishing a connection 55 55 KConfigGroup group = KMessConfig::instance()->getGlobalConfig( "General" ); 56 lowestServerPortLimit_ = group.readEntry( "lowestTransferPort", 6891 );57 highestServerPortLimit_ = group.readEntry( "highestServerPort",6900 );56 lowestServerPortLimit_ = (quint16)group.readEntry( "lowestTransferPort", 6891 ); 57 highestServerPortLimit_ = (quint16)group.readEntry( "highestServerPort", 6900 ); 58 58 #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL 59 59 kDebug() << "Using port interval" << lowestServerPortLimit_ << "-" << highestServerPortLimit_; 60 60 #endif … … 220 220 221 221 222 222 // Return the number of bytes which are already received in the local buffer 223 intDirectConnectionBase::getAvailableBytes() const223 qint64 DirectConnectionBase::getAvailableBytes() const 224 224 { 225 225 if(KMESS_NULL(socket_)) return -2; // same as KExtendedSocket API, means "invalid state" 226 226 return socket_->bytesAvailable(); … … 229 229 230 230 231 231 // Get the server port that will be used 232 intDirectConnectionBase::getLocalServerPort()232 quint16 DirectConnectionBase::getLocalServerPort() 233 233 { 234 234 // Port not chosen yet 235 if( serverPort_ <0 )235 if( serverPort_ == 0 ) 236 236 { 237 237 // It's possible to use a random port nowadays, 238 238 // old clients with the "only port 6891" are no longer in use. … … 242 242 // 243 243 // TODO: verify whether we can use the port by calling openServerPort() earlier. 244 244 245 if( nextServerPort_ <0 || nextServerPort_ > highestServerPortLimit_ )245 if( nextServerPort_ == 0 || nextServerPort_ > highestServerPortLimit_ ) 246 246 { 247 247 nextServerPort_ = lowestServerPortLimit_; 248 248 } … … 275 275 276 276 277 277 // Get the remote port the socket is connected with. 278 intDirectConnectionBase::getRemotePort() const278 quint16 DirectConnectionBase::getRemotePort() const 279 279 { 280 280 if(socket_ == 0) 281 281 { … … 283 283 } 284 284 else 285 285 { 286 #warning localPort() returns quint16 in native byte order.287 286 return socket_->localPort(); 288 287 } 289 288 } … … 376 375 377 376 378 377 // Connect to a host 379 bool DirectConnectionBase::openConnection( const QString &ipAddress, const int port)378 bool DirectConnectionBase::openConnection( const QString &ipAddress, const quint16 port ) 380 379 { 381 380 #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL 382 381 kDebug() << "Connecting to " << ipAddress << " port " << port << "."; … … 428 427 KMESS_ASSERT( server_ == 0 ); 429 428 #endif 430 429 431 intport;430 quint16 port; 432 431 433 432 // Get the port 434 433 port = getLocalServerPort(); … … 467 466 468 467 469 468 // Verify how many bytes the read buffer has. Note this actually reads the data to test it. 470 int DirectConnectionBase::peekBlock( const intsize )469 qint64 DirectConnectionBase::peekBlock( const qint64 size ) 471 470 { 472 471 // Avoid crashes 473 472 if(KMESS_NULL(socket_)) return -1; … … 475 474 // Read the data and see how much got read. 476 475 // This is the only reliable method, but expensive in terms of performance. 477 476 QByteArray buffer; 478 buffer.resize( size );477 buffer.resize( (int)size ); 479 478 #ifdef KMESSTEST 480 479 KMESS_ASSERT( size > 0 ); 481 480 KMESS_ASSERT( buffer.size() == size ); … … 486 485 487 486 488 487 // Read data from the socket 489 int DirectConnectionBase::readBlock( char *buffer, intsize )488 qint64 DirectConnectionBase::readBlock( char *buffer, qint64 size ) 490 489 { 491 490 // Avoid crashes 492 491 if(KMESS_NULL(socket_)) return -1; … … 518 517 519 518 520 519 // Read data from the socket (uses the QByteArray size() as block size) 521 int DirectConnectionBase::readBlock( QByteArray &buffer, const int maxSize, const intbufferOffset )520 qint64 DirectConnectionBase::readBlock( QByteArray &buffer, const qint64 maxSize, const qint64 bufferOffset ) 522 521 { 523 522 // Avoid crashes 524 523 if(KMESS_NULL(socket_)) return -1; … … 531 530 } 532 531 533 532 // Determine the maximum number of bytes we can write to the buffer 534 intbufferSpace = buffer.size() - bufferOffset;533 qint64 bufferSpace = buffer.size() - bufferOffset; 535 534 536 535 // API usage check. 537 536 // Warn if certain sizes get a unusual value … … 554 553 // Fill the buffer from the give offset, 555 554 // size argument is limited to what the buffer can/may sustain. 556 555 char *bufferStart = buffer.data() + bufferOffset; 557 intsize = qMin( bufferSpace, maxSize );556 qint64 size = qMin( bufferSpace, maxSize ); 558 557 return readBlock( bufferStart, size ); 559 558 } 560 559 … … 891 890 * @param size Size of the block to read. 892 891 * @returns Whether the has been a write error. 893 892 */ 894 bool DirectConnectionBase::writeBlock( const char *block, const intsize )893 bool DirectConnectionBase::writeBlock( const char *block, const qint64 size ) 895 894 { 896 895 lastWriteFailed_ = true; 897 896 if(KMESS_NULL(socket_)) return false; … … 927 926 #endif 928 927 } 929 928 930 additionalWriteBuffer_.append( QByteArray::fromRawData( block, size ) );929 additionalWriteBuffer_.append( QByteArray::fromRawData( block, (int)size ) ); 931 930 932 931 // Protect against consuming all system memory 933 932 // 50 kB is more then enough if you're writing messages of 1300 bytes! … … 952 951 // Log in network window. 953 952 // Use actual size of written block. 954 953 #ifdef KMESS_NETWORK_WINDOW 955 QByteArray wrapper = QByteArray::fromRawData( block, noBytesWritten );954 QByteArray wrapper = QByteArray::fromRawData( block, (int)noBytesWritten ); 956 955 KMESS_NET_SENT(this, wrapper); 957 956 #endif 958 957 … … 963 962 kWarning() << "only " << noBytesWritten 964 963 << " of " << size << " bytes could be written!"; 965 964 966 additionalWriteBuffer_.append( QByteArray::fromRawData( block + noBytesWritten, size - noBytesWritten) );965 additionalWriteBuffer_.append( QByteArray::fromRawData( block + noBytesWritten, (int)(size - noBytesWritten) ) ); 967 966 } 968 967 else 969 968 { -
src/network/extra/msnftpconnection.cpp
250 250 unsigned char code; 251 251 unsigned char byte1; 252 252 unsigned char byte2; 253 intblockSize;254 intnoBytesRead;253 qint64 blockSize; 254 qint64 noBytesRead; 255 255 256 256 257 257 // Make sure we read all available bytes from the socket before returning … … 318 318 noBytesRead = readBlock( rawBlock, blockSize ); 319 319 320 320 #ifdef KMESS_NETWORK_WINDOW 321 QByteArray wrapper = QByteArray::fromRawData( rawBlock, noBytesRead );321 QByteArray wrapper = QByteArray::fromRawData( rawBlock, (int)noBytesRead ); 322 322 KMESS_NET_RECEIVED( this, wrapper ); 323 323 #endif 324 324 … … 419 419 420 420 421 421 // Retrieve a file 422 bool MsnFtpConnection::retrieveFile(QFile *outputFile, const QString &ipAddress, const intport)422 bool MsnFtpConnection::retrieveFile(QFile *outputFile, const QString &ipAddress, const quint16 port) 423 423 { 424 424 #ifdef KMESSTEST 425 425 KMESS_ASSERT( authHandle_.length() > 0 ); … … 491 491 // to parseCommand() or parseReceivedFileData() 492 492 493 493 char rawBlock[255]; 494 intblockSize;495 intnoBytesRead;494 qint64 blockSize; 495 qint64 noBytesRead; 496 496 QString commandLine; 497 497 QStringList command; 498 498 … … 524 524 } 525 525 526 526 // Convert data block to UTF8 string 527 commandLine = QString::fromUtf8( rawBlock, noBytesRead );527 commandLine = QString::fromUtf8( rawBlock, (int)noBytesRead ); 528 528 529 529 #ifdef KMESS_NETWORK_WINDOW 530 530 KMESS_NET_RECEIVED( this, commandLine.toUtf8() ); … … 695 695 KMESS_ASSERT( inputStream_ != 0 ); 696 696 #endif 697 697 698 intnoBytesRead;699 char rawBlock[2048];698 qint64 noBytesRead; 699 char rawBlock[2048]; 700 700 701 701 // Read a block from the file. 702 702 noBytesRead = inputStream_->read( rawBlock + 3, sizeof(rawBlock) - 3 ); … … 723 723 724 724 // Set the header 725 725 rawBlock[0] = 0; 726 rawBlock[1] = ( noBytesRead & 0x00ff);727 rawBlock[2] = ( noBytesRead & 0xff00) >> 8;726 rawBlock[1] = (char) ( noBytesRead & 0x00ff ); 727 rawBlock[2] = (char)( ( noBytesRead & 0xff00 ) >> 8 ); 728 728 729 729 // Update the progress 730 730 fileBytesRemaining_ -= noBytesRead; -
src/network/extra/msndirectconnection.cpp
145 145 // start with a new data block 146 146 if( remainingBlockBytes_ <= 0 ) 147 147 { 148 intnoBytesPeeked = peekBlock(4);148 qint64 noBytesPeeked = peekBlock(4); 149 149 if( preambleOffset_ == 0 ) 150 150 { 151 151 // First see if there are enough bytes. … … 163 163 } 164 164 165 165 // First 4 bytes indicate the message/block length. 166 intnoBytesRead = readBlock( preambleBuffer_, 4 - preambleOffset_, preambleOffset_ );166 qint64 noBytesRead = readBlock( preambleBuffer_, 4 - preambleOffset_, preambleOffset_ ); 167 167 if( noBytesRead == 0 ) 168 168 { 169 169 #ifdef KMESSDEBUG_DIRECTCONNECTION_GENERAL … … 239 239 } 240 240 241 241 // Allocate the buffer. 242 buffer_.resize( remainingBlockBytes_);242 buffer_.resize( (int)remainingBlockBytes_ ); 243 243 buffer_.fill('\0'); 244 244 bufferOffset_ = 0; 245 245 … … 258 258 259 259 // Fill the next part of the buffer with the bytes received. 260 260 // Read as many bytes as possible, test for errors. 261 intnoBytesRead = readBlock( buffer_, remainingBlockBytes_, bufferOffset_ );261 qint64 noBytesRead = readBlock( buffer_, remainingBlockBytes_, bufferOffset_ ); 262 262 if( noBytesRead < 0 ) 263 263 { 264 264 kWarning() << "read error " -
src/network/extra/directconnectionpool.h
48 48 virtual ~DirectConnectionPool(); 49 49 50 50 // Add a connection to the list, tells the object to connect to the given ipaddress/port. 51 bool addConnection(DirectConnectionBase *connection, const QString &ipAddress, const intport);51 bool addConnection(DirectConnectionBase *connection, const QString &ipAddress, const quint16 port); 52 52 // Add a connection to the list, starts listening for incoming connections (returns zero if couldn't start listening). 53 53 int addServerConnection(DirectConnectionBase *connection); 54 54 // Remove all connections from the pending list -
src/network/extra/directconnectionbase.h
68 68 // Return true when a write handler is connnected. 69 69 bool isWriteHandlerConnected() const; 70 70 // Get the server port that will be used 71 intgetLocalServerPort();71 quint16 getLocalServerPort(); 72 72 // Get the remote ip the socket is connected with. 73 73 QString getRemoteIp() const; 74 74 // Get the remote port the socket is connected with. 75 intgetRemotePort() const;75 quint16 getRemotePort() const; 76 76 // Return the error description 77 77 QString getSocketError() const; 78 78 // Connect to a host 79 bool openConnection( const QString &ipAddress, const int port);79 bool openConnection( const QString &ipAddress, const quint16 port ); 80 80 // Wait for an incoming connection 81 81 bool openServerPort(); 82 82 … … 106 106 // Close and delete the server socket 107 107 bool closeServerSocket(); 108 108 // Return the number of bytes which are already received in the local buffer 109 intgetAvailableBytes() const;109 qint64 getAvailableBytes() const; 110 110 // Return the name of the locally opened port. 111 111 QString getListeningServiceName() const; 112 112 // Verify how many bytes the read buffer has. Note this actually reads the data to test it. 113 int peekBlock( const intsize );113 qint64 peekBlock( const qint64 size ); 114 114 // Read data from the socket 115 int readBlock( char *buffer, const intsize );115 qint64 readBlock( char *buffer, const qint64 size ); 116 116 // Read data from the socket (uses the QByteArray size() as block size) 117 int readBlock( QByteArray &buffer, const int maxSize = 0, const intoffset = 0 );117 qint64 readBlock( QByteArray &buffer, const qint64 maxSize = 0, const qint64 offset = 0 ); 118 118 // Mark the remote host as authorized (usually after the handshake was successful) 119 119 void setAuthorized(bool authorized); 120 120 // Write data to the socket 121 bool writeBlock( const char *block, const intsize );121 bool writeBlock( const char *block, const qint64 size ); 122 122 // Write data to the socket 123 123 bool writeBlock( const QByteArray &block ); 124 124 … … 140 140 // The timeout handling for openConnection() 141 141 QTimer connectionTimer_; 142 142 // The higher limit to the interval of server ports this class will use 143 inthighestServerPortLimit_;143 quint16 highestServerPortLimit_; 144 144 // Whether the class acts as server or client 145 145 bool isServer_; 146 146 // Whether the last write action failed. 147 147 bool lastWriteFailed_; 148 148 // The lower limit to the interval of server ports this class will use 149 intlowestServerPortLimit_;149 quint16 lowestServerPortLimit_; 150 150 // The server socket which listens for incoming connections. 151 151 QTcpServer *server_; 152 152 // The server port this class will use 153 intserverPort_;153 quint16 serverPort_; 154 154 // The next server port used with a openServerPort() call. 155 static intnextServerPort_;155 static quint16 nextServerPort_; 156 156 // The socket over which data is sent or received. 157 157 QTcpSocket *socket_; 158 158 // Whether an timeout occured -
src/network/extra/msnftpconnection.h
59 59 // Send a file 60 60 bool sendFile(QFile *inputFile); 61 61 // Retrieve a file 62 bool retrieveFile(QFile *outputFile, const QString &ipAddress, const intport);62 bool retrieveFile(QFile *outputFile, const QString &ipAddress, const quint16 port); 63 63 64 64 private slots: 65 65 // This is called when a connection is established. … … 134 134 // The stream to write received data to 135 135 QIODevice *outputStream_; 136 136 // True when only partial file data was received 137 intremainingBlockBytes_;137 qint64 remainingBlockBytes_; 138 138 // True if the user cancelled the session 139 139 bool userCancelled_; 140 140 -
src/network/extra/msndirectconnection.h
61 61 // The buffer for the incoming p2p messages. 62 62 QByteArray buffer_; 63 63 // The offset of the currently received block 64 uintbufferOffset_;64 quint64 bufferOffset_; 65 65 // The other contact we're connected with 66 66 QString contactHandle_; 67 67 // Whether the first message is received … … 69 69 // The buffer for the next preamble message. 70 70 QByteArray preambleBuffer_; 71 71 // The offset in the preamble buffer 72 intpreambleOffset_;72 qint64 preambleOffset_; 73 73 // Set when only partial data was received 74 uintremainingBlockBytes_;74 quint64 remainingBlockBytes_; 75 75 76 76 signals: 77 77 // Signal that a full message block was received. -
src/network/applications/applicationlist.cpp
315 315 * @return Whether the socket could be created or not. 316 316 * Returns false if the socket could not be created. 317 317 */ 318 bool ApplicationList::addConnection(const QString &ipAddress, const intport)318 bool ApplicationList::addConnection(const QString &ipAddress, const quint16 port) 319 319 { 320 320 // Avoid overwriting the current directConnection_ variable. 321 321 if( directConnection_ != 0 ) … … 539 539 P2PApplication *app = 0; 540 540 541 541 // Extract the SLP data message 542 QString slpMessage = QString::fromUtf8( message.getData(), message.getDataSize() );542 QString slpMessage = QString::fromUtf8( message.getData(), (int) message.getDataSize() ); 543 543 544 544 if(! slpMessage.startsWith("INVITE")) 545 545 { … … 1031 1031 1032 1032 // Find the call ID 1033 1033 // Note this assumes that a Call-ID will be found in the first
