Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YGOPRO-520DIY
ygopro
Commits
2b868086
Commit
2b868086
authored
May 02, 2024
by
salix5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EncodeUTF8: use unsigned operand
parent
c4e24293
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
22 deletions
+19
-22
gframe/bufferio.h
gframe/bufferio.h
+19
-22
No files found.
gframe/bufferio.h
View file @
2b868086
...
...
@@ -61,34 +61,31 @@ public:
static
int
EncodeUTF8
(
const
wchar_t
*
wsrc
,
char
*
str
)
{
char
*
pstr
=
str
;
while
(
*
wsrc
!=
0
)
{
if
(
*
wsrc
<
0x80
)
{
*
str
=
(
char
)
*
wsrc
;
unsigned
cur
=
*
wsrc
;
if
(
cur
<
0x80
)
{
*
str
=
(
char
)
cur
;
++
str
;
}
else
if
(
*
wsrc
<
0x800
)
{
str
[
0
]
=
((
*
wsrc
>>
6
)
&
0x1f
)
|
0xc0
;
str
[
1
]
=
(
(
*
wsrc
)
&
0x3f
)
|
0x80
;
}
else
if
(
cur
<
0x800
)
{
str
[
0
]
=
((
cur
>>
6
)
&
0x1f
)
|
0xc0
;
str
[
1
]
=
(
cur
&
0x3f
)
|
0x80
;
str
+=
2
;
}
else
if
(
*
wsrc
<
0x10000
&&
(
*
wsrc
<
0xd800
||
*
wsrc
>
0xdfff
))
{
str
[
0
]
=
((
*
wsrc
>>
12
)
&
0xf
)
|
0xe0
;
str
[
1
]
=
((
*
wsrc
>>
6
)
&
0x3f
)
|
0x80
;
str
[
2
]
=
(
(
*
wsrc
)
&
0x3f
)
|
0x80
;
}
else
if
(
cur
<
0x10000
&&
(
cur
<
0xd800
||
cur
>
0xdfff
))
{
str
[
0
]
=
((
cur
>>
12
)
&
0xf
)
|
0xe0
;
str
[
1
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
str
[
2
]
=
(
cur
&
0x3f
)
|
0x80
;
str
+=
3
;
}
else
{
if
(
sizeof
(
wchar_t
)
==
2
)
{
unsigned
unicode
=
0
;
unicode
|=
(
*
wsrc
++
&
0x3ff
)
<<
10
;
unicode
|=
*
wsrc
&
0x3ff
;
unicode
+=
0x10000
;
str
[
0
]
=
((
unicode
>>
18
)
&
0x7
)
|
0xf0
;
str
[
1
]
=
((
unicode
>>
12
)
&
0x3f
)
|
0x80
;
str
[
2
]
=
((
unicode
>>
6
)
&
0x3f
)
|
0x80
;
str
[
3
]
=
((
unicode
)
&
0x3f
)
|
0x80
;
}
else
{
str
[
0
]
=
((
*
wsrc
>>
18
)
&
0x7
)
|
0xf0
;
str
[
1
]
=
((
*
wsrc
>>
12
)
&
0x3f
)
|
0x80
;
str
[
2
]
=
((
*
wsrc
>>
6
)
&
0x3f
)
|
0x80
;
str
[
3
]
=
((
*
wsrc
)
&
0x3f
)
|
0x80
;
cur
=
0
;
cur
|=
((
unsigned
)
*
wsrc
&
0x3ff
)
<<
10
;
++
wsrc
;
cur
|=
(
unsigned
)
*
wsrc
&
0x3ff
;
cur
+=
0x10000
;
}
str
[
0
]
=
((
cur
>>
18
)
&
0x7
)
|
0xf0
;
str
[
1
]
=
((
cur
>>
12
)
&
0x3f
)
|
0x80
;
str
[
2
]
=
((
cur
>>
6
)
&
0x3f
)
|
0x80
;
str
[
3
]
=
(
cur
&
0x3f
)
|
0x80
;
str
+=
4
;
}
wsrc
++
;
...
...
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