diff options
author | Neil <nyamatongwe@gmail.com> | 2022-08-01 16:48:21 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2022-08-01 16:48:21 +1000 |
commit | 987598c6d853eac0a99bbf97f4fe847874652ed3 (patch) | |
tree | 3d639ab2a73389c4b6393a7377475af94f7fdce4 /src/PositionCache.cxx | |
parent | 6db9764146c11637c6cc3d6749a566f17e6f3429 (diff) | |
download | scintilla-mirror-987598c6d853eac0a99bbf97f4fe847874652ed3.tar.gz |
Avoid some warnings from Code Analysis.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 23733c3a0..fc27dce77 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -87,11 +87,12 @@ LineLayout::~LineLayout() { void LineLayout::Resize(int maxLineLength_) { if (maxLineLength_ > maxLineLength) { Free(); - chars = std::make_unique<char[]>(maxLineLength_ + 1); - styles = std::make_unique<unsigned char []>(maxLineLength_ + 1); + const size_t lineAllocation = maxLineLength_ + 1; + chars = std::make_unique<char[]>(lineAllocation); + styles = std::make_unique<unsigned char []>(lineAllocation); // Extra position allocated as sometimes the Windows // GetTextExtentExPoint API writes an extra element. - positions = std::make_unique<XYPOSITION []>(maxLineLength_ + 1 + 1); + positions = std::make_unique<XYPOSITION []>(lineAllocation + 1); if (bidiData) { bidiData->Resize(maxLineLength_); } |