소스 검색

Tighten string buffer size calculation in enc_string.

When "\u"-escaping a Unicode character, the esc_extra value doesn't
need to include the number of bytes in the input string.  That is, if
a three-byte UTF-8 character is being escaped to a six-byte "\uXXXX"
sequence, esc_extra only needs to be increased by 3.
pull/156/head
David Hull 7 년 전
부모
커밋
0e721a7e5e
1개의 변경된 파일1개의 추가작업 그리고 4개의 파일을 삭제
  1. +1
    -4
      c_src/encoder.c

+ 1
- 4
c_src/encoder.c 파일 보기

@ -307,10 +307,7 @@ enc_string(Encoder* e, ERL_NIF_TERM val)
if(uval < 0) {
return 0;
}
esc_extra += utf8_esc_len(uval);
if(ulen < 0) {
return 0;
}
esc_extra += utf8_esc_len(uval) - ulen;
}
i += ulen;
}

불러오는 중...
취소
저장