Skip to content

Commit f0e1ba0

Browse files
committed
Merge branch 'refactor/tokenizer' into autobuild/tokenizer
2 parents 0d49813 + 730c137 commit f0e1ba0

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

source/base/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
/// where `N` is a serial number starting at 1 in each phase, `TIME` is the number of minutes
101101
/// since 2000-01-01 00:00, and `FEATURE` is an arbitrary alphanumeric moniker for a particular
102102
/// experimental feature.
103-
#define POV_RAY_PRERELEASE "x.tokenizer.9841908"
103+
#define POV_RAY_PRERELEASE "x.tokenizer.9844488"
104104

105105
#if defined(DOXYGEN) && !defined(POV_RAY_PRERELEASE)
106106
// Work around doxygen being unable to document undefined macros.

source/core/material/pattern.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9287,8 +9287,6 @@ void Read_Density_File(IStream *file, DENSITY_FILE *df)
92879287
}
92889288
else
92899289
throw POV_EXCEPTION_STRING("Invalid density file size");
9290-
9291-
delete file;
92929290
}
92939291
}
92949292

source/core/math/randomsequence.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Vector2d Uniform2dOnSquare(SequentialDoubleGeneratorPtr source)
226226
{
227227
double x = (*source)();
228228
double y = (*source)();
229-
return Vector2d((*source)(), (*source)());
229+
return Vector2d(x, y);
230230
}
231231

232232
Vector2d Uniform2dOnDisc(SequentialDoubleGeneratorPtr source)

source/core/support/simplevector.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,23 @@ class VectorPool
627627
{
628628
if (initialPoolSize != 0)
629629
mPool.reserve(initialPoolSize);
630+
#ifdef POV_CORE_DEBUG
631+
mAllocCount = 0;
632+
#endif
633+
}
634+
635+
~VectorPool()
636+
{
637+
for (auto&& p : mPool)
638+
{
639+
delete p;
640+
#ifdef POV_CORE_DEBUG
641+
--mAllocCount;
642+
#endif
643+
}
644+
#ifdef POV_CORE_DEBUG
645+
POV_CORE_ASSERT(mAllocCount == 0);
646+
#endif
630647
}
631648

632649
VectorPool(const VectorPool&) = delete;
@@ -638,6 +655,9 @@ class VectorPool
638655
if (mPool.empty())
639656
{
640657
p = new VECTOR_T();
658+
#ifdef POV_CORE_DEBUG
659+
++mAllocCount;
660+
#endif
641661
}
642662
else
643663
{
@@ -660,6 +680,9 @@ class VectorPool
660680

661681
vector<VECTOR_T*> mPool;
662682
size_t mSizeHint;
683+
#ifdef POV_CORE_DEBUG
684+
size_t mAllocCount;
685+
#endif
663686
};
664687

665688
//******************************************************************************

source/parser/scanner.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,14 @@ void Scanner::SetInputStream(SourcePtr stream)
338338

339339
bool Scanner::SetInputStream(SourcePtr stream, const Bookmark& bookmark)
340340
{
341+
bool seekOk;
342+
341343
if ((mpSource == stream) && (bookmark.offset >= mBase) &&
342344
((bookmark.offset - mBase) < (mpBufferEnd - maBuffer)))
343345
{
344346
// Bookmark is already loaded in the buffer.
345347
// Just advance/rewind the next character accordingly.
348+
seekOk = true;
346349
mpNextChar = maBuffer + (bookmark.offset - mBase);
347350
}
348351
else
@@ -353,11 +356,12 @@ bool Scanner::SetInputStream(SourcePtr stream, const Bookmark& bookmark)
353356
mpSource = stream;
354357

355358
// Refill the buffer.
356-
mEndOfStream = !mpSource->seekg(bookmark.offset);
359+
seekOk = mpSource->seekg(bookmark.offset);
357360
mBase = mpSource->tellg();
358361
mpBufferEnd = maBuffer;
359362
mpNextChar = maBuffer;
360-
if (!mEndOfStream)
363+
mEndOfStream = !seekOk;
364+
if (seekOk)
361365
RefillBuffer();
362366
}
363367

@@ -370,7 +374,7 @@ bool Scanner::SetInputStream(SourcePtr stream, const Bookmark& bookmark)
370374
mNominalEndOfLine = bookmark.nominalEndOfLine;
371375
mAllowNestedBlockComments = bookmark.allowNestedBlockComments;
372376

373-
return !mEndOfStream;
377+
return seekOk;
374378
}
375379

376380
void pov_parser::Scanner::SetStringEncoding(StringEncoding encoding)

0 commit comments

Comments
 (0)