Skip to content

Commit 53b640d

Browse files
authored
Add UnsafeNumber opt-in annotation (#30)
1 parent 198a545 commit 53b640d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ build/
33
*.iml
44
.idea/
55
local.properties
6+
.kotlin/
7+
8+
gh-pages/*
9+
!gh-pages/publish.sh

library/crypto-rand/src/darwinMain/kotlin/org/kotlincrypto/random/internal/DarwinPlatform.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
**/
16+
@file:Suppress("UnnecessaryOptInAnnotation")
17+
1618
package org.kotlincrypto.random.internal
1719

1820
import kotlinx.cinterop.*
@@ -22,8 +24,8 @@ import org.kotlincrypto.random.RandomnessProcurementException
2224

2325
@Throws(RandomnessProcurementException::class)
2426
internal actual fun ByteArray.cryptoRandFill() {
25-
@OptIn(ExperimentalForeignApi::class)
26-
val status: Int = usePinned { pinned ->
27+
@OptIn(ExperimentalForeignApi::class, UnsafeNumber::class)
28+
val status = usePinned { pinned ->
2729
// kSecRandomDefault is synonymous to NULL
2830
SecRandomCopyBytes(kSecRandomDefault, size.toUInt().convert(), pinned.addressOf(0))
2931
}

0 commit comments

Comments
 (0)