Fixed deprecated methods

This commit is contained in:
Robinson 2021-04-27 14:19:56 +02:00
parent 8d47b8b0b8
commit ad1c2450b9
2 changed files with 7 additions and 7 deletions

View File

@ -105,9 +105,9 @@ class ServerConfiguration : dorkbox.network.Configuration() {
@Suppress("DuplicatedCode") @Suppress("DuplicatedCode")
override fun validate() { override fun validate() {
// have to do some basic validation of our configuration // have to do some basic validation of our configuration
if (listenIpAddress != listenIpAddress.toLowerCase()) { if (listenIpAddress != listenIpAddress.lowercase()) {
// only do this once! // only do this once!
listenIpAddress = listenIpAddress.toLowerCase() listenIpAddress = listenIpAddress.lowercase()
} }
require(listenIpAddress.isNotBlank()) { "Blank listen IP address, cannot continue"} require(listenIpAddress.isNotBlank()) { "Blank listen IP address, cannot continue"}

View File

@ -435,7 +435,7 @@ class AeronOutput : Output {
var permitAscii = charCount in 2..32 var permitAscii = charCount in 2..32
if (permitAscii) { if (permitAscii) {
for (i in 0 until charCount) { for (i in 0 until charCount) {
if (value[i].toInt() > 127) { if (value[i].code > 127) {
permitAscii = false permitAscii = false
break // not ascii break // not ascii
} }
@ -459,7 +459,7 @@ class AeronOutput : Output {
// Try to write 7 bit chars. // Try to write 7 bit chars.
val byteBuf = internalBuffer val byteBuf = internalBuffer
while (true) { while (true) {
val c = value[charIndex].toInt() val c = value[charIndex].code
if (c > 127) break if (c > 127) break
byteBuf.putByte(position++, c.toByte()) byteBuf.putByte(position++, c.toByte())
charIndex++ charIndex++
@ -486,7 +486,7 @@ class AeronOutput : Output {
var i = 0 var i = 0
val n = value.length val n = value.length
while (i < n) { while (i < n) {
byteBuf.putByte(position++, value[i].toByte()) byteBuf.putByte(position++, value[i].code.toByte())
++i ++i
} }
byteBuf.putByte(position - 1, (byteBuf.getByte(position - 1).toInt() or 0x80).toByte()) // Bit 8 means end of ASCII. byteBuf.putByte(position - 1, (byteBuf.getByte(position - 1).toInt() or 0x80).toByte()) // Bit 8 means end of ASCII.
@ -495,7 +495,7 @@ class AeronOutput : Output {
private fun writeUtf8Slow(value: String, charCount: Int, charIndex: Int) { private fun writeUtf8Slow(value: String, charCount: Int, charIndex: Int) {
var index = charIndex var index = charIndex
while (index < charCount) { while (index < charCount) {
val c = value[index].toInt() val c = value[index].code
if (c <= 0x007F) { if (c <= 0x007F) {
internalBuffer.putByte(position++, c.toByte()) internalBuffer.putByte(position++, c.toByte())
@ -572,7 +572,7 @@ class AeronOutput : Output {
var newOffset = offset var newOffset = offset
val n = newOffset + count val n = newOffset + count
while (newOffset < n) { while (newOffset < n) {
val value = array[newOffset].toInt() val value = array[newOffset].code
writeChar(value.toChar()) writeChar(value.toChar())
newOffset++ newOffset++
} }