Compare commits

...

4 Commits

Author SHA1 Message Date
Xavier Roche
76260d5e6e src: drop dead and duplicate function declarations
Four declarations named functions that have no definition anywhere, so
they were never exported (absent from libhttrack.so) and any caller
would fail to link: htswrap_set_userdef and htswrap_get_userdef (the
live path is the CHAIN_FUNCTION ARGUMENT with CALLBACKARG_USERDEF),
antislash_unescaped, and the internal liens_record. escape_remove_control
was additionally declared twice in httrack-library.h; the documented
declaration stays, the bare duplicate goes.

Header-only cleanup. The exported symbol set is unchanged (verified with
nm -D), so this is not an ABI break and needs no soname bump.

Found while documenting the public API (#382).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
2026-06-17 22:11:30 +02:00
Xavier Roche
5d0913dfce Merge pull request #383 from xroche/fix/mtime-local-precision
Fix mtime_local sub-second precision loss on POSIX
2026-06-17 22:06:42 +02:00
Xavier Roche
9b7601a987 htslib: fix mtime_local sub-second precision on POSIX
mtime_local() returns milliseconds since the epoch, but the POSIX
branch divided tv_usec (microseconds) by 1000000 instead of 1000,
dropping the entire millisecond term. The clock only advanced at
whole-second boundaries, so every sub-second delta the callers compute
(request/connect timing, transfer-rate smoothing) read as zero. The
Windows ftime() branch was already correct.

Found while documenting the public API (#382).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
2026-06-17 22:03:16 +02:00
Xavier Roche
4ec38c4e66 Merge pull request #382 from xroche/docs/api-httrack-library
Document the public C API with contract comments
2026-06-17 21:17:24 +02:00
3 changed files with 2 additions and 21 deletions

View File

@@ -369,10 +369,6 @@ char *readfile_or(const char *fil, const char *defaultdata);
void check_rate(TStamp stat_timestart, int maxrate);
#endif
// links
int liens_record(char *adr, char *fil, char *save, char *former_adr,
char *former_fil, char *codebase);
/* Backing (download-slot) scheduler. Operate on the back[] ring (struct_back).
Not thread-safe; call from the single crawl loop. */

View File

@@ -2580,8 +2580,8 @@ HTSEXT_API TStamp mtime_local(void) {
assert(! "gettimeofday");
}
return (TStamp) (((TStamp) tv.tv_sec * (TStamp) 1000)
+ ((TStamp) tv.tv_usec / (TStamp) 1000000));
return (TStamp) (((TStamp) tv.tv_sec * (TStamp) 1000) +
((TStamp) tv.tv_usec / (TStamp) 1000));
#else
struct timeb B;
ftime(&B);

View File

@@ -254,15 +254,6 @@ HTSEXT_API int htswrap_add(httrackp * opt, const char *name, void *fct);
or 0 if none or unknown. */
HTSEXT_API uintptr_t htswrap_read(httrackp * opt, const char *name);
/** @warning No implementation is linked into the library; calling this fails to
link. For per-callback user data use the CHAIN_FUNCTION() ARGUMENT and
CALLBACKARG_USERDEF() instead. */
HTSEXT_API int htswrap_set_userdef(httrackp * opt, void *userdef);
/** @warning No implementation is linked into the library; calling this fails to
link. Read per-callback user data with CALLBACKARG_USERDEF() instead. */
HTSEXT_API void *htswrap_get_userdef(httrackp * opt);
/* Internal library allocators, if a different libc is being used by the client */
/** strdup() through the library allocator. Returns a heap copy freed with
hts_free(), or NULL on failure. */
@@ -584,12 +575,6 @@ HTSEXT_API char *unescape_http(char *const catbuff, const size_t size, const cha
space. Returns @p catbuff. */
HTSEXT_API char *unescape_http_unharm(char *const catbuff, const size_t size, const char *s, const int no_high);
/** @warning No implementation is linked into the library; calling this fails to
link. */
HTSEXT_API char *antislash_unescaped(char *catbuff, const char *s);
HTSEXT_API void escape_remove_control(char *s);
/** Determine the MIME type of local file name @p fil into @p s (capacity
@p ssize): user --assume rules, then ".html", then the built-in extension
table. @p flag != 0 forces a fallback type. @return 1 if a type was written,