Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Рефакторинг] Обобщить сортировку по IP во всех фреймах #989

Closed
pavel-pimenov opened this issue Aug 23, 2015 · 6 comments

Comments

@pavel-pimenov
Copy link
Owner

@pavel-pimenov pavel-pimenov commented Aug 23, 2015

From Pavel.Pimenov@gmail.com on March 22, 2013 08:59:41

В нескольких местах выполняется сортировка по колонке IP как по тексту

Предлагается

  1. Добавить сервисный метод для сортировки IP в виде числа

Подобно правило уже реализовано в одном месте вот так:

                const uint32_t a_ip = Socket::convertIP4(Text::fromT(a->getText(COLUMN_IP)));
                const uint32_t b_ip = Socket::convertIP4(Text::fromT(b->getText(COLUMN_IP)));
                return compare(a_ip, b_ip);
  1. Не забыть учесть что во фрейме юзеров впереди появляется звездочка.
  2. Обобщить без копипасты по аналогии с
    Util::DefaultSort(a->getText(col).c_str(), b->getText(col).c_str())

Original issue: http://code.google.com/p/flylinkdc/issues/detail?id=952

@pavel-pimenov
Copy link
Owner Author

@pavel-pimenov pavel-pimenov commented Aug 23, 2015

From tret2...@gmail.com on March 24, 2013 00:19:26

UINT32 IPtoNum(const string& p_IPstring)
{
UINT32 l_IPnum = inet_addr(p_IPstring.c_str());
if (l_IPnum != INADDR_NONE)
l_IPnum = ntohl(l_IPnum);
return res;
}

Попутно сперва можно звёздочку отрезать в конце строки

@pavel-pimenov
Copy link
Owner Author

@pavel-pimenov pavel-pimenov commented Aug 23, 2015

From Pavel.Pimenov@gmail.com on March 24, 2013 01:43:18

Слав, забираешь этот тикет себе?

@pavel-pimenov
Copy link
Owner Author

@pavel-pimenov pavel-pimenov commented Aug 23, 2015

From tret2...@gmail.com on March 24, 2013 02:32:29

в принципе т.к. число будет сравниваться, можно порядок битов не менять с ntohl

@pavel-pimenov
Copy link
Owner Author

@pavel-pimenov pavel-pimenov commented Aug 23, 2015

From tret2...@gmail.com on March 24, 2013 02:34:19

могу забрать

@pavel-pimenov
Copy link
Owner Author

@pavel-pimenov pavel-pimenov commented Aug 23, 2015

From tret2...@gmail.com on March 24, 2013 02:42:39

Owner: tret2...@gmail.com

@pavel-pimenov
Copy link
Owner Author

@pavel-pimenov pavel-pimenov commented Aug 23, 2015

From tret2...@gmail.com on March 24, 2013 10:05:14

This issue was closed by revision r13389 .

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant