aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-09-07 16:23:27 +0000
committerlloyd <[email protected]>2010-09-07 16:23:27 +0000
commitb9534e818f443c6439c294ee694fa0774bc6d79b (patch)
treedfa8fa636ced4123ed1691b1477fdd094e61a532 /src/utils
parentd8fcd41ea72d7e00924bb78baa698565de825844 (diff)
parentad3427826a6dc2113142f1fbee158d79cd3e046d (diff)
propagate from branch 'net.randombit.botan' (head fb78974f57bc3065d8537ebeb5210c86e74e9bb1)
to branch 'net.randombit.botan.c++0x' (head dcb30c0029c7e44a75d0d8b859447a6c9df97cde)
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/mlock.cpp4
-rw-r--r--src/utils/stl_util.h5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/utils/mlock.cpp b/src/utils/mlock.cpp
index bc6ddc67e..ce5ae8aed 100644
--- a/src/utils/mlock.cpp
+++ b/src/utils/mlock.cpp
@@ -31,7 +31,7 @@ bool has_mlock()
bool lock_mem(void* ptr, u32bit bytes)
{
#if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK)
- return (::mlock(ptr, bytes) == 0);
+ return (::mlock((char*)ptr, bytes) == 0);
#elif defined(BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK)
return (::VirtualLock(ptr, bytes) != 0);
#else
@@ -45,7 +45,7 @@ bool lock_mem(void* ptr, u32bit bytes)
void unlock_mem(void* ptr, u32bit bytes)
{
#if defined(BOTAN_TARGET_OS_HAS_POSIX_MLOCK)
- ::munlock(ptr, bytes);
+ ::munlock((char*)ptr, bytes);
#elif defined(BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK)
::VirtualUnlock(ptr, bytes);
#endif
diff --git a/src/utils/stl_util.h b/src/utils/stl_util.h
index 4cc081733..0d672fc50 100644
--- a/src/utils/stl_util.h
+++ b/src/utils/stl_util.h
@@ -43,7 +43,12 @@ template<typename K, typename V>
void multimap_insert(std::multimap<K, V>& multimap,
const K& key, const V& value)
{
+#if defined(BOTAN_BUILD_COMPILER_IS_SUN_STUDIO)
+ // Work around a strange bug in Sun Studio
+ multimap.insert(std::make_pair<const K, V>(key, value));
+#else
multimap.insert(std::make_pair(key, value));
+#endif
}
}