Replace uints in HTMLPaginator to ints.

This commit is contained in:
Relintai 2022-07-02 22:21:43 +02:00
parent 066129b2ba
commit a79a6484e7
2 changed files with 10 additions and 10 deletions

View File

@ -103,7 +103,7 @@ String HTMLPaginator::render_indexed(Ref<HTMLPaginator> target, const int page_i
} }
if (starti != toi) { if (starti != toi) {
for (uint32_t i = starti; i < toi; ++i) { for (int i = starti; i < toi; ++i) {
if (i != page_index) { if (i != page_index) {
b.li()->clsse(tclass_enabled_li); b.li()->clsse(tclass_enabled_li);
{ {
@ -146,7 +146,7 @@ String HTMLPaginator::render_links(Ref<HTMLPaginator> target, const int page_ind
s += '/'; s += '/';
} }
uint32_t max = target->links.size(); int max = target->links.size();
int max_visible_links = target->_max_visible_links; int max_visible_links = target->_max_visible_links;
//int page_count = target->_page_count; //int page_count = target->_page_count;
@ -190,7 +190,7 @@ String HTMLPaginator::render_links(Ref<HTMLPaginator> target, const int page_ind
} }
if (starti != toi) { if (starti != toi) {
for (uint32_t i = starti; i < toi; ++i) { for (int i = starti; i < toi; ++i) {
if (i != page_index) { if (i != page_index) {
b.li()->clsse(tclass_enabled_li); b.li()->clsse(tclass_enabled_li);
{ {
@ -220,7 +220,7 @@ String HTMLPaginator::render_links(Ref<HTMLPaginator> target, const int page_ind
return b.result; return b.result;
} }
String HTMLPaginator::get_pagination_old(const String &base_url, const uint32_t max, const uint32_t current_index, const uint32_t max_visible_links) { String HTMLPaginator::get_pagination_old(const String &base_url, const int max, const int current_index, const int max_visible_links) {
String s = base_url; String s = base_url;
if (s.size() > 0 && s[s.size() - 1] != '/') { if (s.size() > 0 && s[s.size() - 1] != '/') {
s += '/'; s += '/';
@ -262,7 +262,7 @@ String HTMLPaginator::get_pagination_old(const String &base_url, const uint32_t
} }
if (starti != toi) { if (starti != toi) {
for (uint32_t i = starti; i < toi; ++i) { for (int i = starti; i < toi; ++i) {
if (i != current_index) { if (i != current_index) {
b.li(); b.li();
b.a()->href(s + itos(i + 1)); b.a()->href(s + itos(i + 1));
@ -298,13 +298,13 @@ String HTMLPaginator::get_pagination_old(const String &base_url, const uint32_t
return b.result; return b.result;
} }
String HTMLPaginator::get_pagination_links_old(const String &base_url, const Vector<String> &links, const uint32_t current_index, const uint32_t max_visible_links) { String HTMLPaginator::get_pagination_links_old(const String &base_url, const Vector<String> &links, const int current_index, const int max_visible_links) {
String s = base_url; String s = base_url;
if (s.size() > 0 && s[s.size() - 1] != '/') { if (s.size() > 0 && s[s.size() - 1] != '/') {
s += '/'; s += '/';
} }
uint32_t max = links.size(); int max = links.size();
int starti = current_index - max_visible_links / 2; int starti = current_index - max_visible_links / 2;
int toi = current_index + max_visible_links / 2; int toi = current_index + max_visible_links / 2;
@ -342,7 +342,7 @@ String HTMLPaginator::get_pagination_links_old(const String &base_url, const Vec
} }
if (starti != toi) { if (starti != toi) {
for (uint32_t i = starti; i < toi; ++i) { for (int i = starti; i < toi; ++i) {
if (i != current_index) { if (i != current_index) {
b.li(); b.li();
b.a()->href(s + links[i]); b.a()->href(s + links[i]);

View File

@ -45,8 +45,8 @@ public:
Ref<HTMLPaginator> renderer; Ref<HTMLPaginator> renderer;
//Old methods for the time being //Old methods for the time being
static String get_pagination_old(const String &base_url, const uint32_t max, const uint32_t current_index, const uint32_t max_visible_links = 10); static String get_pagination_old(const String &base_url, const int max, const int current_index, const int max_visible_links = 10);
static String get_pagination_links_old(const String &base_url, const Vector<String> &links, const uint32_t current_index, const uint32_t max_visible_links = 10); static String get_pagination_links_old(const String &base_url, const Vector<String> &links, const int current_index, const int max_visible_links = 10);
HTMLPaginator(); HTMLPaginator();
~HTMLPaginator(); ~HTMLPaginator();