summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdoardo La Greca2025-08-07 16:27:30 +0200
committerEdoardo La Greca2025-08-07 16:27:30 +0200
commit0857a08a2f44c7c20e340f8d3e20eccdbe867006 (patch)
tree8ae26384ce35ef84f6a91d7896d6929d862c4b19 /src
parente281e20e53cb4fb8f051f38a0a16a4e2c56b60ef (diff)
fix QID constructor and remove todo
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/QID.kt17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/main/kotlin/QID.kt b/src/main/kotlin/QID.kt
index 93f9f68..ed5abbf 100644
--- a/src/main/kotlin/QID.kt
+++ b/src/main/kotlin/QID.kt
@@ -57,24 +57,13 @@ class QID {
* @param raw The raw QID data.
* @throws IllegalArgumentException if [raw] does not have at least 13 elements.
*/
- constructor(raw: Array<UByte>) {
+ constructor(raw: List<UByte>) {
require(raw.size >= 13)
this.type = raw.first()
val rawVersion = raw.slice(1..4)
val rawPath = raw.slice(5..12)
-
- // TODO: find a way to use InMessage's convInteger method here
- var version = 0u
- for (i in 0..rawVersion.size) {
- version += rawVersion[i].toUInt().shl(i*8)
- }
- this.version = version
-
- var path: ULong = 0u
- for (i in 0..rawPath.size) {
- path += rawPath[i].toULong().shl(i*8)
- }
- this.path = path
+ this.version = InMessage.convInteger(rawVersion, 0, rawVersion.size).toInt().toUInt()
+ this.path = InMessage.convInteger(rawPath, 0, rawPath.size).toLong().toULong()
}
private fun getIsDirectory(): Boolean {