Author: Adam <git@apiote.xyz>
fixup fruchtfleisch
app/src/main/java/ml/adamsprogs/bimba/api/Responses.kt | 22 ++++++------
diff --git a/app/src/main/java/ml/adamsprogs/bimba/api/Responses.kt b/app/src/main/java/ml/adamsprogs/bimba/api/Responses.kt index d1b585e68275c8a693cf9c3e2f8be95594fd0c4b..95a8a2627e8cc9adb3605a0d5f179b261ba9f673 100644 --- a/app/src/main/java/ml/adamsprogs/bimba/api/Responses.kt +++ b/app/src/main/java/ml/adamsprogs/bimba/api/Responses.kt @@ -7,7 +7,7 @@ interface DeparturesResponse { companion object { fun unmarshal(stream: InputStream): DeparturesResponse { val reader = Reader(stream) - return when (reader.readUInt()) { + return when (reader.readUInt().toULong()) { 0UL -> { ErrorResponse.unmarshal(stream) } @@ -33,12 +33,12 @@ val alerts = mutableListOf() val departures = mutableListOf<Departure>() val reader = Reader(stream) - val alertsNum = reader.readUInt() + val alertsNum = reader.readUInt().toULong() for (i in 0UL until alertsNum) { val alert = Alert.unmarshal(stream) alerts.add(alert) } - val departuresNum = reader.readUInt() + val departuresNum = reader.readUInt().toULong() for (i in 0UL until departuresNum) { val departure = Departure.unmarshal(stream) departures.add(departure) @@ -53,7 +53,7 @@ interface ItemsResponse { companion object { fun unmarshal(stream: InputStream): ItemsResponse { val reader = Reader(stream) - return when (reader.readUInt()) { + return when (reader.readUInt().toULong()) { 0UL -> { ErrorResponse.unmarshal(stream) } @@ -73,9 +73,9 @@ companion object { fun unmarshal(stream: InputStream): ItemsSuccess { val items = mutableListOf<Item>() val reader = Reader(stream) - val itemsNum = reader.readUInt() + val itemsNum = reader.readUInt().toULong() for (i in 0UL until itemsNum) { - when (reader.readUInt()) { + when (reader.readUInt().toULong()) { 0UL -> { items.add(Stop.unmarshal(stream)) } @@ -96,7 +96,7 @@ interface FeedsResponse { companion object { fun unmarshal(stream: InputStream): FeedsResponse { val reader = Reader(stream) - return when (reader.readUInt()) { + return when (reader.readUInt().toULong()) { 0UL -> { ErrorResponse.unmarshal(stream) } @@ -124,7 +124,7 @@ val reader = Reader(stream) val adminContact = reader.readString() val rateLimited = reader.readBoolean() val private = reader.readBoolean() - val itemsNum = reader.readUInt() + val itemsNum = reader.readUInt().toULong() for (i in 0UL until itemsNum) { feeds.add(FeedInfo.unmarshal(stream)) } @@ -137,7 +137,7 @@ interface LocatablesResponse { companion object { fun unmarshal(stream: InputStream): LocatablesResponse { val reader = Reader(stream) - return when (reader.readUInt()) { + return when (reader.readUInt().toULong()) { 0UL -> { ErrorResponse.unmarshal(stream) } @@ -157,9 +157,9 @@ companion object { fun unmarshal(stream: InputStream): LocatablesSuccess { val locatables = mutableListOf<Locatable>() val reader = Reader(stream) - val itemsNum = reader.readUInt() + val itemsNum = reader.readUInt().toULong() for (i in 0UL until itemsNum) { - when (reader.readUInt()) { + when (reader.readUInt().toULong()) { 0UL -> { locatables.add(Stop.unmarshal(stream)) }