/[LeafOK_CVS]/lbbs/src/test_section_list.c
ViewVC logotype

Diff of /lbbs/src/test_section_list.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.11 by sysadm, Thu May 22 14:12:33 2025 UTC Revision 1.12 by sysadm, Thu May 22 14:17:50 2025 UTC
# Line 66  int main(int argc, char *argv[]) Line 66  int main(int argc, char *argv[])
66          log_err_redirect(STDERR_FILENO);          log_err_redirect(STDERR_FILENO);
67    
68          // - 1 to make blocks allocated is less than required, to trigger error handling          // - 1 to make blocks allocated is less than required, to trigger error handling
69          block_count = BBS_article_limit_per_section * BBS_max_section / ARTICLE_PER_BLOCK - 1;          block_count = BBS_article_limit_per_section * BBS_max_section / ARTICLE_PER_BLOCK;
70    
71          if (article_block_init("../conf/menu.conf", block_count) < 0)          if (article_block_init("../conf/menu.conf", block_count) < 0)
72          {          {
# Line 450  int main(int argc, char *argv[]) Line 450  int main(int argc, char *argv[])
450                          printf("Inconsistent invisible count in section %d, %d > 0\n", i, p_section[i]->visible_article_count);                          printf("Inconsistent invisible count in section %d, %d > 0\n", i, p_section[i]->visible_article_count);
451                          break;                          break;
452                  }                  }
453    
454                    last_aid = p_section[i]->p_article_head->aid;
455                    if (section_list_calculate_page(p_section[i], last_aid) < 0)
456                    {
457                            printf("section_list_calculate_page(aid = %d) error in section %d offset %d\n", last_aid, i, j);
458                            break;
459                    }
460    
461                    if (p_section[i]->visible_article_count / BBS_article_limit_per_page +
462                                    (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) !=
463                            p_section[i]->page_count)
464                    {
465                            printf("Inconsistent page count in section %d offset %d, %d != %d, "
466                                       "visible_article_count = %d, last_page_visible_count = %d\n",
467                                       i, j,
468                                       p_section[i]->visible_article_count / BBS_article_limit_per_page +
469                                               (p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0),
470                                       p_section[i]->page_count, p_section[i]->visible_article_count,
471                                       p_section[i]->last_page_visible_article_count);
472                            break;
473                    }
474          }          }
475    
476          printf("Press ENTER to exit...");          printf("Press ENTER to exit...");


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1