Kaydet (Commit) 83db9afa authored tarafından Noel Grandin's avatar Noel Grandin

remove some unnecessary typedef struct... sugar

Change-Id: I1576282b0a0a3af8ae14c04725d9c4900073f2c4
Reviewed-on: https://gerrit.libreoffice.org/68758
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst a2e3705d
......@@ -24,10 +24,10 @@
// Transform table for token operators and opcodes
typedef struct {
struct OpTable {
SbiToken eTok; // Token
SbiOpcode eOp; // Opcode
} OpTable;
};
static const OpTable aOpTable [] = {
{ EXPON,SbiOpcode::EXP_ },
......
......@@ -272,11 +272,11 @@ class OSharedConnectionManager : public ::cppu::WeakImplHelper< XEventListener >
{
// contains the currently used master connections
typedef struct
struct TConnectionHolder
{
Reference< XConnection > xMasterConnection;
oslInterlockedCount nALiveCount;
} TConnectionHolder;
};
// the less-compare functor, used for the stl::map
struct TDigestLess
......
......@@ -154,11 +154,11 @@ static LibLibreOffice_Impl *gImpl = nullptr;
static std::weak_ptr< LibreOfficeKitClass > gOfficeClass;
static std::weak_ptr< LibreOfficeKitDocumentClass > gDocumentClass;
typedef struct
struct ExtensionMap
{
const char *extn;
const char *filterName;
} ExtensionMap;
};
static const ExtensionMap aWriterExtensionMap[] =
{
......
......@@ -40,7 +40,7 @@ class FilterConfigItem;
#define PSD_DUOTONE 8
#define PSD_LAB 9
typedef struct
struct PSDFileHeader
{
sal_uInt32 nSignature;
sal_uInt16 nVersion;
......@@ -51,8 +51,7 @@ typedef struct
sal_uInt32 nColumns;
sal_uInt16 nDepth;
sal_uInt16 nMode;
} PSDFileHeader;
};
class PSDReader {
......
......@@ -36,13 +36,13 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::i18n;
using namespace ::com::sun::star::lang;
typedef struct {
struct Number {
sal_Int16 number;
const sal_Unicode *multiplierChar;
sal_Int16 numberFlag;
sal_Int16 exponentCount;
const sal_Int16 *multiplierExponent;
} Number;
};
#define NUMBER_OMIT_ZERO (1 << 0)
......
......@@ -321,11 +321,11 @@ void make_stc_char(FILE *sfp, FILE *cfp)
}
typedef struct {
struct Index {
sal_uInt16 address;
sal_Int32 len;
sal_Unicode *data;
} Index;
};
extern "C" {
static int Index_comp(const void* s1, const void* s2)
......
......@@ -81,11 +81,11 @@ TextConversion_ko::TextConversion_ko( const Reference < XComponentContext >& xCo
static sal_Int16 checkScriptType(sal_Unicode c)
{
typedef struct {
struct UBlock2Script {
UBlockCode from;
UBlockCode to;
sal_Int16 script;
} UBlock2Script;
};
static const UBlock2Script scriptList[] = {
{UBLOCK_HANGUL_JAMO, UBLOCK_HANGUL_JAMO, SCRIPT_HANGUL},
......
......@@ -30,18 +30,18 @@ using com::sun::star::script::XInvocation2;
namespace pyuno
{
typedef struct
struct PyUNO_callable_Internals
{
Reference<XInvocation2> xInvocation;
OUString methodName;
ConversionMode mode;
} PyUNO_callable_Internals;
};
typedef struct
struct PyUNO_callable
{
PyObject_HEAD
PyUNO_callable_Internals* members;
} PyUNO_callable;
};
static void PyUNO_callable_del (PyObject* self)
{
......
......@@ -8931,10 +8931,10 @@ void ScInterpreter::ScLeft()
}
}
typedef struct {
struct UBlockScript {
UBlockCode const from;
UBlockCode const to;
} UBlockScript;
};
static const UBlockScript scriptList[] = {
{UBLOCK_HANGUL_JAMO, UBLOCK_HANGUL_JAMO},
......
......@@ -134,11 +134,11 @@ namespace sfx2
typedef ::std::map< OUString, FilterGroup::iterator > FilterGroupEntryReferrer;
/// a descriptor for a filter class (which in the final dialog is represented by one filter entry)
typedef struct _tagFilterClass
struct FilterClass
{
OUString sDisplayName; // the display name
Sequence< FilterName > aSubFilters; // the (logical) names of the filter which belong to the class
} FilterClass;
};
typedef ::std::list< FilterClass > FilterClassList;
typedef ::std::map< OUString, FilterClassList::iterator > FilterClassReferrer;
......
......@@ -48,11 +48,11 @@ struct Library {
}
typedef struct
struct ProxyEntry
{
OUString Server;
OUString Port;
} ProxyEntry;
};
namespace
......
......@@ -107,10 +107,10 @@ MessageImprint ::= SEQUENCE {
hashedMessage OCTET STRING }
*/
typedef struct {
struct MessageImprint {
SECAlgorithmID hashAlgorithm;
SECItem hashedMessage;
} MessageImprint;
};
/*
Extension ::= SEQUENCE {
......@@ -119,11 +119,11 @@ Extension ::= SEQUENCE {
extnValue OCTET STRING }
*/
typedef struct {
struct Extension {
SECItem const extnID;
SECItem const critical;
SECItem const extnValue;
} Extension;
};
/*
Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
......@@ -143,14 +143,14 @@ TimeStampReq ::= SEQUENCE {
extensions [0] IMPLICIT Extensions OPTIONAL }
*/
typedef struct {
struct TimeStampReq {
SECItem version;
MessageImprint messageImprint;
SECItem reqPolicy;
SECItem nonce;
SECItem certReq;
Extension *extensions;
} TimeStampReq;
};
/**
* General name, defined by RFC 3280.
......@@ -278,11 +278,11 @@ const SEC_ASN1Template SigningCertificateV2Template[] =
{0, 0, nullptr, 0}
};
typedef struct {
struct PKIStatusInfo {
SECItem status;
SECItem statusString;
SECItem failInfo;
} PKIStatusInfo;
};
const SEC_ASN1Template PKIStatusInfo_Template[] =
{
......@@ -298,10 +298,10 @@ const SEC_ASN1Template Any_Template[] =
{ SEC_ASN1_ANY, 0, nullptr, sizeof(SECItem) }
};
typedef struct {
struct TimeStampResp {
PKIStatusInfo status;
SECItem timeStampToken;
} TimeStampResp;
};
const SEC_ASN1Template TimeStampResp_Template[] =
{
......
......@@ -114,11 +114,11 @@ void SalData::ensureThreadAutoreleasePool()
}
}
typedef struct
struct curs_ent
{
const char* pBaseName;
const NSPoint aHotSpot;
} curs_ent;
};
const o3tl::enumarray<PointerStyle, curs_ent> aCursorTab =
{
......
......@@ -79,7 +79,7 @@ struct PSPathElement
/*- In horizontal writing mode right sidebearing is calculated using this formula
*- rsb = aw - (lsb + xMax - xMin) -*/
typedef struct {
struct TTGlyphMetrics {
sal_Int16 xMin;
sal_Int16 yMin;
sal_Int16 xMax;
......@@ -87,21 +87,21 @@ typedef struct {
sal_uInt16 aw; /*- Advance Width (horizontal writing mode) */
sal_Int16 lsb; /*- Left sidebearing (horizontal writing mode) */
sal_uInt16 ah; /*- advance height (vertical writing mode) */
} TTGlyphMetrics;
};
#define HFORMAT_LINELEN 64
typedef struct {
struct HexFmt {
FILE *o;
char buffer[HFORMAT_LINELEN];
size_t bufpos;
int total;
} HexFmt;
};
typedef struct {
struct GlyphOffsets {
sal_uInt32 nGlyphs; /* number of glyphs in the font + 1 */
sal_uInt32 *offs; /* array of nGlyphs offsets */
} GlyphOffsets;
};
static const sal_uInt32 T_true = 0x74727565; /* 'true' */
static const sal_uInt32 T_ttcf = 0x74746366; /* 'ttcf' */
......@@ -1044,12 +1044,12 @@ static sal_uInt32 getGlyph0(const sal_uInt8* cmap, sal_uInt32, sal_uInt32 c) {
}
}
typedef struct _subHeader2 {
struct subHeader2 {
sal_uInt16 const firstCode;
sal_uInt16 const entryCount;
sal_uInt16 const idDelta;
sal_uInt16 idRangeOffset;
} subHeader2;
};
static sal_uInt32 getGlyph2(const sal_uInt8 *cmap, const sal_uInt32 nMaxCmapSize, sal_uInt32 c) {
sal_uInt16 const *CMAP2 = reinterpret_cast<sal_uInt16 const *>(cmap);
......
......@@ -50,11 +50,11 @@ namespace vcl
#define T_cmap 0x636D6170
#define T_post 0x706F7374
typedef struct {
struct TableEntry {
sal_uInt32 tag;
sal_uInt32 length;
sal_uInt8 *data;
} TableEntry;
};
/*- Data access macros for data stored in big-endian or little-endian format */
static sal_Int16 GetInt16( const sal_uInt8* ptr, sal_uInt32 offset)
......@@ -322,39 +322,39 @@ SFErrCodes StreamToFile(TrueTypeCreator *_this, const char* fname)
#define CMAP_PAIR_INIT 500
#define CMAP_PAIR_INCR 500
typedef struct {
struct CmapSubTable {
sal_uInt32 id; /* subtable ID (platform/encoding ID) */
sal_uInt32 n; /* number of used translation pairs */
sal_uInt32 m; /* number of allocated translation pairs */
sal_uInt32 *xc; /* character array */
sal_uInt32 *xg; /* glyph array */
} CmapSubTable;
};
typedef struct {
struct table_cmap {
sal_uInt32 n; /* number of used CMAP sub-tables */
sal_uInt32 m; /* number of allocated CMAP sub-tables */
CmapSubTable *s; /* sorted array of sub-tables */
} table_cmap;
};
typedef struct {
struct tdata_generic {
sal_uInt32 tag;
sal_uInt32 nbytes;
sal_uInt8 *ptr;
} tdata_generic;
};
typedef struct {
struct tdata_loca {
sal_uInt32 nbytes; /* number of bytes in loca table */
sal_uInt8 *ptr; /* pointer to the data */
} tdata_loca;
};
typedef struct {
struct tdata_post {
sal_uInt32 format;
sal_uInt32 italicAngle;
sal_Int16 underlinePosition;
sal_Int16 underlineThickness;
sal_uInt32 isFixedPitch;
void *ptr; /* format-specific pointer */
} tdata_post;
};
/* allocate memory for a TT table */
static sal_uInt8 *ttmalloc(sal_uInt32 nbytes)
......
......@@ -26,14 +26,13 @@
// for all keysyms with byte1 and byte2 equal zero, and of course only for
// keysyms that have a unicode counterpart
typedef const sal_Unicode unicode_t;
typedef struct {
struct keymap_t {
const int first; const int last;
const unicode_t *map;
} keymap_t;
const sal_Unicode *map;
};
// Latin-1 Byte 3 = 0x00
const unicode_t keymap00_map[] = {
const sal_Unicode keymap00_map[] = {
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
......@@ -65,7 +64,7 @@ const unicode_t keymap00_map[] = {
const keymap_t keymap00 = { 32, 255, keymap00_map };
// Latin-2 Byte 3 = 0x01
const unicode_t keymap01_map[] = {
const sal_Unicode keymap01_map[] = {
0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, 0x0000,
0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, 0x0000,
0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, 0x0000,
......@@ -81,7 +80,7 @@ const unicode_t keymap01_map[] = {
const keymap_t keymap01 = { 161, 255, keymap01_map };
// Latin-3 Byte 3 = 0x02
const unicode_t keymap02_map[] = {
const sal_Unicode keymap02_map[] = {
0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, 0x0000,
0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, 0x0000,
0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, 0x0000,
......@@ -97,7 +96,7 @@ const unicode_t keymap02_map[] = {
const keymap_t keymap02 = { 161, 254, keymap02_map };
// Latin-4 Byte 3 = 0x03
const unicode_t keymap03_map[] = {
const sal_Unicode keymap03_map[] = {
0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, 0x0000, 0x0000,
0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, 0x0000, 0x0000,
......@@ -113,7 +112,7 @@ const unicode_t keymap03_map[] = {
const keymap_t keymap03 = { 162, 254, keymap03_map };
// Kana Byte 3 = 0x04
const unicode_t keymap04_map[] = {
const sal_Unicode keymap04_map[] = {
0x203e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
......@@ -130,7 +129,7 @@ const unicode_t keymap04_map[] = {
const keymap_t keymap04 = { 126, 223, keymap04_map };
// Arabic Byte 3 = 0x05
const unicode_t keymap05_map[] = {
const sal_Unicode keymap05_map[] = {
0x060c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x061b,
0x0000, 0x0000, 0x0000, 0x061f, 0x0000, 0x0621, 0x0622, 0x0623,
......@@ -143,7 +142,7 @@ const unicode_t keymap05_map[] = {
const keymap_t keymap05 = { 172, 242, keymap05_map };
// Cyrillic Byte 3 = 0x06
const unicode_t keymap06_map[] = {
const sal_Unicode keymap06_map[] = {
0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458,
0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, 0x2116,
0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408,
......@@ -159,7 +158,7 @@ const unicode_t keymap06_map[] = {
const keymap_t keymap06 = { 161, 255, keymap06_map };
// Greek Byte 3 = 0x07
const unicode_t keymap07_map[] = {
const sal_Unicode keymap07_map[] = {
0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, 0x038e,
0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, 0x0000,
0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, 0x03cd,
......@@ -175,7 +174,7 @@ const unicode_t keymap07_map[] = {
const keymap_t keymap07 = { 161, 249, keymap07_map };
// Technical Byte 3 = 0x08
const unicode_t keymap08_map[] = {
const sal_Unicode keymap08_map[] = {
0x23b7, 0x250c, 0x2500, 0x2320, 0x2321, 0x2502, 0x23a1, 0x23a3,
0x23a4, 0x23a6, 0x239b, 0x239d, 0x239e, 0x23a0, 0x23a8, 0x23ac,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
......@@ -191,7 +190,7 @@ const unicode_t keymap08_map[] = {
const keymap_t keymap08 = { 161, 254, keymap08_map };
// Special Byte 3 = 0x09
const unicode_t keymap09_map[] = {
const sal_Unicode keymap09_map[] = {
0x25c6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000,
0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x23ba,
0x23bb, 0x2500, 0x23bc, 0x23bd, 0x251c, 0x2524, 0x2534, 0x252c,
......@@ -199,7 +198,7 @@ const unicode_t keymap09_map[] = {
const keymap_t keymap09 = { 224, 248, keymap09_map };
// Publishing Byte 3 = 0x0a = 10
const unicode_t keymap10_map[] = {
const sal_Unicode keymap10_map[] = {
0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, 0x200a,
0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, 0x2153,
0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, 0x2105,
......@@ -215,7 +214,7 @@ const unicode_t keymap10_map[] = {
const keymap_t keymap10 = { 161, 254, keymap10_map };
// APL Byte 3 = 0x0b = 11
const unicode_t keymap11_map[] = {
const sal_Unicode keymap11_map[] = {
0x003c, 0x0000, 0x0000, 0x003e, 0x0000, 0x2228, 0x2227, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
......@@ -231,7 +230,7 @@ const unicode_t keymap11_map[] = {
const keymap_t keymap11 = { 163, 252, keymap11_map };
// Hebrew Byte 3 = 0x0c = 12
const unicode_t keymap12_map[] = {
const sal_Unicode keymap12_map[] = {
0x2017, 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6,
0x05d7, 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de,
0x05df, 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6,
......@@ -239,7 +238,7 @@ const unicode_t keymap12_map[] = {
const keymap_t keymap12 = { 223, 250, keymap12_map };
// Thai Byte 3 = 0x0d = 13
const unicode_t keymap13_map[] = {
const sal_Unicode keymap13_map[] = {
0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 0x0e08,
0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, 0x0e10,
0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, 0x0e18,
......@@ -255,7 +254,7 @@ const unicode_t keymap13_map[] = {
const keymap_t keymap13 = { 161, 249, keymap13_map };
// Korean Byte 3 = 0x0e = 14
const unicode_t keymap14_map[] = {
const sal_Unicode keymap14_map[] = {
0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138,
0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, 0x3140,
0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148,
......@@ -274,7 +273,7 @@ const keymap_t keymap14 = { 161, 255, keymap14_map };
// Latin-8 Byte 3 = 0x12 = 18
// Latin-9 Byte 3 = 0x13 = 19
const unicode_t keymap19_map[] = {
const sal_Unicode keymap19_map[] = {
0x0152, 0x0153, 0x0178 };
const keymap_t keymap19 = { 188, 190, keymap19_map };
......@@ -285,13 +284,13 @@ const keymap_t keymap19 = { 188, 190, keymap19_map };
// Vietnamese Byte 3 = 0x1e = 30
// Currency Byte 3 = 0x20 = 32
const unicode_t keymap32_map[] = {
const sal_Unicode keymap32_map[] = {
0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7,
0x20a8, 0x0000, 0x20aa, 0x20ab, 0x20ac };
const keymap_t keymap32 = { 160, 172, keymap32_map };
// Keyboard (Keypad mappings) Byte 3 = 0xff = 255
const unicode_t keymap255_map[] = {
const sal_Unicode keymap255_map[] = {
0x0020, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
......
......@@ -158,11 +158,11 @@ static bool sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI )
extern "C" srv_vendor_t
sal_GetServerVendor( Display *p_display )
{
typedef struct {
struct vendor_t {
srv_vendor_t e_vendor; // vendor as enum
const char* p_name; // vendor name as returned by VendorString()
unsigned int n_len; // number of chars to compare
} vendor_t;
};
static const vendor_t vendorlist[] = {
{ vendor_sun, "Sun Microsystems, Inc.", 10 },
......
......@@ -837,11 +837,11 @@ int PrintFontManager::getFontFaceNumber( fontID nFontID ) const
FontFamily PrintFontManager::matchFamilyName( const OUString& rFamily )
{
typedef struct {
struct family_t {
const char* mpName;
sal_uInt16 const mnLength;
FontFamily const meType;
} family_t;
};
#define InitializeClass( p, a ) p, sizeof(p) - 1, a
static const family_t pFamilyMatch[] = {
......
......@@ -25,11 +25,11 @@ using namespace ::com::sun::star;
// ---------------------- AtkHyperlink ----------------------
typedef struct {
struct HyperLink {
AtkHyperlink const atk_hyper_link;
uno::Reference< accessibility::XAccessibleHyperlink > xLink;
} HyperLink;
};
static uno::Reference< accessibility::XAccessibleHyperlink > const &
getHyperlink( AtkHyperlink *pHyperlink )
......
......@@ -15,13 +15,13 @@
#include <unx/gtk/hudawareness.h>
typedef struct
struct HudAwarenessHandle
{
GDBusConnection *connection;
HudAwarenessCallback callback;
gpointer user_data;
GDestroyNotify notify;
} HudAwarenessHandle;
};
static void
hud_awareness_method_call (GDBusConnection * /* connection */,
......
......@@ -71,16 +71,6 @@ PositionHolder::~PositionHolder()
} // anonymous namespace
typedef struct
{
tools::SvRef<SotStorage> ref;
} SotStorageRefWrapper;
typedef struct
{
tools::SvRef<SotStorageStream> ref;
} SotStorageStreamRefWrapper;
namespace
{
OUString lcl_normalizeSubStreamPath(const OUString& rPath)
......@@ -106,7 +96,7 @@ struct OLEStreamData
{
OLEStreamData(const OString& rName, const OString& rvngName);
SotStorageStreamRefWrapper stream;
tools::SvRef<SotStorageStream> stream;
/** Name of the stream.
*
......@@ -123,7 +113,7 @@ struct OLEStreamData
};
typedef std::unordered_map<OUString, std::size_t> NameMap_t;
typedef std::unordered_map<OUString, SotStorageRefWrapper> OLEStorageMap_t;
typedef std::unordered_map<OUString, tools::SvRef<SotStorage>> OLEStorageMap_t;
/** Representation of an OLE2 storage.
*
......@@ -156,7 +146,7 @@ private:
tools::SvRef<SotStorageStream> createStream(const OUString& rPath);
public:
SotStorageRefWrapper mxRootStorage; //< root storage of the OLE2
tools::SvRef<SotStorage> mxRootStorage; //< root storage of the OLE2
OLEStorageMap_t maStorageMap; //< map of all sub storages by name
::std::vector<OLEStreamData> maStreams; //< list of streams and their names
NameMap_t maNameMap; //< map of stream names to indexes (into @c maStreams)
......@@ -184,9 +174,9 @@ void OLEStorageImpl::initialize(std::unique_ptr<SvStream> pStream)
if (!pStream)
return;
mxRootStorage.ref = new SotStorage(pStream.release(), true);
mxRootStorage = new SotStorage(pStream.release(), true);
traverse(mxRootStorage.ref, "");
traverse(mxRootStorage, "");
mbInitialized = true;
}
......@@ -202,20 +192,20 @@ tools::SvRef<SotStorageStream> OLEStorageImpl::getStream(const OUString& rPath)
if (maNameMap.end() == aIt)
return tools::SvRef<SotStorageStream>();
if (!maStreams[aIt->second].stream.ref.is())
maStreams[aIt->second].stream.ref
if (!maStreams[aIt->second].stream.is())
maStreams[aIt->second].stream
= createStream(OStringToOUString(maStreams[aIt->second].name, RTL_TEXTENCODING_UTF8));
return maStreams[aIt->second].stream.ref;
return maStreams[aIt->second].stream;
}
tools::SvRef<SotStorageStream> const& OLEStorageImpl::getStream(const std::size_t nId)
{
if (!maStreams[nId].stream.ref.is())
maStreams[nId].stream.ref
if (!maStreams[nId].stream.is())
maStreams[nId].stream
= createStream(OStringToOUString(maStreams[nId].name, RTL_TEXTENCODING_UTF8));
return maStreams[nId].stream.ref;
return maStreams[nId].stream;
}
void OLEStorageImpl::traverse(const tools::SvRef<SotStorage>& rStorage, const OUString& rPath)
......@@ -240,12 +230,12 @@ void OLEStorageImpl::traverse(const tools::SvRef<SotStorage>& rStorage, const OU
else if (info.IsStorage())
{
const OUString aPath = concatPath(rPath, info.GetName());
SotStorageRefWrapper aStorage;
aStorage.ref = rStorage->OpenSotStorage(info.GetName(), StreamMode::STD_READ);
tools::SvRef<SotStorage> aStorage
= rStorage->OpenSotStorage(info.GetName(), StreamMode::STD_READ);
maStorageMap[aPath] = aStorage;
// deep-first traversal
traverse(aStorage.ref, aPath);
traverse(aStorage, aPath);
}
else
{
......@@ -260,7 +250,7 @@ tools::SvRef<SotStorageStream> OLEStorageImpl::createStream(const OUString& rPat
const sal_Int32 nDelim = rPath.lastIndexOf(u'/');
if (-1 == nDelim)
return mxRootStorage.ref->OpenSotStream(rPath, StreamMode::STD_READ);
return mxRootStorage->OpenSotStream(rPath, StreamMode::STD_READ);
const OUString aDir = rPath.copy(0, nDelim);
const OUString aName = rPath.copy(nDelim + 1);
......@@ -270,7 +260,7 @@ tools::SvRef<SotStorageStream> OLEStorageImpl::createStream(const OUString& rPat
if (maStorageMap.end() == aIt)
return nullptr;
return aIt->second.ref->OpenSotStream(aName, StreamMode::STD_READ);