Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
0f8c4c4f
Commit
0f8c4c4f
authored
Mar 01, 2002
by
Kenichi Handa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include "character.h".
(x_encode_text): Adjusted for the new code-conversion API.
parent
81b39386
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
30 deletions
+12
-30
src/xfns.c
src/xfns.c
+12
-30
No files found.
src/xfns.c
View file @
0f8c4c4f
...
...
@@ -42,6 +42,7 @@ Boston, MA 02111-1307, USA. */
#include "keyboard.h"
#include "blockinput.h"
#include <epaths.h>
#include "character.h"
#include "charset.h"
#include "coding.h"
#include "fontset.h"
...
...
@@ -2362,46 +2363,27 @@ x_encode_text (string, coding_system, selectionp, text_bytes, stringp)
int *text_bytes, *stringp;
int selectionp;
{
unsigned char *str = XSTRING (string)->data;
int chars = XSTRING (string)->size;
int bytes = STRING_BYTES (XSTRING (string));
int charset_info;
int bufsize;
unsigned char *buf;
int result = string_xstring_p (string);
struct coding_system coding;
charset_info = find_charset_in_text (str, chars, bytes, NULL, Qnil);
if (charset_info == 0)
if (result == 0)
{
/* No multibyte character in OBJ. We need not encode it. */
*text_bytes =
bytes
;
*text_bytes =
STRING_BYTES (XSTRING (string))
;
*stringp = 1;
return
str
;
return
XSTRING (string)->data
;
}
setup_coding_system (coding_system, &coding);
if (selectionp
&& SYMBOLP (coding.pre_write_conversion)
&& !NILP (Ffboundp (coding.pre_write_conversion)))
{
string = run_pre_post_conversion_on_str (string, &coding, 1);
str = XSTRING (string)->data;
chars = XSTRING (string)->size;
bytes = STRING_BYTES (XSTRING (string));
}
coding.src_multibyte = 1;
coding.dst_multibyte = 0;
coding.mode |= CODING_MODE_LAST_BLOCK;
if (coding.type == coding_type_iso2022)
coding.flags |= CODING_FLAG_ISO_SAFE;
coding.mode |= (CODING_MODE_SAFE_ENCODING | CODING_MODE_LAST_BLOCK);
/* We suppress producing escape sequences for composition. */
coding.com
posing
= CO
MPOSITION_DISABLED
;
bufsize = encoding_buffer_size (&coding, bytes);
buf = (unsigned char *) xmalloc (buf
size
);
encode_coding (&coding, str, buf, bytes, bufsize
);
coding.com
mon_flags &
=
~
CO
DING_ANNOTATION_MASK
;
encode_coding_object (&coding, string, 0, 0,
XSTRING (string)->
size
,
STRING_BYTES (XSTRING (string)), Qt
);
*text_bytes = coding.produced;
*stringp = (
charset_info
== 1 || !EQ (coding_system, Qcompound_text));
return
buf
;
*stringp = (
result
== 1 || !EQ (coding_system, Qcompound_text));
return
XSTRING (coding.dst_object)->data
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment