Skip to content

Commit

Permalink
cpp: fix framesToFrameRange() bad formatting with 2 frames (refs #24) (
Browse files Browse the repository at this point in the history
…#25)

cpp: fix framesToFrameRange() bad formatting with 2 frames (refs #24)
  • Loading branch information
justinfx authored Sep 16, 2022
1 parent 4866c35 commit 859ef52
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changes:
2.11.1
----------------
* cpp - Fix FrameSet::inverted() memory leak
* cpp - Fix framesToFrameRange() bad formatting with 2 frames

2.11.0
----------------
Expand Down
6 changes: 3 additions & 3 deletions cpp/fileseq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ std::string framesToFrameRange(const Frames &frames,
return internal::zfill(frames[0], zfill);
}

Frames::const_iterator framesIt = frames.begin();
Frames::const_iterator framesEnd = frames.end();
auto framesIt = frames.begin();
auto framesEnd = frames.end();

Frames sortedFrames;

Expand Down Expand Up @@ -66,8 +66,8 @@ std::string framesToFrameRange(const Frames &frames,
buf << ",";
}
buf << internal::zfill(framesIt[i], zfill);
hasWritten = true;
}
hasWritten = true;
break;
}

Expand Down
23 changes: 23 additions & 0 deletions cpp/test/TestFunctions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ class TestFramesToFrameRange : public testing::Test {
Case t = {FRAME_ARR_TO_VEC(arr), false, 4, "-010"};
m_cases.push_back(t);
}
{
fileseq::Frame arr[] = {1, 2};
Case t = {FRAME_ARR_TO_VEC(arr), true, 0, "1,2"};
m_cases.push_back(t);
}
{
fileseq::Frame arr[] = {1, 3};
Case t = {FRAME_ARR_TO_VEC(arr), true, 0, "1,3"};
m_cases.push_back(t);
}
{
fileseq::Frame arr[] = {2, 4};
Case t = {FRAME_ARR_TO_VEC(arr), true, 0, "2,4"};
m_cases.push_back(t);
}
{
fileseq::Frame arr[] = {1, 2, 3, 4, 5};
Case t = {FRAME_ARR_TO_VEC(arr), true, 0, "1-5"};
Expand Down Expand Up @@ -405,6 +420,14 @@ class TestFindSequenceOnDisk : public testing::Test {
Case t = {PadStyleHash4, "testdata/seqA.$F4.exr", "testdata/seqA.1,3-6,8-10#.exr"};
m_cases.push_back(t);
}
{
Case t = {PadStyleHash4, "testdata/2frame/foo.0001.ext", "testdata/2frame/foo.1,2#.ext"};
m_cases.push_back(t);
}
{
Case t = {PadStyleHash4, "testdata/2frame/foo.#.ext", "testdata/2frame/foo.1,2#.ext"};
m_cases.push_back(t);
}
}

std::vector<Case> m_cases;
Expand Down
Empty file added testdata/2frame/foo.0001.ext
Empty file.
Empty file added testdata/2frame/foo.0002.ext
Empty file.

0 comments on commit 859ef52

Please sign in to comment.