Skip to content

Commit

Permalink
fix double parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
vendelieu committed Dec 14, 2024
1 parent e74c952 commit ab1565b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ suspend fun ReThis.geoPos(key: String, vararg members: String): List<List<GeoPos
),
).unwrapList<RType>().map { entry ->
entry.safeCast<RArray>()?.value?.chunked(2) {
GeoPosition(it.first().unwrap<Double>()!!, it.last().unwrap()!!)
GeoPosition(it.first().unwrap()!!, it.last().unwrap()!!)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import io.ktor.utils.io.charsets.*
import io.ktor.utils.io.core.*
import kotlinx.io.Buffer
import kotlinx.io.readDecimalLong
import kotlinx.io.readDouble
import kotlinx.io.readString

internal suspend fun ByteReadChannel.readRedisMessage(charset: Charset, rawOnly: Boolean = false): RType {
val type = RespCode.fromCode(readByte()) // Read the type byte (e.g., +, -, :, $, *)
Expand Down Expand Up @@ -52,7 +52,7 @@ internal suspend fun ByteReadChannel.readRedisMessage(charset: Charset, rawOnly:
else -> exception { "Invalid boolean format: $line" }
}

RespCode.DOUBLE -> F64(line.readDouble())
RespCode.DOUBLE -> F64(line.readString().toDouble())

RespCode.BIG_NUMBER -> try {
BigNumber(BigInteger.parseString(line.readText(charset)))
Expand Down Expand Up @@ -134,7 +134,7 @@ internal suspend fun <T> ByteReadChannel.processRedisSimpleResponse(
else -> exception { "Invalid boolean format: $line" }
}

RespCode.DOUBLE -> line.readDouble()
RespCode.DOUBLE -> line.readString().toDouble()

RespCode.BIG_NUMBER -> try {
BigInteger.parseString(line.readText(charset))
Expand Down

0 comments on commit ab1565b

Please sign in to comment.