Skip to content

Commit 2922314

Browse files
committed
fix: some LoggedTimer instances lacked a variable name (#4571)
It was syntactically correct, but without an actual variable, there was no RAII scope and so it destructs immediately, causing the timers to capture 0 time. Found by Sonar warnings. --------- Signed-off-by: Larry Gritz <[email protected]>
1 parent d131a49 commit 2922314

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/libOpenImageIO/imagebuf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ ImageBuf::write(ImageOutput* out, ProgressCallback progress_callback,
15001500
}
15011501
bool ok = true;
15021502
ok &= m_impl->validate_pixels();
1503-
pvt::LoggedTimer("IB::write inner");
1503+
pvt::LoggedTimer logtime("IB::write inner");
15041504
if (out->supports("thumbnail") && has_thumbnail()) {
15051505
auto thumb = get_thumbnail();
15061506
// Strutil::print("IB::write: has thumbnail ROI {}\n", thumb->roi());
@@ -1617,7 +1617,7 @@ ImageBuf::write(string_view _filename, TypeDesc dtype, string_view _fileformat,
16171617
ProgressCallback progress_callback,
16181618
void* progress_callback_data) const
16191619
{
1620-
pvt::LoggedTimer("IB::write");
1620+
pvt::LoggedTimer logtime("IB::write");
16211621
string_view filename = _filename.size() ? _filename : string_view(name());
16221622
string_view fileformat = _fileformat.size() ? _fileformat : filename;
16231623
if (filename.size() == 0) {

src/libOpenImageIO/imageoutput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ ImageOutput::write_image(TypeDesc format, const void* data, stride_t xstride,
487487
ProgressCallback progress_callback,
488488
void* progress_callback_data)
489489
{
490-
pvt::LoggedTimer("ImageOutput::write image");
490+
pvt::LoggedTimer logtime("ImageOutput::write image");
491491
bool native = (format == TypeDesc::UNKNOWN);
492492
stride_t pixel_bytes = native ? (stride_t)m_spec.pixel_bytes(native)
493493
: format.size() * m_spec.nchannels;

src/tiff.imageio/tiffoutput.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ TIFFOutput::write_scanlines(int ybegin, int yend, int z, TypeDesc format,
13481348
const void* data, stride_t xstride,
13491349
stride_t ystride)
13501350
{
1351-
pvt::LoggedTimer("TIFFOutput::write_scanlines");
1351+
pvt::LoggedTimer logger("TIFFOutput::write_scanlines");
13521352
// If the stars all align properly, try to write strips, and use the
13531353
// thread pool to parallelize the compression. This can give a large
13541354
// speedup (5x or more!) because the zip compression dwarfs the
@@ -1575,7 +1575,7 @@ TIFFOutput::write_tiles(int xbegin, int xend, int ybegin, int yend, int zbegin,
15751575
int zend, TypeDesc format, const void* data,
15761576
stride_t xstride, stride_t ystride, stride_t zstride)
15771577
{
1578-
pvt::LoggedTimer("TIFFOutput::write_tiles");
1578+
pvt::LoggedTimer logger("TIFFOutput::write_tiles");
15791579
if (!m_spec.valid_tile_range(xbegin, xend, ybegin, yend, zbegin, zend))
15801580
return false;
15811581

0 commit comments

Comments
 (0)