Version: 2.1 (using KDE KDE 3.5.6)
Installed from: Ubuntu Packages
If the column "IP Address" is chosen to sort, by, KTorrent sorts by treating the IP Address as a string, rather than as a numeric entity. For example "222.x.x.x" would be seen earlier than "24.x.x.x".
I believe it should sort by IP Address numerically, not by the displayed string value.
Created attachment 21881 [details]
Sort ip correctly in infowidget peerview
That's the first C++ patch I've done, so be critical. How else would I learn? :)
Hey there, dvj.
Firstly, thanks a lot for addressing the issue! I'll guess you meant that the bug assignee should check the patch...but, hey, I'll in throw my $0.02, just for fun.
1) What about just using inet_aton on both IPs and comparing the results? There might be a lo of back-and-forth about what's more expensive, but if you lost some lines of code, it might be worth any expense (_if_ it's more expensive.)
2) Did you mean "digits" in your variable names instead of "digets" ?
It would be much faster to convert the string ones and then compare with converted value, much faster.
Oops, typo : ones -> once
SVN commit 727609 by guisson:
Sort IP addresses by their actual value and not by their string representation
M +11 -6 peerview.cpp
M +1 -0 peerview.h
WebSVN link: http://websvn.kde.org/?view=rev&revision=727609