Check Long to size_t conversion
This commit is contained in:
1 parent
1430bd9e88
commit
7492841b5f
2 files changed
+6
No files matched your search
@@ -2,6 +2,9 @@ package moe.tarsin.ehviewer
|
||||
|
||||
import platform.posix.size_t
|
||||
|
||||
private val MAX_ALLOWED_CONVERT_VALUE = size_t.MAX_VALUE.toLong()
|
||||
|
||||
actual fun Long.tosize_t(): size_t {
|
||||
check(this <= MAX_ALLOWED_CONVERT_VALUE)
|
||||
return toUInt()
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package moe.tarsin.ehviewer
|
||||
|
||||
import platform.posix.size_t
|
||||
|
||||
private val MAX_ALLOWED_CONVERT_VALUE = size_t.MAX_VALUE.toLong()
|
||||
|
||||
actual fun Long.tosize_t(): size_t {
|
||||
check(this <= MAX_ALLOWED_CONVERT_VALUE)
|
||||
return toUInt()
|
||||
}
|
||||
Reference in new issue
Block a user