summaryrefslogtreecommitdiff
path: root/sot/source/sdstor
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-10-01 15:34:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-10-01 15:35:20 +0100
commit542c93d10d56bef6c9d10ef35c62163b91537a8f (patch)
tree2e69c867cd44af0ced099d4d95edd0bd16a5d49b /sot/source/sdstor
parent6017ef25201a2bd0189de15ce35ff050d7c90fce (diff)
Document that this is known as StructuredStorageDirectoryEntry in the spec
Diffstat (limited to 'sot/source/sdstor')
-rw-r--r--sot/source/sdstor/stgelem.cxx14
-rw-r--r--sot/source/sdstor/stgelem.hxx3
2 files changed, 12 insertions, 5 deletions
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 26091e0c1cab..d5ba9f580179 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -40,6 +40,8 @@
#include "stgdir.hxx"
#include "stgio.hxx"
+static const sal_uInt16 nMaxLegalStr = 31;
+
static sal_uInt8 cStgSignature[ 8 ] = { 0xD0,0xCF,0x11,0xE0,0xA1,0xB1,0x1A,0xE1 };
////////////////////////////// struct ClsId /////////////////////////////
@@ -255,7 +257,7 @@ sal_Bool StgEntry::SetName( const String& rName )
{
// I don't know the locale, so en_US is hopefully fine
aName = ToUpperUnicode( rName );
- aName.Erase( 31 );
+ aName.Erase( nMaxLegalStr );
int i;
for( i = 0; i < aName.Len() && i < 32; i++ )
@@ -346,9 +348,13 @@ sal_Bool StgEntry::Load( const void* pFrom )
sal_uInt16 n = nNameLen;
if( n )
n = ( n >> 1 ) - 1;
- if( n > 31 || (nSize < 0 && cType != STG_STORAGE) )
+
+ if (n > nMaxLegalStr)
+ return sal_False;
+
+ if (nSize < 0 && cType != STG_STORAGE)
{
- // the size makes no sence for the substorage
+ // the size makes no sense for the substorage
// TODO/LATER: actually the size should be an unsigned value, but in this case it would mean a stream of more than 2Gb
return sal_False;
}
@@ -356,7 +362,7 @@ sal_Bool StgEntry::Load( const void* pFrom )
aName = String( nName, n );
// I don't know the locale, so en_US is hopefully fine
aName = ToUpperUnicode( aName );
- aName.Erase( 31 );
+ aName.Erase( nMaxLegalStr );
return sal_True;
}
diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx
index e4e839ca33b5..779260861d11 100644
--- a/sot/source/sdstor/stgelem.hxx
+++ b/sot/source/sdstor/stgelem.hxx
@@ -117,9 +117,10 @@ class StgStream;
#define STGENTRY_SIZE 128
+//StructuredStorageDirectoryEntry
class StgEntry { // directory enty
sal_uInt16 nName[ 32 ]; // 00 name as WCHAR
- sal_Int16 nNameLen; // 40 size of name in bytes including 00H
+ sal_uInt16 nNameLen; // 40 size of name in bytes including 00H
sal_uInt8 cType; // 42 entry type
sal_uInt8 cFlags; // 43 0 or 1 (tree balance?)
sal_Int32 nLeft; // 44 left node entry