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
0922865b
Commit
0922865b
authored
Jun 08, 2015
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fix strtol implementation on strings not containing valid number.
parent
7a02782f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
string.c
dlls/msvcrt/string.c
+8
-2
string.c
dlls/msvcrt/tests/string.c
+8
-0
No files found.
dlls/msvcrt/string.c
View file @
0922865b
...
...
@@ -839,7 +839,9 @@ MSVCRT_size_t CDECL MSVCRT_strnlen(const char *s, MSVCRT_size_t maxlen)
*/
__int64
CDECL
MSVCRT_strtoi64_l
(
const
char
*
nptr
,
char
**
endptr
,
int
base
,
MSVCRT__locale_t
locale
)
{
const
char
*
p
=
nptr
;
BOOL
negative
=
FALSE
;
BOOL
got_digit
=
FALSE
;
__int64
ret
=
0
;
TRACE
(
"(%s %p %d %p)
\n
"
,
debugstr_a
(
nptr
),
endptr
,
base
,
locale
);
...
...
@@ -881,6 +883,7 @@ __int64 CDECL MSVCRT_strtoi64_l(const char *nptr, char **endptr, int base, MSVCR
break
;
v
=
cur
-
'a'
+
10
;
}
got_digit
=
TRUE
;
if
(
negative
)
v
=
-
v
;
...
...
@@ -898,7 +901,7 @@ __int64 CDECL MSVCRT_strtoi64_l(const char *nptr, char **endptr, int base, MSVCR
}
if
(
endptr
)
*
endptr
=
(
char
*
)
nptr
;
*
endptr
=
(
char
*
)
(
got_digit
?
nptr
:
p
)
;
return
ret
;
}
...
...
@@ -1014,7 +1017,9 @@ MSVCRT_ulong CDECL MSVCRT_strtoul(const char* nptr, char** end, int base)
*/
unsigned
__int64
CDECL
MSVCRT_strtoui64_l
(
const
char
*
nptr
,
char
**
endptr
,
int
base
,
MSVCRT__locale_t
locale
)
{
const
char
*
p
=
nptr
;
BOOL
negative
=
FALSE
;
BOOL
got_digit
=
FALSE
;
unsigned
__int64
ret
=
0
;
TRACE
(
"(%s %p %d %p)
\n
"
,
debugstr_a
(
nptr
),
endptr
,
base
,
locale
);
...
...
@@ -1056,6 +1061,7 @@ unsigned __int64 CDECL MSVCRT_strtoui64_l(const char *nptr, char **endptr, int b
break
;
v
=
cur
-
'a'
+
10
;
}
got_digit
=
TRUE
;
nptr
++
;
...
...
@@ -1067,7 +1073,7 @@ unsigned __int64 CDECL MSVCRT_strtoui64_l(const char *nptr, char **endptr, int b
}
if
(
endptr
)
*
endptr
=
(
char
*
)
nptr
;
*
endptr
=
(
char
*
)
(
got_digit
?
nptr
:
p
)
;
return
negative
?
-
ret
:
ret
;
}
...
...
dlls/msvcrt/tests/string.c
View file @
0922865b
...
...
@@ -1401,6 +1401,8 @@ static void test_strtok(void)
static
void
test_strtol
(
void
)
{
static
char
neg
[]
=
"-0x"
;
char
*
e
;
LONG
l
;
ULONG
ul
;
...
...
@@ -1457,6 +1459,12 @@ static void test_strtol(void)
ul
=
strtoul
(
"-4294967296"
,
NULL
,
0
);
ok
(
ul
==
1
,
"wrong value %u
\n
"
,
ul
);
ok
(
errno
==
ERANGE
,
"wrong errno %d
\n
"
,
errno
);
errno
=
0
;
l
=
strtol
(
neg
,
&
e
,
0
);
ok
(
l
==
0
,
"wrong value %d
\n
"
,
l
);
ok
(
errno
==
0
,
"wrong errno %d
\n
"
,
errno
);
ok
(
e
==
neg
,
"e = %p, neg = %p
\n
"
,
e
,
neg
);
}
static
void
test_strnlen
(
void
)
...
...
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