mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
* sys: Updated curl to latest version * sys: Fix macOS compilation * ui: Fix splash screen OpenGL init for macOS * sys: Fix std::min compile errors * git: Re-enabled macos workflow * sys: Remove includes of the range library * build: Find OpenGL using CMake * sys/build: Fix bundled plugins on macOS * build: Copy plugins to bundle when creating a bundle * build: Fixup bundled plugins * sys: Search for plugins in the bundle instead of in Application Support * sys: Allow resources to be placed in multiple directories on macOS * build: Output built plugins to the plugins/ directory when not creating a bundle on macOS * sys: Fix Application Support paths on macOS * sys: Define ftruncate64 on macOS * sys: Fix absolute value computation for std::string::at on macOS Co-authored-by: WerWolv <werwolv98@gmail.com>
This commit is contained in:
@@ -193,7 +193,14 @@ namespace hex::plugin::builtin {
|
||||
auto string = Token::literalToString(params[0], false);
|
||||
auto index = Token::literalToSigned(params[1]);
|
||||
|
||||
if (std::abs(index) > string.length())
|
||||
#if defined(OS_MACOS)
|
||||
const auto signIndex = index >> (sizeof(index) * 8 - 1);
|
||||
const auto absIndex = (index ^ signIndex) - signIndex;
|
||||
#else
|
||||
const auto absIndex = std::abs(index);
|
||||
#endif
|
||||
|
||||
if (absIndex > string.length())
|
||||
LogConsole::abortEvaluation("character index out of range");
|
||||
|
||||
if (index >= 0)
|
||||
|
||||
Reference in New Issue
Block a user