diff options
Diffstat (limited to 'src/compiler/scala/tools/util/UTF8Codec.scala')
-rw-r--r-- | src/compiler/scala/tools/util/UTF8Codec.scala | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/util/UTF8Codec.scala b/src/compiler/scala/tools/util/UTF8Codec.scala index d2d420c4b6..c082a3f0d7 100644 --- a/src/compiler/scala/tools/util/UTF8Codec.scala +++ b/src/compiler/scala/tools/util/UTF8Codec.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -23,20 +23,20 @@ object UTF8Codec { val end = from + len while (i < end) { val ch = src(i) - i = i + 1 + i += 1 if (ch < 128) { dst(j) = ch.toByte - j = j + 1 + j += 1 } else if (ch <= 0x3FF) { dst(j) = (0xC0 | (ch >> 6)).toByte dst(j+1) = (0x80 | (ch & 0x3F)).toByte - j = j + 2 + j += 2 } else { dst(j) = (0xE0 | (ch >> 12)).toByte dst(j+1) = (0x80 | ((ch >> 6) & 0x3F)).toByte dst(j+2) = (0x80 | (ch & 0x3F)).toByte - j = j + 3 + j += 3 } } j @@ -45,7 +45,6 @@ object UTF8Codec { def encode(s: String, dst: Array[Byte], to: Int): Int = encode(s.toCharArray(), 0, dst, to, s.length()) - def encode(s: String): Array[Byte] = { val dst = new Array[Byte](s.length() * 3) val len = encode(s, dst, 0) @@ -60,17 +59,17 @@ object UTF8Codec { val end = from + len while (i < end) { var b = src(i) & 0xFF - i = i + 1 + i += 1 if (b >= 0xE0) { b = ((b & 0x0F) << 12) | (src(i) & 0x3F) << 6 b = b | (src(i+1) & 0x3F) - i = i + 2 + i += 2 } else if (b >= 0xC0) { b = ((b & 0x1F) << 6) | (src(i) & 0x3F) - i = i + 1 + i += 1 } dst(j) = b.toChar - j = j + 1 + j += 1 } j } |