mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-06-07 09:45:53 +02:00
Restrict integer arguments to 32 bits
When built as 64-bit, use the 'i' and 'I' arguments for MiniFFI/Win32API to specifically refer to a 32-bit integer. 'l', 'L', 'n' and 'N' continue to refer to the `long` sizes.
This commit is contained in:
parent
2bcdfdb23a
commit
901b2b6143
1 changed files with 6 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "fake-api.h"
|
#include "fake-api.h"
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "debugwriter.h"
|
#include "debugwriter.h"
|
||||||
|
@ -251,8 +252,12 @@ RB_METHOD(MiniFFI_call) {
|
||||||
lParam = RTEST(rb_ary_entry(args, i));
|
lParam = RTEST(rb_ary_entry(args, i));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _T_NUMBER:
|
|
||||||
case _T_INTEGER:
|
case _T_INTEGER:
|
||||||
|
#if INTPTR_MAX == INT64_MAX
|
||||||
|
lParam = NUM2UINT(rb_ary_entry(args, i)) & UINT32_MAX;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case _T_NUMBER:
|
||||||
default:
|
default:
|
||||||
lParam = NUM2ULONG(rb_ary_entry(args, i));
|
lParam = NUM2ULONG(rb_ary_entry(args, i));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue