mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
remove "import const" everywhere
This commit is contained in:
@@ -6,20 +6,10 @@ module rand
|
||||
|
||||
#flag darwin -framework Security
|
||||
|
||||
// import const (
|
||||
// kSecRandomDefault
|
||||
// errSecSuccess
|
||||
// )
|
||||
|
||||
const (
|
||||
kSecRandomDefault = 0
|
||||
errSecSuccess = 0
|
||||
)
|
||||
|
||||
pub fn read(bytes_needed int) ?[]byte {
|
||||
mut buffer := malloc(bytes_needed)
|
||||
status := C.SecRandomCopyBytes(kSecRandomDefault, bytes_needed, buffer)
|
||||
if status != errSecSuccess {
|
||||
status := C.SecRandomCopyBytes(0, bytes_needed, buffer)
|
||||
if status != 0 {
|
||||
return ReadError
|
||||
}
|
||||
return c_array_to_bytes_tmp(bytes_needed, buffer)
|
||||
|
||||
Reference in New Issue
Block a user