#include <precomp.h>
Go to the source code of this file.
◆ strtol()
Definition at line 8 of file strtol.c.
9{
11 unsigned long acc;
13 unsigned long cutoff;
14 int neg = 0, any, cutlim;
15
16
17
18
19
20
21 do {
25 {
26 neg = 1;
28 }
32 c ==
'0' && (*
s ==
'x' || *
s ==
'X'))
33 {
37 }
39 base =
c ==
'0' ? 8 : 10;
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
59 cutlim = cutoff % (
unsigned long)
base;
61 for (acc = 0, any = 0;;
c = *
s++)
62 {
67 else
68 break;
70 break;
71 if (any < 0 || acc > cutoff || (acc == cutoff &&
c > cutlim))
72 any = -1;
73 else
74 {
75 any = 1;
78 }
79 }
80 if (any < 0)
81 {
83#ifndef _LIBCNT_
85#endif
86 }
87 else if (neg)
88 acc = 0-acc;
89 if (endptr != 0)
90 *endptr = any ? (
char *)((
size_t)(
s - 1)) : (
char *)((
size_t)nptr);
91 return acc;
92}
errno_t __cdecl _set_errno(_In_ int _Value)