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 8
8
- Added a cpointer constructor to native IoBuffer so that IoBuffer can be used to read AND write on a memory chunk
9
9
- Made ByteChannel pass original cause from the owner job
10
10
- Fixed reading UTF-8 lines
11
+ - Fixed empty chunk view creation
12
+ - Utility functions takeWhile* improvements
11
13
12
14
# 0.1.0
13
15
> Published 15 Nov 2018
Original file line number Diff line number Diff line change @@ -957,6 +957,8 @@ actual class IoBuffer internal constructor(
957
957
actual fun isExclusivelyOwned (): Boolean = refCount == 1
958
958
959
959
actual fun makeView (): IoBuffer {
960
+ if (this == = Empty ) return this
961
+
960
962
val o = origin ? : this
961
963
o.acquire()
962
964
Original file line number Diff line number Diff line change @@ -739,6 +739,8 @@ actual class IoBuffer private constructor(
739
739
* Creates a new view to the same actual buffer with independant read and write positions and gaps
740
740
*/
741
741
actual fun makeView (): IoBuffer {
742
+ if (this == = Empty ) return this
743
+
742
744
val newOrigin = origin ? : this
743
745
newOrigin.acquire()
744
746
@@ -863,12 +865,16 @@ actual class IoBuffer private constructor(
863
865
}
864
866
865
867
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
+ }
867
871
while (true ) {
868
872
val value = refCount
869
873
val newValue = value - 1
870
874
871
- if (value == 0L ) throw IllegalStateException (" Unable to release: already released" )
875
+ if (value == 0L ) {
876
+ throw IllegalStateException (" Unable to release: already released" )
877
+ }
872
878
if (RefCount .compareAndSet(this , value, newValue)) {
873
879
return newValue == 0L
874
880
}
Original file line number Diff line number Diff line change @@ -980,6 +980,8 @@ actual class IoBuffer internal constructor(
980
980
actual fun isExclusivelyOwned (): Boolean = refCount == 1
981
981
982
982
actual fun makeView (): IoBuffer {
983
+ if (this == = Empty ) return this
984
+
983
985
val o = origin ? : this
984
986
o.acquire()
985
987
You can’t perform that action at this time.
0 commit comments