-
Notifications
You must be signed in to change notification settings - Fork 0
/
mystring.h
159 lines (136 loc) · 4.06 KB
/
mystring.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#pragma once
HRESULT StringCopyDebugW(
LPWSTR pszDest,
size_t cchDest,
LPCWSTR pszSrc,
LPCSTR pszFile,
int nLine
);
HRESULT StringCopyDebugA(
LPSTR pszDest,
size_t cchDest,
LPCSTR pszSrc,
LPCSTR pszFile,
int nLine
);
HRESULT StringCopyNDebugW(
LPWSTR pszDest,
size_t cchDest,
LPCWSTR pszSrc,
size_t cchSrc,
LPCSTR pszFile,
int nLine
);
HRESULT StringCopyNDebugA(
LPSTR pszDest,
size_t cchDest,
LPCSTR pszSrc,
size_t cchSrc,
LPCSTR pszFile,
int nLine
);
HRESULT StringCatDebugW(
LPWSTR pszDest,
size_t cchDest,
LPCWSTR pszSrc,
LPCSTR pszFile,
int nLine
);
HRESULT StringCatDebugA(
LPSTR pszDest,
size_t cchDest,
LPCSTR pszSrc,
LPCSTR pszFile,
int nLine
);
HRESULT StringCatNDebugW(
LPWSTR pszDest,
size_t cchDest,
LPCWSTR pszSrc,
size_t cchMaxAppend,
LPCSTR pszFile,
int nLine
);
HRESULT StringCatNDebugA(
LPSTR pszDest,
size_t cchDest,
LPCSTR pszSrc,
size_t cchMaxAppend,
LPCSTR pszFile,
int nLine
);
HRESULT StringVPrintfDebugW(
LPWSTR pszDest,
size_t cchDest,
LPCWSTR pszFormat,
va_list argList,
LPCSTR pszFile,
int nLine
);
HRESULT StringVPrintfDebugA(
LPSTR pszDest,
size_t cchDest,
LPCSTR pszFormat,
va_list argList,
LPCSTR pszFile,
int nLine
);
HRESULT StringPrintfDebugW(
LPWSTR pszDest,
size_t cchDest,
LPCWSTR pszFormat,
...
);
HRESULT StringPrintfDebugA(
LPSTR pszDest,
size_t cchDest,
LPCSTR pszFormat,
...
);
#ifdef _DEBUG
#define STRING_FLAGS (STRSAFE_FILL_BEHIND_NULL | 0xcc)
#else
#define STRING_FLAGS 0
#endif
#ifdef UNICODE
#define StringCopy StringCopyW
#define StringCopyN StringCopyNW
#define StringCat StringCatW
#define StringCatN StringCatNW
#define StringVPrintf StringVPrintfW
#define StringPrintf StringPrintfW
#else
#define StringCopy StringCopyA
#define StringCopyN StringCopyNA
#define StringCat StringCatA
#define StringCatN StringCatNA
#define StringVPrintf StringVPrintfA
#define StringPrintf StringPrintfA
#endif
#ifdef _DEBUG
#define StringCopyW(pszDest, cchDest, pszSrc ) StringCopyDebugW(pszDest, cchDest, pszSrc, __FILE__, __LINE__)
#define StringCopyA(pszDest, cchDest, pszSrc ) StringCopyDebugA(pszDest, cchDest, pszSrc, __FILE__, __LINE__)
#define StringCopyNW(pszDest, cchDest, pszSrc, cchSrc ) StringCopyNDebugW(pszDest, cchDest, pszSrc, cchSrc, __FILE__, __LINE__)
#define StringCopyNA(pszDest, cchDest, pszSrc, cchSrc ) StringCopyNDebugA(pszDest, cchDest, pszSrc, cchSrc, __FILE__, __LINE__)
#define StringCatW(pszDest, cchDest, pszSrc ) StringCatDebugW(pszDest, cchDest, pszSrc, __FILE__, __LINE__)
#define StringCatA(pszDest, cchDest, pszSrc ) StringCatDebugA(pszDest, cchDest, pszSrc, __FILE__, __LINE__)
#define StringCatNW(pszDest, cchDest, pszSrc, cchMaxAppend ) StringCatNDebugW(pszDest, cchDest, pszSrc, cchMaxAppend, __FILE__, __LINE__)
#define StringCatNA(pszDest, cchDest, pszSrc, cchMaxAppend ) StringCatNDebugA(pszDest, cchDest, pszSrc, cchMaxAppend, __FILE__, __LINE__)
#define StringVPrintfW(pszDest, cchDest, pszFormat, argList ) StringVPrintfDebugW(pszDest, cchDest, pszFormat, argList, __FILE__, __LINE__)
#define StringVPrintfA(pszDest, cchDest, pszFormat, argList ) StringVPrintfDebugA(pszDest, cchDest, pszFormat, argList, __FILE__, __LINE__)
#define StringPrintfW StringPrintfDebugW
#define StringPrintfA StringPrintfDebugA
#else
#define StringCopyW StringCchCopyW
#define StringCopyA StringCchCopyA
#define StringCopyNW StringCchCopyNW
#define StringCopyNA StringCchCopyNA
#define StringCatW StringCchCatW
#define StringCatA StringCchCatA
#define StringCatNW StringCchCatNW
#define StringCatNA StringCchCatNA
#define StringVPrintfW StringCchVPrintfW
#define StringVPrintfA StringCchVPrintfA
#define StringPrintfW StringCchPrintfW
#define StringPrintfA StringCchPrintfA
#endif