1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <tools/stream.hxx>
#include <tools/tenccvt.hxx>
#include <osl/thread.h>
#include <basic/sbx.hxx>
#include "sb.hxx"
#include <string.h>
#include "image.hxx"
#include <codegen.hxx>
#include <memory>
SbiImage::SbiImage()
{
pStringOff = nullptr;
pStrings = nullptr;
pCode = nullptr;
pLegacyPCode = nullptr;
nFlags = SbiImageFlags::NONE;
nStrings = 0;
nStringSize= 0;
nCodeSize = 0;
nLegacyCodeSize =
nDimBase = 0;
bInit =
bError = false;
bFirstInit = true;
eCharSet = osl_getThreadTextEncoding();
nStringIdx = 0;
nStringOff = 0;
}
SbiImage::~SbiImage()
{
Clear();
}
void SbiImage::Clear()
{
delete[] pStringOff;
delete[] pStrings;
delete[] pCode;
ReleaseLegacyBuffer();
pStringOff = nullptr;
pStrings = nullptr;
pCode = nullptr;
nFlags = SbiImageFlags::NONE;
nStrings = 0;
nStringSize= 0;
nLegacyCodeSize = 0;
nCodeSize = 0;
eCharSet = osl_getThreadTextEncoding();
nDimBase = 0;
bError = false;
}
/**************************************************************************
*
* Service-Routines for Load/Store
*
**************************************************************************/
bool SbiGood( SvStream& r )
{
return !r.IsEof() && r.GetError() == SVSTREAM_OK;
}
// Open Record
sal_uInt64 SbiOpenRecord( SvStream& r, FileOffset nSignature, sal_uInt16 nElem )
{
sal_uInt64 nPos = r.Tell();
r.WriteUInt16( static_cast<sal_uInt16>( nSignature ) )
.WriteInt32( 0 ).WriteUInt16( nElem );
return nPos;
}
// Close Record
void SbiCloseRecord( SvStream& r, sal_uInt64 nOff )
{
sal_uInt64 nPos = r.Tell();
r.Seek( nOff + 2 );
r.WriteInt32(nPos - nOff - 8 );
r.Seek( nPos );
}
/**************************************************************************
*
* Load/Store
*
**************************************************************************/
bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
{
sal_uInt16 nSign, nCount;
sal_uInt32 nLen, nOff;
Clear();
// Read Master-Record
r.ReadUInt16( nSign ).ReadUInt32( nLen ).ReadUInt16( nCount );
sal_uInt64 nLast = r.Tell() + nLen;
sal_uInt32 nCharSet; // System charset
sal_uInt32 lDimBase;
sal_uInt16 nReserved1;
sal_uInt32 nReserved2;
sal_uInt32 nReserved3;
bool bBadVer = false;
if( nSign == static_cast<sal_uInt16>( FileOffset::Module ) )
{
sal_uInt16 nTmpFlags;
r.ReadUInt32( nVersion ).ReadUInt32( nCharSet ).ReadUInt32( lDimBase )
.ReadUInt16( nTmpFlags ).ReadUInt16( nReserved1 ).ReadUInt32( nReserved2 ).ReadUInt32( nReserved3 );
nFlags = static_cast<SbiImageFlags>(nTmpFlags);
eCharSet = nCharSet;
eCharSet = GetSOLoadTextEncoding( eCharSet );
bBadVer = ( nVersion > B_CURVERSION );
nDimBase = (sal_uInt16) lDimBase;
}
bool bLegacy = ( nVersion < B_EXT_IMG_VERSION );
sal_uInt64 nNext;
while( ( nNext = r.Tell() ) < nLast )
{
r.ReadUInt16( nSign ).ReadUInt32( nLen ).ReadUInt16( nCount );
nNext += nLen + 8;
if( r.GetError() == SVSTREAM_OK )
{
switch( static_cast<FileOffset>( nSign ) )
{
case FileOffset::Name:
aName = r.ReadUniOrByteString(eCharSet);
break;
case FileOffset::Comment:
aComment = r.ReadUniOrByteString(eCharSet );
break;
case FileOffset::Source:
{
aOUSource = r.ReadUniOrByteString(eCharSet);
break;
}
case FileOffset::ExtSource:
{
//assuming an empty string with just the lead 32bit/16bit len indicator
const size_t nMinStringSize = (eCharSet == RTL_TEXTENCODING_UNICODE) ? 4 : 2;
const sal_uInt64 nMaxStrings = r.remainingSize() / nMinStringSize;
if (nCount > nMaxStrings)
{
SAL_WARN("basic", "Parsing error: " << nMaxStrings <<
" max possible entries, but " << nCount << " claimed, truncating");
nCount = nMaxStrings;
}
for( sal_uInt16 j = 0; j < nCount; ++j)
{
aOUSource += r.ReadUniOrByteString(eCharSet);
}
break;
}
case FileOffset::PCode:
if( bBadVer ) break;
pCode = new char[ nLen ];
nCodeSize = nLen;
r.ReadBytes(pCode, nCodeSize);
if ( bLegacy )
{
ReleaseLegacyBuffer(); // release any previously held buffer
nLegacyCodeSize = (sal_uInt16) nCodeSize;
pLegacyPCode = pCode;
PCodeBuffConvertor< sal_uInt16, sal_uInt32 > aLegacyToNew( reinterpret_cast<sal_uInt8*>(pLegacyPCode), nLegacyCodeSize );
aLegacyToNew.convert();
pCode = reinterpret_cast<char*>(aLegacyToNew.GetBuffer());
nCodeSize = aLegacyToNew.GetSize();
// we don't release the legacy buffer
// right now, thats because the module
// needs it to fix up the method
// nStart members. When that is done
// the module can release the buffer
// or it can wait until this routine
// is called again or when this class // destructs all of which will trigger
// release of the buffer.
}
break;
case FileOffset::Publics:
case FileOffset::PoolDir:
case FileOffset::SymPool:
case FileOffset::LineRanges:
break;
case FileOffset::StringPool:
{
if( bBadVer ) break;
//assuming an empty string with just the lead 32bit len indicator
const sal_uInt64 nMinStringSize = 4;
const sal_uInt64 nMaxStrings = r.remainingSize() / nMinStringSize;
if (nCount > nMaxStrings)
{
SAL_WARN("basic", "Parsing error: " << nMaxStrings <<
" max possible entries, but " << nCount << " claimed, truncating");
nCount = nMaxStrings;
}
MakeStrings( nCount );
short i;
for( i = 0; i < nStrings && SbiGood( r ); i++ )
{
r.ReadUInt32( nOff );
pStringOff[ i ] = (sal_uInt16) nOff;
}
r.ReadUInt32( nLen );
if( SbiGood( r ) )
{
delete [] pStrings;
pStrings = new sal_Unicode[ nLen ];
nStringSize = (sal_uInt16) nLen;
std::unique_ptr<char[]> pByteStrings(new char[ nLen ]);
r.ReadBytes(pByteStrings.get(), nStringSize);
for( short j = 0; j < nStrings; j++ )
{
sal_uInt16 nOff2 = (sal_uInt16) pStringOff[ j ];
OUString aStr( pByteStrings.get() + nOff2, strlen(pByteStrings.get() + nOff2), eCharSet );
memcpy( pStrings + nOff2, aStr.getStr(), (aStr.getLength() + 1) * sizeof( sal_Unicode ) );
}
}
break;
}
case FileOffset::UserTypes:
{
//assuming an empty string with just the lead 32bit/16bit len indicator
const size_t nMinStringSize = (eCharSet == RTL_TEXTENCODING_UNICODE) ? 4 : 2;
const sal_uInt64 nMinRecordSize = nMinStringSize + sizeof(sal_Int16);
const sal_uInt64 nMaxRecords = r.remainingSize() / nMinRecordSize;
if (nCount > nMaxRecords)
{
SAL_WARN("basic", "Parsing error: " << nMaxRecords <<
" max possible entries, but " << nCount << " claimed, truncating");
nCount = nMaxRecords;
}
// User defined types
for (sal_uInt16 i = 0; i < nCount; i++)
{
OUString aTypeName = r.ReadUniOrByteString(eCharSet);
sal_uInt16 nTypeMembers;
r.ReadUInt16(nTypeMembers);
const sal_uInt64 nMaxTypeMembers = r.remainingSize() / 8;
if (nTypeMembers > nMaxTypeMembers)
{
SAL_WARN("basic", "Parsing error: " << nMaxTypeMembers <<
" max possible entries, but " << nTypeMembers << " claimed, truncating");
nTypeMembers = nMaxTypeMembers;
}
SbxObject *pType = new SbxObject(aTypeName);
SbxArray *pTypeMembers = pType->GetProperties();
for (sal_uInt16 j = 0; j < nTypeMembers; j++)
{
OUString aMemberName = r.ReadUniOrByteString(eCharSet);
sal_Int16 aIntMemberType;
r.ReadInt16(aIntMemberType);
SbxDataType aMemberType = static_cast< SbxDataType > ( aIntMemberType );
SbxProperty *pTypeElem = new SbxProperty( aMemberName, aMemberType );
sal_uInt32 aIntFlag;
r.ReadUInt32(aIntFlag);
SbxFlagBits nElemFlags = static_cast< SbxFlagBits > ( aIntFlag );
pTypeElem->SetFlags(nElemFlags);
sal_Int16 hasObject;
r.ReadInt16(hasObject);
if (hasObject == 1)
{
if(aMemberType == SbxOBJECT)
{
// nested user defined types
// declared before use, so it is ok to reference it by name on load
OUString aNestedTypeName = r.ReadUniOrByteString(eCharSet);
SbxObject* pNestedTypeObj = static_cast< SbxObject* >( rTypes->Find( aNestedTypeName, SbxClassType::Object ) );
if (pNestedTypeObj)
{
SbxObject* pCloneObj = cloneTypeObjectImpl( *pNestedTypeObj );
pTypeElem->PutObject( pCloneObj );
}
}
else
{
// an array
SbxDimArray* pArray = new SbxDimArray();
sal_Int16 isFixedSize;
r.ReadInt16(isFixedSize);
if (isFixedSize == 1)
pArray->setHasFixedSize( true );
sal_Int32 nDims;
r.ReadInt32(nDims);
for (sal_Int32 d = 0; d < nDims; d++)
{
sal_Int32 lBound;
sal_Int32 uBound;
r.ReadInt32(lBound).ReadInt32(uBound);
pArray->unoAddDim32(lBound, uBound);
}
pTypeElem->PutObject( pArray );
}
}
pTypeMembers->Insert( pTypeElem, pTypeMembers->Count() );
}
pType->Remove( "Name", SbxClassType::DontCare );
pType->Remove( "Parent", SbxClassType::DontCare );
AddType(pType);
}
break;
}
case FileOffset::ModEnd:
goto done;
default:
break;
}
}
else
{
break;
}
r.Seek( nNext );
}
done:
r.Seek( nLast );
if( !SbiGood( r ) )
{
bError = true;
}
return !bError;
}
bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
{
bool bLegacy = ( nVer < B_EXT_IMG_VERSION );
// detect if old code exceeds legacy limits
// if so, then disallow save
if ( bLegacy && ExceedsLegacyLimits() )
{
SbiImage aEmptyImg;
aEmptyImg.aName = aName;
aEmptyImg.Save( r, B_LEGACYVERSION );
return true;
}
// First of all the header
sal_uInt64 nStart = SbiOpenRecord( r, FileOffset::Module, 1 );
sal_uInt64 nPos;
eCharSet = GetSOStoreTextEncoding( eCharSet );
if ( bLegacy )
{
r.WriteInt32( B_LEGACYVERSION );
}
else
{
r.WriteInt32( B_CURVERSION );
}
r .WriteInt32( eCharSet )
.WriteInt32( nDimBase )
.WriteInt16( static_cast<sal_uInt16>(nFlags) )
.WriteInt16( 0 )
.WriteInt32( 0 )
.WriteInt32( 0 );
// Name?
if( !aName.isEmpty() && SbiGood( r ) )
{
nPos = SbiOpenRecord( r, FileOffset::Name, 1 );
r.WriteUniOrByteString( aName, eCharSet );
SbiCloseRecord( r, nPos );
}
// Comment?
if( !aComment.isEmpty() && SbiGood( r ) )
{
nPos = SbiOpenRecord( r, FileOffset::Comment, 1 );
r.WriteUniOrByteString( aComment, eCharSet );
SbiCloseRecord( r, nPos );
}
// Source?
if( !aOUSource.isEmpty() && SbiGood( r ) )
{
nPos = SbiOpenRecord( r, FileOffset::Source, 1 );
r.WriteUniOrByteString( aOUSource, eCharSet );
SbiCloseRecord( r, nPos );
}
// Binary data?
if( pCode && SbiGood( r ) )
{
nPos = SbiOpenRecord( r, FileOffset::PCode, 1 );
if ( bLegacy )
{
ReleaseLegacyBuffer(); // release any previously held buffer
PCodeBuffConvertor< sal_uInt32, sal_uInt16 > aNewToLegacy( reinterpret_cast<sal_uInt8*>(pCode), nCodeSize );
aNewToLegacy.convert();
pLegacyPCode = reinterpret_cast<char*>(aNewToLegacy.GetBuffer());
nLegacyCodeSize = aNewToLegacy.GetSize();
r.WriteBytes(pLegacyPCode, nLegacyCodeSize);
}
else
{
r.WriteBytes(pCode, nCodeSize);
}
SbiCloseRecord( r, nPos );
}
// String-Pool?
if( nStrings )
{
nPos = SbiOpenRecord( r, FileOffset::StringPool, nStrings );
// For every String:
// sal_uInt32 Offset of the Strings in the Stringblock
short i;
for( i = 0; i < nStrings && SbiGood( r ); i++ )
{
r.WriteUInt32( pStringOff[ i ] );
}
// Then the String-Block
std::unique_ptr<char[]> pByteStrings(new char[ nStringSize ]);
for( i = 0; i < nStrings; i++ )
{
sal_uInt16 nOff = (sal_uInt16) pStringOff[ i ];
OString aStr(OUStringToOString(OUString(pStrings + nOff), eCharSet));
memcpy( pByteStrings.get() + nOff, aStr.getStr(), (aStr.getLength() + 1) * sizeof( char ) );
}
r.WriteUInt32( nStringSize );
r.WriteBytes(pByteStrings.get(), nStringSize);
pByteStrings.reset();
SbiCloseRecord( r, nPos );
}
// User defined types
if (rTypes)
{
sal_uInt16 nTypes = rTypes->Count();
if (nTypes > 0 )
{
nPos = SbiOpenRecord( r, FileOffset::UserTypes, nTypes );
for (sal_uInt16 i = 0; i < nTypes; i++)
{
SbxObject* pType = static_cast< SbxObject* > ( rTypes->Get(i) );
OUString aTypeName = pType->GetClassName();
r.WriteUniOrByteString( aTypeName, eCharSet );
SbxArray *pTypeMembers = pType->GetProperties();
sal_uInt16 nTypeMembers = pTypeMembers->Count();
r.WriteInt16(nTypeMembers);
for (sal_uInt16 j = 0; j < nTypeMembers; j++)
{
SbxProperty* pTypeElem = static_cast< SbxProperty* > ( pTypeMembers->Get(j) );
OUString aElemName = pTypeElem->GetName();
r.WriteUniOrByteString( aElemName, eCharSet );
SbxDataType dataType = pTypeElem->GetType();
r.WriteInt16(dataType);
SbxFlagBits nElemFlags = pTypeElem->GetFlags();
r.WriteUInt32(static_cast< sal_uInt32 > (nElemFlags) );
SbxBase* pElemObject = pTypeElem->GetObject();
if (pElemObject)
{
r.WriteInt16(1); // has elem Object
if( dataType == SbxOBJECT )
{
// nested user defined types
// declared before use, so it is ok to reference it by name on load
SbxObject* pNestedType = static_cast< SbxObject* > ( pElemObject );
r.WriteUniOrByteString( pNestedType->GetClassName(), eCharSet );
}
else
{
// an array
SbxDimArray* pArray = static_cast< SbxDimArray* > ( pElemObject );
bool bFixedSize = pArray->hasFixedSize();
if (bFixedSize)
r.WriteInt16(1);
else
r.WriteInt16(0);
sal_Int32 nDims = pArray->GetDims();
r.WriteInt32(nDims);
for (sal_Int32 d = 0; d < nDims; d++)
{
sal_Int32 lBound;
sal_Int32 uBound;
pArray->GetDim32(d, lBound, uBound);
r.WriteInt32(lBound).WriteInt32(uBound);
}
}
}
else
r.WriteInt16(0); // no elem Object
}
}
SbiCloseRecord( r, nPos );
}
}
// Set overall length
SbiCloseRecord( r, nStart );
if( !SbiGood( r ) )
{
bError = true;
}
return !bError;
}
/**************************************************************************
*
* Routines called by the compiler
*
**************************************************************************/
void SbiImage::MakeStrings( short nSize )
{
nStrings = 0;
nStringIdx = 0;
nStringOff = 0;
nStringSize = 1024;
pStrings = new sal_Unicode[ nStringSize ];
pStringOff = new sal_uInt32[ nSize ];
nStrings = nSize;
memset( pStringOff, 0, nSize * sizeof( sal_uInt32 ) );
memset( pStrings, 0, nStringSize * sizeof( sal_Unicode ) );
}
// Add a string to StringPool. The String buffer is dynamically
// growing in 1K-Steps
void SbiImage::AddString( const OUString& r )
{
if( nStringIdx >= nStrings )
{
bError = true;
}
if( !bError )
{
sal_Int32 len = r.getLength() + 1;
sal_uInt32 needed = nStringOff + len;
if( needed > 0xFFFFFF00 )
{
bError = true; // out of mem!
}
else if( needed > nStringSize )
{
sal_uInt32 nNewLen = needed + 1024;
nNewLen &= 0xFFFFFC00; // trim to 1K border
sal_Unicode* p = new sal_Unicode[nNewLen];
memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) );
delete[] pStrings;
pStrings = p;
nStringSize = sal::static_int_cast< sal_uInt16 >(nNewLen);
}
if( !bError )
{
pStringOff[ nStringIdx++ ] = nStringOff;
memcpy( pStrings + nStringOff, r.getStr(), len * sizeof( sal_Unicode ) );
nStringOff = nStringOff + len;
// Last String? The update the size of the buffer
if( nStringIdx >= nStrings )
{
nStringSize = nStringOff;
}
}
}
}
// Add code block
// The block was fetched by the compiler from class SbBuffer and
// is already created with new. Additionally it contains all Integers
// in Big Endian format, so can be directly read/written.
void SbiImage::AddCode( char* p, sal_uInt32 s )
{
pCode = p;
nCodeSize = s;
}
// Add user type
void SbiImage::AddType(SbxObject* pObject)
{
if( !rTypes.Is() )
{
rTypes = new SbxArray;
}
SbxObject *pCopyObject = new SbxObject(*pObject);
rTypes->Insert (pCopyObject,rTypes->Count());
}
void SbiImage::AddEnum(SbxObject* pObject) // Register enum type
{
if( !rEnums.Is() )
{
rEnums = new SbxArray;
}
rEnums->Insert( pObject, rEnums->Count() );
}
/**************************************************************************
*
* Accessing the image
*
**************************************************************************/
// Note: IDs start with 1
OUString SbiImage::GetString( short nId ) const
{
if( nId && nId <= nStrings )
{
sal_uInt32 nOff = pStringOff[ nId - 1 ];
sal_Unicode* pStr = pStrings + nOff;
// #i42467: Special treatment for vbNullChar
if( *pStr == 0 )
{
sal_uInt32 nNextOff = (nId < nStrings) ? pStringOff[ nId ] : nStringOff;
sal_uInt32 nLen = nNextOff - nOff - 1;
if( nLen == 1 )
{
// Force length 1 and make char 0 afterwards
OUString aNullCharStr( (sal_Unicode)0);
return aNullCharStr;
}
}
else
{
return OUString(pStr);
}
}
return OUString();
}
const SbxObject* SbiImage::FindType (const OUString& aTypeName) const
{
return rTypes.Is() ? static_cast<SbxObject*>(rTypes->Find(aTypeName,SbxClassType::Object)) : nullptr;
}
sal_uInt16 SbiImage::CalcLegacyOffset( sal_Int32 nOffset )
{
return SbiCodeGen::calcLegacyOffSet( reinterpret_cast<sal_uInt8*>(pCode), nOffset ) ;
}
sal_uInt32 SbiImage::CalcNewOffset( sal_Int16 nOffset )
{
return SbiCodeGen::calcNewOffSet( reinterpret_cast<sal_uInt8*>(pLegacyPCode), nOffset ) ;
}
void SbiImage::ReleaseLegacyBuffer()
{
delete[] pLegacyPCode;
pLegacyPCode = nullptr;
nLegacyCodeSize = 0;
}
bool SbiImage::ExceedsLegacyLimits()
{
return ( nStringSize > 0xFF00 ) || ( CalcLegacyOffset( nCodeSize ) > 0xFF00 );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|