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
7b7cd31f
Commit
7b7cd31f
authored
Jul 03, 2008
by
Jon Griffiths
Committed by
Alexandre Julliard
Jul 09, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Make tests for [w]makepath pass.
parent
afb35932
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
59 deletions
+48
-59
dir.c
dlls/msvcrt/dir.c
+36
-37
dir.c
dlls/msvcrt/tests/dir.c
+12
-22
No files found.
dlls/msvcrt/dir.c
View file @
7b7cd31f
...
...
@@ -865,28 +865,29 @@ VOID CDECL _makepath(char * path, const char * drive,
{
*
p
++
=
drive
[
0
];
*
p
++
=
':'
;
*
p
=
0
;
}
if
(
directory
&&
directory
[
0
])
{
strcpy
(
p
,
directory
);
p
+=
strlen
(
directory
)
-
1
;
if
(
*
p
!=
'/'
&&
*
p
!=
'\\'
)
{
strcat
(
p
,
"
\\
"
);
p
++
;
}
p
++
;
unsigned
int
len
=
strlen
(
directory
);
memmove
(
p
,
directory
,
len
);
p
+=
len
;
if
(
p
[
-
1
]
!=
'/'
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
}
if
(
filename
&&
filename
[
0
])
{
strcpy
(
p
,
filename
);
if
(
extension
&&
extension
[
0
])
{
if
(
extension
[
0
]
!=
'.'
)
strcat
(
p
,
"."
);
strcat
(
p
,
extension
);
}
unsigned
int
len
=
strlen
(
filename
);
memmove
(
p
,
filename
,
len
);
p
+=
len
;
}
if
(
extension
&&
extension
[
0
])
{
if
(
extension
[
0
]
!=
'.'
)
*
p
++
=
'.'
;
strcpy
(
p
,
extension
);
}
else
*
p
=
'\0'
;
TRACE
(
"returning %s
\n
"
,
path
);
}
...
...
@@ -898,43 +899,41 @@ VOID CDECL _makepath(char * path, const char * drive,
VOID
CDECL
_wmakepath
(
MSVCRT_wchar_t
*
path
,
const
MSVCRT_wchar_t
*
drive
,
const
MSVCRT_wchar_t
*
directory
,
const
MSVCRT_wchar_t
*
filename
,
const
MSVCRT_wchar_t
*
extension
)
{
MSVCRT_wchar_t
ch
;
MSVCRT_wchar_t
*
p
=
path
;
TRACE
(
"%s %s %s %s
\n
"
,
debugstr_w
(
drive
),
debugstr_w
(
directory
),
debugstr_w
(
filename
),
debugstr_w
(
extension
));
if
(
!
path
)
return
;
path
[
0
]
=
0
;
if
(
drive
&&
drive
[
0
])
{
path
[
0
]
=
drive
[
0
];
path
[
1
]
=
':'
;
path
[
2
]
=
0
;
*
p
++
=
drive
[
0
];
*
p
++
=
':'
;
}
if
(
directory
&&
directory
[
0
])
{
strcatW
(
path
,
directory
);
ch
=
path
[
strlenW
(
path
)
-
1
];
if
(
ch
!=
'/'
&&
ch
!=
'\\'
)
{
static
const
MSVCRT_wchar_t
backslashW
[]
=
{
'\\'
,
0
};
strcatW
(
path
,
backslashW
);
}
unsigned
int
len
=
strlenW
(
directory
);
memmove
(
p
,
directory
,
len
*
sizeof
(
MSVCRT_wchar_t
));
p
+=
len
;
if
(
p
[
-
1
]
!=
'/'
&&
p
[
-
1
]
!=
'\\'
)
*
p
++
=
'\\'
;
}
if
(
filename
&&
filename
[
0
])
{
strcatW
(
path
,
filename
);
if
(
extension
&&
extension
[
0
])
{
if
(
extension
[
0
]
!=
'.'
)
{
static
const
MSVCRT_wchar_t
dotW
[]
=
{
'.'
,
0
};
strcatW
(
path
,
dotW
);
}
strcatW
(
path
,
extension
);
}
unsigned
int
len
=
strlenW
(
filename
);
memmove
(
p
,
filename
,
len
*
sizeof
(
MSVCRT_wchar_t
));
p
+=
len
;
}
if
(
extension
&&
extension
[
0
])
{
if
(
extension
[
0
]
!=
'.'
)
*
p
++
=
'.'
;
strcpyW
(
p
,
extension
);
}
else
*
p
=
'\0'
;
TRACE
(
"returning %s
\n
"
,
debugstr_w
(
path
));
}
...
...
dlls/msvcrt/tests/dir.c
View file @
7b7cd31f
...
...
@@ -39,14 +39,12 @@ typedef struct
const
char
*
file
;
const
char
*
ext
;
const
char
*
expected
;
BOOL
todoA
;
BOOL
todoW
;
}
makepath_case
;
#define USE_BUFF ((char*)~0ul)
static
const
makepath_case
makepath_cases
[]
=
{
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
""
,
TRUE
},
/* 0 */
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
""
},
/* 0 */
{
NULL
,
"c"
,
NULL
,
NULL
,
NULL
,
"c:"
},
{
NULL
,
"c:"
,
NULL
,
NULL
,
NULL
,
"c:"
},
{
NULL
,
"c:
\\
"
,
NULL
,
NULL
,
NULL
,
"c:"
},
...
...
@@ -56,15 +54,15 @@ static const makepath_case makepath_cases[] =
{
NULL
,
NULL
,
NULL
,
"file"
,
NULL
,
"file"
},
{
NULL
,
NULL
,
NULL
,
"
\\
file"
,
NULL
,
"
\\
file"
},
{
NULL
,
NULL
,
NULL
,
"file"
,
NULL
,
"file"
},
{
NULL
,
NULL
,
NULL
,
NULL
,
"ext"
,
".ext"
,
TRUE
,
TRUE
},
/* 10 */
{
NULL
,
NULL
,
NULL
,
NULL
,
".ext"
,
".ext"
,
TRUE
,
TRUE
},
{
"foo"
,
NULL
,
NULL
,
NULL
,
NULL
,
""
,
TRUE
},
{
"foo"
,
USE_BUFF
,
NULL
,
NULL
,
NULL
,
"f:"
,
FALSE
,
TRUE
},
{
"foo"
,
NULL
,
USE_BUFF
,
NULL
,
NULL
,
"foo
\\
"
,
FALSE
,
TRUE
},
{
"foo"
,
NULL
,
NULL
,
USE_BUFF
,
NULL
,
"foo"
,
FALSE
,
TRUE
},
{
"foo"
,
NULL
,
USE_BUFF
,
"file"
,
NULL
,
"foo
\\
file"
,
FALSE
,
TRUE
},
{
"foo"
,
NULL
,
USE_BUFF
,
"file"
,
"ext"
,
"foo
\\
file.ext"
,
FALSE
,
TRUE
},
{
"foo"
,
NULL
,
NULL
,
USE_BUFF
,
"ext"
,
"foo.ext"
,
FALSE
,
TRUE
},
{
NULL
,
NULL
,
NULL
,
NULL
,
"ext"
,
".ext"
},
/* 10 */
{
NULL
,
NULL
,
NULL
,
NULL
,
".ext"
,
".ext"
},
{
"foo"
,
NULL
,
NULL
,
NULL
,
NULL
,
""
},
{
"foo"
,
USE_BUFF
,
NULL
,
NULL
,
NULL
,
"f:"
},
{
"foo"
,
NULL
,
USE_BUFF
,
NULL
,
NULL
,
"foo
\\
"
},
{
"foo"
,
NULL
,
NULL
,
USE_BUFF
,
NULL
,
"foo"
},
{
"foo"
,
NULL
,
USE_BUFF
,
"file"
,
NULL
,
"foo
\\
file"
},
{
"foo"
,
NULL
,
USE_BUFF
,
"file"
,
"ext"
,
"foo
\\
file.ext"
},
{
"foo"
,
NULL
,
NULL
,
USE_BUFF
,
"ext"
,
"foo.ext"
},
/* remaining combinations of USE_BUFF crash native */
{
NULL
,
"c"
,
"dir"
,
"file"
,
"ext"
,
"c:dir
\\
file.ext"
},
{
NULL
,
"c:"
,
"dir"
,
"file"
,
"ext"
,
"c:dir
\\
file.ext"
},
/* 20 */
...
...
@@ -98,11 +96,7 @@ static void test_makepath(void)
p
->
ext
==
USE_BUFF
?
buffer
:
p
->
ext
);
buffer
[
MAX_PATH
-
1
]
=
'\0'
;
if
(
p
->
todoA
)
todo_wine
{
ok
(
!
strcmp
(
p
->
expected
,
buffer
),
"got '%s' for case %d
\n
"
,
buffer
,
i
);
}
else
ok
(
!
strcmp
(
p
->
expected
,
buffer
),
"got '%s' for case %d
\n
"
,
buffer
,
i
);
ok
(
!
strcmp
(
p
->
expected
,
buffer
),
"got '%s' for case %d
\n
"
,
buffer
,
i
);
/* Unicode */
if
(
p
->
drive
!=
USE_BUFF
)
MultiByteToWideChar
(
CP_ACP
,
0
,
p
->
drive
,
-
1
,
driveW
,
MAX_PATH
);
...
...
@@ -123,11 +117,7 @@ static void test_makepath(void)
bufferW
[
MAX_PATH
-
1
]
=
'\0'
;
WideCharToMultiByte
(
CP_ACP
,
0
,
bufferW
,
-
1
,
buffer
,
MAX_PATH
,
NULL
,
NULL
);
if
(
p
->
todoW
)
todo_wine
{
ok
(
!
strcmp
(
p
->
expected
,
buffer
),
"got '%s' for unicode case %d
\n
"
,
buffer
,
i
);
}
else
ok
(
!
strcmp
(
p
->
expected
,
buffer
),
"got '%s' for unicode case %d
\n
"
,
buffer
,
i
);
ok
(
!
strcmp
(
p
->
expected
,
buffer
),
"got '%s' for unicode case %d
\n
"
,
buffer
,
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