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
Main
Synchronet
Compare Revisions
16571d5b91ad7167faf522993e559594777424e0...5ac964ab6818ebbc4f1295e249028b070495f03a
Commits (1)
Cleanup bad merge (WTF?)
· 5ac964ab
Deucе
authored
Feb 10, 2022
5ac964ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
50 deletions
+0
-50
src/encode/utf8.c
src/encode/utf8.c
+0
-50
No files found.
src/encode/utf8.c
View file @
5ac964ab
...
...
@@ -334,56 +334,6 @@ int utf8_to_latin1_str(const char *src, char *dest, size_t maxlen, unsigned char
return
retval
;
}
// From openssl/crypto/asn1/a_utf8.c:
/*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
/* UTF8 utilities */
/*-
* This parses a UTF8 string one codepoint at a time. It is passed a pointer
* to the string and the size of the string (in bytes). It sets 'value' to
* the value of the current codepoint. It returns the number of bytes read
* or a negative error code:
* -1 = string too short
* -2 = illegal character
* -3 = subsequent characters not of the form 10xxxxxx
* -4 = character encoded incorrectly (not minimal length).
*/
int
utf8_getc
(
const
char
*
str
,
size_t
len
,
enum
unicode_codepoint
*
val
)
{
const
unsigned
char
*
p
;
unsigned
long
value
;
int
ret
;
if
(
len
<=
0
)
return
0
;
p
=
(
const
unsigned
char
*
)
str
;
/* Check syntax and work out the encoded value (if correct) */
if
((
*
p
&
0x80
)
==
0
)
{
value
=
*
p
++
&
0x7f
;
ret
=
1
;
}
else
if
((
*
p
&
0xe0
)
==
0xc0
)
{
if
(
len
<
2
)
return
-
1
;
if
((
p
[
1
]
&
0xc0
)
!=
0x80
)
return
-
3
;
value
=
(
*
p
++
&
0x1f
)
<<
6
;
value
|=
*
p
++
&
0x3f
;
if
(
value
<
0x80
)
return
-
4
;
ret
=
2
;
}
else
if
((
*
p
&
0xf0
)
==
0xe0
)
{
if
(
len
<
3
)
return
-
1
;
#define is_unicode_surrogate(value) \
(value >= UNICODE_BLOCK_SURROGATE_BEGIN && value <= UNICODE_BLOCK_SURROGATE_END)
...
...