Skip to content

Commit

Permalink
Remove unused null check in Bytes.getString
Browse files Browse the repository at this point in the history
  • Loading branch information
limepoutine authored Feb 24, 2025
1 parent b0b2997 commit 36c3da3
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions std/haxe/io/Bytes.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 36c3da3

Please sign in to comment.