Update kotlinter

Signed-off-by: Graham <gpe@openrs2.org>
master
Graham 2 years ago
parent d63af29679
commit c0056f9cb1
  1. 2
      .editorconfig
  2. 2
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheDownloader.kt
  3. 24
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheExporter.kt
  4. 84
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt
  5. 2
      archive/src/main/kotlin/org/openrs2/archive/cache/OsrsJs5ChannelHandler.kt
  6. 2
      archive/src/main/kotlin/org/openrs2/archive/game/GameDatabase.kt
  7. 30
      archive/src/main/kotlin/org/openrs2/archive/key/KeyBruteForcer.kt
  8. 4
      archive/src/main/kotlin/org/openrs2/archive/key/KeyExporter.kt
  9. 6
      archive/src/main/kotlin/org/openrs2/archive/key/KeyImporter.kt
  10. 10
      archive/src/main/kotlin/org/openrs2/archive/map/MapRenderer.kt
  11. 2
      archive/src/main/kotlin/org/openrs2/archive/name/NameImporter.kt
  12. 4
      archive/src/main/kotlin/org/openrs2/archive/name/RuneStarNameDownloader.kt
  13. 12
      archive/src/main/kotlin/org/openrs2/archive/web/CachesController.kt
  14. 2
      asm/src/main/kotlin/org/openrs2/asm/packclass/PackClass.kt
  15. 140
      buffer/src/main/kotlin/org/openrs2/buffer/GeneratedByteBufExtensions.kt
  16. 2
      build.gradle.kts
  17. 2
      cache-550/src/main/kotlin/org/openrs2/cache/sprite/Sprite.kt
  18. 2
      cache/src/main/kotlin/org/openrs2/cache/Js5Index.kt
  19. 2
      cache/src/main/kotlin/org/openrs2/cache/Js5Pack.kt
  20. 4
      cache/src/main/kotlin/org/openrs2/cache/OpenNxtStore.kt
  21. 2
      cache/src/main/kotlin/org/openrs2/cache/VersionList.kt
  22. 2
      cache/src/test/kotlin/org/openrs2/cache/Js5MasterIndexTest.kt
  23. 2
      compress/src/main/kotlin/org/openrs2/compress/bzip2/LibBzip2.kt
  24. 2
      conf/src/main/kotlin/org/openrs2/conf/CountryCode.kt
  25. 2
      game/src/main/kotlin/org/openrs2/game/net/http/Http.kt
  26. 2
      game/src/main/kotlin/org/openrs2/game/net/login/LoginChannelHandler.kt
  27. 2
      game/src/main/kotlin/org/openrs2/game/store/PlayerStore.kt
  28. 2
      gradle/libs.versions.toml
  29. 2
      patcher/src/main/kotlin/org/openrs2/patcher/transform/HighDpiTransformer.kt
  30. 2
      patcher/src/main/kotlin/org/openrs2/patcher/transform/InvalidKeyTransformer.kt
  31. 8
      util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt

@ -15,7 +15,7 @@ indent_style = space
indent_size = 4 indent_size = 4
# see https://github.com/pinterest/ktlint/issues/764 # see https://github.com/pinterest/ktlint/issues/764
# noinspection EditorConfigKeyCorrectness # noinspection EditorConfigKeyCorrectness
disabled_rules = indent, parameter-list-wrapping disabled_rules = argument-list-wrapping, parameter-list-wrapping, wrapping
[*.md] [*.md]
max_line_length = 80 max_line_length = 80

@ -50,7 +50,7 @@ public class CacheDownloader @Inject constructor(
buildMajor, buildMajor,
game.lastMasterIndexId, game.lastMasterIndexId,
continuation, continuation,
importer, importer
) )
) )
} }

