diff options
| author | Tom Tromey <tromey@redhat.com> | 2013-01-16 11:48:32 -0700 |
|---|---|---|
| committer | Tom Tromey <tromey@redhat.com> | 2013-01-16 11:48:32 -0700 |
| commit | 6f4de085f065e11f4df3195d47479f28f5ef08ba (patch) | |
| tree | 1211a00f1afc86c2b73624897993db02a4852943 /src/xml.c | |
| parent | e078a23febca14bc919c5806670479c395e3253e (diff) | |
| parent | ffe04adc88e546c406f9b050238fb98a7243c7a0 (diff) | |
| download | emacs-6f4de085f065e11f4df3195d47479f28f5ef08ba.tar.gz | |
merge from trunk
Diffstat (limited to 'src/xml.c')
| -rw-r--r-- | src/xml.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/xml.c b/src/xml.c index 5939c58a564..5a52b0c2a1e 100644 --- a/src/xml.c +++ b/src/xml.c @@ -180,8 +180,7 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html xmlDoc *doc; Lisp_Object result = Qnil; const char *burl = ""; - ptrdiff_t bytes; - ptrdiff_t istart, iend; + ptrdiff_t istart, iend, istart_byte, iend_byte; fn_xmlCheckVersion (LIBXML_VERSION); @@ -189,9 +188,11 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html istart = XINT (start); iend = XINT (end); + istart_byte = CHAR_TO_BYTE (istart); + iend_byte = CHAR_TO_BYTE (iend); if (istart < GPT && GPT < iend) - move_gap (iend); + move_gap_both (iend, iend_byte); if (! NILP (base_url)) { @@ -199,17 +200,15 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html burl = SSDATA (base_url); } - bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart); - if (htmlp) - doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), - bytes, burl, "utf-8", + doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte), + iend_byte - istart_byte, burl, "utf-8", HTML_PARSE_RECOVER|HTML_PARSE_NONET| HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR| HTML_PARSE_NOBLANKS); else - doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), - bytes, burl, "utf-8", + doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte), + iend_byte - istart_byte, burl, "utf-8", XML_PARSE_NONET|XML_PARSE_NOWARNING| XML_PARSE_NOBLANKS |XML_PARSE_NOERROR); |
