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
9bcdb1c4
Commit
9bcdb1c4
authored
Jul 18, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Jul 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Fix handling of an empty search string in StrStrW.
parent
c43bac44
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
string.c
dlls/shlwapi/string.c
+3
-1
string.c
dlls/shlwapi/tests/string.c
+55
-0
No files found.
dlls/shlwapi/string.c
View file @
9bcdb1c4
...
...
@@ -584,7 +584,9 @@ LPSTR WINAPI StrStrA(LPCSTR lpszStr, LPCSTR lpszSearch)
*/
LPWSTR
WINAPI
StrStrW
(
LPCWSTR
lpszStr
,
LPCWSTR
lpszSearch
)
{
if
(
!
lpszStr
||
!
lpszSearch
)
return
NULL
;
TRACE
(
"(%s, %s)
\n
"
,
debugstr_w
(
lpszStr
),
debugstr_w
(
lpszSearch
));
if
(
!
lpszStr
||
!
lpszSearch
||
!*
lpszSearch
)
return
NULL
;
return
strstrW
(
lpszStr
,
lpszSearch
);
}
...
...
dlls/shlwapi/tests/string.c
View file @
9bcdb1c4
...
...
@@ -1007,6 +1007,60 @@ static void test_StrStrA(void)
}
}
static
void
test_StrStrW
(
void
)
{
static
const
WCHAR
emptyW
[]
=
{
0
};
static
const
WCHAR
deadbeefW
[]
=
{
'D'
,
'e'
,
'A'
,
'd'
,
'B'
,
'e'
,
'E'
,
'f'
,
0
};
static
const
WCHAR
deadW
[]
=
{
'D'
,
'e'
,
'A'
,
'd'
,
0
};
static
const
WCHAR
dead_lowerW
[]
=
{
'd'
,
'e'
,
'a'
,
'd'
,
0
};
static
const
WCHAR
adbeW
[]
=
{
'A'
,
'd'
,
'B'
,
'e'
,
0
};
static
const
WCHAR
adbe_lowerW
[]
=
{
'a'
,
'd'
,
'b'
,
'e'
,
0
};
static
const
WCHAR
beefW
[]
=
{
'B'
,
'e'
,
'E'
,
'f'
,
0
};
static
const
WCHAR
beef_lowerW
[]
=
{
'b'
,
'e'
,
'e'
,
'f'
,
0
};
const
struct
{
const
WCHAR
*
search
;
const
WCHAR
*
expect
;
}
StrStrW_cases
[]
=
{
{
emptyW
,
NULL
},
{
deadW
,
deadbeefW
},
{
dead_lowerW
,
NULL
},
{
adbeW
,
deadbeefW
+
2
},
{
adbe_lowerW
,
NULL
},
{
beefW
,
deadbeefW
+
4
},
{
beef_lowerW
,
NULL
},
};
LPWSTR
ret
;
int
i
;
/* Tests crash on Win9x. */
if
(
0
)
{
ret
=
StrStrW
(
NULL
,
NULL
);
ok
(
!
ret
,
"Expected StrStrW to return NULL, got %p
\n
"
,
ret
);
ret
=
StrStrW
(
NULL
,
emptyW
);
ok
(
!
ret
,
"Expected StrStrW to return NULL, got %p
\n
"
,
ret
);
ret
=
StrStrW
(
emptyW
,
NULL
);
ok
(
!
ret
,
"Expected StrStrW to return NULL, got %p
\n
"
,
ret
);
}
ret
=
StrStrW
(
emptyW
,
emptyW
);
ok
(
!
ret
,
"Expected StrStrW to return NULL, got %p
\n
"
,
ret
);
for
(
i
=
0
;
i
<
sizeof
(
StrStrW_cases
)
/
sizeof
(
StrStrW_cases
[
0
]);
i
++
)
{
ret
=
StrStrW
(
deadbeefW
,
StrStrW_cases
[
i
].
search
);
ok
(
ret
==
StrStrW_cases
[
i
].
expect
,
"[%d] Expected StrStrW to return %p, got %p
\n
"
,
i
,
StrStrW_cases
[
i
].
expect
,
ret
);
}
}
START_TEST
(
string
)
{
HMODULE
hShlwapi
;
...
...
@@ -1077,6 +1131,7 @@ START_TEST(string)
test_SHUnicodeToUnicode
();
test_StrXXX_overflows
();
test_StrStrA
();
test_StrStrW
();
CoUninitialize
();
}
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