Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
3.5 KiB

  1. /****************************************************************************/
  2. /* abacom.c */
  3. /* */
  4. /* BA code common to DD and WD */
  5. /* */
  6. /* Copyright(c) Microsoft 1997-1998 */
  7. /****************************************************************************/
  8. #ifdef DC_DEBUG
  9. /****************************************************************************/
  10. /* Name: BACheckList */
  11. /* */
  12. /* Purpose: Check the integrity of the BA list */
  13. /****************************************************************************/
  14. void RDPCALL SHCLASS BACheckList(void)
  15. {
  16. unsigned usedCount, freeCount;
  17. unsigned next;
  18. unsigned prev;
  19. UINT32 totalArea;
  20. DC_BEGIN_FN("BACheckList");
  21. /************************************************************************/
  22. /* Check used list */
  23. /************************************************************************/
  24. usedCount = 0;
  25. totalArea = 0;
  26. next = _pShm->ba.firstRect;
  27. prev = BA_INVALID_RECT_INDEX;
  28. while (next != BA_INVALID_RECT_INDEX)
  29. {
  30. TRC_ASSERT((_pShm->ba.bounds[next].inUse),
  31. (TB,"BA used list entry not marked in use"));
  32. TRC_ASSERT((_pShm->ba.bounds[next].iPrev == prev),
  33. (TB,"BA used list entry iPrev not correct (%u, expected %u)",
  34. _pShm->ba.bounds[next].iPrev, prev));
  35. totalArea += _pShm->ba.bounds[next].area;
  36. usedCount++;
  37. prev = next;
  38. next = _pShm->ba.bounds[next].iNext;
  39. }
  40. TRC_ASSERT((usedCount == _pShm->ba.rectsUsed),
  41. (TB,"BA used list inconsistent count (%u, expected %u)",
  42. _pShm->ba.rectsUsed, usedCount));
  43. TRC_ASSERT((usedCount <= BA_TOTAL_NUM_RECTS),
  44. (TB,"Too many used list rectangles (%d)", usedCount));
  45. TRC_ASSERT((totalArea == _pShm->ba.totalArea),
  46. (TB,"BA totalArea not correct (shm=%u, elements=%u)",
  47. _pShm->ba.totalArea, totalArea));
  48. /************************************************************************/
  49. /* Check free list */
  50. /************************************************************************/
  51. freeCount = 0;
  52. next = _pShm->ba.firstFreeRect;
  53. while (next != BA_INVALID_RECT_INDEX)
  54. {
  55. TRC_ASSERT((!_pShm->ba.bounds[next].inUse),
  56. (TB,"BA free list entry not marked free"));
  57. freeCount++;
  58. next = _pShm->ba.bounds[next].iNext;
  59. }
  60. TRC_ASSERT((freeCount == (BA_TOTAL_NUM_RECTS - _pShm->ba.rectsUsed)),
  61. (TB,"BA free list inconsistent count (%u, expected %u)",
  62. freeCount, (BA_TOTAL_NUM_RECTS - _pShm->ba.rectsUsed)));
  63. TRC_ASSERT((freeCount <= BA_TOTAL_NUM_RECTS),
  64. (TB,"Too many free list rectangles (%d)", freeCount));
  65. TRC_ASSERT(((freeCount + usedCount) == BA_TOTAL_NUM_RECTS),
  66. (TB,"Used+free (%u) != total rects", usedCount + freeCount));
  67. DC_END_FN();
  68. }
  69. #endif // DC_DEBUG