From 3c4ee3e6f6344a3933383ed939f49c2f8d57e684 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 4 May 2013 17:49:07 +1000 Subject: Replacing raw pointers and allocations with std::vector. --- src/PositionCache.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/PositionCache.h') diff --git a/src/PositionCache.h b/src/PositionCache.h index ad3fffd7f..34f237705 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -73,13 +73,11 @@ public: */ class LineLayoutCache { int level; - int length; - int size; - LineLayout **cache; + std::vectorcache; bool allInvalidated; int styleClock; int useCount; - void Allocate(int length_); + void Allocate(size_t length_); void AllocateForLevel(int linesOnScreen, int linesInDoc); public: LineLayoutCache(); @@ -122,9 +120,7 @@ class BreakFinder { int lineEnd; int posLineStart; int nextBreak; - int *selAndEdge; - unsigned int saeSize; - unsigned int saeLen; + std::vector selAndEdge; unsigned int saeCurrentPos; int saeNext; int subBreak; @@ -146,8 +142,7 @@ public: }; class PositionCache { - PositionCacheEntry *pces; - size_t size; + std::vector pces; unsigned int clock; bool allClear; // Private so PositionCache objects can not be copied @@ -157,7 +152,7 @@ public: ~PositionCache(); void Clear(); void SetSize(size_t size_); - size_t GetSize() const { return size; } + size_t GetSize() const { return pces.size(); } void MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber, const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc); }; -- cgit v1.2.3