[Git][java-team/jcodings][master] 6 commits: avoid Java ArrayIndex error

Hideki Yamane gitlab at salsa.debian.org
Fri May 1 11:43:02 BST 2020



Hideki Yamane pushed to branch master at Debian Java Maintainers / jcodings


Commits:
af4cd406 by kiichi at 2020-04-28T23:15:07+09:00
avoid Java ArrayIndex error
  e.g. "a\0".force_encoding(utf-32le).chomp

update isNewLine condition(port from MRI 2.6.6)
  see https://github.com/ruby/ruby/blob/v2_6_6/enc/utf_32le.c

- - - - -
170f819b by kiichi at 2020-04-28T23:16:54+09:00
format code and add missing increment operator

- - - - -
231974d3 by kiichi at 2020-04-28T23:16:54+09:00
update isNewLine condition(port from MRI 2.6.6).
 see https://github.com/ruby/ruby/blob/v2_6_6/enc/utf_32be.c

- - - - -
8e5c660d by Charles Oliver Nutter at 2020-04-28T20:11:06-05:00
Merge pull request #33 from k77ch7/update-utf32-encoding

Update UTF32Encoding
- - - - -
6396381d by Charles Oliver Nutter at 2020-04-28T20:16:45-05:00
[maven-release-plugin] prepare release jcodings-1.0.50

- - - - -
9bb060b1 by Charles Oliver Nutter at 2020-04-28T20:16:54-05:00
[maven-release-plugin] prepare for next development iteration

- - - - -


3 changed files:

- pom.xml
- src/org/jcodings/specific/UTF32BEEncoding.java
- src/org/jcodings/specific/UTF32LEEncoding.java


Changes:

=====================================
pom.xml
=====================================
@@ -3,7 +3,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.jruby.jcodings</groupId>
   <artifactId>jcodings</artifactId>
-  <version>1.0.50-SNAPSHOT</version>
+  <version>1.0.51-SNAPSHOT</version>
   <name>JCodings</name>
   <description>Byte based encoding support library for java</description>
   <parent>


=====================================
src/org/jcodings/specific/UTF32BEEncoding.java
=====================================
@@ -36,8 +36,8 @@ public final class UTF32BEEncoding extends FixedWidthUnicodeEncoding {
             if (bytes[p + 3] == (byte)0x0a && bytes[p + 2] == 0 && bytes[p + 1] == 0 && bytes[p] == 0) return true;
 
             if (Config.USE_UNICODE_ALL_LINE_TERMINATORS) {
-                if ((Config.USE_CRNL_AS_LINE_TERMINATOR && bytes[p + 3] == (byte)0x0d) ||
-                   bytes[p + 3] == (byte)0x85 && bytes[p + 2] == 0 && bytes[p + 1] == 0 && bytes[p] == 0) return true;
+                if ((bytes[p + 3] == (byte)0x0b || bytes[p + 3] == (byte)0x0c || bytes[p + 3] == (byte)0x0d || bytes[p + 3] == (byte)0x85) 
+                    && bytes[p + 2] == 0 && bytes[p + 1] == 0 && bytes[p] == 0) return true;
 
                 if (bytes[p + 2] == (byte)0x20 &&
                    (bytes[p + 3] == (byte)0x29 || bytes[p + 3] == (byte)0x28) &&


=====================================
src/org/jcodings/specific/UTF32LEEncoding.java
=====================================
@@ -33,15 +33,14 @@ public final class UTF32LEEncoding extends FixedWidthUnicodeEncoding {
     @Override
     public boolean isNewLine(byte[]bytes, int p, int end) {
         if (p + 3 < end) {
-            if (bytes[p] == (byte)0x0a && bytes[p + 1] == 0 && bytes[p + 2] == 0 && bytes[p + 3] == 0) return true;
+            if (bytes[p + 3] == 0 && bytes[p + 2] == 0 && bytes[p + 1] == 0 && bytes[p] == (byte)0x0a) return true;
 
             if (Config.USE_UNICODE_ALL_LINE_TERMINATORS) {
-                if ((Config.USE_CRNL_AS_LINE_TERMINATOR && bytes[p] == (byte)0x0d) ||
-                   bytes[p] == (byte)0x85 && bytes[p + 1] == 0 && bytes[p + 2] == 0 && bytes[3] == 0) return true;
+                if (bytes[p + 3] == 0 && bytes[p + 2] == 0 && bytes[p + 1] == 0 &&
+                    (bytes[p] == (byte)0x0b || bytes[p] == (byte)0x0c || bytes[p] == (byte)0x0d || bytes[p] == (byte)0x85)) return true;
 
-                if (bytes[p + 1] == (byte)0x20 &&
-                   (bytes[p] == (byte)0x29 || bytes[p] == (byte)0x28) &&
-                    bytes[p + 2] == 0 && bytes[p + 3] == 0) return true;
+                if (bytes[p + 3] == 0 && bytes[p + 2] == 0 && bytes[p + 1] == (byte)0x20 &&
+                   (bytes[p] == (byte)0x29 || bytes[p] == (byte)0x28)) return true;
             } // USE_UNICODE_ALL_LINE_TERMINATORS
         }
         return false;
@@ -68,10 +67,12 @@ public final class UTF32LEEncoding extends FixedWidthUnicodeEncoding {
         int foldP = 0;
         if (isAscii(bytes[p] & 0xff) && bytes[p + 1] == 0 && bytes[p + 2] == 0 && bytes[p + 3] == 0) {
 
-            if (Config.USE_UNICODE_CASE_FOLD_TURKISH_AZERI && (flag & Config.CASE_FOLD_TURKISH_AZERI) != 0) {
-                if (bytes[p] == (byte)0x49) {
-                    fold[foldP++] = (byte)0x31;
-                        fold[foldP] = (byte)0x01;
+            if (Config.USE_UNICODE_CASE_FOLD_TURKISH_AZERI) {
+                if ((flag & Config.CASE_FOLD_TURKISH_AZERI) != 0) {
+                    if (bytes[p] == (byte)0x49) {
+                        fold[foldP++] = (byte)0x31;
+                        fold[foldP++] = (byte)0x01;
+                    }
                 }
             } else {
                 fold[foldP++] = AsciiTables.ToLowerCaseTable[bytes[p] & 0xff];



View it on GitLab: https://salsa.debian.org/java-team/jcodings/-/compare/3000f8c84f5857c12ad5d3991ee104a7176df72f...9bb060b15bcfa12e92146ec25b5539e6fd00f07b

-- 
View it on GitLab: https://salsa.debian.org/java-team/jcodings/-/compare/3000f8c84f5857c12ad5d3991ee104a7176df72f...9bb060b15bcfa12e92146ec25b5539e6fd00f07b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20200501/4b8dadcc/attachment.html>


More information about the pkg-java-commits mailing list