From 66fb50a462d72c106bd4a4102a1faff92bd5f7e2 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 20 Dec 2015 17:03:08 -0500 Subject: Throw Lookup_Error instead of bare Exception when creating an obj fails in the algo factory. Fixes remaining issues of GH #369 - test_pubkey.cpp was expecting Lookup_Error when something isn't found. --- src/lib/base/algo_registry.h | 48 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src/lib/base/algo_registry.h') diff --git a/src/lib/base/algo_registry.h b/src/lib/base/algo_registry.h index 3b1a72d88..a431e9178 100644 --- a/src/lib/base/algo_registry.h +++ b/src/lib/base/algo_registry.h @@ -22,7 +22,7 @@ #define BOTAN_WORKAROUND_GH_321 #define NOMINMAX 1 #define WIN32_LEAN_AND_MEAN 1 - #include + #include #endif @@ -33,28 +33,28 @@ namespace Botan { class WinCS_Mutex { public: - WinCS_Mutex() - { - InitializeCriticalSection(&m_cs); - } - - ~WinCS_Mutex() - { - DeleteCriticalSection(&m_cs); - } - - void lock() - { - EnterCriticalSection(&m_cs); - } - - void unlock() - { - LeaveCriticalSection(&m_cs); - } - - private: - CRITICAL_SECTION m_cs; + WinCS_Mutex() + { + ::InitializeCriticalSection(&m_cs); + } + + ~WinCS_Mutex() + { + ::DeleteCriticalSection(&m_cs); + } + + void lock() + { + ::EnterCriticalSection(&m_cs); + } + + void unlock() + { + ::LeaveCriticalSection(&m_cs); + } + + private: + CRITICAL_SECTION m_cs; }; #endif @@ -111,7 +111,7 @@ class Algo_Registry } catch(std::exception& e) { - throw Exception("Creating '" + spec.as_string() + "' failed: " + e.what()); + throw Lookup_Error("Creating '" + spec.as_string() + "' failed: " + e.what()); } return nullptr; -- cgit v1.2.3