/src/httrack/src/htsglobal.h
Line | Count | Source |
1 | | /* ------------------------------------------------------------ */ |
2 | | /* |
3 | | HTTrack Website Copier, Offline Browser for Windows and Unix |
4 | | Copyright (C) 1998 Xavier Roche and other contributors |
5 | | |
6 | | SPDX-License-Identifier: GPL-3.0-or-later |
7 | | |
8 | | This program is free software: you can redistribute it and/or modify |
9 | | it under the terms of the GNU General Public License as published by |
10 | | the Free Software Foundation, either version 3 of the License, or |
11 | | (at your option) any later version. |
12 | | |
13 | | This program is distributed in the hope that it will be useful, |
14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | GNU General Public License for more details. |
17 | | |
18 | | You should have received a copy of the GNU General Public License |
19 | | along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | | |
21 | | Ethical use: we kindly ask that you NOT use this software to harvest email |
22 | | addresses or to collect any other private information about people. Doing so |
23 | | would dishonor our work and waste the many hours we have spent on it. |
24 | | |
25 | | Please visit our Website: http://www.httrack.com |
26 | | */ |
27 | | |
28 | | /* ------------------------------------------------------------ */ |
29 | | /* File: Global #define file */ |
30 | | /* Author: Xavier Roche */ |
31 | | /* ------------------------------------------------------------ */ |
32 | | |
33 | | /** @file htsglobal.h |
34 | | * The portability layer nearly every other installed header includes: the |
35 | | * version strings, the build switches that shape the exported structs, the |
36 | | * HTSEXT_API export marker, the integer, time and socket typedefs with their |
37 | | * printf formats, and the file-access mode constants. */ |
38 | | |
39 | | #ifndef HTTRACK_GLOBAL_DEFH |
40 | | #define HTTRACK_GLOBAL_DEFH |
41 | | |
42 | | /* Package version strings. VERSION is the dashed display form, VERSIONID the |
43 | | dotted numeric form hts_version() returns, AFF_VERSION a deliberately |
44 | | shape-free short form used in the User-Agent and the mirrored-page footer. |
45 | | None of them is the library ABI version, which is VERSION_INFO in |
46 | | configure.ac. */ |
47 | 2.48k | #define HTTRACK_VERSION "3.52-0" |
48 | 0 | #define HTTRACK_VERSIONID "3.52.0" |
49 | | #define HTTRACK_AFF_VERSION "3.x" |
50 | | /* Nothing in the engine reads this one. */ |
51 | | #define HTTRACK_LIB_VERSION "2.0" |
52 | | |
53 | | /* A consumer that defines HTS_NOINCLUDES includes <stdio.h> and <stdlib.h> |
54 | | itself, before this header. */ |
55 | | #ifndef HTS_NOINCLUDES |
56 | | #include <stdio.h> |
57 | | #include <stdlib.h> |
58 | | #endif |
59 | | |
60 | | /* Engine tuning constants: HTS_ACCESS, poll timings, default filenames. */ |
61 | | #include "htsconfig.h" |
62 | | |
63 | | // Fixed-width integer types + PRI* format macros for the LLint/TStamp typedefs |
64 | | #include <stdint.h> |
65 | | #include <inttypes.h> |
66 | | |
67 | | /* Type widths for a build with no configure. Nothing in the engine reads |
68 | | them any more. */ |
69 | | #ifdef _WIN32 |
70 | | #ifndef SIZEOF_LONG |
71 | | #define SIZEOF_LONG 4 |
72 | | #define SIZEOF_LONG_LONG 8 |
73 | | #endif |
74 | | #endif |
75 | | |
76 | | /* Compiler-attribute markers, each expanding to nothing where the compiler has |
77 | | no such attribute. HTS_UNUSED says a symbol may go unused, and HTS_STATIC is |
78 | | a static that may. HTS_PRINTF_FUN(fmt, arg) checks the format string at |
79 | | argument index @p fmt against the varargs starting at @p arg. */ |
80 | | #ifndef HTS_UNUSED |
81 | | #ifdef __GNUC__ |
82 | 0 | #define HTS_UNUSED __attribute__((unused)) |
83 | | |
84 | | #define HTS_STATIC static __attribute__((unused)) |
85 | | |
86 | | #define HTS_PRINTF_FUN(fmt, arg) __attribute__((format(printf, fmt, arg))) |
87 | | #else |
88 | | #define HTS_UNUSED |
89 | | #define HTS_STATIC static |
90 | | #define HTS_PRINTF_FUN(fmt, arg) |
91 | | #endif |
92 | | #endif |
93 | | |
94 | | /* HTS_CHECK_RESULT marks a function whose result a caller must use. GCC |
95 | | still warns through a (void) cast, so the caller must act on the result. */ |
96 | | #ifndef HTS_CHECK_RESULT |
97 | | #ifdef __GNUC__ |
98 | | #define HTS_CHECK_RESULT __attribute__((warn_unused_result)) |
99 | | #elif defined(_MSC_VER) |
100 | | #include <sal.h> |
101 | | #define HTS_CHECK_RESULT _Check_return_ |
102 | | #else |
103 | | #define HTS_CHECK_RESULT |
104 | | #endif |
105 | | #endif |
106 | | |
107 | | /* HTS_FREED_BY(dealloc): DEALLOC, declared before it, may release the result. |
108 | | GCC then warns when another deallocator releases it. */ |
109 | | #ifndef HTS_FREED_BY |
110 | | #if defined(__GNUC__) && __GNUC__ >= 11 && !defined(__clang__) |
111 | | #define HTS_FREED_BY(dealloc) __attribute__((malloc(dealloc, 1))) |
112 | | #else |
113 | | #define HTS_FREED_BY(dealloc) |
114 | | #endif |
115 | | #endif |
116 | | |
117 | | /* HTS_OWNED_BY(dealloc): the result is a fresh heap block the caller releases |
118 | | with DEALLOC. Never on a function that can return its argument, a ring slot |
119 | | or a static. */ |
120 | | #ifndef HTS_OWNED_BY |
121 | | #ifdef __GNUC__ |
122 | | #define HTS_OWNED_BY(dealloc) \ |
123 | | HTS_CHECK_RESULT __attribute__((malloc)) HTS_FREED_BY(dealloc) |
124 | | #else |
125 | | #define HTS_OWNED_BY(dealloc) HTS_CHECK_RESULT |
126 | | #endif |
127 | | #endif |
128 | | |
129 | | /* HTS_OWNED: a fresh heap block the caller frees with freet(). */ |
130 | | #ifndef HTS_OWNED |
131 | | #define HTS_OWNED HTS_OWNED_BY(free) |
132 | | #endif |
133 | | |
134 | | /* HTS_RING: the result is a slot of the rotating buffer of opt, so only the |
135 | | crawl thread may call it. tools/check-api-lint.py checks this. */ |
136 | | #ifndef HTS_RING |
137 | | #define HTS_RING |
138 | | #endif |
139 | | |
140 | | /* Marks a printf-style format parameter so MSVC /analyze checks callers. */ |
141 | | #ifndef HTS_FORMAT_STRING |
142 | | #ifdef _MSC_VER |
143 | | #include <sal.h> |
144 | | #define HTS_FORMAT_STRING _Printf_format_string_ |
145 | | #else |
146 | | #define HTS_FORMAT_STRING |
147 | | #endif |
148 | | #endif |
149 | | |
150 | | /* Where the build switches come from. Windows hard-codes them because MSVC |
151 | | runs no configure, and every other build reads the generated header below. */ |
152 | | #ifdef _WIN32 |
153 | | |
154 | | /* |
155 | | #define HAVE_SYS_STAT_H 1 |
156 | | #define HAVE_SYS_TYPES_H 1 |
157 | | #define HAVE_SYS_STAT_H 1 |
158 | | */ |
159 | | /* Windows can always load a shared library at run time. */ |
160 | | #ifndef DLLIB |
161 | | #define DLLIB 1 |
162 | | #endif |
163 | | #ifndef HTS_INET6 |
164 | | #define HTS_INET6 1 |
165 | | #endif |
166 | | /* Stand-ins for the POSIX macros MSVC does not declare. Each answers non-zero |
167 | | for a match, not 1, so test them for truth and never against 1. */ |
168 | | #ifndef S_ISREG |
169 | | #define S_ISREG(m) ((m) & _S_IFREG) |
170 | | |
171 | | #define S_ISDIR(m) ((m) & _S_IFDIR) |
172 | | #endif |
173 | | |
174 | | #else |
175 | | |
176 | | /* config.h is private: an autoconf consumer has one of its own, so only the |
177 | | switches the installed headers read are published, in htsfeatures.h. An |
178 | | internal build reads config.h and must not need the generated one. */ |
179 | | #ifdef HTS_INTERNAL_BUILD |
180 | | #include "config.h" |
181 | | #else |
182 | | #include "htsfeatures.h" |
183 | | #endif |
184 | | |
185 | | /* Defined when the platform has no setuid(), and the engine then skips its |
186 | | "do not run as root" check. */ |
187 | | #ifndef SETUID |
188 | | #define HTS_DO_NOT_USE_UID |
189 | | #endif |
190 | | |
191 | | /* 1 when the platform can load a shared library at run time. It does not gate |
192 | | the module hooks, which compile either way (htsmodules.c). */ |
193 | | #ifdef DLLIB |
194 | | #define HTS_DLOPEN 1 |
195 | | #else |
196 | | #define HTS_DLOPEN 0 |
197 | | #endif |
198 | | |
199 | | #endif |
200 | | |
201 | | /* Marks a local array big enough to matter for stack use. It expands to |
202 | | nothing. */ |
203 | | #ifndef BIGSTK |
204 | | #define BIGSTK |
205 | | #endif |
206 | | |
207 | | /* 1 when local paths use a backslash separator, so the engine rewrites the |
208 | | '/' in a save name. 1 on Windows, 0 else. */ |
209 | | #ifdef _WIN32 |
210 | | #define HTS_DOSNAME 1 |
211 | | #else |
212 | 0 | #define HTS_DOSNAME 0 |
213 | | #endif |
214 | | |
215 | | /* Always 1: zlib is mandatory, because the cache is a zip file. */ |
216 | | #ifndef HTS_USEZLIB |
217 | | #define HTS_USEZLIB 1 |
218 | | #elif !HTS_USEZLIB |
219 | | #error HTS_USEZLIB=0 is not a supported configuration |
220 | | #endif |
221 | | |
222 | | /* 1 when the engine can decode the br and zstd content codings, so it offers |
223 | | them in Accept-Encoding. Each defaults to off. */ |
224 | | #ifndef HTS_USEBROTLI |
225 | | #define HTS_USEBROTLI 0 |
226 | | #endif |
227 | | #ifndef HTS_USEZSTD |
228 | | #define HTS_USEZSTD 0 |
229 | | #endif |
230 | | |
231 | | /* 1 when the build has IPv6. It picks the sockaddr_in6 arm of SOCaddr |
232 | | (htsnet.h), so it changes the layout of every struct holding one: a consumer |
233 | | must take the value from htsfeatures.h and never guess it. */ |
234 | | #ifndef HTS_INET6 |
235 | | #define HTS_INET6 0 |
236 | | #endif |
237 | | |
238 | | /* 1 when the build speaks https. It adds the ssl fields to htsblk (htsopt.h), |
239 | | so it too changes struct layout and must come from htsfeatures.h. */ |
240 | | #ifndef HTS_USEOPENSSL |
241 | | #define HTS_USEOPENSSL 1 |
242 | | #endif |
243 | | |
244 | | #ifndef HTS_DLOPEN |
245 | | #define HTS_DLOPEN 1 |
246 | | #endif |
247 | | |
248 | | /* 1 when the build advertises Flash (.swf) link support. Only the WebHTTrack |
249 | | feature list reads it. */ |
250 | | #ifndef HTS_USESWF |
251 | | #define HTS_USESWF 1 |
252 | | #endif |
253 | | |
254 | | /* The MSVC calling-convention keyword the engine's callback declarations |
255 | | carry. Defined away elsewhere, so they compile everywhere. */ |
256 | | #ifdef _WIN32 |
257 | | #else |
258 | | #define __cdecl |
259 | | #endif |
260 | | |
261 | | /* Install paths and config-file names, all string literals with no trailing |
262 | | slash except HTS_HTTRACKDIR, which has one. configure passes the directories |
263 | | in (PREFIX, SYSCONFDIR, BINDIR, LIBDIR, DATADIR), and the literals here are |
264 | | the fallback for a build that passes none. Only HTS_HTTRACKRC exists on |
265 | | Windows, so test the others with #ifdef before you use them. */ |
266 | | #ifdef _WIN32 |
267 | | #define HTS_HTTRACKRC "httrackrc" |
268 | | #else |
269 | | |
270 | | #ifndef HTS_ETCPATH |
271 | | #ifdef SYSCONFDIR |
272 | 0 | #define HTS_ETCPATH SYSCONFDIR |
273 | | #else |
274 | | #define HTS_ETCPATH "/etc" |
275 | | #endif |
276 | | #endif |
277 | | #ifndef HTS_BINPATH |
278 | | #ifdef BINDIR |
279 | | #define HTS_BINPATH BINDIR |
280 | | #else |
281 | | #define HTS_BINPATH "/usr/bin" |
282 | | #endif |
283 | | #endif |
284 | | #ifndef HTS_LIBPATH |
285 | | #ifdef LIBDIR |
286 | | #define HTS_LIBPATH LIBDIR |
287 | | #else |
288 | | #define HTS_LIBPATH "/usr/lib" |
289 | | #endif |
290 | | #endif |
291 | | #ifndef HTS_PREFIX |
292 | | #ifdef PREFIX |
293 | | #define HTS_PREFIX PREFIX |
294 | | #else |
295 | | #define HTS_PREFIX "/usr" |
296 | | #endif |
297 | | #endif |
298 | | |
299 | 0 | #define HTS_HTTRACKRC ".httrackrc" |
300 | | /* System-wide config file, read only when no HTS_HTTRACKRC was found. */ |
301 | 0 | #define HTS_HTTRACKCNF HTS_ETCPATH "/httrack.conf" |
302 | | |
303 | | /* Data directory holding the HTML templates and the language files. */ |
304 | | #ifdef DATADIR |
305 | 0 | #define HTS_HTTRACKDIR DATADIR "/httrack/" |
306 | | #else |
307 | | #define HTS_HTTRACKDIR HTS_PREFIX "/share/httrack/" |
308 | | #endif |
309 | | |
310 | | #endif |
311 | | |
312 | | /* Maximum URL length, in bytes. Callers size URL/path string buffers to this; |
313 | | anything longer is rejected. */ |
314 | 0 | #define HTS_URLMAXSIZE 1024 |
315 | | /* Command-line argument cap, in bytes: an argument this long or longer is |
316 | | rejected. A buffer holding a message built around one adds +256. */ |
317 | 0 | #define HTS_CDLMAXSIZE 1024 |
318 | | /* MIME-type buffer contract (htsblk.contenttype/charset/contentencoding); holds |
319 | | the longest registered MIME type, the Office OOXML ones reaching 73 chars */ |
320 | 0 | #define HTS_MIMETYPE_SIZE 128 |
321 | | /* Capacity behind the htsblk.location pointer; the Location header is gated |
322 | | against this, not against HTS_URLMAXSIZE */ |
323 | 0 | #define HTS_LOCATION_SIZE (HTS_URLMAXSIZE * 2) |
324 | | |
325 | | /* Caps on single option arguments, in bytes, exclusive like HTS_CDLMAXSIZE. |
326 | | They bound the value, not a buffer: these option fields are dynamic Strings. |
327 | | Named so the front ends can check against them instead of copying them. */ |
328 | 0 | #define HTS_FOOTER_MAXSIZE 254 /* -%F */ |
329 | 0 | #define HTS_LANGISO_MAXSIZE 62 /* -%l */ |
330 | 0 | #define HTS_REFERER_MAXSIZE 254 /* -%R */ |
331 | 0 | #define HTS_FILELIST_MAXSIZE 254 /* -%L */ |
332 | 0 | #define HTS_BINDHOST_MAXSIZE 254 /* -%b */ |
333 | 0 | #define HTS_FROMEMAIL_MAXSIZE 254 /* -%E */ |
334 | | |
335 | | /* Copyright (C) 1998 Xavier Roche and other contributors */ |
336 | 0 | #define HTTRACK_AFF_AUTHORS "[XR&CO]" |
337 | | /* Named fields (hts_footer_format); a "%s" anywhere would switch the template |
338 | | back to the legacy positional model, a user's own additions included. */ |
339 | | #define HTS_DEFAULT_FOOTER \ |
340 | | "<!-- Mirrored from {url} by HTTrack Website Copier/" HTTRACK_AFF_VERSION \ |
341 | | " " HTTRACK_AFF_AUTHORS ", {date} -->" |
342 | | /* The User-Agent fakes no OS or browser to go stale. */ |
343 | | #define HTS_DEFAULT_USER_AGENT \ |
344 | | "Mozilla/5.0 (compatible; HTTrack/" HTTRACK_AFF_VERSION \ |
345 | | "; +https://www.httrack.com/)" |
346 | | /* Retry-After is the server's number, so the engine caps it (seconds). */ |
347 | 2.48k | #define HTS_DEFAULT_MAX_RETRY_AFTER 60 |
348 | 0 | #define HTS_MAX_RETRY_AFTER_LIMIT 3600 |
349 | | #define HTTRACK_WEB "https://www.httrack.com" |
350 | | /* Language=%s takes the catalog basename (LANGUAGE_FILE), an ASCII identifier; |
351 | | LANGUAGE_NAME is a localized display string in a legacy codepage (#1353). */ |
352 | | #define HTS_UPDATE_WEBSITE \ |
353 | | "http://www.httrack.com/" \ |
354 | | "update.php3?Product=HTTrack&Version=" HTTRACK_VERSIONID \ |
355 | | "&VersionStr=" HTTRACK_VERSION "&Platform=%d&Language=%s" |
356 | | |
357 | | /* CR LF. H_CRLF ends an HTTP header line, and CRLF the lines of the HTML pages |
358 | | the engine writes itself. */ |
359 | 0 | #define H_CRLF "\x0d\x0a" |
360 | | #define CRLF "\x0d\x0a" |
361 | | /* The local text-file and console line terminator, despite the name: CR LF on |
362 | | Windows and LF elsewhere. */ |
363 | | #ifdef _WIN32 |
364 | | #define LF "\x0d\x0a" |
365 | | #else |
366 | 0 | #define LF "\x0a" |
367 | | #endif |
368 | | |
369 | | /* Sentinel meaning "empty parameter", for example -F (none). HTS_NOPARAM2 is |
370 | | the same word with the quote characters still around it. */ |
371 | 0 | #define HTS_NOPARAM "(none)" |
372 | 0 | #define HTS_NOPARAM2 "\"(none)\"" |
373 | | |
374 | | /* Boolean for option fields and yes/no returns. Assign HTS_FALSE or HTS_TRUE. |
375 | | It is an int rather than an enum, so C++ still accepts `field = 1`. */ |
376 | | #ifndef HTS_DEF_DEFSTRUCT_hts_boolean |
377 | | #define HTS_DEF_DEFSTRUCT_hts_boolean |
378 | | |
379 | | typedef int hts_boolean; |
380 | 327k | #define HTS_FALSE 0 |
381 | 1.34M | #define HTS_TRUE 1 |
382 | | #endif |
383 | | |
384 | | #ifndef HTS_DEF_DEFSTRUCT_hts_tristate |
385 | | #define HTS_DEF_DEFSTRUCT_hts_tristate |
386 | | /* Tri-state hts_boolean: HTS_DEFAULT (-1) = "unspecified" (copy_htsopt leaves |
387 | | the target untouched); HTS_FALSE/HTS_TRUE = off/on. */ |
388 | | typedef int hts_tristate; |
389 | 9.92k | #define HTS_DEFAULT (-1) |
390 | | #endif |
391 | | |
392 | | /* Larger and smaller of two values. One argument is evaluated twice, so pass |
393 | | no side effect. */ |
394 | | #define maximum(A, B) ((A) > (B) ? (A) : (B)) |
395 | | |
396 | | #define minimum(A, B) ((A) < (B) ? (A) : (B)) |
397 | | |
398 | | /* Compile-time check, usable as an expression. */ |
399 | 0 | #define HTS_COMPILE_ASSERT(cond) ((void) sizeof(char[(cond) ? 1 : -1])) |
400 | | |
401 | | /* The same where a declaration goes, which is where a rule tying constants |
402 | | together belongs. NAME is what the diagnostic points at. Takes a ';'. */ |
403 | | #define HTS_STATIC_ASSERT(cond, name) \ |
404 | 5.16k | enum { hts_static_assert_##name = 1 / !!(cond) } |
405 | | |
406 | | /* Expands to `inline` when the header is compiled as C++, and to nothing in |
407 | | plain C. */ |
408 | | #ifdef __cplusplus |
409 | | #define HTS_INLINE inline |
410 | | #else |
411 | | #define HTS_INLINE |
412 | | #endif |
413 | | |
414 | | /* Is @p s a non-NULL, non-empty string? */ |
415 | 2.69k | static HTS_INLINE HTS_UNUSED hts_boolean strnotempty(const char *s) { |
416 | 2.69k | return s != NULL && s[0] != '\0'; |
417 | 2.69k | } Unexecuted instantiation: fuzz-warc.c:strnotempty Line | Count | Source | 415 | 2.69k | static HTS_INLINE HTS_UNUSED hts_boolean strnotempty(const char *s) { | 416 | 2.69k | return s != NULL && s[0] != '\0'; | 417 | 2.69k | } |
Unexecuted instantiation: htsbase.c:strnotempty Unexecuted instantiation: htsfetch.c:strnotempty Unexecuted instantiation: htspsl.c:strnotempty Unexecuted instantiation: htscoucal.c:strnotempty Unexecuted instantiation: htspsl_data.c:strnotempty Unexecuted instantiation: htscore.c:strnotempty Unexecuted instantiation: htshash.c:strnotempty Unexecuted instantiation: htsmhtml.c:strnotempty Unexecuted instantiation: htsusercmd.c:strnotempty Unexecuted instantiation: htscache.c:strnotempty Unexecuted instantiation: htsback.c:strnotempty Unexecuted instantiation: htsftp.c:strnotempty Unexecuted instantiation: htsdns.c:strnotempty Unexecuted instantiation: htsfilters.c:strnotempty Unexecuted instantiation: htsmirror.c:strnotempty Unexecuted instantiation: htsparse.c:strnotempty Unexecuted instantiation: htscmdline.c:strnotempty Unexecuted instantiation: htsmime.c:strnotempty Unexecuted instantiation: htssecret.c:strnotempty Unexecuted instantiation: htslines.c:strnotempty Unexecuted instantiation: htsurlport.c:strnotempty Unexecuted instantiation: htsdate.c:strnotempty Unexecuted instantiation: htsshared.c:strnotempty Unexecuted instantiation: htsname.c:strnotempty Unexecuted instantiation: htsrobots.c:strnotempty Unexecuted instantiation: htstools.c:strnotempty Unexecuted instantiation: htswizard.c:strnotempty Unexecuted instantiation: htsthread.c:strnotempty Unexecuted instantiation: htsindex.c:strnotempty Unexecuted instantiation: htsbauth.c:strnotempty Unexecuted instantiation: htscookiefile.c:strnotempty Unexecuted instantiation: htsbundle.c:strnotempty Unexecuted instantiation: htscoremain.c:strnotempty Unexecuted instantiation: htsalias.c:strnotempty Unexecuted instantiation: htshelp.c:strnotempty Unexecuted instantiation: htscatchurl.c:strnotempty Unexecuted instantiation: htscrashtest.c:strnotempty Unexecuted instantiation: htsmd5.c:strnotempty Unexecuted instantiation: htsnet.c:strnotempty Unexecuted instantiation: htscodec.c:strnotempty Unexecuted instantiation: htswarc.c:strnotempty Unexecuted instantiation: htschanges.c:strnotempty Unexecuted instantiation: htssinglefile.c:strnotempty Unexecuted instantiation: htsrandom.c:strnotempty Unexecuted instantiation: htssitemap.c:strnotempty Unexecuted instantiation: htsproxy.c:strnotempty Unexecuted instantiation: htszlib.c:strnotempty Unexecuted instantiation: htsconcat.c:strnotempty Unexecuted instantiation: htsmodules.c:strnotempty Unexecuted instantiation: htscharset.c:strnotempty Unexecuted instantiation: htsencoding.c:strnotempty Unexecuted instantiation: htsescape.c:strnotempty Unexecuted instantiation: htssniff.c:strnotempty Unexecuted instantiation: htsselftest.c:strnotempty Unexecuted instantiation: htsback_selftest.c:strnotempty Unexecuted instantiation: htsselftest_util.c:strnotempty Unexecuted instantiation: htsbase_selftest.c:strnotempty Unexecuted instantiation: htscache_selftest.c:strnotempty Unexecuted instantiation: htsckd_selftest.c:strnotempty Unexecuted instantiation: htscharset_selftest.c:strnotempty Unexecuted instantiation: htscmdline_selftest.c:strnotempty Unexecuted instantiation: htscookie_selftest.c:strnotempty Unexecuted instantiation: htsdns_selftest.c:strnotempty Unexecuted instantiation: htsfetch_selftest.c:strnotempty Unexecuted instantiation: htspsl_selftest.c:strnotempty Unexecuted instantiation: htsindex_selftest.c:strnotempty Unexecuted instantiation: htsbundle_selftest.c:strnotempty Unexecuted instantiation: htsfilters_selftest.c:strnotempty Unexecuted instantiation: htsheader_selftest.c:strnotempty Unexecuted instantiation: htsio_selftest.c:strnotempty Unexecuted instantiation: htslib_selftest.c:strnotempty Unexecuted instantiation: htswrap.c:strnotempty Unexecuted instantiation: htslines_selftest.c:strnotempty Unexecuted instantiation: htsmime_selftest.c:strnotempty Unexecuted instantiation: htsname_selftest.c:strnotempty Unexecuted instantiation: htsnet_selftest.c:strnotempty Unexecuted instantiation: htsopt_selftest.c:strnotempty Unexecuted instantiation: htsparse_selftest.c:strnotempty Unexecuted instantiation: htstools_selftest.c:strnotempty Unexecuted instantiation: htswarc_selftest.c:strnotempty Unexecuted instantiation: htswizard_selftest.c:strnotempty |
418 | | |
419 | | /* Marks a symbol as part of the library's public ABI, so a consumer may link |
420 | | against it. A symbol without it is internal and may change or vanish. It |
421 | | expands to nothing on a compiler with no way to say this. */ |
422 | | #ifdef _WIN32 |
423 | | #ifdef LIBHTTRACK_EXPORTS |
424 | | #define HTSEXT_API __declspec(dllexport) |
425 | | #else |
426 | | #define HTSEXT_API __declspec(dllimport) |
427 | | #endif |
428 | | #else |
429 | | /* See <http://gcc.gnu.org/wiki/Visibility> */ |
430 | | #if ((defined(__GNUC__) && (__GNUC__ >= 4)) || \ |
431 | | (defined(HAVE_VISIBILITY) && HAVE_VISIBILITY)) |
432 | | |
433 | | #define HTSEXT_API __attribute__((visibility("default"))) |
434 | | #else |
435 | | #define HTSEXT_API |
436 | | #endif |
437 | | #endif |
438 | | |
439 | | /** Marks a function deprecated, and @p msg names the replacement. It goes |
440 | | * before the declaration, and expands to nothing where the compiler cannot |
441 | | * warn. */ |
442 | | #if defined(__GNUC__) && \ |
443 | | (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) |
444 | | |
445 | | #define HTS_DEPRECATED(msg) __attribute__((deprecated(msg))) |
446 | | #elif defined(__GNUC__) |
447 | | |
448 | | #define HTS_DEPRECATED(msg) __attribute__((deprecated)) |
449 | | #elif defined(_MSC_VER) && (_MSC_VER >= 1400) |
450 | | |
451 | | #define HTS_DEPRECATED(msg) __declspec(deprecated(msg)) |
452 | | #else |
453 | | #define HTS_DEPRECATED(msg) |
454 | | #endif |
455 | | |
456 | | /* Says the function never returns. It goes before the declaration, and |
457 | | expands to nothing where the compiler has no such attribute. */ |
458 | | #if defined(__GNUC__) |
459 | | #define HTS_NORETURN __attribute__((noreturn)) |
460 | | #elif defined(_MSC_VER) |
461 | | #define HTS_NORETURN __declspec(noreturn) |
462 | | #else |
463 | | #define HTS_NORETURN |
464 | | #endif |
465 | | |
466 | | /* Marks a deliberate switch fallthrough. Write it as a statement before the |
467 | | next case label. It expands to nothing where the compiler has no such |
468 | | attribute. */ |
469 | | #if defined(__has_attribute) |
470 | | |
471 | | #if __has_attribute(fallthrough) |
472 | | |
473 | 0 | #define HTS_FALLTHROUGH __attribute__((fallthrough)) |
474 | | #endif |
475 | | #endif |
476 | | #ifndef HTS_FALLTHROUGH |
477 | | #define HTS_FALLTHROUGH |
478 | | #endif |
479 | | |
480 | | /* Byte counts, file sizes and offsets, exactly 64 bits and signed. -1 means |
481 | | "unknown" or "no limit" in the fields and returns that accept it. */ |
482 | | typedef int64_t LLint; |
483 | | /* A time value, exactly 64 bits and signed. The producer fixes the unit: some |
484 | | fields hold seconds since the Unix epoch, mtime_local() milliseconds since |
485 | | it, and mtime_monotonic() milliseconds from an unspecified origin, comparable |
486 | | only against itself. */ |
487 | | typedef int64_t TStamp; |
488 | | /* printf conversion for an LLint or a TStamp, '%' included, because PRId64 has |
489 | | none: "X: " LLintP. */ |
490 | 0 | #define LLintP "%" PRId64 |
491 | | |
492 | | /* 64 bits where the build has large-file support (HTS_LFS) or under MSVC, and |
493 | | a plain int otherwise, so a consumer must not assume a width. INTsysP is its |
494 | | printf conversion, '%' included. */ |
495 | | #if defined(HTS_LFS) || defined(_MSC_VER) |
496 | | typedef LLint INTsys; |
497 | | |
498 | | #define INTsysP LLintP |
499 | | #else |
500 | | typedef int INTsys; |
501 | | |
502 | | #define INTsysP "%d" |
503 | | #endif |
504 | | |
505 | | /* Socket handle: an unsigned integer as wide as a Windows SOCKET (64 bits on |
506 | | Win64, 32 on Win32), and a plain int file descriptor on POSIX. T_SOCP is its |
507 | | printf conversion, '%' included, so never print a T_SOC with "%d". */ |
508 | | #ifdef _WIN32 |
509 | | #if defined(_WIN64) |
510 | | |
511 | | typedef unsigned __int64 T_SOC; |
512 | | #define T_SOCP "%" PRIu64 |
513 | | #else |
514 | | typedef unsigned __int32 T_SOC; |
515 | | #define T_SOCP "%" PRIu32 |
516 | | #endif |
517 | | #else |
518 | | typedef int T_SOC; |
519 | | #define T_SOCP "%d" |
520 | | #endif |
521 | | |
522 | | /* Buffer size for a printed network address (IPv4 or IPv6, NUL included). */ |
523 | | #define HTS_MAXADDRLEN 64 |
524 | | |
525 | | /* Max resolved addresses kept per host for connect fallback (dead IPv6 etc.). |
526 | | */ |
527 | 0 | #define HTS_MAXADDRNUM 4 |
528 | | |
529 | | /* See __cdecl above. */ |
530 | | #ifdef _WIN32 |
531 | | #else |
532 | | #define __cdecl |
533 | | #endif |
534 | | |
535 | | /* POSIX permission bits for created folders and files (mkdir and chmod). |
536 | | PROTECT_FOLDER/FILE are owner-only. With HTS_ACCESS set (the default) the |
537 | | ACCESS_ modes also grant group/other read; otherwise they stay owner-only. */ |
538 | 0 | #define HTS_PROTECT_FOLDER (S_IRUSR | S_IWUSR | S_IXUSR) |
539 | 7.97k | #define HTS_PROTECT_FILE (S_IRUSR | S_IWUSR) |
540 | | |
541 | | #if HTS_ACCESS |
542 | 0 | #define HTS_ACCESS_FILE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) |
543 | | |
544 | | #define HTS_ACCESS_FOLDER \ |
545 | 0 | (S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) |
546 | | #else |
547 | | #define HTS_ACCESS_FILE (S_IRUSR | S_IWUSR) |
548 | | |
549 | | #define HTS_ACCESS_FOLDER (S_IRUSR | S_IWUSR | S_IXUSR) |
550 | | #endif |
551 | | |
552 | | /* Sanity-check that the required preprocessor switches are defined */ |
553 | | #ifndef HTS_DOSNAME |
554 | | #error | HTS_DOSNAME Has not been defined. |
555 | | #error | Set it to 1 if you are under DOS, 0 under Unix. |
556 | | #error | Example: place this line in you source, before includes: |
557 | | #error | #define HTS_DOSNAME 0 |
558 | | #error |
559 | | #error |
560 | | #endif |
561 | | #ifndef HTS_ACCESS |
562 | | /* Default: files readable by all users */ |
563 | | #define HTS_ACCESS 1 |
564 | | #endif |
565 | | |
566 | | /* Flushes stdout and stdin. It expands to a brace block, so an `if` around it |
567 | | needs braces. */ |
568 | | #define io_flush \ |
569 | 0 | { \ |
570 | 0 | fflush(stdout); \ |
571 | 0 | fflush(stdin); \ |
572 | 0 | } |
573 | | |
574 | | /* HTSLib */ |
575 | | |
576 | | // Enable the DNS cache (speeds up address resolution) |
577 | | #define HTS_DNSCACHE 1 |
578 | | |
579 | | // Pseudo-socket id standing in for a local file:// transfer |
580 | 0 | #define LOCAL_SOCKET_ID -2 |
581 | | |
582 | | // Per-connection transfer buffer size, in bytes |
583 | 0 | #define TAILLE_BUFFER 65536 |
584 | | |
585 | | #define USE_BEGINTHREAD 1 |
586 | | |
587 | | /* Unused. */ |
588 | | #ifndef NOSTRDEBUG |
589 | | #define STRDEBUG 1 |
590 | | #endif |
591 | | |
592 | | #endif |