[Git][java-team/jcodings][master] 4 commits: Fix range check for euc-jp and sjis case fold.
Hideki Yamane
gitlab at salsa.debian.org
Fri Jun 5 00:58:55 BST 2020
Hideki Yamane pushed to branch master at Debian Java Maintainers / jcodings
Commits:
6b2fb14c by kiichi at 2020-05-21T00:29:10+09:00
Fix range check for euc-jp and sjis case fold.
- - - - -
c0dd4202 by Charles Oliver Nutter at 2020-06-03T20:25:50-05:00
Merge pull request #37 from k77ch7/fix-isInRange
Fix range check for euc-jp and sjis case fold.
- - - - -
11a1fdc0 by Charles Oliver Nutter at 2020-06-03T20:35:25-05:00
[maven-release-plugin] prepare release jcodings-1.0.55
- - - - -
e69a7ac4 by Charles Oliver Nutter at 2020-06-03T20:35:34-05:00
[maven-release-plugin] prepare for next development iteration
- - - - -
4 changed files:
- pom.xml
- src/org/jcodings/MultiByteEncoding.java
- test/org/jcodings/specific/TestEUCJP.java
- + test/org/jcodings/specific/TestSJIS.java
Changes:
=====================================
pom.xml
=====================================
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jruby.jcodings</groupId>
<artifactId>jcodings</artifactId>
- <version>1.0.55-SNAPSHOT</version>
+ <version>1.0.56-SNAPSHOT</version>
<name>JCodings</name>
<description>Byte based encoding support library for java</description>
<parent>
=====================================
src/org/jcodings/MultiByteEncoding.java
=====================================
@@ -221,6 +221,6 @@ public abstract class MultiByteEncoding extends AbstractEncoding {
}
public static boolean isInRange(int code, int from, int to) {
- return code - from <= to - from;
+ return code - from >= 0 && to - code >= 0;
}
}
=====================================
test/org/jcodings/specific/TestEUCJP.java
=====================================
@@ -1,11 +1,12 @@
package org.jcodings.specific;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
import java.nio.charset.Charset;
-import org.jcodings.specific.EUCJPEncoding;
+import org.jcodings.IntHolder;
import org.junit.Test;
public class TestEUCJP {
@@ -24,4 +25,21 @@ public class TestEUCJP {
"EUC-JP",
EUCJPEncoding.INSTANCE.getCharsetName());
}
+
+ @Test
+ public void testCaseFold() {
+ EUCJPEncoding enc = EUCJPEncoding.INSTANCE;
+ byte [] lowerSrc = new byte[]{(byte)0xA3, (byte)0xE1};
+ byte [] upperSrc = new byte[]{(byte)0xA3, (byte)0xC1};
+ byte [] lower = new byte[2];
+ IntHolder pp = new IntHolder();
+
+ pp.value = 0;
+ enc.mbcCaseFold(0, lowerSrc, pp, 2, lower);
+ assertArrayEquals(lowerSrc, lower);
+
+ pp.value = 0;
+ enc.mbcCaseFold(0, upperSrc, pp, 2, lower);
+ assertArrayEquals(lowerSrc, lower);
+ }
}
=====================================
test/org/jcodings/specific/TestSJIS.java
=====================================
@@ -0,0 +1,26 @@
+package org.jcodings.specific;
+
+import static org.junit.Assert.assertArrayEquals;
+
+import org.jcodings.IntHolder;
+import org.junit.Test;
+
+public class TestSJIS {
+
+ @Test
+ public void testCaseFold() {
+ SJISEncoding enc = SJISEncoding.INSTANCE;
+ byte [] lowerSrc = new byte[]{(byte)0x82, (byte)0x81};
+ byte [] upperSrc = new byte[]{(byte)0x82, (byte)0x60};
+ byte [] lower = new byte[2];
+ IntHolder pp = new IntHolder();
+
+ pp.value = 0;
+ enc.mbcCaseFold(0, lowerSrc, pp, 2, lower);
+ assertArrayEquals(lowerSrc, lower);
+
+ pp.value = 0;
+ enc.mbcCaseFold(0, upperSrc, pp, 2, lower);
+ assertArrayEquals(lowerSrc, lower);
+ }
+}
\ No newline at end of file
View it on GitLab: https://salsa.debian.org/java-team/jcodings/-/compare/10a7f453230846e38530f32e9c742bff908e8299...e69a7ac4c2b4b0f10b81eb8a72f899b9518c77f8
--
View it on GitLab: https://salsa.debian.org/java-team/jcodings/-/compare/10a7f453230846e38530f32e9c742bff908e8299...e69a7ac4c2b4b0f10b81eb8a72f899b9518c77f8
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/20200604/754b8b6d/attachment.html>
More information about the pkg-java-commits
mailing list