Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
52f81c12
Commit
52f81c12
authored
Jul 10, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmc: Add support for utf-8 codepage.
parent
2bfdff19
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
9 deletions
+19
-9
mcl.c
tools/wmc/mcl.c
+4
-2
mcy.y
tools/wmc/mcy.y
+3
-3
write.c
tools/wmc/write.c
+12
-4
No files found.
tools/wmc/mcl.c
View file @
52f81c12
...
...
@@ -155,7 +155,7 @@ void set_codepage(int cp)
{
codepage
=
cp
;
codepage_def
=
find_codepage
(
codepage
);
if
(
!
codepage_def
)
if
(
!
codepage_def
&&
codepage
!=
CP_UTF8
)
xyyerror
(
"Codepage %d not found; cannot process
\n
"
,
codepage
);
}
...
...
@@ -200,8 +200,10 @@ try_again:
xyyerror
(
err_fatalread
);
else
if
(
!
cptr
)
return
0
;
assert
(
codepage_def
!=
NULL
);
if
(
codepage_def
)
n
=
wine_cp_mbstowcs
(
codepage_def
,
0
,
xlatebuffer
,
strlen
(
xlatebuffer
)
+
1
,
inputbuffer
,
INPUTBUFFER_SIZE
);
else
n
=
wine_utf8_mbstowcs
(
0
,
xlatebuffer
,
strlen
(
xlatebuffer
)
+
1
,
inputbuffer
,
INPUTBUFFER_SIZE
);
if
(
n
<
0
)
internal_error
(
__FILE__
,
__LINE__
,
"Could not translate to unicode (%d)
\n
"
,
n
);
if
(
n
<=
1
)
...
...
tools/wmc/mcy.y
View file @
52f81c12
...
...
@@ -251,12 +251,12 @@ cmaps : cmap
;
cmap : clan '=' tNUMBER ':' tNUMBER {
static const char err_nocp[] = "Codepage %d not builtin; cannot convert";
static const char err_nocp[] = "Codepage %d not builtin; cannot convert
\n
";
if(find_cpxlat($1))
xyyerror("Codepage translation already defined for language 0x%x\n", $1);
if($3 && !find_codepage($3))
if($3 &&
$3 != CP_UTF8 &&
!find_codepage($3))
xyyerror(err_nocp, $3);
if($5 && !find_codepage($5))
if($5 &&
$5 != CP_UTF8 &&
!find_codepage($5))
xyyerror(err_nocp, $5);
add_cpxlat($1, $3, $5);
}
...
...
tools/wmc/write.c
View file @
52f81c12
...
...
@@ -100,11 +100,17 @@ static char *dup_u2c(int cp, const WCHAR *uc)
int
len
;
char
*
cptr
;
const
union
cptable
*
cpdef
=
find_codepage
(
cp
);
if
(
!
cpdef
)
internal_error
(
__FILE__
,
__LINE__
,
"Codepage %d not found (vanished?)
\n
"
,
cp
);
if
(
cpdef
)
len
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
NULL
,
0
,
NULL
,
NULL
);
else
len
=
wine_utf8_wcstombs
(
0
,
uc
,
unistrlen
(
uc
)
+
1
,
NULL
,
0
);
cptr
=
xmalloc
(
len
);
if
((
len
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
cptr
,
len
,
NULL
,
NULL
))
<
0
)
if
(
cpdef
)
len
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
cptr
,
len
,
NULL
,
NULL
);
else
len
=
wine_utf8_wcstombs
(
0
,
uc
,
unistrlen
(
uc
)
+
1
,
cptr
,
len
);
if
(
len
<
0
)
internal_error
(
__FILE__
,
__LINE__
,
"Buffer overflow? code %d
\n
"
,
len
);
return
cptr
;
}
...
...
@@ -385,8 +391,10 @@ static char *make_string(WCHAR *uc, int len, int codepage)
int
mlen
;
const
union
cptable
*
cpdef
=
find_codepage
(
codepage
);
assert
(
cpdef
!=
NULL
);
if
(
cpdef
)
mlen
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
NULL
,
0
,
NULL
,
NULL
);
else
mlen
=
wine_utf8_wcstombs
(
0
,
uc
,
unistrlen
(
uc
)
+
1
,
NULL
,
0
);
cc
=
tmp
=
xmalloc
(
mlen
);
if
((
i
=
wine_cp_wcstombs
(
cpdef
,
0
,
uc
,
unistrlen
(
uc
)
+
1
,
tmp
,
mlen
,
NULL
,
NULL
))
<
0
)
internal_error
(
__FILE__
,
__LINE__
,
"Buffer overflow? code %d
\n
"
,
i
);
...
...
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