Commit: 56978f929e183eb0d5a11dc5dfa02665fe6a3f96 Author: Christoph M. Becker <cmbecke...@gmx.de> Sat, 15 Jun 2019 14:53:05 +0200 Parents: 885a7da0e6b50f2b64dbf9145d11821580e8c61f Branches: master
Link: http://git.php.net/?p=pftt2.git;a=commitdiff;h=56978f929e183eb0d5a11dc5dfa02665fe6a3f96 Log: Fix signedness confusion in byte to char cast Since bytes are signed, but chars are unsigned, we must not cast directly, but rather make sure that the byte is converted to the respective positive integer first. Changed paths: M src/com/github/mattficken/io/NoCharsetByLineReader.java Diff: diff --git a/src/com/github/mattficken/io/NoCharsetByLineReader.java b/src/com/github/mattficken/io/NoCharsetByLineReader.java index a004da3..7e36d56 100644 --- a/src/com/github/mattficken/io/NoCharsetByLineReader.java +++ b/src/com/github/mattficken/io/NoCharsetByLineReader.java @@ -51,7 +51,7 @@ public class NoCharsetByLineReader extends AbstractNoDetectingReader implements System.arraycopy(cbuf, 0, new_cbuf, 0, cbuf_len); cbuf = new_cbuf; } - cbuf[cbuf_len] = (char) bbuf[i]; + cbuf[cbuf_len] = (char) (bbuf[i] & 0xFF); cbuf_len++; } bbuf_len = in.read(bbuf);