summaryrefslogtreecommitdiff
path: root/plugins/CryptoPP/crypto/fltrimpl.h
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-05-15 10:38:20 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-05-15 10:38:20 +0000
commit48540940b6c28bb4378abfeb500ec45a625b37b6 (patch)
tree2ef294c0763e802f91d868bdef4229b6868527de /plugins/CryptoPP/crypto/fltrimpl.h
parent5c350913f011e119127baeb32a6aedeb4f0d33bc (diff)
initial commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@2 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/crypto/fltrimpl.h')
-rw-r--r--plugins/CryptoPP/crypto/fltrimpl.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/plugins/CryptoPP/crypto/fltrimpl.h b/plugins/CryptoPP/crypto/fltrimpl.h
new file mode 100644
index 0000000000..62f7604ab0
--- /dev/null
+++ b/plugins/CryptoPP/crypto/fltrimpl.h
@@ -0,0 +1,64 @@
+#ifndef CRYPTOPP_FLTRIMPL_H
+#define CRYPTOPP_FLTRIMPL_H
+
+#define FILTER_BEGIN \
+ switch (m_continueAt) \
+ { \
+ case 0: \
+ m_inputPosition = 0;
+
+#define FILTER_END_NO_MESSAGE_END_NO_RETURN \
+ break; \
+ default: \
+ assert(false); \
+ }
+
+#define FILTER_END_NO_MESSAGE_END \
+ FILTER_END_NO_MESSAGE_END_NO_RETURN \
+ return 0;
+
+/*
+#define FILTER_END \
+ case -1: \
+ if (messageEnd && Output(-1, NULL, 0, messageEnd, blocking)) \
+ return 1; \
+ FILTER_END_NO_MESSAGE_END
+*/
+
+#define FILTER_OUTPUT2(site, statement, output, length, messageEnd) \
+ {\
+ case site: \
+ statement; \
+ if (Output(site, output, length, messageEnd, blocking)) \
+ return STDMAX(size_t(1), length-m_inputPosition);\
+ }
+
+#define FILTER_OUTPUT(site, output, length, messageEnd) \
+ FILTER_OUTPUT2(site, 0, output, length, messageEnd)
+
+#define FILTER_OUTPUT_BYTE(site, output) \
+ FILTER_OUTPUT(site, &(const byte &)(byte)output, 1, 0)
+
+#define FILTER_OUTPUT2_MODIFIABLE(site, statement, output, length, messageEnd) \
+ {\
+ case site: \
+ statement; \
+ if (OutputModifiable(site, output, length, messageEnd, blocking)) \
+ return STDMAX(size_t(1), length-m_inputPosition);\
+ }
+
+#define FILTER_OUTPUT_MODIFIABLE(site, output, length, messageEnd) \
+ FILTER_OUTPUT2_MODIFIABLE(site, 0, output, length, messageEnd)
+
+#define FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, statement, output, length, messageEnd, modifiable) \
+ {\
+ case site: \
+ statement; \
+ if (modifiable ? OutputModifiable(site, output, length, messageEnd, blocking) : Output(site, output, length, messageEnd, blocking)) \
+ return STDMAX(size_t(1), length-m_inputPosition);\
+ }
+
+#define FILTER_OUTPUT_MAYBE_MODIFIABLE(site, output, length, messageEnd, modifiable) \
+ FILTER_OUTPUT2_MAYBE_MODIFIABLE(site, 0, output, length, messageEnd, modifiable)
+
+#endif