@ -235,7 +235,7 @@ public class CacheExporter @Inject constructor(
cs.groups, cs.valid_keys, cs.keys, cs.size, cs.blocks cs.groups, cs.valid_keys, cs.keys, cs.size, cs.blocks
) t ) t
ORDER BY t.game ASC, t.environment ASC, t.language ASC, t.builds[1] ASC, t.timestamp ASC ORDER BY t.game ASC, t.environment ASC, t.language ASC, t.builds[1] ASC, t.timestamp ASC
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
val caches = mutableListOf<CacheSummary>() val caches = mutableListOf<CacheSummary>()
@ -313,7 +313,7 @@ public class CacheExporter @Inject constructor(
LEFT JOIN blobs b ON b.id = t.blob_id LEFT JOIN blobs b ON b.id = t.blob_id
LEFT JOIN cache_stats cs ON cs.scope_id = s.id AND cs.cache_id = c.id LEFT JOIN cache_stats cs ON cs.scope_id = s.id AND cs.cache_id = c.id
WHERE s.name = ? AND c.id = ? WHERE s.name = ? AND c.id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setString(1, scope) stmt.setString(1, scope)
stmt.setInt(2, id) stmt.setInt(2, id)
@ -373,7 +373,7 @@ public class CacheExporter @Inject constructor(
JOIN languages l ON l.id = v.language_id JOIN languages l ON l.id = v.language_id
WHERE sc.name = ? AND s.cache_id = ? WHERE sc.name = ? AND s.cache_id = ?
ORDER BY s.name ASC ORDER BY s.name ASC
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setString(1, scope) stmt.setString(1, scope)
stmt.setInt(2, id) stmt.setInt(2, id)
@ -417,7 +417,7 @@ public class CacheExporter @Inject constructor(
SELECT url SELECT url
FROM updates FROM updates
WHERE cache_id = ? WHERE cache_id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, id) stmt.setInt(1, id)
@ -443,7 +443,7 @@ public class CacheExporter @Inject constructor(
LEFT JOIN resolve_archive(a.archive_id, a.crc32) b ON TRUE LEFT JOIN resolve_archive(a.archive_id, a.crc32) b ON TRUE
WHERE a.crc_table_id = ? WHERE a.crc_table_id = ?
ORDER BY archive_id ASC ORDER BY archive_id ASC
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setString(1, scope) stmt.setString(1, scope)
stmt.setInt(2, id) stmt.setInt(2, id)
@ -479,7 +479,7 @@ public class CacheExporter @Inject constructor(
JOIN version_list_stats s ON s.blob_id = b.id JOIN version_list_stats s ON s.blob_id = b.id
WHERE a.crc_table_id = ? AND a.archive_id = 5 WHERE a.crc_table_id = ? AND a.archive_id = 5
ORDER BY s.index_id ASC ORDER BY s.index_id ASC
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, id) stmt.setInt(1, id)
@ -526,7 +526,7 @@ public class CacheExporter @Inject constructor(
WHERE sc.name = ? AND s.cache_id = ? WHERE sc.name = ? AND s.cache_id = ?
GROUP BY g.name, e.name, l.iso_code GROUP BY g.name, e.name, l.iso_code
LIMIT 1 LIMIT 1
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setString(1, scope) stmt.setString(1, scope)
stmt.setInt(2, id) stmt.setInt(2, id)
@ -579,7 +579,7 @@ public class CacheExporter @Inject constructor(
SELECT f.data SELECT f.data
FROM resolved_files f FROM resolved_files f
WHERE f.crc_table_id = ? AND f.index_id = ? AND f.file_id = ? WHERE f.crc_table_id = ? AND f.index_id = ? AND f.file_id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setString(1, scope) stmt.setString(1, scope)
stmt.setInt(2, id) stmt.setInt(2, id)
@ -609,7 +609,7 @@ public class CacheExporter @Inject constructor(
SELECT id SELECT id
FROM crc_tables FROM crc_tables
WHERE id = ? WHERE id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, id) stmt.setInt(1, id)
@ -635,7 +635,7 @@ public class CacheExporter @Inject constructor(
FROM resolved_groups g FROM resolved_groups g
JOIN scopes s ON s.id = g.scope_id JOIN scopes s ON s.id = g.scope_id
WHERE s.name = ? AND g.master_index_id = ? WHERE s.name = ? AND g.master_index_id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.fetchSize = BATCH_SIZE stmt.fetchSize = BATCH_SIZE
stmt.setString(1, scope) stmt.setString(1, scope)
@ -677,7 +677,7 @@ public class CacheExporter @Inject constructor(
SELECT index_id, file_id, data, version SELECT index_id, file_id, data, version
FROM resolved_files FROM resolved_files
WHERE crc_table_id = ? WHERE crc_table_id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.fetchSize = BATCH_SIZE stmt.fetchSize = BATCH_SIZE
stmt.setInt(1, id) stmt.setInt(1, id)
@ -717,7 +717,7 @@ public class CacheExporter @Inject constructor(
JOIN keys k ON k.id = g.key_id JOIN keys k ON k.id = g.key_id
LEFT JOIN names n ON n.hash = g.name_hash AND n.name ~ '^l(?:[0-9]|[1-9][0-9])_(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' LEFT JOIN names n ON n.hash = g.name_hash AND n.name ~ '^l(?:[0-9]|[1-9][0-9])_(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
WHERE s.name = ? AND g.master_index_id = ? WHERE s.name = ? AND g.master_index_id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setString(1, scope) stmt.setString(1, scope)
stmt.setInt(2, id) stmt.setInt(2, id)

@ -297,7 +297,7 @@ public class CacheImporter @Inject constructor(
UPDATE game_variants UPDATE game_variants
SET build_major = ?, build_minor = ? SET build_major = ?, build_minor = ?
WHERE id = ? WHERE id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, buildMajor) stmt.setInt(1, buildMajor)
stmt.setObject(2, buildMinor, Types.INTEGER) stmt.setObject(2, buildMinor, Types.INTEGER)
@ -341,7 +341,7 @@ public class CacheImporter @Inject constructor(
LEFT JOIN resolve_index(?, a2.archive_id, a2.crc32, a2.version) c ON TRUE LEFT JOIN resolve_index(?, a2.archive_id, a2.crc32, a2.version) c ON TRUE
WHERE a.master_index_id = ? WHERE a.master_index_id = ?
ORDER BY a.archive_id ASC ORDER BY a.archive_id ASC
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setObject(1, lastId, Types.INTEGER) stmt.setObject(1, lastId, Types.INTEGER)
stmt.setInt(2, scopeId) stmt.setInt(2, scopeId)
@ -404,7 +404,7 @@ public class CacheImporter @Inject constructor(
LEFT JOIN resolve_group(i.scope_id, i.archive_id, ig2.group_id, ig2.crc32, ig2.version) c ON TRUE LEFT JOIN resolve_group(i.scope_id, i.archive_id, ig2.group_id, ig2.crc32, ig2.version) c ON TRUE
WHERE ig.container_id = ? AND c.id IS NULL WHERE ig.container_id = ? AND c.id IS NULL
ORDER BY ig.group_id ASC ORDER BY ig.group_id ASC
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setObject(1, lastMasterIndexId, Types.INTEGER) stmt.setObject(1, lastMasterIndexId, Types.INTEGER)
stmt.setInt(2, archive) stmt.setInt(2, archive)
@ -458,7 +458,7 @@ public class CacheImporter @Inject constructor(
SELECT id SELECT id
FROM master_indexes FROM master_indexes
WHERE container_id = ? AND format = ?::master_index_format WHERE container_id = ? AND format = ?::master_index_format
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setLong(1, containerId) stmt.setLong(1, containerId)
stmt.setString(2, masterIndex.index.format.name.lowercase()) stmt.setString(2, masterIndex.index.format.name.lowercase())
@ -477,7 +477,7 @@ public class CacheImporter @Inject constructor(
INSERT INTO caches (id) INSERT INTO caches (id)
VALUES (DEFAULT) VALUES (DEFAULT)
RETURNING id RETURNING id
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
check(rows.next()) check(rows.next())
@ -489,7 +489,7 @@ public class CacheImporter @Inject constructor(
""" """
INSERT INTO master_indexes (id, container_id, format) INSERT INTO master_indexes (id, container_id, format)
VALUES (?, ?, ?::master_index_format) VALUES (?, ?, ?::master_index_format)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, masterIndexId) stmt.setInt(1, masterIndexId)
stmt.setLong(2, containerId) stmt.setLong(2, containerId)
@ -504,7 +504,7 @@ public class CacheImporter @Inject constructor(
master_index_id, archive_id, crc32, version, whirlpool, groups, total_uncompressed_length master_index_id, archive_id, crc32, version, whirlpool, groups, total_uncompressed_length
) )
VALUES (?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for ((i, entry) in masterIndex.index.entries.withIndex()) { for ((i, entry) in masterIndex.index.entries.withIndex()) {
stmt.setInt(1, masterIndexId) stmt.setInt(1, masterIndexId)
@ -558,7 +558,7 @@ public class CacheImporter @Inject constructor(
SELECT id SELECT id
FROM sources FROM sources
WHERE type = 'js5remote' AND cache_id = ? AND game_id = ? AND build_major = ? AND build_minor IS NOT DISTINCT FROM ? WHERE type = 'js5remote' AND cache_id = ? AND game_id = ? AND build_major = ? AND build_minor IS NOT DISTINCT FROM ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, cacheId) stmt.setInt(1, cacheId)
stmt.setInt(2, gameId) stmt.setInt(2, gameId)
@ -578,7 +578,7 @@ public class CacheImporter @Inject constructor(
INSERT INTO sources (type, cache_id, game_id, build_major, build_minor, timestamp, name, description, url) INSERT INTO sources (type, cache_id, game_id, build_major, build_minor, timestamp, name, description, url)
VALUES (?::source_type, ?, ?, ?, ?, ?, ?, ?, ?) VALUES (?::source_type, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id RETURNING id
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setString(1, type.toString().lowercase()) stmt.setString(1, type.toString().lowercase())
stmt.setInt(2, cacheId) stmt.setInt(2, cacheId)
@ -644,7 +644,7 @@ public class CacheImporter @Inject constructor(
INSERT INTO groups (scope_id, archive_id, group_id, version, version_truncated, container_id) INSERT INTO groups (scope_id, archive_id, group_id, version, version_truncated, container_id)
VALUES (?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?)
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for ((i, group) in groups.withIndex()) { for ((i, group) in groups.withIndex()) {
stmt.setInt(1, scopeId) stmt.setInt(1, scopeId)
@ -664,7 +664,7 @@ public class CacheImporter @Inject constructor(
INSERT INTO source_groups (source_id, archive_id, group_id, version, version_truncated, container_id) INSERT INTO source_groups (source_id, archive_id, group_id, version, version_truncated, container_id)
VALUES (?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?)
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for ((i, group) in groups.withIndex()) { for ((i, group) in groups.withIndex()) {
stmt.setInt(1, sourceId) stmt.setInt(1, sourceId)
@ -704,7 +704,7 @@ public class CacheImporter @Inject constructor(
container_id, protocol, version, has_names, has_digests, has_lengths, has_uncompressed_checksums container_id, protocol, version, has_names, has_digests, has_lengths, has_uncompressed_checksums
) )
VALUES (?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setLong(1, containerId) stmt.setLong(1, containerId)
stmt.setInt(2, index.index.protocol.id) stmt.setInt(2, index.index.protocol.id)
@ -732,7 +732,7 @@ public class CacheImporter @Inject constructor(
uncompressed_crc32 uncompressed_crc32
) )
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for (group in index.index) { for (group in index.index) {
stmt.setLong(1, containerId) stmt.setLong(1, containerId)
@ -771,7 +771,7 @@ public class CacheImporter @Inject constructor(
""" """
INSERT INTO index_files (container_id, group_id, file_id, name_hash) INSERT INTO index_files (container_id, group_id, file_id, name_hash)
VALUES (?, ?, ?, ?) VALUES (?, ?, ?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for (group in index.index) { for (group in index.index) {
for (file in group) { for (file in group) {
@ -799,7 +799,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
LOCK TABLE containers IN EXCLUSIVE MODE LOCK TABLE containers IN EXCLUSIVE MODE
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -816,7 +816,7 @@ public class CacheImporter @Inject constructor(
encrypted BOOLEAN NOT NULL, encrypted BOOLEAN NOT NULL,
empty_loc BOOLEAN NULL empty_loc BOOLEAN NULL
) ON COMMIT DROP ) ON COMMIT DROP
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -829,7 +829,7 @@ public class CacheImporter @Inject constructor(
whirlpool BYTEA NOT NULL, whirlpool BYTEA NOT NULL,
data BYTEA NOT NULL data BYTEA NOT NULL
) ON COMMIT DROP ) ON COMMIT DROP
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -843,7 +843,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
TRUNCATE TABLE tmp_containers TRUNCATE TABLE tmp_containers
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -852,7 +852,7 @@ public class CacheImporter @Inject constructor(
""" """
INSERT INTO tmp_containers (index, crc32, whirlpool, data, uncompressed_length, uncompressed_crc32, encrypted, empty_loc) INSERT INTO tmp_containers (index, crc32, whirlpool, data, uncompressed_length, uncompressed_crc32, encrypted, empty_loc)
VALUES (?, ?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for ((i, container) in containers.withIndex()) { for ((i, container) in containers.withIndex()) {
stmt.setInt(1, i) stmt.setInt(1, i)
@ -883,7 +883,7 @@ public class CacheImporter @Inject constructor(
LEFT JOIN containers c ON c.whirlpool = t.whirlpool LEFT JOIN containers c ON c.whirlpool = t.whirlpool
WHERE c.whirlpool IS NULL WHERE c.whirlpool IS NULL
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -896,7 +896,7 @@ public class CacheImporter @Inject constructor(
FROM tmp_containers t FROM tmp_containers t
JOIN containers c ON c.whirlpool = t.whirlpool JOIN containers c ON c.whirlpool = t.whirlpool
ORDER BY t.index ASC ORDER BY t.index ASC
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
while (rows.next()) { while (rows.next()) {
@ -917,7 +917,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
TRUNCATE TABLE tmp_blobs TRUNCATE TABLE tmp_blobs
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -926,7 +926,7 @@ public class CacheImporter @Inject constructor(
""" """
INSERT INTO tmp_blobs (index, crc32, whirlpool, data) INSERT INTO tmp_blobs (index, crc32, whirlpool, data)
VALUES (?, ?, ?, ?) VALUES (?, ?, ?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for ((i, blob) in blobs.withIndex()) { for ((i, blob) in blobs.withIndex()) {
stmt.setInt(1, i) stmt.setInt(1, i)
@ -948,7 +948,7 @@ public class CacheImporter @Inject constructor(
LEFT JOIN blobs b ON b.whirlpool = t.whirlpool LEFT JOIN blobs b ON b.whirlpool = t.whirlpool
WHERE b.whirlpool IS NULL WHERE b.whirlpool IS NULL
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -961,7 +961,7 @@ public class CacheImporter @Inject constructor(
FROM tmp_blobs t FROM tmp_blobs t
JOIN blobs b ON b.whirlpool = t.whirlpool JOIN blobs b ON b.whirlpool = t.whirlpool
ORDER BY t.index ASC ORDER BY t.index ASC
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
while (rows.next()) { while (rows.next()) {
@ -1007,7 +1007,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
UPDATE game_variants SET last_master_index_id = ? WHERE id = ? UPDATE game_variants SET last_master_index_id = ? WHERE id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, masterIndexId) stmt.setInt(1, masterIndexId)
stmt.setInt(2, gameId) stmt.setInt(2, gameId)
@ -1114,7 +1114,7 @@ public class CacheImporter @Inject constructor(
SELECT id SELECT id
FROM crc_tables FROM crc_tables
WHERE blob_id = ? WHERE blob_id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setLong(1, blobId) stmt.setLong(1, blobId)
@ -1132,7 +1132,7 @@ public class CacheImporter @Inject constructor(
INSERT INTO caches (id) INSERT INTO caches (id)
VALUES (DEFAULT) VALUES (DEFAULT)
RETURNING id RETURNING id
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
check(rows.next()) check(rows.next())
@ -1144,7 +1144,7 @@ public class CacheImporter @Inject constructor(
""" """
INSERT INTO crc_tables (id, blob_id) INSERT INTO crc_tables (id, blob_id)
VALUES (?, ?) VALUES (?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, checksumTableId) stmt.setInt(1, checksumTableId)
stmt.setLong(2, blobId) stmt.setLong(2, blobId)
@ -1156,7 +1156,7 @@ public class CacheImporter @Inject constructor(
""" """
INSERT INTO crc_table_archives (crc_table_id, archive_id, crc32) INSERT INTO crc_table_archives (crc_table_id, archive_id, crc32)
VALUES (?, ?, ?) VALUES (?, ?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for ((i, entry) in checksumTable.table.entries.withIndex()) { for ((i, entry) in checksumTable.table.entries.withIndex()) {
stmt.setInt(1, checksumTableId) stmt.setInt(1, checksumTableId)
@ -1194,7 +1194,7 @@ public class CacheImporter @Inject constructor(
INSERT INTO archives (archive_id, blob_id) INSERT INTO archives (archive_id, blob_id)
VALUES (?, ?) VALUES (?, ?)
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, archive.id) stmt.setInt(1, archive.id)
stmt.setLong(2, blobId) stmt.setLong(2, blobId)
@ -1207,7 +1207,7 @@ public class CacheImporter @Inject constructor(
INSERT INTO source_archives (source_id, archive_id, blob_id) INSERT INTO source_archives (source_id, archive_id, blob_id)
VALUES (?, ?, ?) VALUES (?, ?, ?)
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, sourceId) stmt.setInt(1, sourceId)
stmt.setInt(2, archive.id) stmt.setInt(2, archive.id)
@ -1223,7 +1223,7 @@ public class CacheImporter @Inject constructor(
""" """
INSERT INTO version_lists (blob_id) INSERT INTO version_lists (blob_id)
VALUES (?) VALUES (?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
try { try {
stmt.setLong(1, blobId) stmt.setLong(1, blobId)
@ -1242,7 +1242,7 @@ public class CacheImporter @Inject constructor(
""" """
INSERT INTO version_list_files (blob_id, index_id, file_id, version, crc32) INSERT INTO version_list_files (blob_id, index_id, file_id, version, crc32)
VALUES (?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for ((indexId, files) in versionList.files.withIndex()) { for ((indexId, files) in versionList.files.withIndex()) {
for ((fileId, file) in files.withIndex()) { for ((fileId, file) in files.withIndex()) {
@ -1267,7 +1267,7 @@ public class CacheImporter @Inject constructor(
""" """
INSERT INTO version_list_maps (blob_id, map_square, map_file_id, loc_file_id, free_to_play) INSERT INTO version_list_maps (blob_id, map_square, map_file_id, loc_file_id, free_to_play)
VALUES (?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for ((mapSquare, map) in versionList.maps) { for ((mapSquare, map) in versionList.maps) {
stmt.setLong(1, blobId) stmt.setLong(1, blobId)
@ -1306,7 +1306,7 @@ public class CacheImporter @Inject constructor(
INSERT INTO files (index_id, file_id, version, blob_id) INSERT INTO files (index_id, file_id, version, blob_id)
VALUES (?, ?, ?, ?) VALUES (?, ?, ?, ?)
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for ((i, file) in files.withIndex()) { for ((i, file) in files.withIndex()) {
stmt.setInt(1, file.index) stmt.setInt(1, file.index)
@ -1325,7 +1325,7 @@ public class CacheImporter @Inject constructor(
INSERT INTO source_files (source_id, index_id, file_id, version, blob_id) INSERT INTO source_files (source_id, index_id, file_id, version, blob_id)
VALUES (?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?)
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for ((i, file) in files.withIndex()) { for ((i, file) in files.withIndex()) {
stmt.setInt(1, sourceId) stmt.setInt(1, sourceId)
@ -1346,7 +1346,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
SELECT pg_try_advisory_lock(0) SELECT pg_try_advisory_lock(0)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
if (!rows.next()) { if (!rows.next()) {
@ -1363,7 +1363,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
REFRESH MATERIALIZED VIEW CONCURRENTLY index_stats REFRESH MATERIALIZED VIEW CONCURRENTLY index_stats
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -1371,7 +1371,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
REFRESH MATERIALIZED VIEW CONCURRENTLY master_index_stats REFRESH MATERIALIZED VIEW CONCURRENTLY master_index_stats
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -1379,7 +1379,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
REFRESH MATERIALIZED VIEW CONCURRENTLY version_list_stats REFRESH MATERIALIZED VIEW CONCURRENTLY version_list_stats
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -1387,7 +1387,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
REFRESH MATERIALIZED VIEW CONCURRENTLY crc_table_stats REFRESH MATERIALIZED VIEW CONCURRENTLY crc_table_stats
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }

@ -24,7 +24,7 @@ public class OsrsJs5ChannelHandler(
build: Int, build: Int,
lastMasterIndexId: Int?, lastMasterIndexId: Int?,
continuation: Continuation<Unit>, continuation: Continuation<Unit>,
importer: CacheImporter, importer: CacheImporter
) : Js5ChannelHandler( ) : Js5ChannelHandler(
bootstrap, bootstrap,
scopeId, scopeId,

@ -18,7 +18,7 @@ public class GameDatabase @Inject constructor(
JOIN environments e ON e.id = v.environment_id JOIN environments e ON e.id = v.environment_id
JOIN languages l ON l.id = v.language_id JOIN languages l ON l.id = v.language_id
WHERE g.name = ? AND e.name = ? AND l.iso_code = ? WHERE g.name = ? AND e.name = ? AND l.iso_code = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setString(1, name) stmt.setString(1, name)
stmt.setString(2, environment) stmt.setString(2, environment)

@ -36,7 +36,7 @@ public class KeyBruteForcer @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
LOCK TABLE keys IN EXCLUSIVE MODE LOCK TABLE keys IN EXCLUSIVE MODE
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -49,7 +49,7 @@ public class KeyBruteForcer @Inject constructor(
first_seen TIMESTAMPTZ NOT NULL, first_seen TIMESTAMPTZ NOT NULL,
last_seen TIMESTAMPTZ NOT NULL last_seen TIMESTAMPTZ NOT NULL
) ON COMMIT DROP ) ON COMMIT DROP
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -60,7 +60,7 @@ public class KeyBruteForcer @Inject constructor(
SELECT key, source, first_seen, last_seen SELECT key, source, first_seen, last_seen
FROM key_queue FROM key_queue
FOR UPDATE SKIP LOCKED FOR UPDATE SKIP LOCKED
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -73,7 +73,7 @@ public class KeyBruteForcer @Inject constructor(
LEFT JOIN keys k ON k.key = t.key LEFT JOIN keys k ON k.key = t.key
WHERE k.key IS NULL WHERE k.key IS NULL
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -87,7 +87,7 @@ public class KeyBruteForcer @Inject constructor(
ON CONFLICT (key_id, source) DO UPDATE SET ON CONFLICT (key_id, source) DO UPDATE SET
first_seen = LEAST(s.first_seen, EXCLUDED.first_seen), first_seen = LEAST(s.first_seen, EXCLUDED.first_seen),
last_seen = GREATEST(s.last_seen, EXCLUDED.last_seen) last_seen = GREATEST(s.last_seen, EXCLUDED.last_seen)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -97,7 +97,7 @@ public class KeyBruteForcer @Inject constructor(
DELETE FROM key_queue k DELETE FROM key_queue k
USING tmp_keys t USING tmp_keys t
WHERE k.key = t.key AND k.source = t.source WHERE k.key = t.key AND k.source = t.source
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -152,7 +152,7 @@ public class KeyBruteForcer @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
LOCK TABLE containers, keys IN SHARE MODE LOCK TABLE containers, keys IN SHARE MODE
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.execute() stmt.execute()
} }
@ -170,7 +170,7 @@ public class KeyBruteForcer @Inject constructor(
SELECT last_container_id SELECT last_container_id
FROM brute_force_iterator FROM brute_force_iterator
FOR UPDATE FOR UPDATE
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
check(rows.next()) check(rows.next())
@ -191,7 +191,7 @@ public class KeyBruteForcer @Inject constructor(
""" """
SELECT id, (key).k0, (key).k1, (key).k2, (key).k3 SELECT id, (key).k0, (key).k1, (key).k2, (key).k3
FROM keys FROM keys
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.fetchSize = BATCH_SIZE stmt.fetchSize = BATCH_SIZE
@ -224,7 +224,7 @@ public class KeyBruteForcer @Inject constructor(
""" """
UPDATE brute_force_iterator UPDATE brute_force_iterator
SET last_container_id = ? SET last_container_id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setObject(1, lastContainerId, Types.BIGINT) stmt.setObject(1, lastContainerId, Types.BIGINT)
stmt.execute() stmt.execute()
@ -239,7 +239,7 @@ public class KeyBruteForcer @Inject constructor(
WHERE (? IS NULL OR id > ?) AND encrypted AND key_id IS NULL WHERE (? IS NULL OR id > ?) AND encrypted AND key_id IS NULL
ORDER BY id ASC ORDER BY id ASC
LIMIT 1 LIMIT 1
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setObject(1, lastContainerId, Types.BIGINT) stmt.setObject(1, lastContainerId, Types.BIGINT)
stmt.setObject(2, lastContainerId, Types.BIGINT) stmt.setObject(2, lastContainerId, Types.BIGINT)
@ -265,7 +265,7 @@ public class KeyBruteForcer @Inject constructor(
SELECT last_key_id, last_container_id SELECT last_key_id, last_container_id
FROM brute_force_iterator FROM brute_force_iterator
FOR UPDATE FOR UPDATE
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
check(rows.next()) check(rows.next())
@ -292,7 +292,7 @@ public class KeyBruteForcer @Inject constructor(
SELECT id, data SELECT id, data
FROM containers FROM containers
WHERE encrypted AND key_id IS NULL AND id <= ? WHERE encrypted AND key_id IS NULL AND id <= ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.fetchSize = BATCH_SIZE stmt.fetchSize = BATCH_SIZE
stmt.setLong(1, lastContainerId) stmt.setLong(1, lastContainerId)
@ -319,7 +319,7 @@ public class KeyBruteForcer @Inject constructor(
""" """
UPDATE brute_force_iterator UPDATE brute_force_iterator
SET last_key_id = ? SET last_key_id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setObject(1, lastKeyId, Types.BIGINT) stmt.setObject(1, lastKeyId, Types.BIGINT)
stmt.execute() stmt.execute()
@ -334,7 +334,7 @@ public class KeyBruteForcer @Inject constructor(
WHERE ? IS NULL OR id > ? WHERE ? IS NULL OR id > ?
ORDER BY id ASC ORDER BY id ASC
LIMIT 1 LIMIT 1
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setObject(1, lastKeyId, Types.BIGINT) stmt.setObject(1, lastKeyId, Types.BIGINT)
stmt.setObject(2, lastKeyId, Types.BIGINT) stmt.setObject(2, lastKeyId, Types.BIGINT)

@ -51,7 +51,7 @@ public class KeyExporter @Inject constructor(
COUNT(*) FILTER (WHERE c.key_id IS NULL AND c.empty_loc) COUNT(*) FILTER (WHERE c.key_id IS NULL AND c.empty_loc)
FROM containers c FROM containers c
WHERE c.encrypted WHERE c.encrypted
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
check(rows.next()) check(rows.next())
@ -69,7 +69,7 @@ public class KeyExporter @Inject constructor(
COUNT(DISTINCT k.id) FILTER (WHERE c.key_id IS NOT NULL) COUNT(DISTINCT k.id) FILTER (WHERE c.key_id IS NOT NULL)
FROM keys k FROM keys k
LEFT JOIN containers c ON c.key_id = k.id LEFT JOIN containers c ON c.key_id = k.id
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
check(rows.next()) check(rows.next())

@ -59,7 +59,7 @@ public class KeyImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
SELECT url FROM keysets SELECT url FROM keysets
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
val urls = mutableSetOf<String>() val urls = mutableSetOf<String>()
@ -94,7 +94,7 @@ public class KeyImporter @Inject constructor(
INSERT INTO keysets (url) INSERT INTO keysets (url)
VALUES (?) VALUES (?)
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for (url in urls) { for (url in urls) {
stmt.setString(1, url) stmt.setString(1, url)
@ -128,7 +128,7 @@ public class KeyImporter @Inject constructor(
ON CONFLICT (key, source) DO UPDATE SET ON CONFLICT (key, source) DO UPDATE SET
first_seen = LEAST(k.first_seen, EXCLUDED.first_seen), first_seen = LEAST(k.first_seen, EXCLUDED.first_seen),
last_seen = GREATEST(k.last_seen, EXCLUDED.last_seen) last_seen = GREATEST(k.last_seen, EXCLUDED.last_seen)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for (key in keys) { for (key in keys) {
if (key.key.isZero) { if (key.key.isZero) {

@ -38,7 +38,7 @@ public class MapRenderer @Inject constructor(
SELECT id SELECT id
FROM scopes FROM scopes
WHERE name = ? WHERE name = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setString(1, scope) stmt.setString(1, scope)
@ -175,7 +175,7 @@ public class MapRenderer @Inject constructor(
JOIN names n ON n.hash = g.name_hash JOIN names n ON n.hash = g.name_hash
WHERE g.scope_id = ? AND g.master_index_id = ? AND g.archive_id = ${Js5Archive.MAPS} AND WHERE g.scope_id = ? AND g.master_index_id = ? AND g.archive_id = ${Js5Archive.MAPS} AND
n.name ~ '^[lm](?:[0-9]|[1-9][0-9])_(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' n.name ~ '^[lm](?:[0-9]|[1-9][0-9])_(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, scopeId) stmt.setInt(1, scopeId)
stmt.setInt(2, masterIndexId) stmt.setInt(2, masterIndexId)
@ -228,7 +228,7 @@ public class MapRenderer @Inject constructor(
JOIN names n ON n.hash = g.name_hash JOIN names n ON n.hash = g.name_hash
WHERE g.scope_id = ? AND g.master_index_id = ? AND g.archive_id = ${Js5Archive.MAPS} AND WHERE g.scope_id = ? AND g.master_index_id = ? AND g.archive_id = ${Js5Archive.MAPS} AND
n.name ~ '^m(?:[0-9]|[1-9][0-9])_(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' n.name ~ '^m(?:[0-9]|[1-9][0-9])_(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, scopeId) stmt.setInt(1, scopeId)
stmt.setInt(2, masterIndexId) stmt.setInt(2, masterIndexId)
@ -272,7 +272,7 @@ public class MapRenderer @Inject constructor(
SELECT data SELECT data
FROM resolved_indexes FROM resolved_indexes
WHERE scope_id = ? AND master_index_id = ? AND archive_id = ? WHERE scope_id = ? AND master_index_id = ? AND archive_id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, scopeId) stmt.setInt(1, scopeId)
stmt.setInt(2, masterIndexId) stmt.setInt(2, masterIndexId)
@ -306,7 +306,7 @@ public class MapRenderer @Inject constructor(
SELECT data SELECT data
FROM resolved_groups FROM resolved_groups
WHERE scope_id = ? AND master_index_id = ? AND archive_id = ? AND group_id = ? WHERE scope_id = ? AND master_index_id = ? AND archive_id = ? AND group_id = ?
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.setInt(1, scopeId) stmt.setInt(1, scopeId)
stmt.setInt(2, masterIndexId) stmt.setInt(2, masterIndexId)

@ -25,7 +25,7 @@ public class NameImporter @Inject constructor(
INSERT INTO names (hash, name) INSERT INTO names (hash, name)
VALUES (?, ?) VALUES (?, ?)
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
for (name in names) { for (name in names) {
stmt.setInt(1, name.krHashCode()) stmt.setInt(1, name.krHashCode())

@ -51,11 +51,11 @@ public class RuneStarNameDownloader @Inject constructor(
private companion object { private companion object {
private val NAMES_ENDPOINTS = listOf( private val NAMES_ENDPOINTS = listOf(
URI("https://raw.githubusercontent.com/RuneStar/cache-names/master/names.tsv"), URI("https://raw.githubusercontent.com/RuneStar/cache-names/master/names.tsv"),
URI("https://raw.githubusercontent.com/Joshua-F/cache-names/master/names.tsv"), URI("https://raw.githubusercontent.com/Joshua-F/cache-names/master/names.tsv")
) )
private val INDIVIDUAL_NAMES_ENDPOINTS = listOf( private val INDIVIDUAL_NAMES_ENDPOINTS = listOf(
URI("https://raw.githubusercontent.com/RuneStar/cache-names/master/individual-names.tsv"), URI("https://raw.githubusercontent.com/RuneStar/cache-names/master/individual-names.tsv"),
URI("https://raw.githubusercontent.com/Joshua-F/cache-names/master/individual-names.tsv"), URI("https://raw.githubusercontent.com/Joshua-F/cache-names/master/individual-names.tsv")
) )
} }
} }

@ -58,9 +58,9 @@ public class CachesController @Inject constructor(
call.caching = CachingOptions( call.caching = CachingOptions(
cacheControl = CacheControl.MaxAge( cacheControl = CacheControl.MaxAge(
maxAgeSeconds = 900, maxAgeSeconds = 900,
visibility = CacheControl.Visibility.Public, visibility = CacheControl.Visibility.Public
), ),
expires = ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(900), expires = ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(900)
) )
call.respond(caches) call.respond(caches)
} }
@ -83,7 +83,7 @@ public class CachesController @Inject constructor(
ThymeleafContent( ThymeleafContent(
"caches/show.html", mapOf( "caches/show.html", mapOf(
"cache" to cache, "cache" to cache,
"scope" to scope, "scope" to scope
) )
) )
) )
@ -113,12 +113,12 @@ public class CachesController @Inject constructor(
caching = CachingOptions( caching = CachingOptions(
cacheControl = CacheControl.MaxAge( cacheControl = CacheControl.MaxAge(
maxAgeSeconds = 86400, maxAgeSeconds = 86400,
visibility = CacheControl.Visibility.Public, visibility = CacheControl.Visibility.Public
), ),
expires = ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(86400), expires = ZonedDateTime.now(ZoneOffset.UTC).plusSeconds(86400)
) )
versions = listOf( versions = listOf(
EntityTagVersion(etag, weak = false), EntityTagVersion(etag, weak = false)
) )
} }
} }

@ -42,7 +42,7 @@ public object PackClass {
Opcodes.V1_3, Opcodes.V1_3,
Opcodes.V1_4, Opcodes.V1_4,
Opcodes.V1_5, Opcodes.V1_5,
Opcodes.V1_6, Opcodes.V1_6
) )
private const val INT_DESCRIPTOR = "I" private const val INT_DESCRIPTOR = "I"

@ -446,7 +446,7 @@ public fun ByteBuf.getBytesA(
index: Int, index: Int,
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
getBytes(index, dst, dstIndex, len) getBytes(index, dst, dstIndex, len)
for (i in 0 until len) { for (i in 0 until len) {
@ -467,7 +467,7 @@ public fun ByteBuf.getBytesA(index: Int, dst: ByteBuf): ByteBuf {
public fun ByteBuf.getBytesA( public fun ByteBuf.getBytesA(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val dstIndex = dst.writerIndex() val dstIndex = dst.writerIndex()
dst.ensureWritable(len) dst.ensureWritable(len)
@ -480,7 +480,7 @@ public fun ByteBuf.getBytesA(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
dst.setByte(dstIndex + i, getByteA(index + i).toInt()) dst.setByte(dstIndex + i, getByteA(index + i).toInt())
@ -496,7 +496,7 @@ public fun ByteBuf.readBytesA(dst: ByteArray): ByteBuf {
public fun ByteBuf.readBytesA( public fun ByteBuf.readBytesA(
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesA(index, dst, dstIndex, len) getBytesA(index, dst, dstIndex, len)
@ -524,7 +524,7 @@ public fun ByteBuf.readBytesA(dst: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.readBytesA( public fun ByteBuf.readBytesA(
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesA(index, dst, dstIndex, len) getBytesA(index, dst, dstIndex, len)
@ -551,7 +551,7 @@ public fun ByteBuf.setBytesA(
index: Int, index: Int,
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
Unpooled.wrappedBuffer(src).use { buf -> Unpooled.wrappedBuffer(src).use { buf ->
setBytesA(index, buf, srcIndex, len) setBytesA(index, buf, srcIndex, len)
@ -570,7 +570,7 @@ public fun ByteBuf.setBytesA(index: Int, src: ByteBuf): ByteBuf {
public fun ByteBuf.setBytesA( public fun ByteBuf.setBytesA(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val srcIndex = src.readerIndex() val srcIndex = src.readerIndex()
setBytesA(index, src, srcIndex, len) setBytesA(index, src, srcIndex, len)
@ -582,7 +582,7 @@ public fun ByteBuf.setBytesA(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
setByteA(index + i, src.getByte(srcIndex + i).toInt()) setByteA(index + i, src.getByte(srcIndex + i).toInt())
@ -598,7 +598,7 @@ public fun ByteBuf.writeBytesA(src: ByteArray): ByteBuf {
public fun ByteBuf.writeBytesA( public fun ByteBuf.writeBytesA(
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -625,7 +625,7 @@ public fun ByteBuf.writeBytesA(src: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.writeBytesA( public fun ByteBuf.writeBytesA(
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -643,7 +643,7 @@ public fun ByteBuf.getBytesC(
index: Int, index: Int,
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
getBytes(index, dst, dstIndex, len) getBytes(index, dst, dstIndex, len)
for (i in 0 until len) { for (i in 0 until len) {
@ -664,7 +664,7 @@ public fun ByteBuf.getBytesC(index: Int, dst: ByteBuf): ByteBuf {
public fun ByteBuf.getBytesC( public fun ByteBuf.getBytesC(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val dstIndex = dst.writerIndex() val dstIndex = dst.writerIndex()
dst.ensureWritable(len) dst.ensureWritable(len)
@ -677,7 +677,7 @@ public fun ByteBuf.getBytesC(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
dst.setByte(dstIndex + i, getByteC(index + i).toInt()) dst.setByte(dstIndex + i, getByteC(index + i).toInt())
@ -693,7 +693,7 @@ public fun ByteBuf.readBytesC(dst: ByteArray): ByteBuf {
public fun ByteBuf.readBytesC( public fun ByteBuf.readBytesC(
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesC(index, dst, dstIndex, len) getBytesC(index, dst, dstIndex, len)
@ -721,7 +721,7 @@ public fun ByteBuf.readBytesC(dst: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.readBytesC( public fun ByteBuf.readBytesC(
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesC(index, dst, dstIndex, len) getBytesC(index, dst, dstIndex, len)
@ -748,7 +748,7 @@ public fun ByteBuf.setBytesC(
index: Int, index: Int,
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
Unpooled.wrappedBuffer(src).use { buf -> Unpooled.wrappedBuffer(src).use { buf ->
setBytesC(index, buf, srcIndex, len) setBytesC(index, buf, srcIndex, len)
@ -767,7 +767,7 @@ public fun ByteBuf.setBytesC(index: Int, src: ByteBuf): ByteBuf {
public fun ByteBuf.setBytesC( public fun ByteBuf.setBytesC(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val srcIndex = src.readerIndex() val srcIndex = src.readerIndex()
setBytesC(index, src, srcIndex, len) setBytesC(index, src, srcIndex, len)
@ -779,7 +779,7 @@ public fun ByteBuf.setBytesC(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
setByteC(index + i, src.getByte(srcIndex + i).toInt()) setByteC(index + i, src.getByte(srcIndex + i).toInt())
@ -795,7 +795,7 @@ public fun ByteBuf.writeBytesC(src: ByteArray): ByteBuf {
public fun ByteBuf.writeBytesC( public fun ByteBuf.writeBytesC(
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -822,7 +822,7 @@ public fun ByteBuf.writeBytesC(src: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.writeBytesC( public fun ByteBuf.writeBytesC(
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -840,7 +840,7 @@ public fun ByteBuf.getBytesS(
index: Int, index: Int,
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
getBytes(index, dst, dstIndex, len) getBytes(index, dst, dstIndex, len)
for (i in 0 until len) { for (i in 0 until len) {
@ -861,7 +861,7 @@ public fun ByteBuf.getBytesS(index: Int, dst: ByteBuf): ByteBuf {
public fun ByteBuf.getBytesS( public fun ByteBuf.getBytesS(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val dstIndex = dst.writerIndex() val dstIndex = dst.writerIndex()
dst.ensureWritable(len) dst.ensureWritable(len)
@ -874,7 +874,7 @@ public fun ByteBuf.getBytesS(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
dst.setByte(dstIndex + i, getByteS(index + i).toInt()) dst.setByte(dstIndex + i, getByteS(index + i).toInt())
@ -890,7 +890,7 @@ public fun ByteBuf.readBytesS(dst: ByteArray): ByteBuf {
public fun ByteBuf.readBytesS( public fun ByteBuf.readBytesS(
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesS(index, dst, dstIndex, len) getBytesS(index, dst, dstIndex, len)
@ -918,7 +918,7 @@ public fun ByteBuf.readBytesS(dst: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.readBytesS( public fun ByteBuf.readBytesS(
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesS(index, dst, dstIndex, len) getBytesS(index, dst, dstIndex, len)
@ -945,7 +945,7 @@ public fun ByteBuf.setBytesS(
index: Int, index: Int,
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
Unpooled.wrappedBuffer(src).use { buf -> Unpooled.wrappedBuffer(src).use { buf ->
setBytesS(index, buf, srcIndex, len) setBytesS(index, buf, srcIndex, len)
@ -964,7 +964,7 @@ public fun ByteBuf.setBytesS(index: Int, src: ByteBuf): ByteBuf {
public fun ByteBuf.setBytesS( public fun ByteBuf.setBytesS(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val srcIndex = src.readerIndex() val srcIndex = src.readerIndex()
setBytesS(index, src, srcIndex, len) setBytesS(index, src, srcIndex, len)
@ -976,7 +976,7 @@ public fun ByteBuf.setBytesS(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
setByteS(index + i, src.getByte(srcIndex + i).toInt()) setByteS(index + i, src.getByte(srcIndex + i).toInt())
@ -992,7 +992,7 @@ public fun ByteBuf.writeBytesS(src: ByteArray): ByteBuf {
public fun ByteBuf.writeBytesS( public fun ByteBuf.writeBytesS(
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -1019,7 +1019,7 @@ public fun ByteBuf.writeBytesS(src: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.writeBytesS( public fun ByteBuf.writeBytesS(
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -1037,7 +1037,7 @@ public fun ByteBuf.getBytesReverse(
index: Int, index: Int,
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
getBytes(index, dst, dstIndex, len) getBytes(index, dst, dstIndex, len)
for (i in 0 until len) { for (i in 0 until len) {
@ -1059,7 +1059,7 @@ public fun ByteBuf.getBytesReverse(index: Int, dst: ByteBuf): ByteBuf {
public fun ByteBuf.getBytesReverse( public fun ByteBuf.getBytesReverse(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val dstIndex = dst.writerIndex() val dstIndex = dst.writerIndex()
dst.ensureWritable(len) dst.ensureWritable(len)
@ -1072,7 +1072,7 @@ public fun ByteBuf.getBytesReverse(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
dst.setByte(dstIndex + i, getByte(index + len - i - 1).toInt()) dst.setByte(dstIndex + i, getByte(index + len - i - 1).toInt())
@ -1088,7 +1088,7 @@ public fun ByteBuf.readBytesReverse(dst: ByteArray): ByteBuf {
public fun ByteBuf.readBytesReverse( public fun ByteBuf.readBytesReverse(
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesReverse(index, dst, dstIndex, len) getBytesReverse(index, dst, dstIndex, len)
@ -1116,7 +1116,7 @@ public fun ByteBuf.readBytesReverse(dst: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.readBytesReverse( public fun ByteBuf.readBytesReverse(
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesReverse(index, dst, dstIndex, len) getBytesReverse(index, dst, dstIndex, len)
@ -1143,7 +1143,7 @@ public fun ByteBuf.setBytesReverse(
index: Int, index: Int,
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
Unpooled.wrappedBuffer(src).use { buf -> Unpooled.wrappedBuffer(src).use { buf ->
setBytesReverse(index, buf, srcIndex, len) setBytesReverse(index, buf, srcIndex, len)
@ -1162,7 +1162,7 @@ public fun ByteBuf.setBytesReverse(index: Int, src: ByteBuf): ByteBuf {
public fun ByteBuf.setBytesReverse( public fun ByteBuf.setBytesReverse(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val srcIndex = src.readerIndex() val srcIndex = src.readerIndex()
setBytesReverse(index, src, srcIndex, len) setBytesReverse(index, src, srcIndex, len)
@ -1174,7 +1174,7 @@ public fun ByteBuf.setBytesReverse(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
setByte(index + i, src.getByte(srcIndex + len - i - 1).toInt()) setByte(index + i, src.getByte(srcIndex + len - i - 1).toInt())
@ -1190,7 +1190,7 @@ public fun ByteBuf.writeBytesReverse(src: ByteArray): ByteBuf {
public fun ByteBuf.writeBytesReverse( public fun ByteBuf.writeBytesReverse(
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -1217,7 +1217,7 @@ public fun ByteBuf.writeBytesReverse(src: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.writeBytesReverse( public fun ByteBuf.writeBytesReverse(
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -1235,7 +1235,7 @@ public fun ByteBuf.getBytesReverseA(
index: Int, index: Int,
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
getBytes(index, dst, dstIndex, len) getBytes(index, dst, dstIndex, len)
for (i in 0 until len) { for (i in 0 until len) {
@ -1257,7 +1257,7 @@ public fun ByteBuf.getBytesReverseA(index: Int, dst: ByteBuf): ByteBuf {
public fun ByteBuf.getBytesReverseA( public fun ByteBuf.getBytesReverseA(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val dstIndex = dst.writerIndex() val dstIndex = dst.writerIndex()
dst.ensureWritable(len) dst.ensureWritable(len)
@ -1270,7 +1270,7 @@ public fun ByteBuf.getBytesReverseA(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
dst.setByte(dstIndex + i, getByteA(index + len - i - 1).toInt()) dst.setByte(dstIndex + i, getByteA(index + len - i - 1).toInt())
@ -1286,7 +1286,7 @@ public fun ByteBuf.readBytesReverseA(dst: ByteArray): ByteBuf {
public fun ByteBuf.readBytesReverseA( public fun ByteBuf.readBytesReverseA(
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesReverseA(index, dst, dstIndex, len) getBytesReverseA(index, dst, dstIndex, len)
@ -1314,7 +1314,7 @@ public fun ByteBuf.readBytesReverseA(dst: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.readBytesReverseA( public fun ByteBuf.readBytesReverseA(
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesReverseA(index, dst, dstIndex, len) getBytesReverseA(index, dst, dstIndex, len)
@ -1341,7 +1341,7 @@ public fun ByteBuf.setBytesReverseA(
index: Int, index: Int,
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
Unpooled.wrappedBuffer(src).use { buf -> Unpooled.wrappedBuffer(src).use { buf ->
setBytesReverseA(index, buf, srcIndex, len) setBytesReverseA(index, buf, srcIndex, len)
@ -1360,7 +1360,7 @@ public fun ByteBuf.setBytesReverseA(index: Int, src: ByteBuf): ByteBuf {
public fun ByteBuf.setBytesReverseA( public fun ByteBuf.setBytesReverseA(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val srcIndex = src.readerIndex() val srcIndex = src.readerIndex()
setBytesReverseA(index, src, srcIndex, len) setBytesReverseA(index, src, srcIndex, len)
@ -1372,7 +1372,7 @@ public fun ByteBuf.setBytesReverseA(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
setByteA(index + i, src.getByte(srcIndex + len - i - 1).toInt()) setByteA(index + i, src.getByte(srcIndex + len - i - 1).toInt())
@ -1388,7 +1388,7 @@ public fun ByteBuf.writeBytesReverseA(src: ByteArray): ByteBuf {
public fun ByteBuf.writeBytesReverseA( public fun ByteBuf.writeBytesReverseA(
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -1415,7 +1415,7 @@ public fun ByteBuf.writeBytesReverseA(src: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.writeBytesReverseA( public fun ByteBuf.writeBytesReverseA(
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -1433,7 +1433,7 @@ public fun ByteBuf.getBytesReverseC(
index: Int, index: Int,
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
getBytes(index, dst, dstIndex, len) getBytes(index, dst, dstIndex, len)
for (i in 0 until len) { for (i in 0 until len) {
@ -1455,7 +1455,7 @@ public fun ByteBuf.getBytesReverseC(index: Int, dst: ByteBuf): ByteBuf {
public fun ByteBuf.getBytesReverseC( public fun ByteBuf.getBytesReverseC(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val dstIndex = dst.writerIndex() val dstIndex = dst.writerIndex()
dst.ensureWritable(len) dst.ensureWritable(len)
@ -1468,7 +1468,7 @@ public fun ByteBuf.getBytesReverseC(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
dst.setByte(dstIndex + i, getByteC(index + len - i - 1).toInt()) dst.setByte(dstIndex + i, getByteC(index + len - i - 1).toInt())
@ -1484,7 +1484,7 @@ public fun ByteBuf.readBytesReverseC(dst: ByteArray): ByteBuf {
public fun ByteBuf.readBytesReverseC( public fun ByteBuf.readBytesReverseC(
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesReverseC(index, dst, dstIndex, len) getBytesReverseC(index, dst, dstIndex, len)
@ -1512,7 +1512,7 @@ public fun ByteBuf.readBytesReverseC(dst: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.readBytesReverseC( public fun ByteBuf.readBytesReverseC(
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesReverseC(index, dst, dstIndex, len) getBytesReverseC(index, dst, dstIndex, len)
@ -1539,7 +1539,7 @@ public fun ByteBuf.setBytesReverseC(
index: Int, index: Int,
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
Unpooled.wrappedBuffer(src).use { buf -> Unpooled.wrappedBuffer(src).use { buf ->
setBytesReverseC(index, buf, srcIndex, len) setBytesReverseC(index, buf, srcIndex, len)
@ -1558,7 +1558,7 @@ public fun ByteBuf.setBytesReverseC(index: Int, src: ByteBuf): ByteBuf {
public fun ByteBuf.setBytesReverseC( public fun ByteBuf.setBytesReverseC(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val srcIndex = src.readerIndex() val srcIndex = src.readerIndex()
setBytesReverseC(index, src, srcIndex, len) setBytesReverseC(index, src, srcIndex, len)
@ -1570,7 +1570,7 @@ public fun ByteBuf.setBytesReverseC(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
setByteC(index + i, src.getByte(srcIndex + len - i - 1).toInt()) setByteC(index + i, src.getByte(srcIndex + len - i - 1).toInt())
@ -1586,7 +1586,7 @@ public fun ByteBuf.writeBytesReverseC(src: ByteArray): ByteBuf {
public fun ByteBuf.writeBytesReverseC( public fun ByteBuf.writeBytesReverseC(
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -1613,7 +1613,7 @@ public fun ByteBuf.writeBytesReverseC(src: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.writeBytesReverseC( public fun ByteBuf.writeBytesReverseC(
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -1631,7 +1631,7 @@ public fun ByteBuf.getBytesReverseS(
index: Int, index: Int,
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
getBytes(index, dst, dstIndex, len) getBytes(index, dst, dstIndex, len)
for (i in 0 until len) { for (i in 0 until len) {
@ -1653,7 +1653,7 @@ public fun ByteBuf.getBytesReverseS(index: Int, dst: ByteBuf): ByteBuf {
public fun ByteBuf.getBytesReverseS( public fun ByteBuf.getBytesReverseS(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val dstIndex = dst.writerIndex() val dstIndex = dst.writerIndex()
dst.ensureWritable(len) dst.ensureWritable(len)
@ -1666,7 +1666,7 @@ public fun ByteBuf.getBytesReverseS(
index: Int, index: Int,
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
dst.setByte(dstIndex + i, getByteS(index + len - i - 1).toInt()) dst.setByte(dstIndex + i, getByteS(index + len - i - 1).toInt())
@ -1682,7 +1682,7 @@ public fun ByteBuf.readBytesReverseS(dst: ByteArray): ByteBuf {
public fun ByteBuf.readBytesReverseS( public fun ByteBuf.readBytesReverseS(
dst: ByteArray, dst: ByteArray,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesReverseS(index, dst, dstIndex, len) getBytesReverseS(index, dst, dstIndex, len)
@ -1710,7 +1710,7 @@ public fun ByteBuf.readBytesReverseS(dst: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.readBytesReverseS( public fun ByteBuf.readBytesReverseS(
dst: ByteBuf, dst: ByteBuf,
dstIndex: Int, dstIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = readerIndex() val index = readerIndex()
getBytesReverseS(index, dst, dstIndex, len) getBytesReverseS(index, dst, dstIndex, len)
@ -1737,7 +1737,7 @@ public fun ByteBuf.setBytesReverseS(
index: Int, index: Int,
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
Unpooled.wrappedBuffer(src).use { buf -> Unpooled.wrappedBuffer(src).use { buf ->
setBytesReverseS(index, buf, srcIndex, len) setBytesReverseS(index, buf, srcIndex, len)
@ -1756,7 +1756,7 @@ public fun ByteBuf.setBytesReverseS(index: Int, src: ByteBuf): ByteBuf {
public fun ByteBuf.setBytesReverseS( public fun ByteBuf.setBytesReverseS(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val srcIndex = src.readerIndex() val srcIndex = src.readerIndex()
setBytesReverseS(index, src, srcIndex, len) setBytesReverseS(index, src, srcIndex, len)
@ -1768,7 +1768,7 @@ public fun ByteBuf.setBytesReverseS(
index: Int, index: Int,
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
for (i in 0 until len) { for (i in 0 until len) {
setByteS(index + i, src.getByte(srcIndex + len - i - 1).toInt()) setByteS(index + i, src.getByte(srcIndex + len - i - 1).toInt())
@ -1784,7 +1784,7 @@ public fun ByteBuf.writeBytesReverseS(src: ByteArray): ByteBuf {
public fun ByteBuf.writeBytesReverseS( public fun ByteBuf.writeBytesReverseS(
src: ByteArray, src: ByteArray,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)
@ -1811,7 +1811,7 @@ public fun ByteBuf.writeBytesReverseS(src: ByteBuf, len: Int): ByteBuf {
public fun ByteBuf.writeBytesReverseS( public fun ByteBuf.writeBytesReverseS(
src: ByteBuf, src: ByteBuf,
srcIndex: Int, srcIndex: Int,
len: Int, len: Int
): ByteBuf { ): ByteBuf {
val index = writerIndex() val index = writerIndex()
ensureWritable(len) ensureWritable(len)

@ -53,7 +53,7 @@ allprojects {
plugins.withType<KotlinterPlugin> { plugins.withType<KotlinterPlugin> {
configure<KotlinterExtension> { configure<KotlinterExtension> {
// see https://github.com/pinterest/ktlint/issues/764 // see https://github.com/pinterest/ktlint/issues/764
disabledRules = arrayOf("indent", "parameter-list-wrapping") disabledRules = arrayOf("argument-list-wrapping", "parameter-list-wrapping", "wrapping")
} }
} }

@ -14,7 +14,7 @@ public class Sprite private constructor(
val xOffset: Int, val xOffset: Int,
val yOffset: Int, val yOffset: Int,
val innerWidth: Int, val innerWidth: Int,
val innerHeight: Int, val innerHeight: Int
) { ) {
val pixels = ByteArray(innerWidth * innerHeight) val pixels = ByteArray(innerWidth * innerHeight)
var alpha: ByteArray? = null var alpha: ByteArray? = null

@ -102,7 +102,7 @@ public class Js5Index(
public class MutableFile internal constructor( public class MutableFile internal constructor(
parent: MutableNamedEntryCollection<MutableFile>, parent: MutableNamedEntryCollection<MutableFile>,
override val id: Int, override val id: Int
) : MutableNamedEntry, File { ) : MutableNamedEntry, File {
private var parent: MutableNamedEntryCollection<MutableFile>? = parent private var parent: MutableNamedEntryCollection<MutableFile>? = parent

@ -23,7 +23,7 @@ public class Js5Pack private constructor(
index: Js5Index, index: Js5Index,
unpackedCacheSize: Int, unpackedCacheSize: Int,
private var packedIndex: ByteBuf, private var packedIndex: ByteBuf,
private val packed: Int2ObjectSortedMap<ByteBuf>, private val packed: Int2ObjectSortedMap<ByteBuf>
) : Archive(alloc, index, 0, UnpackedCache(unpackedCacheSize)), Closeable { ) : Archive(alloc, index, 0, UnpackedCache(unpackedCacheSize)), Closeable {
override fun packedExists(group: Int): Boolean { override fun packedExists(group: Int): Boolean {
return packed.containsKey(group) return packed.containsKey(group)

@ -33,7 +33,7 @@ public object OpenNxtStore {
SELECT data, crc SELECT data, crc
FROM cache_index FROM cache_index
WHERE key = 1 WHERE key = 1
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
if (rows.next()) { if (rows.next()) {
@ -57,7 +57,7 @@ public object OpenNxtStore {
""" """
SELECT key, data, crc, version SELECT key, data, crc, version
FROM cache FROM cache
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->
stmt.executeQuery().use { rows -> stmt.executeQuery().use { rows ->
while (rows.next()) { while (rows.next()) {

@ -4,7 +4,7 @@ import org.openrs2.buffer.use
public class VersionList( public class VersionList(
public val files: List<List<File>>, public val files: List<List<File>>,
public val maps: Map<Int, MapSquare>, public val maps: Map<Int, MapSquare>
) { ) {
public data class File( public data class File(
val version: Int, val version: Int,

@ -28,7 +28,7 @@ class Js5MasterIndexTest {
"0e1a2b93c80a41c7ad2a985dff707a6a8ff82e229cbc468f04191198920955a1" + "0e1a2b93c80a41c7ad2a985dff707a6a8ff82e229cbc468f04191198920955a1" +
"4b3d7eab77a17faf99208dee5b44afb789962ad79f230b3b59106a0af892219c" "4b3d7eab77a17faf99208dee5b44afb789962ad79f230b3b59106a0af892219c"
) )
), )
) )
), index ), index
) )

@ -56,7 +56,7 @@ public interface LibBzip2 {
public fun load(): LibBzip2 { public fun load(): LibBzip2 {
return LibraryLoader.loadLibrary( return LibraryLoader.loadLibrary(
LibBzip2::class.java, mapOf( LibBzip2::class.java, mapOf(
LibraryOption.LoadNow to true, LibraryOption.LoadNow to true
), "bz2" ), "bz2"
) )
} }

@ -245,5 +245,5 @@ public enum class CountryCode {
EH, // Western Sahara EH, // Western Sahara
YE, // Yemen YE, // Yemen
ZM, // Zambia ZM, // Zambia
ZW, // Zimbabwe ZW // Zimbabwe
} }

@ -109,7 +109,7 @@ public object Http {
<center>$BANNER</center> <center>$BANNER</center>
</body> </body>
</html> </html>
""".trimIndent().plus("\n"), Charsets.UTF_8 """.trimIndent().plus("\n"), Charsets.UTF_8
).use { buf -> ).use { buf ->
writeResponse(ctx, request, status, buf, HttpHeaderValues.TEXT_HTML, buf.readableBytes().toLong()) writeResponse(ctx, request, status, buf, HttpHeaderValues.TEXT_HTML, buf.readableBytes().toLong())
} }

@ -209,7 +209,7 @@ public class LoginChannelHandler @Inject constructor(
msg.affiliate, msg.affiliate,
dateOfBirth, dateOfBirth,
country, country,
msg.email, msg.email
).bind() ).bind()
}.getErrorOr(CreateResponse.Ok) }.getErrorOr(CreateResponse.Ok)

@ -16,6 +16,6 @@ public interface PlayerStore {
affiliate: Int, affiliate: Int,
dateOfBirth: LocalDate, dateOfBirth: LocalDate,
country: CountryCode, country: CountryCode,
email: String, email: String
): Result<Unit, CreateResponse> ): Result<Unit, CreateResponse>
} }

@ -15,7 +15,7 @@ nettyIoUring = "0.0.15.Final"
[plugins] [plugins]
dependencyLicenseReport = { id = "com.github.jk1.dependency-license-report", version = "2.1" } dependencyLicenseReport = { id = "com.github.jk1.dependency-license-report", version = "2.1" }
dokka = { id = "org.jetbrains.dokka", version = "1.7.10" } dokka = { id = "org.jetbrains.dokka", version = "1.7.10" }
kotlinter = { id = "org.jmailen.kotlinter", version = "3.9.0" } kotlinter = { id = "org.jmailen.kotlinter", version = "3.12.0" }
shadow = { id = "com.github.johnrengelman.shadow", version = "7.1.2" } shadow = { id = "com.github.johnrengelman.shadow", version = "7.1.2" }
versions = { id = "com.github.ben-manes.versions", version = "0.42.0" } versions = { id = "com.github.ben-manes.versions", version = "0.42.0" }

@ -358,7 +358,7 @@ public class HighDpiTransformer : Transformer() {
private val DRAW_PIXELS_MATCHER = InsnMatcher.compile( private val DRAW_PIXELS_MATCHER = InsnMatcher.compile(
""" """
ALOAD ILOAD ILOAD LDC GETSTATIC IFEQ LDC GOTO SIPUSH ALOAD INVOKESTATIC INVOKEINTERFACE ALOAD ILOAD ILOAD LDC GETSTATIC IFEQ LDC GOTO SIPUSH ALOAD INVOKESTATIC INVOKEINTERFACE
""".trimIndent() """.trimIndent()
) )
private val GET_GL_MATCHER = InsnMatcher.compile("GETSTATIC INVOKEVIRTUAL PUTSTATIC") private val GET_GL_MATCHER = InsnMatcher.compile("GETSTATIC INVOKEVIRTUAL PUTSTATIC")
private val SET_CANVAS_VISIBLE_MATCHER = InsnMatcher.compile("GETSTATIC ICONST_1 INVOKEVIRTUAL") private val SET_CANVAS_VISIBLE_MATCHER = InsnMatcher.compile("GETSTATIC ICONST_1 INVOKEVIRTUAL")

@ -96,7 +96,7 @@ public class InvalidKeyTransformer : Transformer() {
private val MATCHER = InsnMatcher.compile( private val MATCHER = InsnMatcher.compile(
""" """
ALOAD INVOKESTATIC ASTORE GOTO ASTORE ALOAD NEW DUP INVOKESPECIAL? LDC .*? INVOKESTATIC ATHROW ALOAD INVOKESTATIC ASTORE GOTO ASTORE ALOAD NEW DUP INVOKESPECIAL? LDC .*? INVOKESTATIC ATHROW
""".trimIndent() """.trimIndent()
) )
} }
} }

@ -109,7 +109,7 @@ public inline fun <T> Path.useTempFile(
public inline fun <T> Path.atomicWrite( public inline fun <T> Path.atomicWrite(
sync: Boolean = true, sync: Boolean = true,
f: (Path) -> T, f: (Path) -> T
): T { ): T {
parent.useTempFile(".$fileName", ".tmp") { tempFile -> parent.useTempFile(".$fileName", ".tmp") { tempFile ->
val result = f(tempFile) val result = f(tempFile)
@ -134,7 +134,7 @@ public inline fun <T> Path.atomicWrite(
public inline fun <T> Path.useAtomicBufferedWriter( public inline fun <T> Path.useAtomicBufferedWriter(
vararg options: OpenOption, vararg options: OpenOption,
sync: Boolean = true, sync: Boolean = true,
f: (BufferedWriter) -> T, f: (BufferedWriter) -> T
): T { ): T {
return atomicWrite(sync) { path -> return atomicWrite(sync) { path ->
Files.newBufferedWriter(path, *options).use { writer -> Files.newBufferedWriter(path, *options).use { writer ->
@ -147,7 +147,7 @@ public inline fun <T> Path.useAtomicBufferedWriter(
cs: Charset, cs: Charset,
vararg options: OpenOption, vararg options: OpenOption,
sync: Boolean = true, sync: Boolean = true,
f: (BufferedWriter) -> T, f: (BufferedWriter) -> T
): T { ): T {
return atomicWrite(sync) { path -> return atomicWrite(sync) { path ->
Files.newBufferedWriter(path, cs, *options).use { writer -> Files.newBufferedWriter(path, cs, *options).use { writer ->
@ -159,7 +159,7 @@ public inline fun <T> Path.useAtomicBufferedWriter(
public inline fun <T> Path.useAtomicOutputStream( public inline fun <T> Path.useAtomicOutputStream(
vararg options: OpenOption, vararg options: OpenOption,
sync: Boolean = true, sync: Boolean = true,
f: (OutputStream) -> T, f: (OutputStream) -> T
): T { ): T {
return atomicWrite(sync) { path -> return atomicWrite(sync) { path ->
Files.newOutputStream(path, *options).use { output -> Files.newOutputStream(path, *options).use { output ->

Loading…
Cancel
Save