fix compile warnings

This commit is contained in:
Aria Moradi
2021-08-17 23:52:34 +04:30
parent fcdda6406e
commit a5578a7ac7
17 changed files with 39 additions and 28 deletions

View File

@@ -1,5 +0,0 @@
package kotlinx.coroutines.experimental.android
import kotlinx.coroutines.GlobalScope
val UI = GlobalScope.coroutineContext

View File

@@ -4,11 +4,21 @@ import java.io.InputStream
import java.io.Reader
import java.math.BigDecimal
import java.net.URL
import java.sql.*
import java.sql.Array
import java.sql.Blob
import java.sql.Clob
import java.sql.Date
import java.util.*
import java.sql.NClob
import java.sql.Ref
import java.sql.ResultSet
import java.sql.ResultSetMetaData
import java.sql.RowId
import java.sql.SQLXML
import java.sql.Time
import java.sql.Timestamp
import java.util.Calendar
@Suppress("UNCHECKED_CAST")
class ScrollableResultSet(val parent: ResultSet) : ResultSet by parent {
private val cachedContent = mutableListOf<ResultSetEntry>()

View File

@@ -18,7 +18,7 @@ class ServiceSupport {
private val logger = KotlinLogging.logger {}
fun startService(context: Context, intent: Intent) {
fun startService(@Suppress("UNUSED_PARAMETER") context: Context, intent: Intent) {
val name = intentToClassName(intent)
logger.debug { "Starting service: $name" }
@@ -35,7 +35,7 @@ class ServiceSupport {
}
}
fun stopService(context: Context, intent: Intent) {
fun stopService(@Suppress("UNUSED_PARAMETER") context: Context, intent: Intent) {
val name = intentToClassName(intent)
stopService(name)
}

View File

@@ -25,6 +25,7 @@ object KodeinGlobalHelper {
* Get a dependency
*/
@JvmStatic
@Suppress("UNCHECKED_CAST")
fun <T : Any> instance(type: Class<T>, kodein: DI? = null): T {
return when(type) {
AndroidFiles::class.java -> {

View File

@@ -54,7 +54,7 @@ abstract class AnimeHttpSource : AnimeCatalogueSource {
* Note the generated id sets the sign bit to 0.
*/
override val id by lazy {
val key = "${name.toLowerCase()}/$lang/$versionId"
val key = "${name.lowercase()}/$lang/$versionId"
val bytes = MessageDigest.getInstance("MD5").digest(key.toByteArray())
(0..7).map { bytes[it].toLong() and 0xff shl 8 * (7 - it) }.reduce(Long::or) and Long.MAX_VALUE
}
@@ -80,7 +80,7 @@ abstract class AnimeHttpSource : AnimeCatalogueSource {
/**
* Visible name of the source.
*/
override fun toString() = "$name (${lang.toUpperCase()})"
override fun toString() = "$name (${lang.uppercase()})"
/**
* Returns an observable containing a page with a list of anime. Normally it's not needed to

View File

@@ -18,6 +18,7 @@ import okhttp3.OkHttpClient
// import uy.kohesive.injekt.injectLazy
import java.util.concurrent.TimeUnit
@Suppress("UNUSED_PARAMETER")
class NetworkHelper(context: Context) {
// private val preferences: PreferencesHelper by injectLazy()

View File

@@ -110,6 +110,7 @@ fun Call.asObservableSuccess(): Observable<Response> {
// return progressClient.newCall(request)
// }
@Suppress("UNUSED_PARAMETER")
fun OkHttpClient.newCallWithProgress(request: Request, listener: ProgressListener): Call {
val progressClient = newBuilder()
// .cache(null)

View File

@@ -55,7 +55,7 @@ abstract class HttpSource : CatalogueSource {
* Note the generated id sets the sign bit to 0.
*/
override val id by lazy {
val key = "${name.toLowerCase()}/$lang/$versionId"
val key = "${name.lowercase()}/$lang/$versionId"
val bytes = MessageDigest.getInstance("MD5").digest(key.toByteArray())
(0..7).map { bytes[it].toLong() and 0xff shl 8 * (7 - it) }.reduce(Long::or) and Long.MAX_VALUE
}
@@ -81,7 +81,7 @@ abstract class HttpSource : CatalogueSource {
/**
* Visible name of the source.
*/
override fun toString() = "$name (${lang.toUpperCase()})"
override fun toString() = "$name (${lang.uppercase()})"
/**
* Returns an observable containing a page with a list of manga. Normally it's not needed to

View File

@@ -7,7 +7,6 @@ package suwayomi.tachidesk.manga
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import io.javalin.Javalin
import io.javalin.apibuilder.ApiBuilder.delete
import io.javalin.apibuilder.ApiBuilder.get
import io.javalin.apibuilder.ApiBuilder.patch
@@ -22,7 +21,7 @@ import suwayomi.tachidesk.manga.controller.MangaController
import suwayomi.tachidesk.manga.controller.SourceController
object MangaAPI {
fun defineEndpoints(app: Javalin) {
fun defineEndpoints() {
path("extension") {
get("list", ExtensionController::list)
@@ -82,7 +81,7 @@ object MangaAPI {
patch(":categoryId", LibraryController::categoryModify)
delete(":categoryId", LibraryController::categoryDelete)
patch(":categoryId/reorder", LibraryController::categoryReorder)
patch(":categoryId/reorder", LibraryController::categoryReorder) // TODO: the underlying code doesn't need `:categoryId`, remove it
}
}

View File

@@ -54,10 +54,9 @@ object LibraryController {
/** category re-ordering */
fun categoryReorder(ctx: Context) {
val categoryId = ctx.pathParam("categoryId").toInt()
val from = ctx.formParam("from")!!.toInt()
val to = ctx.formParam("to")!!.toInt()
Category.reorderCategory(categoryId, from, to)
Category.reorderCategory(from, to)
ctx.status(200)
}
}

View File

@@ -47,7 +47,7 @@ object Category {
/**
* Move the category from position `from` to `to`
*/
fun reorderCategory(categoryId: Int, from: Int, to: Int) {
fun reorderCategory(from: Int, to: Int) {
transaction {
val categories = CategoryTable.selectAll().orderBy(CategoryTable.order to SortOrder.ASC).toMutableList()
categories.add(to - 1, categories.removeAt(from - 1))

View File

@@ -20,15 +20,18 @@ object Search {
}
// TODO
@Suppress("UNUSED_PARAMETER", "UNUSED_VARIABLE")
fun sourceFilters(sourceId: Long) {
val source = getHttpSource(sourceId)
// source.getFilterList().toItems()
}
@Suppress("UNUSED_PARAMETER")
fun sourceGlobalSearch(searchTerm: String) {
// TODO
}
@Suppress("unused")
data class FilterWrapper(
val type: String,
val filter: Any

View File

@@ -141,6 +141,7 @@ object LegacyBackupImport : LegacyBackupBase() {
* @param history history data from json
* @param tracks tracking data from json
*/
@Suppress("UNUSED_PARAMETER")
private suspend fun restoreMangaData(
manga: Manga,
source: Source,
@@ -204,6 +205,7 @@ object LegacyBackupImport : LegacyBackupBase() {
return fetchedManga
}
@Suppress("UNUSED_PARAMETER") // TODO: remove this suppress when update Chapters is written
private fun updateChapters(source: Source, fetchedManga: SManga, chapters: List<Chapter>) {
// TODO("Not yet implemented")
}

View File

@@ -42,11 +42,11 @@ object LegacyBackupValidator {
.sorted()
}
val trackers = mangas
.filter { it.asJsonObject.has("track") }
.flatMap { it.asJsonObject["track"].asJsonArray }
.map { it.asJsonObject["s"].asInt }
.distinct()
// val trackers = mangas
// .filter { it.asJsonObject.has("track") }
// .flatMap { it.asJsonObject["track"].asJsonArray }
// .map { it.asJsonObject["s"].asInt }
// .distinct()
val missingTrackers = listOf("")
// val missingTrackers = trackers

View File

@@ -85,7 +85,7 @@ object BytecodeEditor {
bytes[2],
bytes[3]
)
if (cafebabe.toLowerCase() != "cafebabe") {
if (cafebabe.lowercase() != "cafebabe") {
// Corrupted class
return@use null
}

View File

@@ -81,7 +81,7 @@ object JavalinSetup {
app.routes {
path("api/v1/") {
GlobalAPI.defineEndpoints()
MangaAPI.defineEndpoints(app)
MangaAPI.defineEndpoints()
AnimeAPI.defineEndpoints(app) // TODO: migrate Anime endpoints
}
}

View File

@@ -72,7 +72,7 @@ class TestExtensions {
sources = getSourceList().map { getHttpSource(it.id.toLong()) }
}
setLoggingEnabled(true)
File("tmp/TestDesk/sources.txt").writeText(sources.joinToString("\n") { "${it.name} - ${it.lang.toUpperCase()} - ${it.id}" })
File("tmp/TestDesk/sources.txt").writeText(sources.joinToString("\n") { "${it.name} - ${it.lang.uppercase()} - ${it.id}" })
}
@Test
@@ -99,7 +99,7 @@ class TestExtensions {
}.awaitAll()
File("tmp/TestDesk/failedToFetch.txt").writeText(
failedToFetch.joinToString("\n") { (source, exception) ->
"${source.name} (${source.lang.toUpperCase()}, ${source.id}):" +
"${source.name} (${source.lang.uppercase()}, ${source.id}):" +
" ${exception.message}"
}
)