Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 802927c330d8
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 911c6c05e088
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Mar 23, 2015

  1. Copy the full SHA
    78589a9 View commit details
  2. Use MBCLEN "macro" here.

    headius committed Mar 23, 2015
    Copy the full SHA
    911c6c0 View commit details
Showing with 13 additions and 2 deletions.
  1. +13 −2 core/src/main/java/org/jruby/RubyRegexp.java
15 changes: 13 additions & 2 deletions core/src/main/java/org/jruby/RubyRegexp.java
Original file line number Diff line number Diff line change
@@ -574,7 +574,7 @@ private static int unescapeEscapedNonAscii(Ruby runtime, ByteList to, byte[]byte
int chLen = 0;

p = readEscapedByte(runtime, chBuf, chLen++, bytes, p, end, str, mode);
while (chLen < enc.maxLength() && StringSupport.preciseLength(enc, chBuf, 0, chLen) < -1) { // MBCLEN_NEEDMORE_P
while (chLen < enc.maxLength() && StringSupport.MBCLEN_NEEDMORE_P(StringSupport.preciseLength(enc, chBuf, 0, chLen))) {
p = readEscapedByte(runtime, chBuf, chLen++, bytes, p, end, str, mode);
}

@@ -706,6 +706,7 @@ private static int unescapeUnicodeBmp(Ruby runtime, ByteList to, byte[] bytes, i
*/
private static boolean unescapeNonAscii(Ruby runtime, ByteList to, byte[]bytes, int p, int end, Encoding enc, Encoding[]encp, ByteList str, ErrorMode mode) {
boolean hasProperty = false;
byte[] buf = null;

while (p < end) {
int cl = StringSupport.preciseLength(enc, bytes, p, end);
@@ -738,7 +739,17 @@ private static boolean unescapeNonAscii(Ruby runtime, ByteList to, byte[]bytes,
case 'c': /* \cX, \c\M-X */
case 'C': /* \C-X, \C-\M-X */
case 'M': /* \M-X, \M-\C-X, \M-\cX */
p = unescapeEscapedNonAscii(runtime, to, bytes, p - 2, end, enc, encp, str, mode);
p -= 2;
if (enc == USASCIIEncoding.INSTANCE) {
if (buf == null) buf = new byte[1];
p = readEscapedByte(runtime, buf, 0, bytes, p, end, str, mode);
c = buf[0];
if (c == (char)-1) return false;
if (to != null) to.append(c);
}
else {
p = unescapeEscapedNonAscii(runtime, to, bytes, p, end, enc, encp, str, mode);
}
break;

case 'u':