| Index: src/shared/Communication.h |
| =================================================================== |
| --- a/src/shared/Communication.h |
| +++ b/src/shared/Communication.h |
| @@ -7,17 +7,16 @@ |
| #include <stdint.h> |
| #include <string> |
| #include <vector> |
| #include <Windows.h> |
| namespace Communication |
| { |
| extern const std::wstring pipeName; |
| - const int bufferSize = 1024; |
| enum ProcType : uint32_t { |
| PROC_MATCHES, |
| PROC_GET_ELEMHIDE_SELECTORS, |
| PROC_AVAILABLE_SUBSCRIPTIONS, |
| PROC_LISTED_SUBSCRIPTIONS, |
| PROC_SET_SUBSCRIPTION, |
| PROC_UPDATE_ALL_SUBSCRIPTIONS, |
| @@ -39,30 +38,17 @@ namespace Communication |
| InputBuffer& operator>>(int64_t& value) { return Read(value, TYPE_INT64); } |
| InputBuffer& operator>>(int32_t& value) { return Read(value, TYPE_INT32); } |
| InputBuffer& operator>>(bool& value) { return Read(value, TYPE_BOOL); } |
| private: |
| std::istringstream buffer; |
| ValueType currentType; |
| bool hasType; |
| - void CheckType(ValueType expectedType) |
| - { |
| - if (!hasType) |
| - ReadBinary(currentType); |
| - |
| - if (currentType != expectedType) |
| - { |
| - // Make sure we don't attempt to read the type again |
| - hasType = true; |
| - throw new std::runtime_error("Unexpected type found in input buffer"); |
| - } |
| - else |
| - hasType = false; |
| - } |
| + void CheckType(ValueType expectedType); |
| template<class T> |
| InputBuffer& ReadString(T& value, ValueType expectedType) |
| { |
| CheckType(expectedType); |
| SizeType length; |
| ReadBinary(length); |