Skip to content

Commit 074baf4

Browse files
authored
fix: fix warnings and deal with recent OIIO deprecations (#1844)
* fix: Handle OIIO deprecations * int: Use ustring::strhash if it exists (not Strutil::strhash) If it exists, ustring::strhash has some planned special properties. * Deal with OIIO deprecations --------- Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent 8913eed commit 074baf4

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/include/OSL/hashes.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ constexpr inline size_t
4040
strhash(const char* s)
4141
{
4242
size_t len = pvt::pvtstrlen(s);
43-
return OIIO::Strutil::strhash(OIIO::string_view(s, len));
43+
#ifdef OIIO_USTRING_SAFE_HASH
44+
return ustring::strhash(string_view(s, len));
45+
#else
46+
return OIIO::Strutil::strhash(string_view(s, len));
47+
#endif
4448
}
4549

4650
// Template to ensure the hash is evaluated at compile time.

src/liboslexec/batched_llvm_gen.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,7 +2929,8 @@ LLVMGEN(llvm_gen_filterwidth)
29292929
}
29302930

29312931
rop.ll.call_function(rop.build_name(func_spec),
2932-
{ &args[0], argCount });
2932+
{ &args[0],
2933+
cspan<llvm::Value*>::size_type(argCount) });
29332934
// Don't have 2nd order derivs
29342935
rop.llvm_zero_derivs(Result);
29352936
}
@@ -6957,7 +6958,9 @@ LLVMGEN(llvm_gen_calculatenormal)
69576958
args[arg_count++] = rop.ll.mask_as_int(rop.ll.current_mask());
69586959
func_spec.mask();
69596960
}
6960-
rop.ll.call_function(rop.build_name(func_spec), { &args[0], arg_count });
6961+
rop.ll.call_function(rop.build_name(func_spec),
6962+
{ &args[0],
6963+
cspan<llvm::Value*>::size_type(arg_count) });
69616964

69626965
if (Result.has_derivs())
69636966
rop.llvm_zero_derivs(Result);

src/liboslexec/batched_llvm_instance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ struct CStrHash {
200200
OSL_FORCEINLINE size_t operator()(const char* str) const
201201
{
202202
OSL_DASSERT(str != nullptr);
203-
return OIIO::Strutil::strhash(str);
203+
return OSL::strhash(str);
204204
}
205205
};
206206

src/osltoy/osltoyapp.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,8 @@ OSLToyMainWindow::OSLToyMainWindow(OSLToyRenderer* rend, int xr, int yr)
432432
QPixmap pixmap(xres, yres);
433433
OIIO::ImageBuf checks(
434434
OIIO::ImageSpec(xres, yres, 3, OIIO::TypeDesc::UINT8));
435-
const float white[] = { 1, 1, 1 };
436-
const float black[] = { 0, 0, 0 };
437-
OIIO::ImageBufAlgo::checker(checks, 16, 16, 1, white, black);
435+
OIIO::ImageBufAlgo::checker(checks, 16, 16, 1, 1.0f /* white */,
436+
0.0f /* black */);
438437
renderView->update(checks);
439438

440439
textTabs = new QTabWidget;

0 commit comments

Comments
 (0)