private static int strLengthFromRubyStringFull(CodeRangeable string, ByteList bytes, Encoding enc) { if (string.isCodeRangeValid() && enc.isUTF8()) return utf8Length(bytes); long lencr = strLengthWithCodeRange(bytes, enc); int cr = unpackArg(lencr); if (cr != 0) string.setCodeRange(cr); return unpackResult(lencr); }
private static int strLengthFromRubyStringFull(CodeRangeable string, ByteList bytes, Encoding enc) { if (string.isCodeRangeValid() && enc.isUTF8()) return utf8Length(bytes); long lencr = strLengthWithCodeRange(bytes, enc); int cr = unpackArg(lencr); if (cr != 0) string.setCodeRange(cr); return unpackResult(lencr); }
strBufCat(runtime, str, ptrBytes, ptr, len); str.getByteList().setEncoding(ptrEnc); str.setCodeRange(ptr_cr); return ptr_cr; str.setCodeRange(res_cr);
strBufCat(runtime, str, ptrBytes, ptr, len); str.getByteList().setEncoding(ptrEnc); str.setCodeRange(ptr_cr); return ptr_cr; str.setCodeRange(res_cr);
public static void replaceInternal19(int beg, int len, CodeRangeable source, CodeRangeable repl) { Encoding enc = source.checkEncoding(repl); source.modify(); source.keepCodeRange(); ByteList sourceBL = source.getByteList(); byte[] sourceBytes = sourceBL.unsafeBytes(); int sourceBeg = sourceBL.begin(); int sourceEnd = sourceBeg + sourceBL.realSize(); boolean singlebyte = isSingleByteOptimizable(source, source.getByteList().getEncoding()); int p = nth(enc, sourceBytes, sourceBeg, sourceEnd, beg, singlebyte); if (p == -1) p = sourceEnd; int e = nth(enc, sourceBytes, p, sourceEnd, len, singlebyte); if (e == -1) e = sourceEnd; /* error check */ beg = p - sourceBeg; /* physical position */ len = e - p; /* physical length */ replaceInternal(beg, len, source, repl); associateEncoding(source, enc); int cr = CodeRangeSupport.codeRangeAnd(source.getCodeRange(), repl.getCodeRange()); if (cr != CR_BROKEN) source.setCodeRange(cr); }
public static void replaceInternal19(int beg, int len, CodeRangeable source, CodeRangeable repl) { Encoding enc = source.checkEncoding(repl); source.modify(); source.keepCodeRange(); ByteList sourceBL = source.getByteList(); byte[] sourceBytes = sourceBL.unsafeBytes(); int sourceBeg = sourceBL.begin(); int sourceEnd = sourceBeg + sourceBL.realSize(); boolean singlebyte = isSingleByteOptimizable(source, source.getByteList().getEncoding()); int p = nth(enc, sourceBytes, sourceBeg, sourceEnd, beg, singlebyte); if (p == -1) p = sourceEnd; int e = nth(enc, sourceBytes, p, sourceEnd, len, singlebyte); if (e == -1) e = sourceEnd; /* error check */ beg = p - sourceBeg; /* physical position */ len = e - p; /* physical length */ replaceInternal(beg, len, source, repl); associateEncoding(source, enc); int cr = CodeRangeSupport.codeRangeAnd(source.getCodeRange(), repl.getCodeRange()); if (cr != CR_BROKEN) source.setCodeRange(cr); }
rubyString.setCodeRange(cr);
rubyString.setCodeRange(cr);
if (cr != CR_BROKEN) self.setCodeRange(cr); StringSupport.associateEncoding(self, enc); return self;
if (cr != CR_BROKEN) self.setCodeRange(cr); StringSupport.associateEncoding(self, enc); return self;