summaryrefslogtreecommitdiff
path: root/store
diff options
context:
space:
mode:
authorMatthias Huetsch <mhu@openoffice.org>2002-08-17 16:06:37 +0000
committerMatthias Huetsch <mhu@openoffice.org>2002-08-17 16:06:37 +0000
commit3a8df0becbf6bf4e8275ecc5c1f37e6780166822 (patch)
tree36b719a56964b90b94a2917633c44c77f5168228 /store
parentea2c3b9c9a016059b48170a35367093cdfa69da7 (diff)
#i3980# Added class specific 'OStorePageObject' allocator to avoid mix with
standard allocators. Minor code cleanup.
Diffstat (limited to 'store')
-rw-r--r--store/source/storbase.hxx70
1 files changed, 62 insertions, 8 deletions
diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx
index 3ae6a4b4c442..658a1110863c 100644
--- a/store/source/storbase.hxx
+++ b/store/source/storbase.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: storbase.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mhu $ $Date: 2001-11-26 21:10:51 $
+ * last change: $Author: mhu $ $Date: 2002-08-17 17:06:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,7 +60,7 @@
************************************************************************/
#ifndef _STORE_STORBASE_HXX_
-#define _STORE_STORBASE_HXX_ "$Revision: 1.3 $"
+#define _STORE_STORBASE_HXX_ "$Revision: 1.4 $"
#ifndef _SAL_TYPES_H_
#include <sal/types.h>
@@ -69,9 +69,6 @@
#ifndef _RTL_ALLOC_H_
#include <rtl/alloc.h>
#endif
-#ifndef _RTL_MEMORY_H_
-#include <rtl/memory.h>
-#endif
#ifndef _RTL_STRING_H_
#include <rtl/string.h>
#endif
@@ -96,10 +93,56 @@
#include <store/lockbyte.hxx>
#endif
+#ifndef INCLUDED_CSTDDEF
+#include <cstddef>
+#define INCLUDED_CSTDDEF
+#endif
+
+#ifndef INCLUDED_CSTRING
+#include <cstring>
+#define INCLUDED_CSTRING
+#endif
+
+/*========================================================================
+ *
+ * store common internals.
+ *
+ *======================================================================*/
+/* MSVC 6.0 still has std functions in global namespace */
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
+#define __STORE_CSTD
+#else
+#define __STORE_CSTD std
+#endif /* _MSC_VER */
+
#ifndef __STORE_DELETEZ
#define __STORE_DELETEZ(p) (delete p, p = 0)
#endif
+/*
+ * __store_memcpy.
+ */
+inline void __store_memcpy (void * dst, const void * src, sal_uInt32 n)
+{
+ __STORE_CSTD::memcpy (dst, src, n);
+}
+
+/*
+ * __store_memmove.
+ */
+inline void __store_memmove (void * dst, const void * src, sal_uInt32 n)
+{
+ __STORE_CSTD::memmove (dst, src, n);
+}
+
+/*
+ * __store_memset.
+ */
+inline void __store_memset (void * dst, int val, sal_uInt32 n)
+{
+ __STORE_CSTD::memset (dst, val, n);
+}
+
namespace store
{
@@ -391,7 +434,7 @@ struct OStorePageNameBlock
m_aGuard = G();
m_aKey = K();
m_nAttrib = 0;
- rtl_zeroMemory (m_pData, sizeof(m_pData));
+ __store_memset (m_pData, 0, sizeof(m_pData));
}
/** Construction.
@@ -399,7 +442,7 @@ struct OStorePageNameBlock
OStorePageNameBlock (void)
: m_nAttrib (0)
{
- rtl_zeroMemory (m_pData, sizeof(m_pData));
+ __store_memset (m_pData, 0, sizeof(m_pData));
}
/** Comparison.
@@ -605,6 +648,17 @@ class OStorePageObject
typedef OStorePageDescriptor D;
public:
+ /** Allocation.
+ */
+ static void * operator new (std::size_t n) SAL_THROW(())
+ {
+ return rtl_allocateMemory (sal_uInt32(n));
+ }
+ static void operator delete (void * p, std::size_t) SAL_THROW(())
+ {
+ rtl_freeMemory (p);
+ }
+
/** Construction.
*/
inline OStorePageObject (page& rPage);