This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SVN] Cosmetic patches

Tags: None
(comma "," separated)
NuMessiah
Registered Member
Posts
6
Karma
0

[SVN] Cosmetic patches

Tue Feb 03, 2009 11:47 am
Hi!

I am just wondering if you are interested in cosmetic patches like this:

Code: Select all
--- ../svn/ktorrent/libbtcore/net/downloadthread.cpp    2009-02-03 12:01:23.000000000 +0100
+++ ktorrent/libbtcore/net/downloadthread.cpp   2009-02-03 12:19:52.000000000 +0100
@@ -124,7 +124,7 @@

        int DownloadThread::waitForSocketReady(int timeout)
        {
+               unsigned int i = 1;
-               int i = 1;
                sm->lock();

                // Add the wake up pipe
--- ../svn/ktorrent/libbtcore/peer/authenticationmonitor.cpp    2009-02-03 12:01:24.000000000 +0100
+++ ktorrent/libbtcore/peer/authenticationmonitor.cpp   2009-02-03 12:25:27.000000000 +0100
@@ -73,7 +73,7 @@
                if (auths.size() == 0)
                        return;

+               unsigned int i = 0;
-               int i = 0;

                std::list<AuthenticateBase*>::iterator itr = auths.begin();
                while (itr != auths.end())


If you are, I would send you the patches to get rid of most of the warnings during compilation.

bb4now,
PMC

Last edited by NuMessiah on Wed Feb 04, 2009 9:55 am, edited 1 time in total.
George
Moderator
Posts
5421
Karma
1

Tue Feb 03, 2009 2:59 pm
Send them, I will take a look at them.
NuMessiah
Registered Member
Posts
6
Karma
0

Tue Feb 03, 2009 8:58 pm
OK, here is the whole patch. It casts or changes Uint32 variables to int when applicable to get rid of warnings like: "warning: comparison between signed and unsigned integer expressions".

After this patch there should be no waring messages like those anymore.

Code: Select all
diff -ur ../svn/ktorrent/libbtcore/dht/announcetask.cpp ktorrent/libbtcore/dht/announcetask.cpp
--- ../svn/ktorrent/libbtcore/dht/announcetask.cpp   2009-02-03 12:01:20.000000000 +0100
+++ ktorrent/libbtcore/dht/announcetask.cpp   2009-02-03 13:26:52.000000000 +0100
@@ -143,7 +143,7 @@
          Out(SYS_DHT|LOG_NOTICE) << "DHT: AnnounceTask done" << endl;
          done();
       }
