aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx7
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_);
}