summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connectivity/source/drivers/macab/MacabRecords.cxx2
-rw-r--r--connectivity/source/drivers/macab/macabutilities.hxx10
-rw-r--r--fpicker/source/aqua/NSString_OOoAdditions.mm10
-rw-r--r--shell/source/backends/macbe/macbackend.mm9
-rw-r--r--vcl/osx/salframeview.mm6
-rw-r--r--vcl/quartz/salgdi.cxx7
6 files changed, 30 insertions, 14 deletions
diff --git a/connectivity/source/drivers/macab/MacabRecords.cxx b/connectivity/source/drivers/macab/MacabRecords.cxx
index 17ee6585d45c..07d462425e65 100644
--- a/connectivity/source/drivers/macab/MacabRecords.cxx
+++ b/connectivity/source/drivers/macab/MacabRecords.cxx
@@ -344,7 +344,7 @@ MacabHeader *MacabRecords::createHeaderForRecordType(const CFArrayRef _records,
/* While searching through the properties for required properties, these
* sal_Bools will keep track of what we have found.
*/
- bool bFoundRequiredProperties[requiredProperties.size()];
+ auto const bFoundRequiredProperties = std::make_unique<bool[]>(requiredProperties.size());
/* We have three MacabHeaders: headerDataForProperty is where we
diff --git a/connectivity/source/drivers/macab/macabutilities.hxx b/connectivity/source/drivers/macab/macabutilities.hxx
index cfe46f37f286..7e0f6b091085 100644
--- a/connectivity/source/drivers/macab/macabutilities.hxx
+++ b/connectivity/source/drivers/macab/macabutilities.hxx
@@ -19,6 +19,10 @@
#pragma once
+#include <sal/config.h>
+
+#include <memory>
+
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <unotools/resmgr.hxx>
@@ -47,15 +51,15 @@ namespace connectivity::macab
CFRetain(sOrig);
CFIndex nStringLength = CFStringGetLength(sOrig);
- UniChar unichars[nStringLength+1];
+ auto const unichars = std::make_unique<UniChar[]>(nStringLength+1);
//'close' the string buffer correctly
unichars[nStringLength] = '\0';
- CFStringGetCharacters (sOrig, CFRangeMake(0,nStringLength), unichars);
+ CFStringGetCharacters (sOrig, CFRangeMake(0,nStringLength), unichars.get());
CFRelease(sOrig);
- return OUString(reinterpret_cast<sal_Unicode *>(unichars));
+ return OUString(reinterpret_cast<sal_Unicode *>(unichars.get()));
}
diff --git a/fpicker/source/aqua/NSString_OOoAdditions.mm b/fpicker/source/aqua/NSString_OOoAdditions.mm
index 23ae6bc5c853..5721674f8121 100644
--- a/fpicker/source/aqua/NSString_OOoAdditions.mm
+++ b/fpicker/source/aqua/NSString_OOoAdditions.mm
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <memory>
+
#include "NSString_OOoAdditions.hxx"
@implementation NSString (OOoAdditions)
@@ -32,14 +36,14 @@
{
unsigned int nFileNameLength = [self length];
- UniChar unichars[nFileNameLength+1];
+ auto const unichars = std::make_unique<UniChar[]>(nFileNameLength+1);
//'close' the string buffer correctly
unichars[nFileNameLength] = '\0';
- [self getCharacters:unichars];
+ [self getCharacters:unichars.get()];
- return OUString(reinterpret_cast<sal_Unicode *>(unichars));
+ return OUString(reinterpret_cast<sal_Unicode *>(unichars.get()));
}
@end
diff --git a/shell/source/backends/macbe/macbackend.mm b/shell/source/backends/macbe/macbackend.mm
index e84ecd4b8013..7733bf95da6c 100644
--- a/shell/source/backends/macbe/macbackend.mm
+++ b/shell/source/backends/macbe/macbackend.mm
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <memory>
// For MAXHOSTNAMELEN constant
#include <sys/param.h>
@@ -157,13 +160,13 @@ static OUString CFStringToOUString(const CFStringRef sOrig) {
CFIndex nStringLen = CFStringGetLength(sOrig)+1;
// Allocate a c string buffer
- char sBuffer[nStringLen];
+ auto const sBuffer = std::make_unique<char[]>(nStringLen);
- CFStringGetCString(sOrig, sBuffer, nStringLen, kCFStringEncodingASCII);
+ CFStringGetCString(sOrig, sBuffer.get(), nStringLen, kCFStringEncodingASCII);
CFRelease(sOrig);
- return OUString::createFromAscii(sBuffer);
+ return OUString::createFromAscii(sBuffer.get());
}
static OUString GetOUString( NSString* pStr )
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index f8608f62c2f7..4071155e28cc 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -19,6 +19,8 @@
#include <sal/config.h>
+#include <memory>
+
#include <sal/macros.h>
#include <tools/helpers.hxx>
#include <tools/long.hxx>
@@ -2048,7 +2050,7 @@ static NSArray *getMergedAccessibilityChildren(NSArray *pDefaultChildren, NSArra
// Skip the posting of SalEvent::ExtTextInput and
// SalEvent::EndExtTextInput events for private use area characters.
NSUInteger nLen = [pChars length];
- unichar pBuf[ nLen + 1 ];
+ auto const pBuf = std::make_unique<unichar[]>( nLen + 1 );
NSUInteger nBufLen = 0;
for ( NSUInteger i = 0; i < nLen; i++ )
{
@@ -2060,7 +2062,7 @@ static NSArray *getMergedAccessibilityChildren(NSArray *pDefaultChildren, NSArra
}
pBuf[nBufLen] = 0;
- pNewMarkedText = [NSString stringWithCharacters:pBuf length:nBufLen];
+ pNewMarkedText = [NSString stringWithCharacters:pBuf.get() length:nBufLen];
if (!pNewMarkedText || ![pNewMarkedText length])
bNeedsExtTextInput = false;
}
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index f800e3c15829..0522ff8d58e7 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -18,6 +18,9 @@
*/
#include <sal/config.h>
+
+#include <memory>
+
#include <sal/log.hxx>
#include <config_folders.h>
@@ -77,8 +80,8 @@ public:
bool FontHasCharacter(CTFontRef pFont, const OUString& rString, sal_Int32 nIndex, sal_Int32 nLen)
{
- CGGlyph glyphs[nLen];
- return CTFontGetGlyphsForCharacters(pFont, reinterpret_cast<const UniChar*>(rString.getStr() + nIndex), glyphs, nLen);
+ auto const glyphs = std::make_unique<CGGlyph[]>(nLen);
+ return CTFontGetGlyphsForCharacters(pFont, reinterpret_cast<const UniChar*>(rString.getStr() + nIndex), glyphs.get(), nLen);
}
}