Fix issues needing a fix caught by review.
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
import com.vanniktech.maven.publish.KotlinMultiplatform
|
||||
import io.github.frankois944.spmForKmp.swiftPackageConfig
|
||||
import io.github.frankois944.spmForKmp.utils.ExperimentalSpmForKmpFeature
|
||||
import org.gradle.kotlin.dsl.androidLibrary
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
|
||||
|
||||
@@ -25,7 +24,7 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
androidLibrary {
|
||||
android {
|
||||
namespace = "com.vitorpamplona.quartz"
|
||||
compileSdk =
|
||||
libs.versions.android.compileSdk
|
||||
|
||||
@@ -31,7 +31,7 @@ actual object Rfc3986 {
|
||||
actual fun normalize(uri: String): String =
|
||||
rfc3986UriBridge
|
||||
.normalizeUrlWithUrl(uri, null)
|
||||
.let { if (it?.last() == '/') it else "$it/" }
|
||||
?.let { if (it.last() == '/') it else "$it/" } ?: throw Exception("Could not normalize URI: $uri")
|
||||
|
||||
actual fun isValidUrl(url: String): Boolean = rfc3986UriBridge.isUrlValidWithUrl(url)
|
||||
|
||||
|
||||
+12
-11
@@ -80,7 +80,7 @@ actual class LargeCache<K, V> : ICacheOperations<K, V> {
|
||||
} else {
|
||||
val newObject = builder(key)
|
||||
concurrentMap.put(key, newObject)
|
||||
concurrentMap[key] == null
|
||||
concurrentMap[key] != null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ actual class LargeCache<K, V> : ICacheOperations<K, V> {
|
||||
|
||||
actual override fun <R> mapNotNullIntoSet(consumer: CacheCollectors.BiMapper<K, V, R?>): Set<R> = mapNotNull(consumer).toSet()
|
||||
|
||||
actual override fun <R> mapFlatten(consumer: CacheCollectors.BiMapper<K, V, Collection<R>?>): List<R> = concurrentMap.flatMap { consumer.map(it.key, it.value) as Iterable<R> }
|
||||
actual override fun <R> mapFlatten(consumer: CacheCollectors.BiMapper<K, V, Collection<R>?>): List<R> = concurrentMap.flatMap { entry -> consumer.map(entry.key, entry.value) ?: emptyList() }
|
||||
|
||||
actual override fun <R> mapFlattenIntoSet(consumer: CacheCollectors.BiMapper<K, V, Collection<R>?>): Set<R> = mapFlatten(consumer).toSet()
|
||||
|
||||
@@ -312,10 +312,14 @@ fun <K, V> CacheMap<K, V>.subMapAlt(
|
||||
val keySet = keys
|
||||
val fromIndex = keySet.indexOf(from)
|
||||
val toIndex = keySet.indexOf(to)
|
||||
for (index in fromIndex..toIndex) {
|
||||
for (index in fromIndex until toIndex) {
|
||||
val correspondingEntry = entries.elementAt(index)
|
||||
resultMap[correspondingEntry.key] = correspondingEntry.value
|
||||
}
|
||||
if (toInclusive) {
|
||||
val correspondingToEntry = entries.elementAt(toIndex)
|
||||
resultMap[correspondingToEntry.key] = correspondingToEntry.value
|
||||
}
|
||||
|
||||
return resultMap
|
||||
}
|
||||
@@ -332,10 +336,6 @@ fun <K, V> Map<K, V>.maxOrNullOf(
|
||||
): V? {
|
||||
var maxK: K? = null
|
||||
var maxV: V? = null
|
||||
|
||||
val finalMaxK: K? = maxK
|
||||
val finalMaxV: V? = maxV
|
||||
|
||||
forEach {
|
||||
if (filter.filter(it.key, it.value)) {
|
||||
if (maxK == null || (maxV != null && comparator.compare(it.value, maxV) > 0)) {
|
||||
@@ -345,21 +345,22 @@ fun <K, V> Map<K, V>.maxOrNullOf(
|
||||
}
|
||||
}
|
||||
|
||||
val finalMaxK: K? = maxK
|
||||
val finalMaxV: V? = maxV
|
||||
|
||||
return finalMaxV
|
||||
}
|
||||
|
||||
fun <K, V> Map<K, V>.sumOf(consumer: CacheCollectors.BiSumOf<K, V>): Int {
|
||||
var sum = 0
|
||||
val totalSum = sum
|
||||
forEach { sum += consumer.map(it.key, it.value) }
|
||||
return totalSum
|
||||
return sum
|
||||
}
|
||||
|
||||
fun <K, V> Map<K, V>.sumOfLong(consumer: CacheCollectors.BiSumOfLong<K, V>): Long {
|
||||
var sum = 0L
|
||||
val totalSum = sum
|
||||
forEach { sum += consumer.map(it.key, it.value) }
|
||||
return totalSum
|
||||
return sum
|
||||
}
|
||||
|
||||
fun <K, V, R> Map<K, V>.groupBy(consumer: CacheCollectors.BiNotNullMapper<K, V, R>): Map<R, List<V>> {
|
||||
|
||||
@@ -227,7 +227,7 @@ class CustomBitSet(
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
for (i in 0..words.size) words[i] = 0
|
||||
for (i in words.indices) words[i] = 0
|
||||
}
|
||||
|
||||
private constructor(longArray: LongArray) : this(0) {
|
||||
|
||||
@@ -38,7 +38,7 @@ actual class MacInstance actual constructor(
|
||||
.keyDecoder(digestForAlgorithm(algorithm))
|
||||
.decodeFromByteArrayBlocking(HMAC.Key.Format.RAW, key)
|
||||
|
||||
private val hmacSignFunction = internalMacInstance.signatureGenerator().createSignFunction()
|
||||
private var hmacSignFunction = internalMacInstance.signatureGenerator().createSignFunction()
|
||||
|
||||
actual fun init(
|
||||
key: ByteArray,
|
||||
@@ -49,6 +49,8 @@ actual class MacInstance actual constructor(
|
||||
.get(HMAC)
|
||||
.keyDecoder(digestForAlgorithm(algorithm))
|
||||
.decodeFromByteArrayBlocking(HMAC.Key.Format.RAW, key)
|
||||
|
||||
hmacSignFunction = internalMacInstance.signatureGenerator().createSignFunction()
|
||||
}
|
||||
|
||||
actual fun getMacLength(): Int = hmacSignFunction.signIntoByteArray(internalMacInstance.encodeToByteArrayBlocking(HMAC.Key.Format.RAW))
|
||||
|
||||
Reference in New Issue
Block a user