File tree Expand file tree Collapse file tree 4 files changed +14
-2
lines changed
kotlinx-io-js/src/main/kotlin/kotlinx/io/core
kotlinx-io-jvm/src/main/kotlin/kotlinx/io/core
kotlinx-io-native/src/main/kotlin/kotlinx/io/core Expand file tree Collapse file tree 4 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 88- Added a cpointer constructor to native IoBuffer so that IoBuffer can be used to read AND write on a memory chunk
99- Made ByteChannel pass original cause from the owner job
1010- Fixed reading UTF-8 lines
11+ - Fixed empty chunk view creation
12+ - Utility functions takeWhile* improvements
1113
1214# 0.1.0
1315> Published 15 Nov 2018
Original file line number Diff line number Diff line change @@ -957,6 +957,8 @@ actual class IoBuffer internal constructor(
957957 actual fun isExclusivelyOwned (): Boolean = refCount == 1
958958
959959 actual fun makeView (): IoBuffer {
960+ if (this == = Empty ) return this
961+
960962 val o = origin ? : this
961963 o.acquire()
962964
Original file line number Diff line number Diff line change @@ -739,6 +739,8 @@ actual class IoBuffer private constructor(
739739 * Creates a new view to the same actual buffer with independant read and write positions and gaps
740740 */
741741 actual fun makeView (): IoBuffer {
742+ if (this == = Empty ) return this
743+
742744 val newOrigin = origin ? : this
743745 newOrigin.acquire()
744746
@@ -863,12 +865,16 @@ actual class IoBuffer private constructor(
863865 }
864866
865867 private fun releaseRefCount (): Boolean {
866- if (this == = Empty ) throw IllegalArgumentException (" Attempted to release empty" )
868+ if (this == = Empty ) {
869+ throw IllegalArgumentException (" Attempted to release empty" )
870+ }
867871 while (true ) {
868872 val value = refCount
869873 val newValue = value - 1
870874
871- if (value == 0L ) throw IllegalStateException (" Unable to release: already released" )
875+ if (value == 0L ) {
876+ throw IllegalStateException (" Unable to release: already released" )
877+ }
872878 if (RefCount .compareAndSet(this , value, newValue)) {
873879 return newValue == 0L
874880 }
Original file line number Diff line number Diff line change @@ -980,6 +980,8 @@ actual class IoBuffer internal constructor(
980980 actual fun isExclusivelyOwned (): Boolean = refCount == 1
981981
982982 actual fun makeView (): IoBuffer {
983+ if (this == = Empty ) return this
984+
983985 val o = origin ? : this
984986 o.acquire()
985987
You can’t perform that action at this time.
0 commit comments