Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2913 addressing code review comments

James93d380823252
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/address.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/address.hh
index a8ee9798d1..46f73910b6 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/address.hh
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/address.hh
@@ -479,7 +479,7 @@ inline bool Range::contains(const Address &addr) const {
/// \param size is the desired size in bytes
/// \return a value appropriate for masking off the first \e size bytes
-inline uintb calc_mask(uint4 size) { return uintbmasks[(size<8)? size : 8]; }
+inline uintb calc_mask(int4 size) { return uintbmasks[((uint4)size) < 8 ? size : 8]; }
/// Perform a CPUI_INT_RIGHT on the given val
/// \param val is the value to shift
@@ -518,7 +518,7 @@ inline uintb minimalmask(uintb val)
}
extern bool signbit_negative(uintb val,int4 size); ///< Return true if the sign-bit is set
-extern uintb calc_mask(uint4 size); ///< Calculate a mask for a given byte size
+extern uintb calc_mask(int4 size); ///< Calculate a mask for a given byte size
extern uintb uintb_negate(uintb in,int4 size); ///< Negate the \e sized value
extern uintb sign_extend(uintb in,int4 sizein,int4 sizeout); ///< Sign-extend a value between two byte sizes
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
index 2de830ffe2..a0cd141ae1 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
@@ -2199,8 +2199,8 @@ const Location *SleighCompile::getLocation(SleighSymbol *sym) const
{
try {
return &symbolLocationMap.at(sym);
- } catch (const std::out_of_range &e) {
- return NULL;
+ } catch (const out_of_range &e) {
+ return nullptr;
}
}