summaryrefslogtreecommitdiff
path: root/registry/source
diff options
context:
space:
mode:
authorJuergen Schmidt <jsc@openoffice.org>2000-10-09 10:54:41 +0000
committerJuergen Schmidt <jsc@openoffice.org>2000-10-09 10:54:41 +0000
commit7b1a97badbc2387962c36875712c6ef5df0b0ea9 (patch)
tree60de1512c45a1590baeb2b724e4b61902d69ba45 /registry/source
parent742d9bc4a0114c7d69a6012758b0c0d4e0a155b4 (diff)
change the binary typelibrary format, make it extendable
Diffstat (limited to 'registry/source')
-rw-r--r--registry/source/reflcnst.hxx24
-rw-r--r--registry/source/reflread.cxx183
-rw-r--r--registry/source/reflwrit.cxx178
3 files changed, 258 insertions, 127 deletions
diff --git a/registry/source/reflcnst.hxx b/registry/source/reflcnst.hxx
index a57addcce1cc..caa4d9212499 100644
--- a/registry/source/reflcnst.hxx
+++ b/registry/source/reflcnst.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: reflcnst.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ * last change: $Author: jsc $ $Date: 2000-10-09 11:54:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,17 +79,23 @@ extern const sal_uInt16 majorVersion;
#define OFFSET_SIZE (OFFSET_MAGIC + sizeof(magic))
#define OFFSET_MINOR_VERSION (OFFSET_SIZE + sizeof(sal_uInt32))
#define OFFSET_MAJOR_VERSION (OFFSET_MINOR_VERSION + sizeof(minorVersion))
-#define OFFSET_TYPE_CLASS (OFFSET_MAJOR_VERSION + sizeof(majorVersion))
+#define OFFSET_N_ENTRIES (OFFSET_MAJOR_VERSION + sizeof(sal_uInt16))
+#define OFFSET_TYPE_SOURCE (OFFSET_N_ENTRIES + sizeof(sal_uInt16))
+#define OFFSET_TYPE_CLASS (OFFSET_TYPE_SOURCE + sizeof(sal_uInt16))
#define OFFSET_THIS_TYPE (OFFSET_TYPE_CLASS + sizeof(sal_uInt16))
#define OFFSET_SUPER_TYPE (OFFSET_THIS_TYPE + sizeof(sal_uInt16))
#define OFFSET_UIK (OFFSET_SUPER_TYPE + sizeof(sal_uInt16))
#define OFFSET_DOKU (OFFSET_UIK + sizeof(sal_uInt16))
#define OFFSET_FILENAME (OFFSET_DOKU + sizeof(sal_uInt16))
-#define OFFSET_CP_SIZE (OFFSET_FILENAME + sizeof(sal_uInt16))
+
+#define OFFSET_N_SUPERTYPES (OFFSET_FILENAME + sizeof(sal_uInt16))
+#define OFFSET_SUPERTYPES (OFFSET_N_SUPERTYPES + sizeof(sal_uInt16))
+
+#define OFFSET_CP_SIZE (OFFSET_SUPERTYPES + sizeof(sal_uInt16))
#define OFFSET_CP (OFFSET_CP_SIZE + sizeof(sal_uInt16))
#define CP_OFFSET_ENTRY_SIZE 0
-#define CP_OFFSET_ENTRY_TAG (CP_OFFSET_ENTRY_SIZE + sizeof(sal_uInt16))
+#define CP_OFFSET_ENTRY_TAG (CP_OFFSET_ENTRY_SIZE + sizeof(sal_uInt32))
#define CP_OFFSET_ENTRY_DATA (CP_OFFSET_ENTRY_TAG + sizeof(sal_uInt16))
#define CP_OFFSET_ENTRY_UIK1 CP_OFFSET_ENTRY_DATA
#define CP_OFFSET_ENTRY_UIK2 (CP_OFFSET_ENTRY_UIK1 + sizeof(sal_uInt32))
@@ -103,12 +109,12 @@ extern const sal_uInt16 majorVersion;
#define FIELD_OFFSET_VALUE (FIELD_OFFSET_TYPE + sizeof(sal_uInt16))
#define FIELD_OFFSET_DOKU (FIELD_OFFSET_VALUE + sizeof(sal_uInt16))
#define FIELD_OFFSET_FILENAME (FIELD_OFFSET_DOKU + sizeof(sal_uInt16))
-#define FIELD_ENTRY_SIZE (FIELD_OFFSET_FILENAME + sizeof(sal_uInt16))
+//#define FIELD_ENTRY_SIZE (FIELD_OFFSET_FILENAME + sizeof(sal_uInt16))
#define PARAM_OFFSET_TYPE 0
#define PARAM_OFFSET_MODE (PARAM_OFFSET_TYPE + sizeof(sal_uInt16))
#define PARAM_OFFSET_NAME (PARAM_OFFSET_MODE + sizeof(sal_uInt16))
-#define PARAM_ENTRY_SIZE (PARAM_OFFSET_NAME + sizeof(sal_uInt16))
+//#define PARAM_ENTRY_SIZE (PARAM_OFFSET_NAME + sizeof(sal_uInt16))
#define METHOD_OFFSET_SIZE 0
#define METHOD_OFFSET_MODE (METHOD_OFFSET_SIZE + sizeof(sal_uInt16))
@@ -116,13 +122,13 @@ extern const sal_uInt16 majorVersion;
#define METHOD_OFFSET_RETURN (METHOD_OFFSET_NAME + sizeof(sal_uInt16))
#define METHOD_OFFSET_DOKU (METHOD_OFFSET_RETURN + sizeof(sal_uInt16))
#define METHOD_OFFSET_PARAM_COUNT (METHOD_OFFSET_DOKU + sizeof(sal_uInt16))
-#define METHOD_OFFSET_PARAM(i) (METHOD_OFFSET_PARAM_COUNT + sizeof(sal_uInt16) + (i * PARAM_ENTRY_SIZE))
+//#define METHOD_OFFSET_PARAM(i) (METHOD_OFFSET_PARAM_COUNT + sizeof(sal_uInt16) + (i * PARAM_ENTRY_SIZE))
#define REFERENCE_OFFSET_TYPE 0
#define REFERENCE_OFFSET_NAME (REFERENCE_OFFSET_TYPE + sizeof(sal_uInt16))
#define REFERENCE_OFFSET_DOKU (REFERENCE_OFFSET_NAME + sizeof(sal_uInt16))
#define REFERENCE_OFFSET_ACCESS (REFERENCE_OFFSET_DOKU + sizeof(sal_uInt16))
-#define REFERENCE_ENTRY_SIZE (REFERENCE_OFFSET_ACCESS + sizeof(sal_uInt16))
+//#define REFERENCE_ENTRY_SIZE (REFERENCE_OFFSET_ACCESS + sizeof(sal_uInt16))
enum CPInfoTag
{
diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx
index cb462132db24..f0008b86d5e6 100644
--- a/registry/source/reflread.cxx
+++ b/registry/source/reflread.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: reflread.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ * last change: $Author: jsc $ $Date: 2000-10-09 11:54:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -309,14 +309,12 @@ sal_uInt32 ConstantPool::parseIndex()
for (int i = 0; i < m_numOfEntries; i++)
{
- m_pIndex[i] = (sal_Int32) offset;
+ m_pIndex[i] = offset;
- offset += readUINT16(offset);
+ offset += readUINT32(offset);
- if (
- ((CPInfoTag) readUINT16(m_pIndex[i] + CP_OFFSET_ENTRY_TAG)) ==
- CP_TAG_CONST_STRING
- )
+ if ( ((CPInfoTag) readUINT16(m_pIndex[i] + CP_OFFSET_ENTRY_TAG)) ==
+ CP_TAG_CONST_STRING )
{
numOfStrings++;
}
@@ -564,6 +562,8 @@ class FieldList : public BlopObject
public:
sal_uInt16 m_numOfEntries;
+ sal_uInt16 m_numOfFieldEntries;
+ sal_uInt8 m_FIELD_ENTRY_SIZE;
ConstantPool* m_pCP;
FieldList(const sal_uInt8* buffer, sal_uInt16 numEntries, ConstantPool* pCP)
@@ -571,6 +571,15 @@ public:
, m_numOfEntries(numEntries)
, m_pCP(pCP)
{
+ if ( m_numOfEntries > 0 )
+ {
+ m_numOfFieldEntries = readUINT16(0);
+ m_FIELD_ENTRY_SIZE = m_numOfFieldEntries * sizeof(sal_uInt16);
+ } else
+ {
+ m_numOfFieldEntries = 0;
+ m_FIELD_ENTRY_SIZE = 0;
+ }
}
sal_uInt32 parseIndex();
@@ -585,16 +594,16 @@ public:
sal_uInt32 FieldList::parseIndex()
{
- return (m_numOfEntries * (sizeof(sal_uInt16) * 6));
+ return ((m_numOfEntries ? sizeof(sal_uInt16) : 0) + (m_numOfEntries * m_FIELD_ENTRY_SIZE));
}
const sal_Char* FieldList::getFieldName(sal_uInt16 index)
{
const sal_Char* aName = NULL;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- aName = m_pCP->readUTF8NameConstant(readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_NAME));
+ aName = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_NAME));
}
return aName;
@@ -604,9 +613,9 @@ const sal_Char* FieldList::getFieldType(sal_uInt16 index)
{
const sal_Char* aName = NULL;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- aName = m_pCP->readUTF8NameConstant(readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_TYPE));
+ aName = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_TYPE));
}
return aName;
@@ -616,9 +625,9 @@ RTFieldAccess FieldList::getFieldAccess(sal_uInt16 index)
{
RTFieldAccess aAccess;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- aAccess = (RTFieldAccess) readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_ACCESS);
+ aAccess = (RTFieldAccess) readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_ACCESS);
}
return aAccess;
@@ -628,9 +637,9 @@ RTValueType FieldList::getFieldConstValue(sal_uInt16 index, RTConstValueUnion* v
{
RTValueType ret = RT_TYPE_NONE;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- sal_uInt16 cpIndex = readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_VALUE);
+ sal_uInt16 cpIndex = readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_VALUE);
switch (m_pCP->readTag(cpIndex))
{
@@ -690,9 +699,9 @@ const sal_Char* FieldList::getFieldDoku(sal_uInt16 index)
{
const sal_Char* aDoku = NULL;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- aDoku = m_pCP->readUTF8NameConstant(readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_DOKU));
+ aDoku = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_DOKU));
}
return aDoku;
@@ -702,9 +711,9 @@ const sal_Char* FieldList::getFieldFileName(sal_uInt16 index)
{
const sal_Char* aFileName = NULL;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- aFileName = m_pCP->readUTF8NameConstant(readUINT16((index * FIELD_ENTRY_SIZE) + FIELD_OFFSET_FILENAME));
+ aFileName = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_FIELD_ENTRY_SIZE) + FIELD_OFFSET_FILENAME));
}
return aFileName;
@@ -720,7 +729,9 @@ class ReferenceList : public BlopObject
{
public:
- sal_uInt16 m_numOfEntries;
+ sal_uInt16 m_numOfEntries;
+ sal_uInt16 m_numOfReferenceEntries;
+ sal_uInt8 m_REFERENCE_ENTRY_SIZE;
ConstantPool* m_pCP;
ReferenceList(const sal_uInt8* buffer, sal_uInt16 numEntries, ConstantPool* pCP)
@@ -728,6 +739,15 @@ public:
, m_numOfEntries(numEntries)
, m_pCP(pCP)
{
+ if ( m_numOfEntries > 0 )
+ {
+ m_numOfReferenceEntries = readUINT16(0);
+ m_REFERENCE_ENTRY_SIZE = m_numOfReferenceEntries * sizeof(sal_uInt16);
+ } else
+ {
+ m_numOfReferenceEntries = 0;
+ m_REFERENCE_ENTRY_SIZE = 0;
+ }
}
sal_uInt32 parseIndex();
@@ -740,16 +760,16 @@ public:
sal_uInt32 ReferenceList::parseIndex()
{
- return (m_numOfEntries * (sizeof(sal_uInt16) * 4));
+ return ((m_numOfEntries ? sizeof(sal_uInt16) : 0) + (m_numOfEntries * m_REFERENCE_ENTRY_SIZE));
}
const sal_Char* ReferenceList::getReferenceName(sal_uInt16 index)
{
const sal_Char* aName = NULL;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- aName = m_pCP->readUTF8NameConstant(readUINT16((index * REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_NAME));
+ aName = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_NAME));
}
return aName;
@@ -759,9 +779,9 @@ RTReferenceType ReferenceList::getReferenceType(sal_uInt16 index)
{
RTReferenceType refType;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- refType = (RTReferenceType) readUINT16((index * REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_TYPE);
+ refType = (RTReferenceType) readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_TYPE);
}
return refType;
@@ -771,9 +791,9 @@ const sal_Char* ReferenceList::getReferenceDoku(sal_uInt16 index)
{
const sal_Char* aDoku = NULL;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- aDoku = m_pCP->readUTF8NameConstant(readUINT16((index * REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_DOKU));
+ aDoku = m_pCP->readUTF8NameConstant(readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_DOKU));
}
return aDoku;
@@ -783,9 +803,9 @@ RTFieldAccess ReferenceList::getReferenceAccess(sal_uInt16 index)
{
RTFieldAccess aAccess;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- aAccess = (RTFieldAccess) readUINT16((index * REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_ACCESS);
+ aAccess = (RTFieldAccess) readUINT16(sizeof(sal_uInt16) + (index * m_REFERENCE_ENTRY_SIZE) + REFERENCE_OFFSET_ACCESS);
}
return aAccess;
@@ -801,8 +821,11 @@ class MethodList : public BlopObject
{
public:
- sal_uInt16 m_numOfEntries;
- sal_uInt32* m_pIndex;
+ sal_uInt16 m_numOfEntries;
+ sal_uInt16 m_numOfMethodEntries;
+ sal_uInt16 m_numOfParamEntries;
+ sal_uInt8 m_PARAM_ENTRY_SIZE;
+ sal_uInt32* m_pIndex;
ConstantPool* m_pCP;
MethodList(const sal_uInt8* buffer, sal_uInt16 numEntries, ConstantPool* pCP)
@@ -811,6 +834,17 @@ public:
, m_pIndex(NULL)
, m_pCP(pCP)
{
+ if ( m_numOfEntries > 0 )
+ {
+ m_numOfMethodEntries = readUINT16(0);
+ m_numOfParamEntries = readUINT16(sizeof(sal_uInt16));
+ m_PARAM_ENTRY_SIZE = m_numOfParamEntries * sizeof(sal_uInt16);
+ } else
+ {
+ m_numOfMethodEntries = 0;
+ m_numOfParamEntries = 0;
+ m_PARAM_ENTRY_SIZE = 0;
+ }
}
~MethodList();
@@ -827,6 +861,9 @@ public:
const sal_Char* getMethodReturnType(sal_uInt16 index);
RTMethodMode getMethodMode(sal_uInt16 index);
const sal_Char* getMethodDoku(sal_uInt16 index);
+
+private:
+ sal_uInt8 calcMethodParamIndex( const sal_uInt8 index );
};
MethodList::~MethodList()
@@ -834,6 +871,11 @@ MethodList::~MethodList()
if (m_pIndex) delete[] m_pIndex;
}
+sal_uInt8 MethodList::calcMethodParamIndex( const sal_uInt8 index )
+{
+ return (METHOD_OFFSET_PARAM_COUNT + sizeof(sal_uInt16) + (index * m_PARAM_ENTRY_SIZE));
+}
+
sal_uInt32 MethodList::parseIndex()
{
if (m_pIndex)
@@ -846,6 +888,7 @@ sal_uInt32 MethodList::parseIndex()
if (m_numOfEntries)
{
+ offset = 2 * sizeof(sal_uInt16);
m_pIndex = new sal_uInt32[m_numOfEntries];
for (int i = 0; i < m_numOfEntries; i++)
@@ -863,7 +906,7 @@ const sal_Char* MethodList::getMethodName(sal_uInt16 index)
{
const sal_Char* aName = NULL;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
aName = m_pCP->readUTF8NameConstant(readUINT16(m_pIndex[index] + METHOD_OFFSET_NAME));
}
@@ -875,7 +918,7 @@ sal_uInt16 MethodList::getMethodParamCount(sal_uInt16 index)
{
sal_uInt16 aCount = 0;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
aCount = readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT);
}
@@ -887,12 +930,14 @@ const sal_Char* MethodList::getMethodParamType(sal_uInt16 index, sal_uInt16 para
{
const sal_Char* aName = NULL;
- if ((index <= m_numOfEntries) && (paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
+ if ((m_numOfEntries > 0) &&
+ (index <= m_numOfEntries) &&
+ (paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
{
aName = m_pCP->readUTF8NameConstant(
readUINT16(
m_pIndex[index] +
- METHOD_OFFSET_PARAM(paramIndex) +
+ calcMethodParamIndex(paramIndex) +
PARAM_OFFSET_TYPE));
}
@@ -903,12 +948,14 @@ const sal_Char* MethodList::getMethodParamName(sal_uInt16 index, sal_uInt16 para
{
const sal_Char* aName = NULL;
- if ((index <= m_numOfEntries) && (paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
+ if ((m_numOfEntries > 0) &&
+ (index <= m_numOfEntries) &&
+ (paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
{
aName = m_pCP->readUTF8NameConstant(
readUINT16(
m_pIndex[index] +
- METHOD_OFFSET_PARAM(paramIndex) +
+ calcMethodParamIndex(paramIndex) +
PARAM_OFFSET_NAME));
}
@@ -919,11 +966,13 @@ RTParamMode MethodList::getMethodParamMode(sal_uInt16 index, sal_uInt16 paramInd
{
RTParamMode aMode = RT_PARAM_INVALID;
- if ((index <= m_numOfEntries) && (paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
+ if ((m_numOfEntries > 0) &&
+ (index <= m_numOfEntries) &&
+ (paramIndex <= readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)))
{
aMode = (RTParamMode) readUINT16(
m_pIndex[index] +
- METHOD_OFFSET_PARAM(paramIndex) +
+ calcMethodParamIndex(paramIndex) +
PARAM_OFFSET_MODE);
}
@@ -934,9 +983,9 @@ sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index)
{
sal_uInt16 aCount = 0;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- aCount = readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM(readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)));
+ aCount = readUINT16(m_pIndex[index] + calcMethodParamIndex(readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)));
}
return aCount;
@@ -946,9 +995,9 @@ const sal_Char* MethodList::getMethodExcType(sal_uInt16 index, sal_uInt16 excInd
{
const sal_Char* aName = NULL;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
- sal_uInt32 excOffset = m_pIndex[index] + METHOD_OFFSET_PARAM(readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT));
+ sal_uInt32 excOffset = m_pIndex[index] + calcMethodParamIndex(readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT));
if (excIndex <= readUINT16(excOffset))
{
@@ -967,7 +1016,7 @@ const sal_Char* MethodList::getMethodReturnType(sal_uInt16 index)
{
const sal_Char* aName = NULL;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
aName = m_pCP->readUTF8NameConstant(readUINT16(m_pIndex[index] + METHOD_OFFSET_RETURN));
}
@@ -979,7 +1028,7 @@ RTMethodMode MethodList::getMethodMode(sal_uInt16 index)
{
RTMethodMode aMode = RT_MODE_INVALID;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
aMode = (RTMethodMode) readUINT16(m_pIndex[index] + METHOD_OFFSET_MODE);
}
@@ -991,7 +1040,7 @@ const sal_Char* MethodList::getMethodDoku(sal_uInt16 index)
{
const sal_Char* aDoku = NULL;
- if (index <= m_numOfEntries)
+ if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
aDoku = m_pCP->readUTF8NameConstant(readUINT16(m_pIndex[index] + METHOD_OFFSET_DOKU));
}
@@ -1015,6 +1064,8 @@ public:
MethodList* m_pMethods;
ReferenceList* m_pReferences;
sal_uInt32 m_refCount;
+ sal_uInt16 m_nSuperTypes;
+ sal_uInt16 m_offset_SUPERTYPES;
TypeRegistryEntry(const sal_uInt8* buffer, sal_uInt32 len, sal_Bool copyBuffer)
: BlopObject(buffer, len, copyBuffer)
@@ -1023,12 +1074,14 @@ public:
, m_pMethods(NULL)
, m_pReferences(NULL)
, m_refCount(1)
+ , m_nSuperTypes(0)
+ , m_offset_SUPERTYPES(0)
{
}
~TypeRegistryEntry();
- void init() const;
+ void init();
};
@@ -1041,7 +1094,7 @@ TypeRegistryEntry::~TypeRegistryEntry()
}
-void TypeRegistryEntry::init() const
+void TypeRegistryEntry::init()
{
#ifdef OS2
TypeRegistryEntry* _This = (TypeRegistryEntry*)(this);
@@ -1055,19 +1108,31 @@ void TypeRegistryEntry::init() const
_This->m_pCP = NULL;
}
- _This->m_pCP = new ConstantPool(m_pBuffer + OFFSET_CP, readUINT16(OFFSET_CP_SIZE));
+ sal_uInt16 entrySize = sizeof(sal_uInt16);
+ sal_uInt16 nHeaderEntries = readUINT16(OFFSET_N_ENTRIES);
+ sal_uInt16 offset_N_SUPERTYPES = OFFSET_N_ENTRIES + entrySize + (nHeaderEntries * entrySize);
+ m_offset_SUPERTYPES = offset_N_SUPERTYPES + entrySize;
+ m_nSuperTypes = readUINT16(offset_N_SUPERTYPES);
+
+ sal_uInt16 offset_CP_SIZE = m_offset_SUPERTYPES + (m_nSuperTypes * entrySize);
+ sal_uInt16 offset_CP = offset_CP_SIZE + entrySize;
- sal_uInt32 offset = OFFSET_CP + _This->m_pCP->parseIndex();
+ _This->m_pCP = new ConstantPool(m_pBuffer + offset_CP, readUINT16(offset_CP_SIZE));
- _This->m_pFields = new FieldList(m_pBuffer + offset + sizeof(sal_uInt16), readUINT16(offset), _This->m_pCP);
+ sal_uInt32 offset = offset_CP + _This->m_pCP->parseIndex();
+
+ _This->m_pFields = new FieldList(m_pBuffer + offset + entrySize,
+ readUINT16(offset), _This->m_pCP);
offset += sizeof(sal_uInt16) + _This->m_pFields->parseIndex();
- _This->m_pMethods = new MethodList(m_pBuffer + offset + sizeof(sal_uInt16), readUINT16(offset), _This->m_pCP);
+ _This->m_pMethods = new MethodList(m_pBuffer + offset + entrySize,
+ readUINT16(offset), _This->m_pCP);
offset += sizeof(sal_uInt16) + _This->m_pMethods->parseIndex();
- _This->m_pReferences = new ReferenceList(m_pBuffer + offset + sizeof(sal_uInt16), readUINT16(offset), _This->m_pCP);
+ _This->m_pReferences = new ReferenceList(m_pBuffer + offset + entrySize,
+ readUINT16(offset), _This->m_pCP);
offset += sizeof(sal_uInt16) + _This->m_pReferences->parseIndex();
}
@@ -1175,7 +1240,13 @@ static void TYPEREG_CALLTYPE getSuperTypeName(TypeReaderImpl hEntry, rtl_uString
if (pEntry->m_pCP == NULL) pEntry->init();
- const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(OFFSET_SUPER_TYPE));
+ if (pEntry->m_nSuperTypes == 0)
+ {
+ rtl_uString_new(pSuperTypeName);
+ return;
+ }
+
+ const sal_Char* pTmp = pEntry->m_pCP->readUTF8NameConstant(pEntry->readUINT16(pEntry->m_offset_SUPERTYPES )); //+ (index * sizeof(sal_uInt16))));
if ( pTmp )
rtl_string2UString( pSuperTypeName, pTmp, rtl_str_getLength(pTmp), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
}
diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx
index d8e1e2c74350..f13de40e6239 100644
--- a/registry/source/reflwrit.cxx
+++ b/registry/source/reflwrit.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: reflwrit.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 15:18:42 $
+ * last change: $Author: jsc $ $Date: 2000-10-09 11:54:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,40 +83,49 @@ ORealDynamicLoader* ODynamicLoader<RegistryTypeWriter_Api>::m_pLoader = NULL;
#define BLOP_OFFSET_SIZE (BLOP_OFFSET_MAGIC + sizeof(sal_uInt32))
#define BLOP_OFFSET_MINOR (BLOP_OFFSET_SIZE + sizeof(sal_uInt32))
#define BLOP_OFFSET_MAJOR (BLOP_OFFSET_MINOR + sizeof(sal_uInt16))
-#define BLOP_OFFSET_TYPE_CLASS (BLOP_OFFSET_MAJOR + sizeof(sal_uInt16))
+#define BLOP_OFFSET_N_ENTRIES (BLOP_OFFSET_MAJOR + sizeof(sal_uInt16))
+#define BLOP_OFFSET_TYPE_SOURCE (BLOP_OFFSET_N_ENTRIES + sizeof(sal_uInt16))
+#define BLOP_OFFSET_TYPE_CLASS (BLOP_OFFSET_TYPE_SOURCE + sizeof(sal_uInt16))
#define BLOP_OFFSET_THIS (BLOP_OFFSET_TYPE_CLASS + sizeof(sal_uInt16))
-#define BLOP_OFFSET_SUPER (BLOP_OFFSET_THIS + sizeof(sal_uInt16))
-#define BLOP_OFFSET_UIK (BLOP_OFFSET_SUPER + sizeof(sal_uInt16))
+//#define BLOP_OFFSET_SUPER (BLOP_OFFSET_THIS + sizeof(sal_uInt16))
+#define BLOP_OFFSET_UIK (BLOP_OFFSET_THIS + sizeof(sal_uInt16))
#define BLOP_OFFSET_DOKU (BLOP_OFFSET_UIK + sizeof(sal_uInt16))
#define BLOP_OFFSET_FILENAME (BLOP_OFFSET_DOKU + sizeof(sal_uInt16))
-#define BLOP_HEADER_SIZE (BLOP_OFFSET_FILENAME + sizeof(sal_uInt16))
+//#define BLOP_HEADER_SIZE (BLOP_OFFSET_FILENAME + sizeof(sal_uInt16))
+#define BLOP_HEADER_N_ENTRIES 6
+#define BLOP_OFFSET_N_SUPERTYPES 0
+#define BLOP_OFFSET_SUPERTYPES (BLOP_OFFSET_N_SUPERTYPES + sizeof(sal_uInt16))
-#define BLOP_FIELD_ENTRY_ACCESS 0
+#define BLOP_FIELD_ENTRY_ACCESS 0
#define BLOP_FIELD_ENTRY_NAME (BLOP_FIELD_ENTRY_ACCESS + sizeof(sal_uInt16))
#define BLOP_FIELD_ENTRY_TYPE (BLOP_FIELD_ENTRY_NAME + sizeof(sal_uInt16))
#define BLOP_FIELD_ENTRY_VALUE (BLOP_FIELD_ENTRY_TYPE + sizeof(sal_uInt16))
#define BLOP_FIELD_ENTRY_DOKU (BLOP_FIELD_ENTRY_VALUE + sizeof(sal_uInt16))
#define BLOP_FIELD_ENTRY_FILENAME (BLOP_FIELD_ENTRY_DOKU + sizeof(sal_uInt16))
-#define BLOP_FIELD_ENTRY_SIZE (BLOP_FIELD_ENTRY_FILENAME + sizeof(sal_uInt16))
+//#define BLOP_FIELD_ENTRY_SIZE (BLOP_FIELD_ENTRY_FILENAME + sizeof(sal_uInt16))
+#define BLOP_FIELD_N_ENTRIES 6
#define BLOP_METHOD_SIZE 0
#define BLOP_METHOD_MODE (BLOP_METHOD_SIZE + sizeof(sal_uInt16))
#define BLOP_METHOD_NAME (BLOP_METHOD_MODE + sizeof(sal_uInt16))
#define BLOP_METHOD_RETURN (BLOP_METHOD_NAME + sizeof(sal_uInt16))
#define BLOP_METHOD_DOKU (BLOP_METHOD_RETURN + sizeof(sal_uInt16))
-#define BLOP_METHOD_HEADER_SIZE (BLOP_METHOD_DOKU + sizeof(sal_uInt16))
+//#define BLOP_METHOD_HEADER_SIZE (BLOP_METHOD_DOKU + sizeof(sal_uInt16))
+#define BLOP_METHOD_N_ENTRIES 5
#define BLOP_PARAM_TYPE 0
#define BLOP_PARAM_MODE (BLOP_PARAM_TYPE + sizeof(sal_uInt16))
#define BLOP_PARAM_NAME (BLOP_PARAM_MODE + sizeof(sal_uInt16))
-#define BLOP_PARAM_ENTRY_SIZE (BLOP_PARAM_NAME + sizeof(sal_uInt16))
+//#define BLOP_PARAM_ENTRY_SIZE (BLOP_PARAM_NAME + sizeof(sal_uInt16))
+#define BLOP_PARAM_N_ENTRIES 3
#define BLOP_REFERENCE_TYPE 0
#define BLOP_REFERENCE_NAME (BLOP_REFERENCE_TYPE + sizeof(sal_uInt16))
#define BLOP_REFERENCE_DOKU (BLOP_REFERENCE_NAME + sizeof(sal_uInt16))
#define BLOP_REFERENCE_ACCESS (BLOP_REFERENCE_DOKU + sizeof(sal_uInt16))
-#define BLOP_REFERENCE_ENTRY_SIZE (BLOP_REFERENCE_ACCESS + sizeof(sal_uInt16))
+//#define BLOP_REFERENCE_ENTRY_SIZE (BLOP_REFERENCE_ACCESS + sizeof(sal_uInt16))
+#define BLOP_REFERENCE_N_ENTRIES 4
sal_uInt32 UINT16StringLen(const sal_uInt8* wstring)
{
@@ -278,22 +287,11 @@ struct CPInfo
union
{
const sal_Char* aUtf8;
- RTUik* aUik;
+ RTUik* aUik;
RTConstValueUnion aConst;
-/* sal_Bool aBool;
- sal_uInt8 aByte;
- sal_Int16 aShort;
- sal_uInt16 aUShort;
- sal_Int32 aLong;
- sal_uInt32 aULong;
-// INT64 aHyper;
-// UINT64 aUHyper;
- float aFloat;
- double aDouble;
- const sal_Unicode* aString;*/
} m_value;
- sal_uInt16 m_index;
+ sal_uInt16 m_index;
struct CPInfo* m_next;
CPInfo(CPInfoTag tag, struct CPInfo* prev);
@@ -317,7 +315,7 @@ CPInfo::CPInfo(CPInfoTag tag, struct CPInfo* prev)
sal_uInt32 CPInfo::getBlopSize()
{
- sal_uInt32 size = sizeof(sal_uInt16) /* size */ + sizeof(sal_uInt16) /* tag */;
+ sal_uInt32 size = sizeof(sal_uInt32) /* size */ + sizeof(sal_uInt16) /* tag */;
switch (m_tag)
{
@@ -372,7 +370,7 @@ sal_uInt32 CPInfo::toBlop(sal_uInt8* buffer, sal_uInt32 maxLen)
{
sal_uInt8* buff = buffer;
- buff += writeUINT16(buff, (sal_uInt16) getBlopSize());
+ buff += writeUINT32(buff, getBlopSize());
buff += writeUINT16(buff, (sal_uInt16) m_tag);
switch (m_tag)
@@ -745,9 +743,11 @@ class TypeWriter
public:
sal_uInt32 m_refCount;
+ RTTypeSource m_typeSource;
RTTypeClass m_typeClass;
OString m_typeName;
- OString m_superTypeName;
+ sal_uInt16 m_nSuperTypes;
+ OString* m_superTypeNames;
RTUik* m_pUik;
OString m_doku;
OString m_fileName;
@@ -761,7 +761,8 @@ public:
sal_uInt8* m_blop;
sal_uInt32 m_blopSize;
- TypeWriter(RTTypeClass RTTypeClass,
+ TypeWriter(RTTypeSource RTTypeSource,
+ RTTypeClass RTTypeClass,
const OString& typeName,
const OString& superTypeName,
sal_uInt16 FieldCount,
@@ -773,16 +774,18 @@ public:
void createBlop();
};
-TypeWriter::TypeWriter(RTTypeClass RTTypeClass,
+TypeWriter::TypeWriter(RTTypeSource RTTypeSource,
+ RTTypeClass RTTypeClass,
const OString& typeName,
const OString& superTypeName,
sal_uInt16 fieldCount,
sal_uInt16 methodCount,
sal_uInt16 referenceCount)
: m_refCount(1)
+ , m_typeSource(RTTypeSource)
, m_typeClass(RTTypeClass)
, m_typeName(typeName)
- , m_superTypeName(superTypeName)
+ , m_nSuperTypes(superTypeName.getLength() > 0 ? 1 : 0)
, m_fieldCount(fieldCount)
, m_methodCount(methodCount)
, m_referenceCount(referenceCount)
@@ -790,6 +793,15 @@ TypeWriter::TypeWriter(RTTypeClass RTTypeClass,
, m_blopSize(0)
, m_pUik(NULL)
{
+ if (m_nSuperTypes > 0)
+ {
+ m_superTypeNames = new OString[m_nSuperTypes];
+ m_superTypeNames[0] = superTypeName;
+ } else
+ {
+ m_superTypeNames = NULL;
+ }
+
if (m_fieldCount)
m_fields = new FieldEntry[fieldCount];
@@ -802,6 +814,9 @@ TypeWriter::TypeWriter(RTTypeClass RTTypeClass,
TypeWriter::~TypeWriter()
{
+ if (m_superTypeNames)
+ delete[] m_superTypeNames;
+
if (m_blop)
delete[] m_blop;
@@ -833,26 +848,43 @@ void TypeWriter::createBlop()
delete[] m_blop;
CPInfo root(CP_TAG_INVALID, NULL);
- sal_uInt16 cpIndexThisName = 0;
- sal_uInt16 cpIndexSuperName = 0;
- sal_uInt16 cpIndexUik = 0;
- sal_uInt16 cpIndexDoku = 0;
- sal_uInt16 cpIndexFileName = 0;
+ sal_uInt32 cpIndexThisName = 0;
+ sal_uInt32* cpIndexSuperNames = NULL;
+ sal_uInt32 cpIndexUik = 0;
+ sal_uInt32 cpIndexDoku = 0;
+ sal_uInt32 cpIndexFileName = 0;
CPInfo* pInfo = NULL;
- m_blopSize = BLOP_HEADER_SIZE;
+ sal_uInt16 entrySize = sizeof(sal_uInt16);
+ sal_uInt32 blopHeaderEntrySize = BLOP_OFFSET_N_ENTRIES + entrySize + (BLOP_HEADER_N_ENTRIES * entrySize);
+ sal_uInt32 blopFieldEntrySize = BLOP_FIELD_N_ENTRIES * entrySize;
+ sal_uInt32 blopMethodEntrySize = BLOP_METHOD_N_ENTRIES * entrySize;
+ sal_uInt32 blopParamEntrySize = BLOP_PARAM_N_ENTRIES * entrySize;
+ sal_uInt32 blopReferenceEntrySize = BLOP_REFERENCE_N_ENTRIES * entrySize;
+
+ m_blopSize = blopHeaderEntrySize;
// create CP entry for this name
pInfo = new CPInfo(CP_TAG_UTF8_NAME, &root);
pInfo->m_value.aUtf8 = m_typeName.getStr();
cpIndexThisName = pInfo->m_index;
- // create CP entry for super name
- if (m_superTypeName.getLength())
+ // nSuperTypes
+ m_blopSize += entrySize;
+
+ // create CP entry for super names
+ if (m_nSuperTypes)
{
- pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
- pInfo->m_value.aUtf8 = m_superTypeName.getStr();
- cpIndexSuperName = pInfo->m_index;
+ m_blopSize += m_nSuperTypes * entrySize;
+
+ cpIndexSuperNames = new sal_uInt32[m_nSuperTypes];
+
+ for (sal_uInt32 i=0; i < m_nSuperTypes; i++)
+ {
+ pInfo = new CPInfo(CP_TAG_UTF8_NAME, pInfo);
+ pInfo->m_value.aUtf8 = m_superTypeNames[i].getStr();
+ cpIndexSuperNames[i] = pInfo->m_index;
+ }
}
// create CP entry for uik
@@ -880,8 +912,7 @@ void TypeWriter::createBlop()
}
// fields blop
-
- m_blopSize += sizeof(sal_uInt16); // fieldCount
+ m_blopSize += sizeof(sal_uInt16); // fieldCount + nFieldEntries
if (m_fieldCount)
{
@@ -891,13 +922,16 @@ void TypeWriter::createBlop()
sal_uInt16 cpIndexDoku = 0;
sal_uInt16 cpIndexFileName = 0;
- blopFieldsSize = m_fieldCount * BLOP_FIELD_ENTRY_SIZE;
+ // nFieldEntries + n fields
+ blopFieldsSize = sizeof(sal_uInt16) + (m_fieldCount * blopFieldEntrySize);
m_blopSize += blopFieldsSize;
pBlopFields = new sal_uInt8[blopFieldsSize];
pBuffer = pBlopFields;
+ pBuffer += writeUINT16(pBuffer, BLOP_FIELD_N_ENTRIES);
+
for (i = 0; i < m_fieldCount; i++)
{
cpIndexName = 0;
@@ -951,26 +985,26 @@ void TypeWriter::createBlop()
}
// methods blop
-
m_blopSize += sizeof(sal_uInt16); // methodCount
if (m_methodCount)
{
sal_uInt16* pMethodEntrySize = new sal_uInt16[m_methodCount];
- sal_uInt16 cpIndexName = 0;
- sal_uInt16 cpIndexReturn = 0;
- sal_uInt16 cpIndexDoku = 0;
+ sal_uInt32 cpIndexName = 0;
+ sal_uInt32 cpIndexReturn = 0;
+ sal_uInt32 cpIndexDoku = 0;
- blopMethodsSize = 0;
+ // nMethodEntries + nParamEntries
+ blopMethodsSize = (2 * sizeof(sal_uInt16));
for (i = 0; i < m_methodCount; i++)
{
pMethodEntrySize[i] =
- BLOP_METHOD_HEADER_SIZE + // header
- sizeof(sal_uInt16) + // parameterCount
- (m_methods[i].m_paramCount * BLOP_PARAM_ENTRY_SIZE) + // exceptions
- sizeof(sal_uInt16) + // exceptionCount
- (m_methods[i].m_excCount * sizeof(sal_uInt16)); // exceptions
+ blopMethodEntrySize + // header
+ sizeof(sal_uInt16) + // parameterCount
+ (m_methods[i].m_paramCount * blopParamEntrySize) + // exceptions
+ sizeof(sal_uInt16) + // exceptionCount
+ (m_methods[i].m_excCount * sizeof(sal_uInt16)); // exceptions
blopMethodsSize += pMethodEntrySize[i];
}
@@ -981,6 +1015,9 @@ void TypeWriter::createBlop()
pBuffer = pBlopMethods;
+ pBuffer += writeUINT16(pBuffer, BLOP_METHOD_N_ENTRIES);
+ pBuffer += writeUINT16(pBuffer, BLOP_PARAM_N_ENTRIES );
+
for (i = 0; i < m_methodCount; i++)
{
cpIndexReturn = 0;
@@ -1060,21 +1097,23 @@ void TypeWriter::createBlop()
}
// reference blop
-
- m_blopSize += sizeof(sal_uInt16); // referenceCount
+ m_blopSize += entrySize; // referenceCount
if (m_referenceCount)
{
- sal_uInt16 cpIndexName = 0;
- sal_uInt16 cpIndexDoku = 0;
+ sal_uInt32 cpIndexName = 0;
+ sal_uInt32 cpIndexDoku = 0;
- blopReferenceSize = m_referenceCount * BLOP_REFERENCE_ENTRY_SIZE;
+ // nReferenceEntries + n references
+ blopReferenceSize = entrySize + (m_referenceCount * blopReferenceEntrySize);
m_blopSize += blopReferenceSize;
pBlopReferences = new sal_uInt8[blopReferenceSize];
pBuffer = pBlopReferences;
+ pBuffer += writeUINT16(pBuffer, BLOP_REFERENCE_N_ENTRIES);
+
for (i = 0; i < m_referenceCount; i++)
{
pBuffer += writeUINT16(pBuffer, m_references[i].m_type);
@@ -1103,7 +1142,7 @@ void TypeWriter::createBlop()
}
- // CP infos blop-laenge holen
+ // get CP infos blop-length
pInfo = root.m_next;
sal_uInt32 cpBlopSize = 0;
sal_uInt16 cpCount = 0;
@@ -1128,12 +1167,26 @@ void TypeWriter::createBlop()
pBuffer += writeUINT32(pBuffer, m_blopSize);
pBuffer += writeUINT16(pBuffer, minorVersion);
pBuffer += writeUINT16(pBuffer, majorVersion);
+ pBuffer += writeUINT16(pBuffer, BLOP_HEADER_N_ENTRIES);
+
+ pBuffer += writeUINT16(pBuffer, (sal_uInt16)m_typeSource);
pBuffer += writeUINT16(pBuffer, (sal_uInt16)m_typeClass);
pBuffer += writeUINT16(pBuffer, cpIndexThisName);
- pBuffer += writeUINT16(pBuffer, cpIndexSuperName);
pBuffer += writeUINT16(pBuffer, cpIndexUik);
pBuffer += writeUINT16(pBuffer, cpIndexDoku);
pBuffer += writeUINT16(pBuffer, cpIndexFileName);
+
+ // write supertypes
+ pBuffer += writeUINT16(pBuffer, m_nSuperTypes);
+ if (m_nSuperTypes)
+ {
+ for (sal_uInt32 i=0; i < m_nSuperTypes; i++)
+ {
+ pBuffer += writeUINT16(pBuffer, cpIndexSuperNames[i]);
+ }
+ delete[] cpIndexSuperNames;
+ }
+
pBuffer += writeUINT16(pBuffer, cpCount);
// write and delete CP infos
@@ -1197,7 +1250,8 @@ static TypeWriterImpl TYPEREG_CALLTYPE createEntry(RTTypeClass RTTypeClass,
rtl_uString2String( &rTypeName.pData, typeName->buffer, typeName->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
rtl_uString2String( &rSuperTypeName.pData, superTypeName->buffer, superTypeName->length, RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
- return new TypeWriter(RTTypeClass,
+ return new TypeWriter(RT_UNO_IDL,
+ RTTypeClass,
rTypeName,
rSuperTypeName,
FieldCount,