-      else if (answered_visited.count() >= dht::K)
+      else if (answered_visited.count() >= (int) dht::K)
       {
          // if K announces have occurred stop
          Out(SYS_DHT|LOG_NOTICE) << "DHT: AnnounceTask done" << endl;
diff -ur ../svn/ktorrent/libbtcore/dht/database.cpp ktorrent/libbtcore/dht/database.cpp
--- ../svn/ktorrent/libbtcore/dht/database.cpp   2009-02-03 12:01:20.000000000 +0100
+++ ktorrent/libbtcore/dht/database.cpp   2009-02-03 20:51:59.000000000 +0100
@@ -103,7 +103,7 @@
       if (!dbl)
          return;
       
-      if (dbl->count() < max_entries)
+      if (dbl->count() < (int) max_entries)
       {
          DBItemList::iterator i = dbl->begin();
          while (i != dbl->end())
diff -ur ../svn/ktorrent/libbtcore/dht/kbucket.cpp ktorrent/libbtcore/dht/kbucket.cpp
--- ../svn/ktorrent/libbtcore/dht/kbucket.cpp   2009-02-03 12:01:20.000000000 +0100
+++ ktorrent/libbtcore/dht/kbucket.cpp   2009-02-03 21:07:33.000000000 +0100
@@ -134,7 +134,7 @@
       }
       
       // insert if not already in the list and we still have room
-      if (i == entries.end() && entries.count() < dht::K)
+      if (i == entries.end() && entries.count() < (int) dht::K)
       {
          entries.append(entry);
          last_modified = bt::GetCurrentTime();
diff -ur ../svn/ktorrent/libbtcore/dht/key.cpp ktorrent/libbtcore/dht/key.cpp
--- ../svn/ktorrent/libbtcore/dht/key.cpp   2009-02-03 12:01:20.000000000 +0100
+++ ktorrent/libbtcore/dht/key.cpp   2009-02-03 20:53:15.000000000 +0100
@@ -40,7 +40,7 @@
    
    Key::Key(const QByteArray & ba)
    {
-      for (Uint32 i = 0;i < 20 && i < ba.size();i++)
+      for (int i = 0;i < 20 && i < ba.size();i++)
          hash[i] = ba[i];
    }
 
diff -ur ../svn/ktorrent/libbtcore/dht/pack.cpp ktorrent/libbtcore/dht/pack.cpp
--- ../svn/ktorrent/libbtcore/dht/pack.cpp   2009-02-03 12:01:20.000000000 +0100
+++ ktorrent/libbtcore/dht/pack.cpp   2009-02-03 21:02:58.000000000 +0100
@@ -37,7 +37,7 @@
       if (addr.ipVersion() == 4)
       {
          // first check size
-         if (off + 26 > ba.size())
+         if ((int) off + 26 > ba.size())
             throw bt::Error("Not enough room in buffer");
          
          // copy ID, IP address and port into the buffer
@@ -48,7 +48,7 @@
       else
       {
          // first check size
-         if (off + 38 > ba.size())
+         if ((int) off + 38 > ba.size())
             throw bt::Error("Not enough room in buffer");
          
          // copy ID, IP address and port into the buffer
@@ -62,7 +62,7 @@
    {
       if (ip_version == 4)
       {
-         if (off + 26 > ba.size())
+         if ((int) off + 26 > ba.size())
             throw bt::Error("Not enough room in buffer");
          
          const Uint8* data = (Uint8*)ba.data();
@@ -77,7 +77,7 @@
       }
       else
       {
-         if (off + 38 > ba.size())
+         if ((int) off + 38 > ba.size())
             throw bt::Error("Not enough room in buffer");
          
          const Uint8* data = (Uint8*)ba.data();
diff -ur ../svn/ktorrent/libbtcore/dht/rpcserver.cpp ktorrent/libbtcore/dht/rpcserver.cpp
--- ../svn/ktorrent/libbtcore/dht/rpcserver.cpp   2009-02-03 12:01:20.000000000 +0100
+++ ktorrent/libbtcore/dht/rpcserver.cpp   2009-02-03 21:05:07.000000000 +0100
@@ -85,7 +85,7 @@
    static void PrintRawData(const QByteArray & data)
    {
       QString tmp;
-      for (Uint32 i = 0;i < data.size();i++)
+      for (int i = 0;i < data.size();i++)
       {
          char c = QChar(data[i]).toLatin1();
          if (!QChar(data[i]).isPrint() || c == 0)
diff -ur ../svn/ktorrent/libbtcore/download/httpconnection.cpp ktorrent/libbtcore/download/httpconnection.cpp
--- ../svn/ktorrent/libbtcore/download/httpconnection.cpp   2009-02-03 12:01:25.000000000 +0100
+++ ktorrent/libbtcore/download/httpconnection.cpp   2009-02-03 20:51:00.000000000 +0100
@@ -168,7 +168,7 @@
          
          memcpy(data,g->buffer.data() + g->bytes_sent,len);
          g->bytes_sent += len;
-         if (len == g->buffer.size())
+         if ((int) len == g->buffer.size())
          {
             g->buffer.clear();
             g->request_sent = true;
diff -ur ../svn/ktorrent/libbtcore/migrate/cachemigrate.cpp ktorrent/libbtcore/migrate/cachemigrate.cpp
--- ../svn/ktorrent/libbtcore/migrate/cachemigrate.cpp   2009-02-03 12:01:23.000000000 +0100
+++ ktorrent/libbtcore/migrate/cachemigrate.cpp   2009-02-03 21:18:51.000000000 +0100
@@ -59,7 +59,7 @@
       // create all necessary subdirs
       QString ctmp = startdir;
       
-      for (Uint32 i = 0;i < sl.count() - 1;i++)
+      for (int i = 0;i < sl.count() - 1;i++)
       {
          ctmp += sl[i];
          // we need to make the same directory structure in the cache
diff -ur ../svn/ktorrent/libbtcore/net/downloadthread.cpp ktorrent/libbtcore/net/downloadthread.cpp
--- ../svn/ktorrent/libbtcore/net/downloadthread.cpp   2009-02-03 12:01:23.000000000 +0100
+++ ktorrent/libbtcore/net/downloadthread.cpp   2009-02-03 12:19:52.000000000 +0100
@@ -124,7 +124,7 @@
    
    int DownloadThread::waitForSocketReady(int timeout)
    {
-      int i = 1;
+      unsigned int i = 1;
       sm->lock();
       
       // Add the wake up pipe
diff -ur ../svn/ktorrent/libbtcore/peer/authenticationmonitor.cpp ktorrent/libbtcore/peer/authenticationmonitor.cpp
--- ../svn/ktorrent/libbtcore/peer/authenticationmonitor.cpp   2009-02-03 12:01:24.000000000 +0100
+++ ktorrent/libbtcore/peer/authenticationmonitor.cpp   2009-02-03 12:25:27.000000000 +0100
@@ -73,7 +73,7 @@
       if (auths.size() == 0)
          return;
       
-      int i = 0;
+      unsigned int i = 0;
       
       std::list<AuthenticateBase*>::iterator itr = auths.begin();
       while (itr != auths.end())
diff -ur ../svn/ktorrent/libbtcore/peer/packetreader.cpp ktorrent/libbtcore/peer/packetreader.cpp
--- ../svn/ktorrent/libbtcore/peer/packetreader.cpp   2009-02-03 12:01:24.000000000 +0100
+++ ktorrent/libbtcore/peer/packetreader.cpp   2009-02-03 20:49:11.000000000 +0100
@@ -147,7 +147,7 @@
       Uint32 am_of_len_read = 0;
       if (len_received > 0)
       {
-         if (size < 4 - len_received)
+         if ((int) size < 4 - len_received)
          {
             memcpy(len + len_received,buf,size);
             len_received += size;
diff -ur ../svn/ktorrent/libbtcore/tracker/httptracker.cpp ktorrent/libbtcore/tracker/httptracker.cpp
--- ../svn/ktorrent/libbtcore/tracker/httptracker.cpp   2009-02-03 12:01:23.000000000 +0100
+++ ktorrent/libbtcore/tracker/httptracker.cpp   2009-02-03 21:12:04.000000000 +0100
@@ -256,7 +256,7 @@
       Out(SYS_TRK|LOG_DEBUG) << QString(data) << endl;
 #endif
       // search for dictionary, there might be random garbage infront of the data
-      Uint32 i = 0;
+      int i = 0;
       while (i < data.size())
       {
          if (data[i] == 'd')
@@ -332,7 +332,7 @@
          }
 
          QByteArray arr = vn->data().toByteArray();
-         for (Uint32 i = 0;i < arr.size();i+=6)
+         for (int i = 0;i < arr.size();i+=6)
          {
             Uint8 buf[6];
             for (int j = 0;j < 6;j++)
@@ -372,7 +372,7 @@
       if (vn && vn->data().getType() == Value::STRING)
       {
          QByteArray arr = vn->data().toByteArray();
-         for (Uint32 i = 0;i < arr.size();i+=18)
+         for (int i = 0;i < arr.size();i+=18)
          {
             Uint8 buf[18];
             for (int j = 0;j < 18;j++)
diff -ur ../svn/ktorrent/libbtcore/tracker/udptracker.cpp ktorrent/libbtcore/tracker/udptracker.cpp
--- ../svn/ktorrent/libbtcore/tracker/udptracker.cpp   2009-02-03 12:01:23.000000000 +0100
+++ ktorrent/libbtcore/tracker/udptracker.cpp   2009-02-03 21:13:10.000000000 +0100
@@ -139,7 +139,7 @@
 
       Uint32 nip = leechers + seeders;
       Uint32 j = 0;
-      for (Uint32 i = 20;i < b.size() && j < nip;i+=6,j++)
+      for (int i = 20;i < b.size() && j < nip;i+=6,j++)
       {
          Uint32 ip = ReadUint32(buf,i);
          QString ip_str = QString("%1.%2.%3.%4")
diff -ur ../svn/ktorrent/libbtcore/tracker/udptrackersocket.cpp ktorrent/libbtcore/tracker/udptrackersocket.cpp
--- ../svn/ktorrent/libbtcore/tracker/udptrackersocket.cpp   2009-02-03 12:01:23.000000000 +0100
+++ ktorrent/libbtcore/tracker/udptrackersocket.cpp   2009-02-03 21:13:45.000000000 +0100
@@ -161,7 +161,7 @@
       // extract error message
       transactions.erase(it);
       QString msg;
-      for (Uint32 i = 8;i < buf.size();i++)
+      for (int i = 8;i < buf.size();i++)
          msg += (char)buf[i];
 
       // emit signal
diff -ur ../svn/ktorrent/libktupnp/upnpmcastsocket.cpp ktorrent/libktupnp/upnpmcastsocket.cpp
--- ../svn/ktorrent/libktupnp/upnpmcastsocket.cpp   2009-02-03 12:01:35.000000000 +0100
+++ ktorrent/libktupnp/upnpmcastsocket.cpp   2009-02-03 21:21:41.000000000 +0100
@@ -172,7 +172,7 @@
       
       // quick check that the response being parsed is valid
       bool validDevice = false;
-      for (Uint32 idx = 0;idx < lines.count() && !validDevice; idx++)
+      for (int idx = 0;idx < lines.count() && !validDevice; idx++)
       {
          line = lines[idx];
          if ((line.contains("ST:") || line.contains("NT:")) && line.contains("InternetGatewayDevice"))
@@ -187,7 +187,7 @@
       }
       
       // read all lines and try to find the server and location fields
-      for (Uint32 i = 1;i < lines.count();i++)
+      for (int i = 1;i < lines.count();i++)
       {
          line = lines[i];
          if (line.startsWith("Location") || line.startsWith("LOCATION") || line.startsWith("location"))
diff -ur ../svn/ktorrent/plugins/infowidget/GeoIP.c ktorrent/plugins/infowidget/GeoIP.c
--- ../svn/ktorrent/plugins/infowidget/GeoIP.c   2009-02-03 12:01:16.000000000 +0100
+++ ktorrent/plugins/infowidget/GeoIP.c   2009-02-03 21:23:55.000000000 +0100
@@ -768,7 +768,7 @@
    }
 
    seek_org = _GeoIP_seek_record(gi, ipnum);
-   if (seek_org == gi->databaseSegments[0])      
+   if (seek_org == (int) gi->databaseSegments[0])      
       return NULL;
 
    record_pointer = seek_org + (2 * gi->record_length - 1) * gi->databaseSegments[0];
@@ -779,7 +779,7 @@
       org_buf = malloc(sizeof(char) * (strlen(buf)+1));
       strcpy(org_buf, buf);
    } else {
-      buf_pointer = gi->cache + (long)record_pointer;
+      buf_pointer = (char *)gi->cache + (long)record_pointer;
       org_buf = malloc(sizeof(char) * (strlen(buf_pointer)+1));
       strcpy(org_buf, buf_pointer);
    }
diff -ur ../svn/ktorrent/plugins/infowidget/webseedsmodel.cpp ktorrent/plugins/infowidget/webseedsmodel.cpp
--- ../svn/ktorrent/plugins/infowidget/webseedsmodel.cpp   2009-02-03 12:01:16.000000000 +0100
+++ ktorrent/plugins/infowidget/webseedsmodel.cpp   2009-02-03 21:25:29.000000000 +0100
@@ -134,7 +134,7 @@
       if (!curr_tc)
          return QVariant();
       
-      if (!index.isValid() || index.row() >= curr_tc->getNumWebSeeds() || index.row() < 0)
+      if (!index.isValid() || index.row() >= (int) curr_tc->getNumWebSeeds() || index.row() < 0)
          return QVariant();
       
       if (role == Qt::DisplayRole)


You can DL the patch file here: http://numessiah.pastebin.com/f169b4a28

Have fun ...

bb4now,
PMC
George
Moderator
Posts
5421
Karma
1

Thu Feb 05, 2009 7:08 pm
OK, patch has been committed
NuMessiah
Registered Member
Posts
6
Karma
0

Fri Feb 06, 2009 1:09 pm
Here is another one:

Code: Select all
diff -ur -x ktorrent/build/ ../svn/ktorrent/plugins/downloadorder/downloadordermodel.cpp ktorrent/plugins/downloadorder/downloadordermodel.cpp
--- ../svn/ktorrent/plugins/downloadorder/downloadordermodel.cpp   2009-02-03 12:01:17.000000000 +0100
+++ ktorrent/plugins/downloadorder/downloadordermodel.cpp   2009-02-06 13:55:54.000000000 +0100
@@ -183,7 +183,7 @@
          return;
       
       int r = index.row();
-      if (r == tor->getNumFiles() - 1)
+      if (r == (int) tor->getNumFiles() - 1)
          return;
       
       order.swap(r,r+1);


To DL go here: http://numessiah.pastebin.com/f22fc915c

bb4now,
PMC
NuMessiah
Registered Member
Posts
6
Karma
0

Fri Feb 06, 2009 2:55 pm
And another one.

This one un-hides the virtual methods which have been declared in parent class.
The rationale (almost) for this can be found at http://burks.bton.ac.uk/burks/language/ ... angei.htm#[23.3] .


Code: Select all
--- ../svn/ktorrent/libbtcore/diskio/singlefilecache.h   2009-02-03 12:01:20.000000000 +0100
+++ ktorrent/libbtcore/diskio/singlefilecache.h   2009-02-06 15:38:05.000000000 +0100
@@ -50,7 +50,9 @@
       virtual void close();
       virtual void open();
       virtual void changeTmpDir(const QString & ndir);
+      using Cache::moveDataFiles;
       virtual KJob* moveDataFiles(const QString & ndir);
+      using Cache::moveDataFilesFinished;
       virtual void moveDataFilesFinished(KJob* job);
       virtual void changeOutputPath(const QString& outputpath);
       virtual QString getOutputPath() const {return output_file;}


DL here http://numessiah.pastebin.com/f40da2196 .

bb4now,
PMC
George
Moderator
Posts
5421
Karma
1

Thu Feb 12, 2009 5:33 pm
Both of these are now committed


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar