From 36c3da3c285226ce25032b2cef64d90ed9c3f478 Mon Sep 17 00:00:00 2001 From: limepoutine <144896890+limepoutine@users.noreply.github.com> Date: Mon, 24 Feb 2025 14:30:16 +0800 Subject: [PATCH] Remove unused null check in Bytes.getString --- std/haxe/io/Bytes.hx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/std/haxe/io/Bytes.hx b/std/haxe/io/Bytes.hx index fdfdf4290fe..4278f101761 100644 --- a/std/haxe/io/Bytes.hx +++ b/std/haxe/io/Bytes.hx @@ -404,15 +404,12 @@ class Bytes { interpreted with the given `encoding` (UTF-8 by default). **/ public function getString(pos:Int, len:Int, ?encoding:Encoding):String { - if (encoding == null) - encoding == UTF8; - #if !neko - if (pos < 0 || len < 0 || pos + len > length) - throw Error.OutsideBounds; - #end #if neko return try new String(untyped __dollar__ssub(b, pos, len)) catch (e:Dynamic) throw Error.OutsideBounds; - #elseif flash + #end + if (pos < 0 || len < 0 || pos + len > length) + throw Error.OutsideBounds; + #if flash b.position = pos; return encoding == RawNative ? b.readMultiByte(len, "unicode") : b.readUTFBytes(len); #elseif cpp