Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
3139b927
Commit
3139b927
authored
Oct 04, 2002
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Oct 04, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a prototype code page test. Fixed issue regarding negative
source length handling.
parent
a5e995ae
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
2 deletions
+51
-2
.cvsignore
dlls/kernel/tests/.cvsignore
+1
-0
Makefile.in
dlls/kernel/tests/Makefile.in
+1
-0
codepage.c
dlls/kernel/tests/codepage.c
+47
-0
codepage.c
memory/codepage.c
+2
-2
No files found.
dlls/kernel/tests/.cvsignore
View file @
3139b927
Makefile
alloc.ok
atom.ok
codepage.ok
directory.ok
drive.ok
environ.ok
...
...
dlls/kernel/tests/Makefile.in
View file @
3139b927
...
...
@@ -8,6 +8,7 @@ IMPORTS = kernel32
CTESTS
=
\
alloc.c
\
atom.c
\
codepage.c
\
directory.c
\
drive.c
\
environ.c
\
...
...
dlls/kernel/tests/codepage.c
0 → 100644
View file @
3139b927
/*
* Unit tests for code page to/from unicode translations
*
* Copyright (c) 2002 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "wine/test.h"
#include "winbase.h"
#include "winnls.h"
static
void
test_negative_source_length
(
void
)
{
int
len
;
char
buf
[
10
];
WCHAR
bufW
[
10
];
static
const
WCHAR
foobarW
[]
=
{
'f'
,
'o'
,
'o'
,
'b'
,
'a'
,
'r'
,
0
};
/* Test, whether any negative source length works as strlen() + 1 */
SetLastError
(
0xdeadbeef
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
foobarW
,
-
2002
,
buf
,
10
,
NULL
,
NULL
);
ok
(
len
==
7
&&
!
lstrcmpA
(
buf
,
"foobar"
)
&&
GetLastError
()
==
0xdeadbeef
,
"any negative value should work as strlen() + 1"
);
SetLastError
(
0xdeadbeef
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
"foobar"
,
-
2002
,
bufW
,
10
);
ok
(
len
==
7
&&
!
lstrcmpW
(
bufW
,
foobarW
)
&&
GetLastError
()
==
0xdeadbeef
,
"any negative value should work as strlen() + 1"
);
}
START_TEST
(
codepage
)
{
test_negative_source_length
();
}
memory/codepage.c
View file @
3139b927
...
...
@@ -311,7 +311,7 @@ INT WINAPI MultiByteToWideChar( UINT page, DWORD flags, LPCSTR src, INT srclen,
return
0
;
}
if
(
srclen
==
-
1
)
srclen
=
strlen
(
src
)
+
1
;
if
(
srclen
<
0
)
srclen
=
strlen
(
src
)
+
1
;
if
(
flags
&
MB_USEGLYPHCHARS
)
FIXME
(
"MB_USEGLYPHCHARS not supported
\n
"
);
...
...
@@ -386,7 +386,7 @@ INT WINAPI WideCharToMultiByte( UINT page, DWORD flags, LPCWSTR src, INT srclen,
return
0
;
}
if
(
srclen
==
-
1
)
srclen
=
strlenW
(
src
)
+
1
;
if
(
srclen
<
0
)
srclen
=
strlenW
(
src
)
+
1
;
switch
(
page
)
{
...
...
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