From 0da2415bc15c2abe6385e2048fecb8d42dc549b7 Mon Sep 17 00:00:00 2001
From: Augustin Cavalier <waddlesplash@gmail.com>
Date: Fri, 11 Jul 2014 14:10:37 -0400
Subject: [PATCH] QCA2: fix compilation on Haiku/GCC4.

---
 src/botantools/botan/botan/secmem.h    | 6 +++---
 src/botantools/botan/ml_unix/mlock.cpp | 4 ++++
 src/qca_tools.cpp                      | 2 ++
 src/support/console.cpp                | 2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/botantools/botan/botan/secmem.h b/src/botantools/botan/botan/secmem.h
index f421220..ddbb733 100644
--- a/src/botantools/botan/botan/secmem.h
+++ b/src/botantools/botan/botan/secmem.h
@@ -214,11 +214,11 @@ class SecureVector : public MemoryRegion<T>
 
       SecureVector(u32bit n = 0) { MemoryRegion<T>::init(true, n); }
       SecureVector(const T in[], u32bit n)
-         { MemoryRegion<T>::init(true); set(in, n); }
+         { MemoryRegion<T>::init(true); this->set(in, n); }
       SecureVector(const MemoryRegion<T>& in)
-         { MemoryRegion<T>::init(true); set(in); }
+         { MemoryRegion<T>::init(true); this->set(in); }
       SecureVector(const MemoryRegion<T>& in1, const MemoryRegion<T>& in2)
-         { MemoryRegion<T>::init(true); set(in1); append(in2); }
+         { MemoryRegion<T>::init(true); this->set(in1); append(in2); }
    };
 
 /*************************************************
diff --git a/src/botantools/botan/ml_unix/mlock.cpp b/src/botantools/botan/ml_unix/mlock.cpp
index 109609c..c88b23b 100644
--- a/src/botantools/botan/ml_unix/mlock.cpp
+++ b/src/botantools/botan/ml_unix/mlock.cpp
@@ -52,7 +52,9 @@ namespace Botan {
 *************************************************/
 void lock_mem(void* ptr, u32bit bytes)
    {
+   #ifndef __HAIKU__
    mlock(ptr, bytes);
+   #endif
    }
 
 /*************************************************
@@ -60,7 +62,9 @@ void lock_mem(void* ptr, u32bit bytes)
 *************************************************/
 void unlock_mem(void* ptr, u32bit bytes)
    {
+   #ifndef __HAIKU__
    munlock(ptr, bytes);
+   #endif
    }
 
 }
diff --git a/src/qca_tools.cpp b/src/qca_tools.cpp
index cef2b79..44357c0 100644
--- a/src/qca_tools.cpp
+++ b/src/qca_tools.cpp
@@ -44,11 +44,13 @@ static bool can_lock()
 #endif
 
 	MLOCK_TYPE d = MLOCK_TYPE_CAST malloc(256);
+	#ifndef __HAIKU__
 	if(mlock(d, 256) == 0)
 	{
 		munlock(d, 256);
 		ok = true;
 	}
+	#endif
 	free(d);
 	return ok;
 #else
diff --git a/src/support/console.cpp b/src/support/console.cpp
index 8cb19dd..b6ffec6 100644
--- a/src/support/console.cpp
+++ b/src/support/console.cpp
@@ -30,7 +30,7 @@
 #ifdef Q_OS_WIN
 # include <windows.h>
 #else
-# include <sys/termios.h>
+# include <termios.h>
 # include <unistd.h>
 # include <fcntl.h>
 #endif
-- 
1.8.3.4

