mirror of https://github.com/sbt/sbt.git
[2.x] refactor: Use new Array instead of Array.fill (#8929)
This commit is contained in:
parent
a6a1cf383e
commit
b839d308e1
|
|
@ -144,7 +144,7 @@ object EscHelpers {
|
||||||
* the length of the output string (which may be smaller than the returned array)
|
* the length of the output string (which may be smaller than the returned array)
|
||||||
*/
|
*/
|
||||||
def strip(bytes: Array[Byte], stripAnsi: Boolean, stripColor: Boolean): (Array[Byte], Int) = {
|
def strip(bytes: Array[Byte], stripAnsi: Boolean, stripColor: Boolean): (Array[Byte], Int) = {
|
||||||
val res = Array.fill[Byte](bytes.length)(0)
|
val res = new Array[Byte](bytes.length)
|
||||||
var index = 0
|
var index = 0
|
||||||
var state = 0
|
var state = 0
|
||||||
var limit = 0
|
var limit = 0
|
||||||
|
|
@ -199,7 +199,7 @@ object EscHelpers {
|
||||||
*/
|
*/
|
||||||
def stripColorsAndMoves(s: String): String = {
|
def stripColorsAndMoves(s: String): String = {
|
||||||
val bytes = s.getBytes
|
val bytes = s.getBytes
|
||||||
val res = Array.fill[Byte](bytes.length)(0)
|
val res = new Array[Byte](bytes.length)
|
||||||
var index = 0
|
var index = 0
|
||||||
var state = 0
|
var state = 0
|
||||||
var limit = 0
|
var limit = 0
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ libraryDependencies += "com.chuusai" %% "shapeless" % "2.3.41" from {
|
||||||
val os = new java.io.FileOutputStream(f)
|
val os = new java.io.FileOutputStream(f)
|
||||||
|
|
||||||
var read = -1
|
var read = -1
|
||||||
val b = Array.fill[Byte](16*1024)(0)
|
val b = new Array[Byte](16*1024)
|
||||||
while ({
|
while ({
|
||||||
read = is.read(b)
|
read = is.read(b)
|
||||||
read >= 0
|
read >= 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue