Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/libutil/strutil_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,14 @@ test_string_view()
Strutil::print("addr cstr={:p}, s={:p}, ustring={:p}, sr={:p}, c_str(sr)={:p}\n",
(void*)cstr, (void*)s.c_str(), (void*)ustring(cstr).c_str(), (void*)sr.data(),
(void*)OIIO::c_str(sr));

// Test some edge cases for fmt formatting
string_view empty(""), uninit;
Strutil::print("Test print empty string_view: '{}'\n", empty);
Strutil::print("Test print default initialized string_view: '{}'\n", uninit);
OIIO_CHECK_EQUAL(empty, uninit);
OIIO_CHECK_EQUAL(Strutil::format("{}", empty),
Strutil::format("{}", uninit));
}


Expand Down
6 changes: 6 additions & 0 deletions src/libutil/ustring_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ test_ustring()
OIIO_CHECK_EQUAL(whichtype, ustring("foo"));
OIIO_CHECK_ASSERT((std::is_same<decltype(whichtype), ustring>::value));
OIIO_CHECK_ASSERT(!(std::is_same<decltype(whichtype), const char*>::value));

// Test some edge cases for fmt formatting
Strutil::print("Test print empty ustring: '{}'\n", empty);
Strutil::print("Test print default initialized ustring: '{}'\n", uninit);
OIIO_CHECK_EQUAL(Strutil::format("{}", empty),
Strutil::format("{}", uninit));
}


Expand Down
31 changes: 20 additions & 11 deletions src/raw.imageio/rawinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,18 @@ RawInput::open_raw(bool unpack, bool process, const std::string& name,
int ret = m_processor->open_file(name.c_str());
#endif
if (ret != LIBRAW_SUCCESS) {
const char* err = libraw_strerror(ret);
errorfmt("Could not open file \"{}\", {}", m_filename,
libraw_strerror(ret));
err ? err : "unknown error");
return false;
}

OIIO_ASSERT(!m_unpacked);
if (unpack) {
if ((ret = m_processor->unpack()) != LIBRAW_SUCCESS) {
const char* err = libraw_strerror(ret);
errorfmt("Could not unpack \"{}\", {}", m_filename,
libraw_strerror(ret));
err ? err : "unknown error");
return false;
}
m_unpacked = true;
Expand Down Expand Up @@ -912,13 +914,16 @@ RawInput::open_raw(bool unpack, bool process, const std::string& name,
// Get unadjusted max value (need to force a read first)
ret = m_processor->raw2image_ex(/*subtract_black=*/true);
if (ret != LIBRAW_SUCCESS) {
errorfmt("HighlightMode adjustment detection read failed");
errorfmt("{}", libraw_strerror(ret));
const char* err = libraw_strerror(ret);
errorfmt("HighlightMode adjustment detection read failed ({})",
err ? err : "unknown error");
return false;
}
if (m_processor->adjust_maximum() != LIBRAW_SUCCESS) {
errorfmt("HighlightMode minimum adjustment failed");
errorfmt("{}", libraw_strerror(ret));
ret = m_processor->adjust_maximum();
if (ret != LIBRAW_SUCCESS) {
const char* err = libraw_strerror(ret);
errorfmt("HighlightMode minimum adjustment failed ({})",
err ? err : "unknown error");
return false;
}
float unadjusted = m_processor->imgdata.color.maximum;
Expand All @@ -928,9 +933,11 @@ RawInput::open_raw(bool unpack, bool process, const std::string& name,
= (old_max_thr == 0.0f) ? 1.0 : old_max_thr;

// Get new max value
if (m_processor->adjust_maximum() != LIBRAW_SUCCESS) {
errorfmt("HighlightMode maximum adjustment failed");
errorfmt("{}", libraw_strerror(ret));
ret = m_processor->adjust_maximum();
if (ret != LIBRAW_SUCCESS) {
const char* err = libraw_strerror(ret);
errorfmt("HighlightMode maximum adjustment failed ({})",
err ? err : "unknown error");
return false;
}
float adjusted = m_processor->imgdata.color.maximum;
Expand Down Expand Up @@ -1566,7 +1573,9 @@ RawInput::do_process()
if (!m_image) {
int ret = m_processor->dcraw_process();
if (ret != LIBRAW_SUCCESS) {
errorfmt("Processing image failed, {}", libraw_strerror(ret));
const char* err = libraw_strerror(ret);
errorfmt("Processing image failed, {}",
err ? err : "unknown error");
return false;
}

Expand Down
Loading