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
a449b2d5
Commit
a449b2d5
authored
Sep 25, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 25, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Call MSVCRT_strtoi64_l in strtoul implementation.
parent
c3c44544
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
29 deletions
+38
-29
string.c
dlls/msvcrt/string.c
+18
-29
string.c
dlls/msvcrt/tests/string.c
+20
-0
No files found.
dlls/msvcrt/string.c
View file @
a449b2d5
...
...
@@ -726,35 +726,6 @@ int CDECL __STRINGTOLD( MSVCRT__LDOUBLE *value, char **endptr, const char *str,
return
0
;
}
/******************************************************************
* strtoul (MSVCRT.@)
*/
MSVCRT_ulong
CDECL
MSVCRT_strtoul
(
const
char
*
nptr
,
char
**
end
,
int
base
)
{
/* wrapper to forward libc error code to msvcrt's error codes */
unsigned
long
ret
;
errno
=
0
;
ret
=
strtoul
(
nptr
,
end
,
base
);
switch
(
errno
)
{
case
ERANGE
:
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
break
;
case
EINVAL
:
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
break
;
default:
/* cope with the fact that we may use 64bit long integers on libc
* while msvcrt always uses 32bit long integers
*/
if
(
ret
>
MSVCRT_ULONG_MAX
)
{
ret
=
MSVCRT_ULONG_MAX
;
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
}
break
;
}
return
ret
;
}
/*********************************************************************
* strlen (MSVCRT.@)
*/
...
...
@@ -918,6 +889,24 @@ MSVCRT_long CDECL MSVCRT_strtol(const char* nptr, char** end, int base)
return
ret
;
}
/******************************************************************
* strtoul (MSVCRT.@)
*/
MSVCRT_ulong
CDECL
MSVCRT_strtoul
(
const
char
*
nptr
,
char
**
end
,
int
base
)
{
__int64
ret
=
MSVCRT_strtoi64_l
(
nptr
,
end
,
base
,
NULL
);
if
(
ret
>
MSVCRT_ULONG_MAX
)
{
ret
=
MSVCRT_ULONG_MAX
;
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
}
else
if
(
ret
<
-
(
__int64
)
MSVCRT_ULONG_MAX
)
{
ret
=
1
;
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
}
return
ret
;
}
/*********************************************************************
* _strtoui64_l (MSVCRT.@)
*
...
...
dlls/msvcrt/tests/string.c
View file @
a449b2d5
...
...
@@ -1341,6 +1341,26 @@ static void test_strtol(void)
ul
=
strtoul
(
"9223372036854775807L"
,
&
e
,
0
);
ok
(
ul
==
4294967295ul
,
"wrong value %u
\n
"
,
ul
);
ok
(
errno
==
ERANGE
,
"wrong errno %d
\n
"
,
errno
);
errno
=
0
;
ul
=
strtoul
(
"-2"
,
NULL
,
0
);
ok
(
ul
==
-
2
,
"wrong value %u
\n
"
,
ul
);
ok
(
errno
==
0
,
"wrong errno %d
\n
"
,
errno
);
errno
=
0
;
ul
=
strtoul
(
"-4294967294"
,
NULL
,
0
);
ok
(
ul
==
2
,
"wrong value %u
\n
"
,
ul
);
ok
(
errno
==
0
,
"wrong errno %d
\n
"
,
errno
);
errno
=
0
;
ul
=
strtoul
(
"-4294967295"
,
NULL
,
0
);
ok
(
ul
==
1
,
"wrong value %u
\n
"
,
ul
);
ok
(
errno
==
0
,
"wrong errno %d
\n
"
,
errno
);
errno
=
0
;
ul
=
strtoul
(
"-4294967296"
,
NULL
,
0
);
ok
(
ul
==
1
,
"wrong value %u
\n
"
,
ul
);
ok
(
errno
==
ERANGE
,
"wrong errno %d
\n
"
,
errno
);
}
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