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
a1af8395
Commit
a1af8395
authored
Mar 08, 2012
by
Carlo Bramini
Committed by
Alexandre Julliard
Mar 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Implemented StrToInt64ExA/W.
parent
3dd58d8b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
133 additions
and
10 deletions
+133
-10
shlwapi.spec
dlls/shlwapi/shlwapi.spec
+2
-0
string.c
dlls/shlwapi/string.c
+38
-4
string.c
dlls/shlwapi/tests/string.c
+93
-6
No files found.
dlls/shlwapi/shlwapi.spec
View file @
a1af8395
...
...
@@ -804,6 +804,8 @@
@ stdcall StrStrNW(wstr wstr long)
@ stdcall StrStrNIW(wstr wstr long)
@ stdcall StrStrW(wstr wstr)
@ stdcall StrToInt64ExA(str long ptr)
@ stdcall StrToInt64ExW(wstr long ptr)
@ stdcall StrToIntA(str)
@ stdcall StrToIntExA(str long ptr)
@ stdcall StrToIntExW(wstr long ptr)
...
...
dlls/shlwapi/string.c
View file @
a1af8395
...
...
@@ -91,7 +91,7 @@ static void FillNumberFmt(NUMBERFMTW *fmt, LPWSTR decimal_buffer, int decimal_bu
* Format an integer according to the current locale
*
* RETURNS
* The number of
byte
s written on success or 0 on failure
* The number of
character
s written on success or 0 on failure
*/
static
int
FormatInt
(
LONGLONG
qdwValue
,
LPWSTR
pszBuf
,
int
cchBuf
)
{
...
...
@@ -124,7 +124,7 @@ static int FormatInt(LONGLONG qdwValue, LPWSTR pszBuf, int cchBuf)
* after the decimal point
*
* RETURNS
* The number of
byte
s written on success or 0 on failure
* The number of
character
s written on success or 0 on failure
*/
static
int
FormatDouble
(
double
value
,
int
decimals
,
LPWSTR
pszBuf
,
int
cchBuf
)
{
...
...
@@ -855,8 +855,25 @@ int WINAPI StrToIntW(LPCWSTR lpszStr)
*/
BOOL
WINAPI
StrToIntExA
(
LPCSTR
lpszStr
,
DWORD
dwFlags
,
LPINT
lpiRet
)
{
LONGLONG
li
;
BOOL
bRes
;
TRACE
(
"(%s,%08X,%p)
\n
"
,
debugstr_a
(
lpszStr
),
dwFlags
,
lpiRet
);
bRes
=
StrToInt64ExA
(
lpszStr
,
dwFlags
,
&
li
);
if
(
bRes
)
*
lpiRet
=
li
;
return
bRes
;
}
/*************************************************************************
* StrToInt64ExA [SHLWAPI.@]
*
* See StrToIntExA.
*/
BOOL
WINAPI
StrToInt64ExA
(
LPCSTR
lpszStr
,
DWORD
dwFlags
,
LONGLONG
*
lpiRet
)
{
BOOL
bNegative
=
FALSE
;
int
iRet
=
0
;
LONGLONG
iRet
=
0
;
TRACE
(
"(%s,%08X,%p)
\n
"
,
debugstr_a
(
lpszStr
),
dwFlags
,
lpiRet
);
...
...
@@ -922,8 +939,25 @@ BOOL WINAPI StrToIntExA(LPCSTR lpszStr, DWORD dwFlags, LPINT lpiRet)
*/
BOOL
WINAPI
StrToIntExW
(
LPCWSTR
lpszStr
,
DWORD
dwFlags
,
LPINT
lpiRet
)
{
LONGLONG
li
;
BOOL
bRes
;
TRACE
(
"(%s,%08X,%p)
\n
"
,
debugstr_w
(
lpszStr
),
dwFlags
,
lpiRet
);
bRes
=
StrToInt64ExW
(
lpszStr
,
dwFlags
,
&
li
);
if
(
bRes
)
*
lpiRet
=
li
;
return
bRes
;
}
/*************************************************************************
* StrToInt64ExW [SHLWAPI.@]
*
* See StrToIntExA.
*/
BOOL
WINAPI
StrToInt64ExW
(
LPCWSTR
lpszStr
,
DWORD
dwFlags
,
LONGLONG
*
lpiRet
)
{
BOOL
bNegative
=
FALSE
;
int
iRet
=
0
;
LONGLONG
iRet
=
0
;
TRACE
(
"(%s,%08X,%p)
\n
"
,
debugstr_w
(
lpszStr
),
dwFlags
,
lpiRet
);
...
...
dlls/shlwapi/tests/string.c
View file @
a1af8395
...
...
@@ -65,6 +65,8 @@ static LPWSTR (WINAPI *pStrStrNIW)(LPCWSTR,LPCWSTR,UINT);
static
INT
(
WINAPIV
*
pwnsprintfA
)(
LPSTR
,
INT
,
LPCSTR
,
...);
static
INT
(
WINAPIV
*
pwnsprintfW
)(
LPWSTR
,
INT
,
LPCWSTR
,
...);
static
LPWSTR
(
WINAPI
*
pStrChrNW
)(
LPWSTR
,
WCHAR
,
UINT
);
static
BOOL
(
WINAPI
*
pStrToInt64ExA
)(
LPCSTR
,
DWORD
,
LONGLONG
*
);
static
BOOL
(
WINAPI
*
pStrToInt64ExW
)(
LPCWSTR
,
DWORD
,
LONGLONG
*
);
static
int
strcmpW
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
{
...
...
@@ -77,17 +79,19 @@ typedef struct tagStrToIntResult
{
const
char
*
string
;
int
str_to_int
;
int
str_to_int
_ex
;
int
str_to_int
_hex
;
LONGLONG
str_to_int64
_ex
;
LONGLONG
str_to_int64
_hex
;
}
StrToIntResult
;
static
const
StrToIntResult
StrToInt_results
[]
=
{
{
"1099"
,
1099
,
1099
,
1099
},
{
"4294967319"
,
23
,
((
LONGLONG
)
1
<<
32
)
|
23
,
((
LONGLONG
)
1
<<
32
)
|
23
},
{
"+88987"
,
0
,
88987
,
88987
},
{
"012"
,
12
,
12
,
12
},
{
"-55"
,
-
55
,
-
55
,
-
55
},
{
"-0"
,
0
,
0
,
0
},
{
"0x44ff"
,
0
,
0
,
0x44ff
},
{
"0x2bdc546291f4b1"
,
0
,
0
,
((
LONGLONG
)
0x2bdc54
<<
32
)
|
0x6291f4b1
},
{
"+0x44f4"
,
0
,
0
,
0x44f4
},
{
"-0x44fd"
,
0
,
0
,
0x44fd
},
{
"+ 88987"
,
0
,
0
,
0
},
...
...
@@ -480,7 +484,7 @@ static void test_StrToIntExA(void)
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int
_ex
,
"converted '%s' wrong (%d)
\n
"
,
ok
(
return_val
==
(
int
)
result
->
str_to_int64
_ex
,
"converted '%s' wrong (%d)
\n
"
,
result
->
string
,
return_val
);
result
++
;
}
...
...
@@ -493,7 +497,7 @@ static void test_StrToIntExA(void)
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int
_hex
,
"converted '%s' wrong (%d)
\n
"
,
ok
(
return_val
==
(
int
)
result
->
str_to_int64
_hex
,
"converted '%s' wrong (%d)
\n
"
,
result
->
string
,
return_val
);
result
++
;
}
...
...
@@ -514,7 +518,7 @@ static void test_StrToIntExW(void)
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int
_ex
,
"converted '%s' wrong (%d)
\n
"
,
ok
(
return_val
==
(
int
)
result
->
str_to_int64
_ex
,
"converted '%s' wrong (%d)
\n
"
,
result
->
string
,
return_val
);
result
++
;
}
...
...
@@ -528,12 +532,91 @@ static void test_StrToIntExW(void)
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int
_hex
,
"converted '%s' wrong (%d)
\n
"
,
ok
(
return_val
==
(
int
)
result
->
str_to_int64
_hex
,
"converted '%s' wrong (%d)
\n
"
,
result
->
string
,
return_val
);
result
++
;
}
}
static
void
test_StrToInt64ExA
(
void
)
{
const
StrToIntResult
*
result
=
StrToInt_results
;
LONGLONG
return_val
;
BOOL
bRet
;
if
(
!
pStrToInt64ExA
)
{
win_skip
(
"StrToInt64ExA() is not available
\n
"
);
return
;
}
while
(
result
->
string
)
{
return_val
=
-
1
;
bRet
=
pStrToInt64ExA
(
result
->
string
,
0
,
&
return_val
);
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int64_ex
,
"converted '%s' wrong (%08x%08x)
\n
"
,
result
->
string
,
(
DWORD
)(
return_val
>>
32
),
(
DWORD
)
return_val
);
result
++
;
}
result
=
StrToInt_results
;
while
(
result
->
string
)
{
return_val
=
-
1
;
bRet
=
pStrToInt64ExA
(
result
->
string
,
STIF_SUPPORT_HEX
,
&
return_val
);
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int64_hex
,
"converted '%s' wrong (%08x%08x)
\n
"
,
result
->
string
,
(
DWORD
)(
return_val
>>
32
),
(
DWORD
)
return_val
);
result
++
;
}
}
static
void
test_StrToInt64ExW
(
void
)
{
WCHAR
szBuff
[
256
];
const
StrToIntResult
*
result
=
StrToInt_results
;
LONGLONG
return_val
;
BOOL
bRet
;
if
(
!
pStrToInt64ExW
)
{
win_skip
(
"StrToInt64ExW() is not available
\n
"
);
return
;
}
while
(
result
->
string
)
{
return_val
=
-
1
;
MultiByteToWideChar
(
0
,
0
,
result
->
string
,
-
1
,
szBuff
,
sizeof
(
szBuff
)
/
sizeof
(
WCHAR
));
bRet
=
pStrToInt64ExW
(
szBuff
,
0
,
&
return_val
);
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int64_ex
,
"converted '%s' wrong (%08x%08x)
\n
"
,
result
->
string
,
(
DWORD
)(
return_val
>>
32
),
(
DWORD
)
return_val
);
result
++
;
}
result
=
StrToInt_results
;
while
(
result
->
string
)
{
return_val
=
-
1
;
MultiByteToWideChar
(
0
,
0
,
result
->
string
,
-
1
,
szBuff
,
sizeof
(
szBuff
)
/
sizeof
(
WCHAR
));
bRet
=
pStrToInt64ExW
(
szBuff
,
STIF_SUPPORT_HEX
,
&
return_val
);
ok
(
!
bRet
||
return_val
!=
-
1
,
"No result returned from '%s'
\n
"
,
result
->
string
);
if
(
bRet
)
ok
(
return_val
==
result
->
str_to_int64_hex
,
"converted '%s' wrong (%08x%08x)
\n
"
,
result
->
string
,
(
DWORD
)(
return_val
>>
32
),
(
DWORD
)
return_val
);
result
++
;
}
}
static
void
test_StrDupA
(
void
)
{
LPSTR
lpszStr
;
...
...
@@ -1422,6 +1505,8 @@ START_TEST(string)
pStrStrNIW
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"StrStrNIW"
);
pwnsprintfA
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"wnsprintfA"
);
pwnsprintfW
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"wnsprintfW"
);
pStrToInt64ExA
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"StrToInt64ExA"
);
pStrToInt64ExW
=
(
void
*
)
GetProcAddress
(
hShlwapi
,
"StrToInt64ExW"
);
test_StrChrA
();
test_StrChrW
();
...
...
@@ -1435,6 +1520,8 @@ START_TEST(string)
test_StrToIntW
();
test_StrToIntExA
();
test_StrToIntExW
();
test_StrToInt64ExA
();
test_StrToInt64ExW
();
test_StrDupA
();
/* language-dependent test */
...
...
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