diff options
| author | Bill Wohler | 2013-02-18 10:11:43 -0800 |
|---|---|---|
| committer | Bill Wohler | 2013-02-18 10:11:43 -0800 |
| commit | 21733e4f154f8830fa568a347a0d6dbd59793c2b (patch) | |
| tree | 3170dbbcdfafeb42f6c381d6b80b251e9f31b788 /src/xml.c | |
| parent | 6d14beddb06b5ae86f9dd770a1661ebd24846f28 (diff) | |
| parent | 587feed443522f738b65b57b22a31cc8a25525c5 (diff) | |
| download | emacs-21733e4f154f8830fa568a347a0d6dbd59793c2b.tar.gz emacs-21733e4f154f8830fa568a347a0d6dbd59793c2b.zip | |
Merge from trunk; up to 2013-02-18T01:30:27Z!monnier@iro.umontreal.ca.
Diffstat (limited to 'src/xml.c')
| -rw-r--r-- | src/xml.c | 21 |
1 files changed, 10 insertions, 11 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Interface to libxml2. | 1 | /* Interface to libxml2. |
| 2 | Copyright (C) 2010-2012 Free Software Foundation, Inc. | 2 | Copyright (C) 2010-2013 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -93,7 +93,7 @@ init_libxml2_functions (void) | |||
| 93 | 93 | ||
| 94 | if (!(library = w32_delayed_load (Qlibxml2_dll))) | 94 | if (!(library = w32_delayed_load (Qlibxml2_dll))) |
| 95 | { | 95 | { |
| 96 | message ("%s", "libxml2 library not found"); | 96 | message1 ("libxml2 library not found"); |
| 97 | return 0; | 97 | return 0; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| @@ -180,8 +180,7 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html | |||
| 180 | xmlDoc *doc; | 180 | xmlDoc *doc; |
| 181 | Lisp_Object result = Qnil; | 181 | Lisp_Object result = Qnil; |
| 182 | const char *burl = ""; | 182 | const char *burl = ""; |
| 183 | ptrdiff_t bytes; | 183 | ptrdiff_t istart, iend, istart_byte, iend_byte; |
| 184 | ptrdiff_t istart, iend; | ||
| 185 | 184 | ||
| 186 | fn_xmlCheckVersion (LIBXML_VERSION); | 185 | fn_xmlCheckVersion (LIBXML_VERSION); |
| 187 | 186 | ||
| @@ -189,9 +188,11 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html | |||
| 189 | 188 | ||
| 190 | istart = XINT (start); | 189 | istart = XINT (start); |
| 191 | iend = XINT (end); | 190 | iend = XINT (end); |
| 191 | istart_byte = CHAR_TO_BYTE (istart); | ||
| 192 | iend_byte = CHAR_TO_BYTE (iend); | ||
| 192 | 193 | ||
| 193 | if (istart < GPT && GPT < iend) | 194 | if (istart < GPT && GPT < iend) |
| 194 | move_gap (iend); | 195 | move_gap_both (iend, iend_byte); |
| 195 | 196 | ||
| 196 | if (! NILP (base_url)) | 197 | if (! NILP (base_url)) |
| 197 | { | 198 | { |
| @@ -199,17 +200,15 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html | |||
| 199 | burl = SSDATA (base_url); | 200 | burl = SSDATA (base_url); |
| 200 | } | 201 | } |
| 201 | 202 | ||
| 202 | bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart); | ||
| 203 | |||
| 204 | if (htmlp) | 203 | if (htmlp) |
| 205 | doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), | 204 | doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte), |
| 206 | bytes, burl, "utf-8", | 205 | iend_byte - istart_byte, burl, "utf-8", |
| 207 | HTML_PARSE_RECOVER|HTML_PARSE_NONET| | 206 | HTML_PARSE_RECOVER|HTML_PARSE_NONET| |
| 208 | HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR| | 207 | HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR| |
| 209 | HTML_PARSE_NOBLANKS); | 208 | HTML_PARSE_NOBLANKS); |
| 210 | else | 209 | else |
| 211 | doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)), | 210 | doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (istart_byte), |
| 212 | bytes, burl, "utf-8", | 211 | iend_byte - istart_byte, burl, "utf-8", |
| 213 | XML_PARSE_NONET|XML_PARSE_NOWARNING| | 212 | XML_PARSE_NONET|XML_PARSE_NOWARNING| |
| 214 | XML_PARSE_NOBLANKS |XML_PARSE_NOERROR); | 213 | XML_PARSE_NOBLANKS |XML_PARSE_NOERROR); |
| 215 | 214 | ||