core: fix a few warnings
authorDa Risk <da_risk@geekorum.com>
Mon, 04 May 2026 23:44:20 -0400
changeset 116 7e40819b3fe2
parent 115 5c6baebd860d
child 117 22d79b197676
core: fix a few warnings
core/src/commonMain/kotlin/licensee/LicenseeParser.kt
core/src/iosMain/kotlin/licenseplist/LicensePlistParser.kt
--- a/core/src/commonMain/kotlin/licensee/LicenseeParser.kt	Mon May 04 18:53:53 2026 -0400
+++ b/core/src/commonMain/kotlin/licensee/LicenseeParser.kt	Mon May 04 23:44:20 2026 -0400
@@ -45,11 +45,11 @@
         }
         val items: List<LicenseItem> = json.decodeFromString(buffered.readUtf8())
 
-        return items.associate {
-            val name = it.name ?: "${it.groupId}:${it.artifactId}"
-            val license = it.spdxLicenses.firstNotNullOfOrNull {
+        return items.associate { item ->
+            val name = item.name ?: "${item.groupId}:${item.artifactId}"
+            val license = item.spdxLicenses.firstNotNullOfOrNull {
                 "${it.name}\n\n${it.url}"
-            } ?: it.unknownLicenses.firstNotNullOf {
+            } ?: item.unknownLicenses.firstNotNullOf {
                 "${it.name}\n\n${it.url}"
             }
             name to license
--- a/core/src/iosMain/kotlin/licenseplist/LicensePlistParser.kt	Mon May 04 18:53:53 2026 -0400
+++ b/core/src/iosMain/kotlin/licenseplist/LicensePlistParser.kt	Mon May 04 23:44:20 2026 -0400
@@ -28,6 +28,7 @@
 import kotlinx.cinterop.memScoped
 import kotlinx.cinterop.ptr
 import kotlinx.cinterop.value
+import kotlinx.coroutines.suspendCancellableCoroutine
 import platform.Foundation.NSBundle
 import platform.Foundation.NSData
 import platform.Foundation.NSError
@@ -37,7 +38,6 @@
 import platform.Foundation.dataWithContentsOfURL
 import kotlin.coroutines.resume
 import kotlin.coroutines.resumeWithException
-import kotlin.coroutines.suspendCoroutine
 
 /**
  * Parse LicensePlist files
@@ -87,10 +87,11 @@
     }
 
     @OptIn(ExperimentalForeignApi::class, BetaInteropApi::class)
-    private suspend fun NSData.toPropertyList(): Any? = suspendCoroutine { cont ->
+    private suspend fun NSData.toPropertyList(): Any? = suspendCancellableCoroutine { cont ->
         val parsed = memScoped {
             val error: ObjCObjectVar<NSError?> = alloc()
-            val result = NSPropertyListSerialization.propertyListWithData(this@toPropertyList,
+            val result = NSPropertyListSerialization.propertyListWithData(
+                this@toPropertyList,
                 options = NSPropertyListMutableContainers,
                 format = null,
                 error.ptr