Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
12bcae05
Commit
12bcae05
authored
Jul 13, 2001
by
Gerd Moellmann
Browse files
(char_to_string_1): Extracted from char_to_string.
Return -1 instead of signaling an error. (char_to_string): Use it.
parent
ea9dd091
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
8 deletions
+29
-8
src/charset.c
src/charset.c
+29
-8
No files found.
src/charset.c
View file @
12bcae05
/* Basic multilingual character support.
Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN.
Licensed to the Free Software Foundation.
Copyright (C) 2001 Free Software Foundation, Inc.
This file is part of GNU Emacs.
...
...
@@ -160,13 +161,10 @@ invalid_character (c)
/* Store multi-byte form of the character C in STR. The caller should
allocate at least 4-byte area at STR in advance. Returns the
length of the multi-byte form. If C is an invalid character code,
signal an error.
Use macro `CHAR_STRING (C, STR)' instead of calling this function
directly if C can be an ASCII character. */
return -1. */
int
char_to_string
(
c
,
str
)
char_to_string
_1
(
c
,
str
)
int
c
;
unsigned
char
*
str
;
{
...
...
@@ -176,7 +174,7 @@ char_to_string (c, str)
{
/* Multibyte character can't have a modifier bit. */
if
(
!
SINGLE_BYTE_CHAR_P
((
c
&
~
CHAR_MODIFIER_MASK
)))
invalid_character
(
c
)
;
return
-
1
;
/* For Meta, Shift, and Control modifiers, we need special care. */
if
(
c
&
CHAR_META
)
...
...
@@ -211,6 +209,7 @@ char_to_string (c, str)
/* If C still has any modifier bits, just ignore it. */
c
&=
~
CHAR_MODIFIER_MASK
;
}
if
(
SINGLE_BYTE_CHAR_P
(
c
))
{
if
(
ASCII_BYTE_P
(
c
)
||
c
>=
0xA0
)
...
...
@@ -237,7 +236,7 @@ char_to_string (c, str)
:
LEADING_CODE_PRIVATE_22
)));
*
p
++
=
charset
;
if
(
c1
>
0
&&
c1
<
32
||
c2
>
0
&&
c2
<
32
)
invalid_character
(
c
)
;
return
-
1
;
if
(
c1
)
{
*
p
++
=
c1
|
0x80
;
...
...
@@ -246,11 +245,33 @@ char_to_string (c, str)
}
}
else
invalid_character
(
c
)
;
return
-
1
;
return
(
p
-
str
);
}
/* Store multi-byte form of the character C in STR. The caller should
allocate at least 4-byte area at STR in advance. Returns the
length of the multi-byte form. If C is an invalid character code,
signal an error.
Use macro `CHAR_STRING (C, STR)' instead of calling this function
directly if C can be an ASCII character. */
int
char_to_string
(
c
,
str
)
int
c
;
unsigned
char
*
str
;
{
int
len
;
len
=
char_to_string_1
(
c
,
str
);
if
(
len
==
-
1
)
invalid_character
(
c
);
return
len
;
}
/* Return the non-ASCII character corresponding to multi-byte form at
STR of length LEN. If ACTUAL_LEN is not NULL, store the byte
length of the multibyte form in *ACTUAL_LEN.
...
...
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