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.

51 lines
1.2 KiB

  1. /*
  2. * optdebug.c
  3. *
  4. * Optimal encoder debugging stubs
  5. */
  6. #include <string.h>
  7. #include <stdio.h>
  8. #include <crtdbg.h>
  9. #include "deflate.h"
  10. #ifdef _DEBUG
  11. static void OptimalEncoderVerifyTreeStructure(t_encoder_context *context, byte val1, byte val2, long where)
  12. {
  13. long left, right;
  14. if (where == 0)
  15. return;
  16. _ASSERT(context->optimal_encoder->window[where] == val1);
  17. _ASSERT(context->optimal_encoder->window[where+1] == val2);
  18. left = context->optimal_encoder->search_left[where];
  19. right = context->optimal_encoder->search_right[where];
  20. OptimalEncoderVerifyTreeStructure(context, val1, val2, left);
  21. OptimalEncoderVerifyTreeStructure(context, val1, val2, right);
  22. }
  23. void OptimalEncoderVerifyHashes(t_encoder_context *context, long bufpos)
  24. {
  25. long i;
  26. for (i = 0; i < NUM_DIRECT_LOOKUP_TABLE_ELEMENTS; i++)
  27. {
  28. long where = context->optimal_encoder->search_tree_root[i];
  29. USHORT tree_to_use;
  30. if (where == 0)
  31. continue;
  32. tree_to_use = *((USHORT UNALIGNED *) &context->optimal_encoder->window[where]);
  33. _ASSERT(where < bufpos);
  34. _ASSERT(tree_to_use == i);
  35. OptimalEncoderVerifyTreeStructure(context, context->optimal_encoder->window[where], context->optimal_encoder->window[where+1], where);
  36. }
  37. }
  38. #endif