-
Notifications
You must be signed in to change notification settings - Fork 29
/
str_to_int.h
90 lines (65 loc) · 1.83 KB
/
str_to_int.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
Copyright (C) 2011 Jay Satiro <[email protected]>
All rights reserved.
This file is part of GetHooks.
GetHooks is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GetHooks is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GetHooks. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _STR_TO_INT_H
#define _STR_TO_INT_H
#include <windows.h>
#include <limits.h>
#ifdef __cplusplus
extern "C" {
#endif
/* I64_MAX and I64_MIN are supposed to be defined in limits.h but often they aren't */
#ifndef I64_MAX
#define I64_MAX _I64_MAX
#endif
#ifndef I64_MIN
#define I64_MIN _I64_MIN
#endif
#ifndef UI64_MAX
#define UI64_MAX _UI64_MAX
#endif
/* returns for str_to_uint64(), str_to_int64(), str_to_uint(), str_to_int() */
enum sti_type
{
/* the number is negative */
NUM_NEG = -1,
/* the function failed */
NUM_FAIL = 0,
/* the number is positive or 0 */
NUM_POS = 1
};
/**
these functions are documented in the comment block above their definitions in str_to_int.c
*/
enum sti_type str_to_uint64(
unsigned __int64 *const num, // out
const char *const str // in
);
enum sti_type str_to_int64(
__int64 *const num, // out
const char *const str // in
);
enum sti_type str_to_uint(
unsigned *const num, // out
const char *const str // in
);
enum sti_type str_to_int(
int *const num, // out
const char *const str // in
);
#ifdef __cplusplus
}
#endif
#endif // _STR_TO_INT_H