diff options
| author | ruki <[email protected]> | 2021-09-20 22:54:29 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-20 22:54:29 +0800 |
| commit | ed1c24645198aa1451ee22c005a16fa7b8e4d5bc (patch) | |
| tree | ccb126d4087620e72a658531434e06be4b86a5d3 /xmake/core/base/bytes.lua | |
| parent | 68f4ab938564a43656236de3a0eb67f9222bc876 (diff) | |
add libc.dataptr
Diffstat (limited to 'xmake/core/base/bytes.lua')
| -rw-r--r-- | xmake/core/base/bytes.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/xmake/core/base/bytes.lua b/xmake/core/base/bytes.lua index ba44d3403..a4a963762 100644 --- a/xmake/core/base/bytes.lua +++ b/xmake/core/base/bytes.lua @@ -60,10 +60,10 @@ function _instance.new(...) local ptr = arg2 local manage = arg3 if manage then - instance._CDATA = ffi.gc(ffi.cast("unsigned char*", ptr), ffi.C.free) + instance._CDATA = ffi.gc(libc.dataptr(ptr), ffi.C.free) instance._MANAGED = true else - instance._CDATA = ffi.cast("unsigned char*", ptr) + instance._CDATA = libc.dataptr(ptr) instance._MANAGED = false end else @@ -91,7 +91,7 @@ function _instance.new(...) -- bytes(str): mounts a buffer from the given string local str = arg1 instance._SIZE = #str - instance._CDATA = ffi.cast("unsigned char*", str) + instance._CDATA = libc.dataptr(str) instance._REF = str -- keep ref for GC instance._MANAGED = false instance._READONLY = true |
