Team Fortress 2 Source Code as on 22/4/2020
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.

85 lines
2.2 KiB

  1. #ifndef CRYPTOPP_FLTRIMPL_H
  2. #define CRYPTOPP_FLTRIMPL_H
  3. #if CRYPTOPP_MSC_VERSION
  4. # pragma warning(push)
  5. # pragma warning(disable: 4100)
  6. #endif
  7. #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
  8. # pragma GCC diagnostic push
  9. # pragma GCC diagnostic ignored "-Wunused-value"
  10. #endif
  11. #define FILTER_BEGIN \
  12. switch (m_continueAt) \
  13. { \
  14. case 0: \
  15. m_inputPosition = 0;
  16. #define FILTER_END_NO_MESSAGE_END_NO_RETURN \
  17. break; \
  18. default: \
  19. assert(false); \
  20. }
  21. #define FILTER_END_NO_MESSAGE_END \
  22. FILTER_END_NO_MESSAGE_END_NO_RETURN \
  23. return 0;
  24. /*
  25. #define FILTER_END \
  26. case -1: \
  27. if (messageEnd && Output(-1, NULL, 0, messageEnd, blocking)) \
  28. return 1; \
  29. FILTER_END_NO_MESSAGE_END
  30. */
  31. #define FILTER_OUTPUT3(site, statement, output, length, messageEnd, channel) \
  32. {\
  33. case site: \
  34. statement; \
  35. if (Output(site, output, length, messageEnd, blocking, channel)) \
  36. return STDMAX(size_t(1), length-m_inputPosition);\
  37. }
  38. #define FILTER_OUTPUT2(site, statement, output, length, messageEnd) \
  39. FILTER_OUTPUT3(site, statement, output, length, messageEnd, DEFAULT_CHANNEL)
  40. #define FILTER_OUTPUT(site, output, length, messageEnd) \
  41. FILTER_OUTPUT2(site, 0, output, length, messageEnd)
  42. #define FILTER_OUTPUT_BYTE(site, output) \
  43. FILTER_OUTPUT(site, &(const byte &)(byte)output, 1, 0)
  44. #define FILTER_OUTPUT2_MODIFIABLE(site, statement, output, length, messageEnd) \
  45. {\
  46. case site: \
  47. statement; \
  48. if (OutputModifiable(site, output, length, messageEnd, blocking)) \
  49. return STDMAX(size_t(1), length-m_inputPosition);\
  50. }
  51. #define FILTER_OUTPUT_MODIFIABLE(site, output, length, messageEnd) \
  52. FILTER_OUTPUT2_MODIFIABLE(site, 0, output, length, messageEnd)
  53. #define FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, statement, output, length, messageEnd, modifiable) \
  54. {\
  55. case site: \
  56. statement; \
  57. if (modifiable ? OutputModifiable(site, output, length, messageEnd, blocking) : Output(site, output, length, messageEnd, blocking)) \
  58. return STDMAX(size_t(1), length-m_inputPosition);\
  59. }
  60. #define FILTER_OUTPUT_MAYBE_MODIFIABLE(site, output, length, messageEnd, modifiable) \
  61. FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, 0, output, length, messageEnd, modifiable)
  62. #if CRYPTOPP_MSC_VERSION
  63. # pragma warning(pop)
  64. #endif
  65. #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
  66. # pragma GCC diagnostic pop
  67. #endif
  68. #endif