mirror of
https://github.com/CrazyRedMachine/popnhax.git
synced 2024-11-27 23:40:50 +01:00
tachi scorehook, rivals
This commit is contained in:
parent
6927d5ec99
commit
7ce5f1adec
2
Makefile
2
Makefile
@ -49,7 +49,7 @@ cflags := -O3 -pipe -ffunction-sections -fdata-sections \
|
|||||||
cxxflags := -O3 -pipe -ffunction-sections -fdata-sections \
|
cxxflags := -O3 -pipe -ffunction-sections -fdata-sections \
|
||||||
-std=c++11 $(wxxflags)
|
-std=c++11 $(wxxflags)
|
||||||
|
|
||||||
ldflags := -Wl,--gc-sections -static -static-libgcc -lstdc++ \
|
ldflags := -Wl,--gc-sections -static -static-libgcc -lstdc++ -L./libcurl/ -llibcurl \
|
||||||
-fdiagnostics-color -Werror \
|
-fdiagnostics-color -Werror \
|
||||||
-Wl,--gc-keep-exported \
|
-Wl,--gc-keep-exported \
|
||||||
-Wl,--enable-auto-image-base \
|
-Wl,--enable-auto-image-base \
|
||||||
|
BIN
dist/popnhax/libcurl.dll
vendored
Normal file
BIN
dist/popnhax/libcurl.dll
vendored
Normal file
Binary file not shown.
BIN
dist/popnhax/normaliz.dll
vendored
Normal file
BIN
dist/popnhax/normaliz.dll
vendored
Normal file
Binary file not shown.
10
dist/popnhax/popnhax.xml
vendored
10
dist/popnhax/popnhax.xml
vendored
@ -18,6 +18,12 @@
|
|||||||
<!-- Handle favorites through data_mods/<game>.<friendID>.fav files (Note: allows UNLIMITED favorites as well as favorites without an account/server) -->
|
<!-- Handle favorites through data_mods/<game>.<friendID>.fav files (Note: allows UNLIMITED favorites as well as favorites without an account/server) -->
|
||||||
<local_favorites __type="bool">0</local_favorites>
|
<local_favorites __type="bool">0</local_favorites>
|
||||||
|
|
||||||
|
<!-- Tachi integration (requires a _tachi.default.conf or _tachi.<friendid>.conf with your api key and url parameters) -->
|
||||||
|
<!-- Automatically send scores to tachi -->
|
||||||
|
<tachi_scorehook __type="bool">0</tachi_scorehook>
|
||||||
|
<!-- Replace ingame rivals with tachi ones -->
|
||||||
|
<tachi_rivals __type="bool">0</tachi_rivals>
|
||||||
|
|
||||||
<!-- Framerate -->
|
<!-- Framerate -->
|
||||||
<!-- Fix animation speed at higher framerate for a smoother experience (lower visual latency) -->
|
<!-- Fix animation speed at higher framerate for a smoother experience (lower visual latency) -->
|
||||||
<high_framerate __type="bool">0</high_framerate>
|
<high_framerate __type="bool">0</high_framerate>
|
||||||
@ -147,6 +153,10 @@
|
|||||||
<!-- Dump the generated patch file to data_mods\patches_<datecode>.xml (in case generated patches require some fixes) -->
|
<!-- Dump the generated patch file to data_mods\patches_<datecode>.xml (in case generated patches require some fixes) -->
|
||||||
<patch_xml_dump __type="bool">0</patch_xml_dump>
|
<patch_xml_dump __type="bool">0</patch_xml_dump>
|
||||||
|
|
||||||
|
<!-- Tachi integration -->
|
||||||
|
<!-- Do not send omni chart scores to tachi server (note: custom charts with songid > 3400 will always be skipped) -->
|
||||||
|
<tachi_scorehook_skip_omni __type="bool">0</tachi_scorehook_skip_omni>
|
||||||
|
|
||||||
<!-- Custom category options (requires patch_db) -->
|
<!-- Custom category options (requires patch_db) -->
|
||||||
<!-- Also exclude omnimix (song id < 3000) tracks from version/level (requires custom_exclude_from_level or custom_exclude_from_version) -->
|
<!-- Also exclude omnimix (song id < 3000) tracks from version/level (requires custom_exclude_from_level or custom_exclude_from_version) -->
|
||||||
<exclude_omni __type="bool">0</exclude_omni>
|
<exclude_omni __type="bool">0</exclude_omni>
|
||||||
|
14
libcurl/README.md
Normal file
14
libcurl/README.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# include
|
||||||
|
|
||||||
|
Public include files for libcurl, external users.
|
||||||
|
|
||||||
|
They're all placed in the curl subdirectory here for better fit in any kind of
|
||||||
|
environment. You must include files from here using...
|
||||||
|
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
... style and point the compiler's include path to the directory holding the
|
||||||
|
curl subdirectory. It makes it more likely to survive future modifications.
|
||||||
|
|
||||||
|
The public curl include files can be shared freely between different platforms
|
||||||
|
and different architectures.
|
39
libcurl/curl/Makefile.am
Normal file
39
libcurl/curl/Makefile.am
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#***************************************************************************
|
||||||
|
# _ _ ____ _
|
||||||
|
# Project ___| | | | _ \| |
|
||||||
|
# / __| | | | |_) | |
|
||||||
|
# | (__| |_| | _ <| |___
|
||||||
|
# \___|\___/|_| \_\_____|
|
||||||
|
#
|
||||||
|
# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# This software is licensed as described in the file COPYING, which
|
||||||
|
# you should have received as part of this distribution. The terms
|
||||||
|
# are also available at https://curl.se/docs/copyright.html.
|
||||||
|
#
|
||||||
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
# copies of the Software, and permit persons to whom the Software is
|
||||||
|
# furnished to do so, under the terms of the COPYING file.
|
||||||
|
#
|
||||||
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
# KIND, either express or implied.
|
||||||
|
#
|
||||||
|
###########################################################################
|
||||||
|
pkginclude_HEADERS = \
|
||||||
|
curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
|
||||||
|
typecheck-gcc.h system.h urlapi.h options.h
|
||||||
|
|
||||||
|
pkgincludedir= $(includedir)/curl
|
||||||
|
|
||||||
|
CHECKSRC = $(CS_$(V))
|
||||||
|
CS_0 = @echo " RUN " $@;
|
||||||
|
CS_1 =
|
||||||
|
CS_ = $(CS_0)
|
||||||
|
|
||||||
|
checksrc:
|
||||||
|
$(CHECKSRC)@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS)
|
||||||
|
|
||||||
|
if CURLDEBUG
|
||||||
|
# for debug builds, we scan the sources on all regular make invokes
|
||||||
|
all-local: checksrc
|
||||||
|
endif
|
714
libcurl/curl/Makefile.in
Normal file
714
libcurl/curl/Makefile.in
Normal file
@ -0,0 +1,714 @@
|
|||||||
|
# Makefile.in generated by automake 1.16.4 from Makefile.am.
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
|
||||||
|
VPATH = @srcdir@
|
||||||
|
am__is_gnu_make = { \
|
||||||
|
if test -z '$(MAKELEVEL)'; then \
|
||||||
|
false; \
|
||||||
|
elif test -n '$(MAKE_HOST)'; then \
|
||||||
|
true; \
|
||||||
|
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||||
|
true; \
|
||||||
|
else \
|
||||||
|
false; \
|
||||||
|
fi; \
|
||||||
|
}
|
||||||
|
am__make_running_with_option = \
|
||||||
|
case $${target_option-} in \
|
||||||
|
?) ;; \
|
||||||
|
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||||
|
"target option '$${target_option-}' specified" >&2; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
has_opt=no; \
|
||||||
|
sane_makeflags=$$MAKEFLAGS; \
|
||||||
|
if $(am__is_gnu_make); then \
|
||||||
|
sane_makeflags=$$MFLAGS; \
|
||||||
|
else \
|
||||||
|
case $$MAKEFLAGS in \
|
||||||
|
*\\[\ \ ]*) \
|
||||||
|
bs=\\; \
|
||||||
|
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||||
|
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||||
|
esac; \
|
||||||
|
fi; \
|
||||||
|
skip_next=no; \
|
||||||
|
strip_trailopt () \
|
||||||
|
{ \
|
||||||
|
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||||
|
}; \
|
||||||
|
for flg in $$sane_makeflags; do \
|
||||||
|
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||||
|
case $$flg in \
|
||||||
|
*=*|--*) continue;; \
|
||||||
|
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||||
|
-*I?*) strip_trailopt 'I';; \
|
||||||
|
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||||
|
-*O?*) strip_trailopt 'O';; \
|
||||||
|
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||||
|
-*l?*) strip_trailopt 'l';; \
|
||||||
|
-[dEDm]) skip_next=yes;; \
|
||||||
|
-[JT]) skip_next=yes;; \
|
||||||
|
esac; \
|
||||||
|
case $$flg in \
|
||||||
|
*$$target_option*) has_opt=yes; break;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
test $$has_opt = yes
|
||||||
|
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||||
|
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||||
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
|
install_sh_DATA = $(install_sh) -c -m 644
|
||||||
|
install_sh_PROGRAM = $(install_sh) -c
|
||||||
|
install_sh_SCRIPT = $(install_sh) -c
|
||||||
|
INSTALL_HEADER = $(INSTALL_DATA)
|
||||||
|
transform = $(program_transform_name)
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
build_triplet = @build@
|
||||||
|
host_triplet = @host@
|
||||||
|
subdir = include/curl
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compile_check_sizeof.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-amissl.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-bearssl.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-compilers.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-confopts.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-functions.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-gnutls.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-mbedtls.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-mesalink.m4 $(top_srcdir)/m4/curl-nss.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-openssl.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-override.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-reentrant.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-rustls.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-schannel.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-sectransp.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-sysconfig.m4 \
|
||||||
|
$(top_srcdir)/m4/curl-wolfssl.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||||
|
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||||
|
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||||
|
$(top_srcdir)/m4/xc-am-iface.m4 \
|
||||||
|
$(top_srcdir)/m4/xc-cc-check.m4 \
|
||||||
|
$(top_srcdir)/m4/xc-lt-iface.m4 \
|
||||||
|
$(top_srcdir)/m4/xc-translit.m4 \
|
||||||
|
$(top_srcdir)/m4/xc-val-flgs.m4 \
|
||||||
|
$(top_srcdir)/m4/zz40-xc-ovr.m4 \
|
||||||
|
$(top_srcdir)/m4/zz50-xc-ovr.m4 \
|
||||||
|
$(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \
|
||||||
|
$(top_srcdir)/configure.ac
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
DIST_COMMON = $(srcdir)/Makefile.am $(pkginclude_HEADERS) \
|
||||||
|
$(am__DIST_COMMON)
|
||||||
|
mkinstalldirs = $(install_sh) -d
|
||||||
|
CONFIG_HEADER = $(top_builddir)/lib/curl_config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
|
AM_V_P = $(am__v_P_@AM_V@)
|
||||||
|
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||||
|
am__v_P_0 = false
|
||||||
|
am__v_P_1 = :
|
||||||
|
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||||
|
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||||
|
am__v_GEN_0 = @echo " GEN " $@;
|
||||||
|
am__v_GEN_1 =
|
||||||
|
AM_V_at = $(am__v_at_@AM_V@)
|
||||||
|
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||||
|
am__v_at_0 = @
|
||||||
|
am__v_at_1 =
|
||||||
|
SOURCES =
|
||||||
|
DIST_SOURCES =
|
||||||
|
am__can_run_installinfo = \
|
||||||
|
case $$AM_UPDATE_INFO_DIR in \
|
||||||
|
n|no|NO) false;; \
|
||||||
|
*) (install-info --version) >/dev/null 2>&1;; \
|
||||||
|
esac
|
||||||
|
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||||
|
am__vpath_adj = case $$p in \
|
||||||
|
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||||
|
*) f=$$p;; \
|
||||||
|
esac;
|
||||||
|
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||||
|
am__install_max = 40
|
||||||
|
am__nobase_strip_setup = \
|
||||||
|
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||||
|
am__nobase_strip = \
|
||||||
|
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||||
|
am__nobase_list = $(am__nobase_strip_setup); \
|
||||||
|
for p in $$list; do echo "$$p $$p"; done | \
|
||||||
|
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||||
|
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||||
|
if (++n[$$2] == $(am__install_max)) \
|
||||||
|
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||||
|
END { for (dir in files) print dir, files[dir] }'
|
||||||
|
am__base_list = \
|
||||||
|
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||||
|
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||||
|
am__uninstall_files_from_dir = { \
|
||||||
|
test -z "$$files" \
|
||||||
|
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||||
|
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||||
|
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||||
|
}
|
||||||
|
am__installdirs = "$(DESTDIR)$(pkgincludedir)"
|
||||||
|
HEADERS = $(pkginclude_HEADERS)
|
||||||
|
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||||
|
# Read a list of newline-separated strings from the standard input,
|
||||||
|
# and print each of them once, without duplicates. Input order is
|
||||||
|
# *not* preserved.
|
||||||
|
am__uniquify_input = $(AWK) '\
|
||||||
|
BEGIN { nonempty = 0; } \
|
||||||
|
{ items[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in items) print i; }; } \
|
||||||
|
'
|
||||||
|
# Make sure the list of sources is unique. This is necessary because,
|
||||||
|
# e.g., the same source file might be shared among _SOURCES variables
|
||||||
|
# for different programs/libraries.
|
||||||
|
am__define_uniq_tagged_files = \
|
||||||
|
list='$(am__tagged_files)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | $(am__uniquify_input)`
|
||||||
|
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
pkgincludedir = $(includedir)/curl
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AMTAR = @AMTAR@
|
||||||
|
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||||
|
AR = @AR@
|
||||||
|
AR_FLAGS = @AR_FLAGS@
|
||||||
|
AS = @AS@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AWK = @AWK@
|
||||||
|
BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@
|
||||||
|
CC = @CC@
|
||||||
|
CCDEPMODE = @CCDEPMODE@
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@
|
||||||
|
CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@
|
||||||
|
CPP = @CPP@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CPPFLAG_CURL_STATICLIB = @CPPFLAG_CURL_STATICLIB@
|
||||||
|
CSCOPE = @CSCOPE@
|
||||||
|
CTAGS = @CTAGS@
|
||||||
|
CURLVERSION = @CURLVERSION@
|
||||||
|
CURL_CA_BUNDLE = @CURL_CA_BUNDLE@
|
||||||
|
CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@
|
||||||
|
CURL_DISABLE_DICT = @CURL_DISABLE_DICT@
|
||||||
|
CURL_DISABLE_FILE = @CURL_DISABLE_FILE@
|
||||||
|
CURL_DISABLE_FTP = @CURL_DISABLE_FTP@
|
||||||
|
CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@
|
||||||
|
CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@
|
||||||
|
CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@
|
||||||
|
CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@
|
||||||
|
CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@
|
||||||
|
CURL_DISABLE_MQTT = @CURL_DISABLE_MQTT@
|
||||||
|
CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@
|
||||||
|
CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@
|
||||||
|
CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@
|
||||||
|
CURL_DISABLE_SMB = @CURL_DISABLE_SMB@
|
||||||
|
CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@
|
||||||
|
CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@
|
||||||
|
CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@
|
||||||
|
CURL_LT_SHLIB_VERSIONED_FLAVOUR = @CURL_LT_SHLIB_VERSIONED_FLAVOUR@
|
||||||
|
CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@
|
||||||
|
CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@
|
||||||
|
CURL_WITH_MULTI_SSL = @CURL_WITH_MULTI_SSL@
|
||||||
|
CYGPATH_W = @CYGPATH_W@
|
||||||
|
DEFAULT_SSL_BACKEND = @DEFAULT_SSL_BACKEND@
|
||||||
|
DEFS = @DEFS@
|
||||||
|
DEPDIR = @DEPDIR@
|
||||||
|
DLLTOOL = @DLLTOOL@
|
||||||
|
DSYMUTIL = @DSYMUTIL@
|
||||||
|
DUMPBIN = @DUMPBIN@
|
||||||
|
ECHO_C = @ECHO_C@
|
||||||
|
ECHO_N = @ECHO_N@
|
||||||
|
ECHO_T = @ECHO_T@
|
||||||
|
EGREP = @EGREP@
|
||||||
|
ENABLE_SHARED = @ENABLE_SHARED@
|
||||||
|
ENABLE_STATIC = @ENABLE_STATIC@
|
||||||
|
ETAGS = @ETAGS@
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
|
FGREP = @FGREP@
|
||||||
|
FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@
|
||||||
|
GCOV = @GCOV@
|
||||||
|
GREP = @GREP@
|
||||||
|
HAVE_BROTLI = @HAVE_BROTLI@
|
||||||
|
HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@
|
||||||
|
HAVE_LDAP_SSL = @HAVE_LDAP_SSL@
|
||||||
|
HAVE_LIBZ = @HAVE_LIBZ@
|
||||||
|
HAVE_OPENSSL_SRP = @HAVE_OPENSSL_SRP@
|
||||||
|
HAVE_PROTO_BSDSOCKET_H = @HAVE_PROTO_BSDSOCKET_H@
|
||||||
|
HAVE_ZSTD = @HAVE_ZSTD@
|
||||||
|
IDN_ENABLED = @IDN_ENABLED@
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
|
IPV6_ENABLED = @IPV6_ENABLED@
|
||||||
|
LCOV = @LCOV@
|
||||||
|
LD = @LD@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBCURL_LIBS = @LIBCURL_LIBS@
|
||||||
|
LIBCURL_NO_SHARED = @LIBCURL_NO_SHARED@
|
||||||
|
LIBOBJS = @LIBOBJS@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
LIBTOOL = @LIBTOOL@
|
||||||
|
LIPO = @LIPO@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
|
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||||
|
MAINT = @MAINT@
|
||||||
|
MAKEINFO = @MAKEINFO@
|
||||||
|
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||||
|
MANOPT = @MANOPT@
|
||||||
|
MKDIR_P = @MKDIR_P@
|
||||||
|
NM = @NM@
|
||||||
|
NMEDIT = @NMEDIT@
|
||||||
|
NROFF = @NROFF@
|
||||||
|
NSS_LIBS = @NSS_LIBS@
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
|
OBJEXT = @OBJEXT@
|
||||||
|
OTOOL = @OTOOL@
|
||||||
|
OTOOL64 = @OTOOL64@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||||
|
PACKAGE_NAME = @PACKAGE_NAME@
|
||||||
|
PACKAGE_STRING = @PACKAGE_STRING@
|
||||||
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||||
|
PACKAGE_URL = @PACKAGE_URL@
|
||||||
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
PERL = @PERL@
|
||||||
|
PKGADD_NAME = @PKGADD_NAME@
|
||||||
|
PKGADD_PKG = @PKGADD_PKG@
|
||||||
|
PKGADD_VENDOR = @PKGADD_VENDOR@
|
||||||
|
PKGCONFIG = @PKGCONFIG@
|
||||||
|
RANDOM_FILE = @RANDOM_FILE@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@
|
||||||
|
SED = @SED@
|
||||||
|
SET_MAKE = @SET_MAKE@
|
||||||
|
SHELL = @SHELL@
|
||||||
|
SSL_BACKENDS = @SSL_BACKENDS@
|
||||||
|
SSL_ENABLED = @SSL_ENABLED@
|
||||||
|
SSL_LIBS = @SSL_LIBS@
|
||||||
|
STRIP = @STRIP@
|
||||||
|
SUPPORT_FEATURES = @SUPPORT_FEATURES@
|
||||||
|
SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@
|
||||||
|
USE_ARES = @USE_ARES@
|
||||||
|
USE_BEARSSL = @USE_BEARSSL@
|
||||||
|
USE_GNUTLS = @USE_GNUTLS@
|
||||||
|
USE_HYPER = @USE_HYPER@
|
||||||
|
USE_LIBRTMP = @USE_LIBRTMP@
|
||||||
|
USE_LIBSSH = @USE_LIBSSH@
|
||||||
|
USE_LIBSSH2 = @USE_LIBSSH2@
|
||||||
|
USE_MBEDTLS = @USE_MBEDTLS@
|
||||||
|
USE_MESALINK = @USE_MESALINK@
|
||||||
|
USE_NGHTTP2 = @USE_NGHTTP2@
|
||||||
|
USE_NGHTTP3 = @USE_NGHTTP3@
|
||||||
|
USE_NGTCP2 = @USE_NGTCP2@
|
||||||
|
USE_NGTCP2_CRYPTO_GNUTLS = @USE_NGTCP2_CRYPTO_GNUTLS@
|
||||||
|
USE_NGTCP2_CRYPTO_OPENSSL = @USE_NGTCP2_CRYPTO_OPENSSL@
|
||||||
|
USE_NSS = @USE_NSS@
|
||||||
|
USE_OPENLDAP = @USE_OPENLDAP@
|
||||||
|
USE_QUICHE = @USE_QUICHE@
|
||||||
|
USE_RUSTLS = @USE_RUSTLS@
|
||||||
|
USE_SCHANNEL = @USE_SCHANNEL@
|
||||||
|
USE_SECTRANSP = @USE_SECTRANSP@
|
||||||
|
USE_UNIX_SOCKETS = @USE_UNIX_SOCKETS@
|
||||||
|
USE_WIN32_CRYPTO = @USE_WIN32_CRYPTO@
|
||||||
|
USE_WIN32_LARGE_FILES = @USE_WIN32_LARGE_FILES@
|
||||||
|
USE_WIN32_SMALL_FILES = @USE_WIN32_SMALL_FILES@
|
||||||
|
USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@
|
||||||
|
USE_WOLFSSH = @USE_WOLFSSH@
|
||||||
|
USE_WOLFSSL = @USE_WOLFSSL@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
VERSIONNUM = @VERSIONNUM@
|
||||||
|
ZLIB_LIBS = @ZLIB_LIBS@
|
||||||
|
ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@
|
||||||
|
abs_builddir = @abs_builddir@
|
||||||
|
abs_srcdir = @abs_srcdir@
|
||||||
|
abs_top_builddir = @abs_top_builddir@
|
||||||
|
abs_top_srcdir = @abs_top_srcdir@
|
||||||
|
ac_ct_AR = @ac_ct_AR@
|
||||||
|
ac_ct_CC = @ac_ct_CC@
|
||||||
|
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||||
|
am__include = @am__include@
|
||||||
|
am__leading_dot = @am__leading_dot@
|
||||||
|
am__quote = @am__quote@
|
||||||
|
am__tar = @am__tar@
|
||||||
|
am__untar = @am__untar@
|
||||||
|
bindir = @bindir@
|
||||||
|
build = @build@
|
||||||
|
build_alias = @build_alias@
|
||||||
|
build_cpu = @build_cpu@
|
||||||
|
build_os = @build_os@
|
||||||
|
build_vendor = @build_vendor@
|
||||||
|
builddir = @builddir@
|
||||||
|
datadir = @datadir@
|
||||||
|
datarootdir = @datarootdir@
|
||||||
|
docdir = @docdir@
|
||||||
|
dvidir = @dvidir@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
host = @host@
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_cpu = @host_cpu@
|
||||||
|
host_os = @host_os@
|
||||||
|
host_vendor = @host_vendor@
|
||||||
|
htmldir = @htmldir@
|
||||||
|
includedir = @includedir@
|
||||||
|
infodir = @infodir@
|
||||||
|
install_sh = @install_sh@
|
||||||
|
libdir = @libdir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
libext = @libext@
|
||||||
|
localedir = @localedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
mandir = @mandir@
|
||||||
|
mkdir_p = @mkdir_p@
|
||||||
|
oldincludedir = @oldincludedir@
|
||||||
|
pdfdir = @pdfdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
program_transform_name = @program_transform_name@
|
||||||
|
psdir = @psdir@
|
||||||
|
runstatedir = @runstatedir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
subdirs = @subdirs@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
target_alias = @target_alias@
|
||||||
|
top_build_prefix = @top_build_prefix@
|
||||||
|
top_builddir = @top_builddir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
|
||||||
|
#***************************************************************************
|
||||||
|
# _ _ ____ _
|
||||||
|
# Project ___| | | | _ \| |
|
||||||
|
# / __| | | | |_) | |
|
||||||
|
# | (__| |_| | _ <| |___
|
||||||
|
# \___|\___/|_| \_\_____|
|
||||||
|
#
|
||||||
|
# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# This software is licensed as described in the file COPYING, which
|
||||||
|
# you should have received as part of this distribution. The terms
|
||||||
|
# are also available at https://curl.se/docs/copyright.html.
|
||||||
|
#
|
||||||
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
# copies of the Software, and permit persons to whom the Software is
|
||||||
|
# furnished to do so, under the terms of the COPYING file.
|
||||||
|
#
|
||||||
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
# KIND, either express or implied.
|
||||||
|
#
|
||||||
|
###########################################################################
|
||||||
|
pkginclude_HEADERS = \
|
||||||
|
curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
|
||||||
|
typecheck-gcc.h system.h urlapi.h options.h
|
||||||
|
|
||||||
|
CHECKSRC = $(CS_$(V))
|
||||||
|
CS_0 = @echo " RUN " $@;
|
||||||
|
CS_1 =
|
||||||
|
CS_ = $(CS_0)
|
||||||
|
all: all-am
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||||
|
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/curl/Makefile'; \
|
||||||
|
$(am__cd) $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --foreign include/curl/Makefile
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
@case '$?' in \
|
||||||
|
*config.status*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||||
|
*) \
|
||||||
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||||
|
esac;
|
||||||
|
|
||||||
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
|
||||||
|
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(am__aclocal_m4_deps):
|
||||||
|
|
||||||
|
mostlyclean-libtool:
|
||||||
|
-rm -f *.lo
|
||||||
|
|
||||||
|
clean-libtool:
|
||||||
|
-rm -rf .libs _libs
|
||||||
|
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
|
||||||
|
if test -n "$$list"; then \
|
||||||
|
echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
|
||||||
|
$(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
|
||||||
|
fi; \
|
||||||
|
for p in $$list; do \
|
||||||
|
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||||
|
echo "$$d$$p"; \
|
||||||
|
done | $(am__base_list) | \
|
||||||
|
while read files; do \
|
||||||
|
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
|
||||||
|
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-pkgincludeHEADERS:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
|
||||||
|
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||||
|
dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
|
||||||
|
|
||||||
|
ID: $(am__tagged_files)
|
||||||
|
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||||
|
tags: tags-am
|
||||||
|
TAGS: tags
|
||||||
|
|
||||||
|
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||||
|
set x; \
|
||||||
|
here=`pwd`; \
|
||||||
|
$(am__define_uniq_tagged_files); \
|
||||||
|
shift; \
|
||||||
|
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||||
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
|
if test $$# -gt 0; then \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
"$$@" $$unique; \
|
||||||
|
else \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$unique; \
|
||||||
|
fi; \
|
||||||
|
fi
|
||||||
|
ctags: ctags-am
|
||||||
|
|
||||||
|
CTAGS: ctags
|
||||||
|
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||||
|
$(am__define_uniq_tagged_files); \
|
||||||
|
test -z "$(CTAGS_ARGS)$$unique" \
|
||||||
|
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||||
|
$$unique
|
||||||
|
|
||||||
|
GTAGS:
|
||||||
|
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||||
|
&& $(am__cd) $(top_srcdir) \
|
||||||
|
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||||
|
cscopelist: cscopelist-am
|
||||||
|
|
||||||
|
cscopelist-am: $(am__tagged_files)
|
||||||
|
list='$(am__tagged_files)'; \
|
||||||
|
case "$(srcdir)" in \
|
||||||
|
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||||
|
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||||
|
esac; \
|
||||||
|
for i in $$list; do \
|
||||||
|
if test -f "$$i"; then \
|
||||||
|
echo "$(subdir)/$$i"; \
|
||||||
|
else \
|
||||||
|
echo "$$sdir/$$i"; \
|
||||||
|
fi; \
|
||||||
|
done >> $(top_builddir)/cscope.files
|
||||||
|
|
||||||
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||||
|
distdir: $(BUILT_SOURCES)
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||||
|
|
||||||
|
distdir-am: $(DISTFILES)
|
||||||
|
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
|
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
|
list='$(DISTFILES)'; \
|
||||||
|
dist_files=`for file in $$list; do echo $$file; done | \
|
||||||
|
sed -e "s|^$$srcdirstrip/||;t" \
|
||||||
|
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||||
|
case $$dist_files in \
|
||||||
|
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||||
|
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||||
|
sort -u` ;; \
|
||||||
|
esac; \
|
||||||
|
for file in $$dist_files; do \
|
||||||
|
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
|
if test -d "$(distdir)/$$file"; then \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
|
fi; \
|
||||||
|
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||||
|
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
|
fi; \
|
||||||
|
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
|
else \
|
||||||
|
test -f "$(distdir)/$$file" \
|
||||||
|
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
check-am: all-am
|
||||||
|
check: check-am
|
||||||
|
@CURLDEBUG_FALSE@all-local:
|
||||||
|
all-am: Makefile $(HEADERS) all-local
|
||||||
|
installdirs:
|
||||||
|
for dir in "$(DESTDIR)$(pkgincludedir)"; do \
|
||||||
|
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||||
|
done
|
||||||
|
install: install-am
|
||||||
|
install-exec: install-exec-am
|
||||||
|
install-data: install-data-am
|
||||||
|
uninstall: uninstall-am
|
||||||
|
|
||||||
|
install-am: all-am
|
||||||
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-strip:
|
||||||
|
if test -z '$(STRIP)'; then \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
|
install; \
|
||||||
|
else \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
|
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||||
|
fi
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
@echo "This command is intended for maintainers to use"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
clean: clean-am
|
||||||
|
|
||||||
|
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
-rm -f Makefile
|
||||||
|
distclean-am: clean-am distclean-generic distclean-tags
|
||||||
|
|
||||||
|
dvi: dvi-am
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
html: html-am
|
||||||
|
|
||||||
|
html-am:
|
||||||
|
|
||||||
|
info: info-am
|
||||||
|
|
||||||
|
info-am:
|
||||||
|
|
||||||
|
install-data-am: install-pkgincludeHEADERS
|
||||||
|
|
||||||
|
install-dvi: install-dvi-am
|
||||||
|
|
||||||
|
install-dvi-am:
|
||||||
|
|
||||||
|
install-exec-am:
|
||||||
|
|
||||||
|
install-html: install-html-am
|
||||||
|
|
||||||
|
install-html-am:
|
||||||
|
|
||||||
|
install-info: install-info-am
|
||||||
|
|
||||||
|
install-info-am:
|
||||||
|
|
||||||
|
install-man:
|
||||||
|
|
||||||
|
install-pdf: install-pdf-am
|
||||||
|
|
||||||
|
install-pdf-am:
|
||||||
|
|
||||||
|
install-ps: install-ps-am
|
||||||
|
|
||||||
|
install-ps-am:
|
||||||
|
|
||||||
|
installcheck-am:
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
-rm -f Makefile
|
||||||
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||||
|
|
||||||
|
pdf: pdf-am
|
||||||
|
|
||||||
|
pdf-am:
|
||||||
|
|
||||||
|
ps: ps-am
|
||||||
|
|
||||||
|
ps-am:
|
||||||
|
|
||||||
|
uninstall-am: uninstall-pkgincludeHEADERS
|
||||||
|
|
||||||
|
.MAKE: install-am install-strip
|
||||||
|
|
||||||
|
.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \
|
||||||
|
clean-generic clean-libtool cscopelist-am ctags ctags-am \
|
||||||
|
distclean distclean-generic distclean-libtool distclean-tags \
|
||||||
|
distdir dvi dvi-am html html-am info info-am install \
|
||||||
|
install-am install-data install-data-am install-dvi \
|
||||||
|
install-dvi-am install-exec install-exec-am install-html \
|
||||||
|
install-html-am install-info install-info-am install-man \
|
||||||
|
install-pdf install-pdf-am install-pkgincludeHEADERS \
|
||||||
|
install-ps install-ps-am install-strip installcheck \
|
||||||
|
installcheck-am installdirs maintainer-clean \
|
||||||
|
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||||
|
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||||
|
uninstall-am uninstall-pkgincludeHEADERS
|
||||||
|
|
||||||
|
.PRECIOUS: Makefile
|
||||||
|
|
||||||
|
|
||||||
|
checksrc:
|
||||||
|
$(CHECKSRC)@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS)
|
||||||
|
|
||||||
|
# for debug builds, we scan the sources on all regular make invokes
|
||||||
|
@CURLDEBUG_TRUE@all-local: checksrc
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
3067
libcurl/curl/curl.h
Normal file
3067
libcurl/curl/curl.h
Normal file
File diff suppressed because it is too large
Load Diff
77
libcurl/curl/curlver.h
Normal file
77
libcurl/curl/curlver.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#ifndef CURLINC_CURLVER_H
|
||||||
|
#define CURLINC_CURLVER_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at https://curl.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/* This header file contains nothing but libcurl version info, generated by
|
||||||
|
a script at release-time. This was made its own header file in 7.11.2 */
|
||||||
|
|
||||||
|
/* This is the global package copyright */
|
||||||
|
#define LIBCURL_COPYRIGHT "1996 - 2021 Daniel Stenberg, <daniel@haxx.se>."
|
||||||
|
|
||||||
|
/* This is the version number of the libcurl package from which this header
|
||||||
|
file origins: */
|
||||||
|
#define LIBCURL_VERSION "7.79.1"
|
||||||
|
|
||||||
|
/* The numeric version number is also available "in parts" by using these
|
||||||
|
defines: */
|
||||||
|
#define LIBCURL_VERSION_MAJOR 7
|
||||||
|
#define LIBCURL_VERSION_MINOR 79
|
||||||
|
#define LIBCURL_VERSION_PATCH 1
|
||||||
|
|
||||||
|
/* This is the numeric version of the libcurl version number, meant for easier
|
||||||
|
parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will
|
||||||
|
always follow this syntax:
|
||||||
|
|
||||||
|
0xXXYYZZ
|
||||||
|
|
||||||
|
Where XX, YY and ZZ are the main version, release and patch numbers in
|
||||||
|
hexadecimal (using 8 bits each). All three numbers are always represented
|
||||||
|
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
|
||||||
|
appears as "0x090b07".
|
||||||
|
|
||||||
|
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
|
||||||
|
and it is always a greater number in a more recent release. It makes
|
||||||
|
comparisons with greater than and less than work.
|
||||||
|
|
||||||
|
Note: This define is the full hex number and _does not_ use the
|
||||||
|
CURL_VERSION_BITS() macro since curl's own configure script greps for it
|
||||||
|
and needs it to contain the full number.
|
||||||
|
*/
|
||||||
|
#define LIBCURL_VERSION_NUM 0x074f01
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the date and time when the full source package was created. The
|
||||||
|
* timestamp is not stored in git, as the timestamp is properly set in the
|
||||||
|
* tarballs by the maketgz script.
|
||||||
|
*
|
||||||
|
* The format of the date follows this template:
|
||||||
|
*
|
||||||
|
* "2007-11-23"
|
||||||
|
*/
|
||||||
|
#define LIBCURL_TIMESTAMP "2021-09-22"
|
||||||
|
|
||||||
|
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
|
||||||
|
#define CURL_AT_LEAST_VERSION(x,y,z) \
|
||||||
|
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
|
||||||
|
|
||||||
|
#endif /* CURLINC_CURLVER_H */
|
123
libcurl/curl/easy.h
Normal file
123
libcurl/curl/easy.h
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
#ifndef CURLINC_EASY_H
|
||||||
|
#define CURLINC_EASY_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at https://curl.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Flag bits in the curl_blob struct: */
|
||||||
|
#define CURL_BLOB_COPY 1 /* tell libcurl to copy the data */
|
||||||
|
#define CURL_BLOB_NOCOPY 0 /* tell libcurl to NOT copy the data */
|
||||||
|
|
||||||
|
struct curl_blob {
|
||||||
|
void *data;
|
||||||
|
size_t len;
|
||||||
|
unsigned int flags; /* bit 0 is defined, the rest are reserved and should be
|
||||||
|
left zeroes */
|
||||||
|
};
|
||||||
|
|
||||||
|
CURL_EXTERN CURL *curl_easy_init(void);
|
||||||
|
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
|
||||||
|
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
|
||||||
|
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NAME curl_easy_getinfo()
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
*
|
||||||
|
* Request internal information from the curl session with this function. The
|
||||||
|
* third argument MUST be a pointer to a long, a pointer to a char * or a
|
||||||
|
* pointer to a double (as the documentation describes elsewhere). The data
|
||||||
|
* pointed to will be filled in accordingly and can be relied upon only if the
|
||||||
|
* function returns CURLE_OK. This function is intended to get used *AFTER* a
|
||||||
|
* performed transfer, all results from this function are undefined until the
|
||||||
|
* transfer is completed.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NAME curl_easy_duphandle()
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
*
|
||||||
|
* Creates a new curl session handle with the same options set for the handle
|
||||||
|
* passed in. Duplicating a handle could only be a matter of cloning data and
|
||||||
|
* options, internal state info and things like persistent connections cannot
|
||||||
|
* be transferred. It is useful in multithreaded applications when you can run
|
||||||
|
* curl_easy_duphandle() for each new thread to avoid a series of identical
|
||||||
|
* curl_easy_setopt() invokes in every thread.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NAME curl_easy_reset()
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
*
|
||||||
|
* Re-initializes a CURL handle to the default values. This puts back the
|
||||||
|
* handle to the same state as it was in when it was just created.
|
||||||
|
*
|
||||||
|
* It does keep: live connections, the Session ID cache, the DNS cache and the
|
||||||
|
* cookies.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN void curl_easy_reset(CURL *curl);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NAME curl_easy_recv()
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
*
|
||||||
|
* Receives data from the connected socket. Use after successful
|
||||||
|
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
|
||||||
|
size_t *n);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NAME curl_easy_send()
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
*
|
||||||
|
* Sends data over the connected socket. Use after successful
|
||||||
|
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
|
||||||
|
size_t buflen, size_t *n);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NAME curl_easy_upkeep()
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
*
|
||||||
|
* Performs connection upkeep for the given session handle.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLcode curl_easy_upkeep(CURL *curl);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
50
libcurl/curl/mprintf.h
Normal file
50
libcurl/curl/mprintf.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#ifndef CURLINC_MPRINTF_H
|
||||||
|
#define CURLINC_MPRINTF_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at https://curl.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h> /* needed for FILE */
|
||||||
|
#include "curl.h" /* for CURL_EXTERN */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CURL_EXTERN int curl_mprintf(const char *format, ...);
|
||||||
|
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
|
||||||
|
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
|
||||||
|
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
|
||||||
|
const char *format, ...);
|
||||||
|
CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
|
||||||
|
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
|
||||||
|
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
|
||||||
|
CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
|
||||||
|
const char *format, va_list args);
|
||||||
|
CURL_EXTERN char *curl_maprintf(const char *format, ...);
|
||||||
|
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CURLINC_MPRINTF_H */
|
456
libcurl/curl/multi.h
Normal file
456
libcurl/curl/multi.h
Normal file
@ -0,0 +1,456 @@
|
|||||||
|
#ifndef CURLINC_MULTI_H
|
||||||
|
#define CURLINC_MULTI_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at https://curl.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
/*
|
||||||
|
This is an "external" header file. Don't give away any internals here!
|
||||||
|
|
||||||
|
GOALS
|
||||||
|
|
||||||
|
o Enable a "pull" interface. The application that uses libcurl decides where
|
||||||
|
and when to ask libcurl to get/send data.
|
||||||
|
|
||||||
|
o Enable multiple simultaneous transfers in the same thread without making it
|
||||||
|
complicated for the application.
|
||||||
|
|
||||||
|
o Enable the application to select() on its own file descriptors and curl's
|
||||||
|
file descriptors simultaneous easily.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This header file should not really need to include "curl.h" since curl.h
|
||||||
|
* itself includes this file and we expect user applications to do #include
|
||||||
|
* <curl/curl.h> without the need for especially including multi.h.
|
||||||
|
*
|
||||||
|
* For some reason we added this include here at one point, and rather than to
|
||||||
|
* break existing (wrongly written) libcurl applications, we leave it as-is
|
||||||
|
* but with this warning attached.
|
||||||
|
*/
|
||||||
|
#include "curl.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
|
||||||
|
typedef struct Curl_multi CURLM;
|
||||||
|
#else
|
||||||
|
typedef void CURLM;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
|
||||||
|
curl_multi_socket*() soon */
|
||||||
|
CURLM_OK,
|
||||||
|
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
|
||||||
|
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
|
||||||
|
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
|
||||||
|
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
|
||||||
|
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
|
||||||
|
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
|
||||||
|
CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was
|
||||||
|
attempted to get added - again */
|
||||||
|
CURLM_RECURSIVE_API_CALL, /* an api function was called from inside a
|
||||||
|
callback */
|
||||||
|
CURLM_WAKEUP_FAILURE, /* wakeup is unavailable or failed */
|
||||||
|
CURLM_BAD_FUNCTION_ARGUMENT, /* function called with a bad parameter */
|
||||||
|
CURLM_LAST
|
||||||
|
} CURLMcode;
|
||||||
|
|
||||||
|
/* just to make code nicer when using curl_multi_socket() you can now check
|
||||||
|
for CURLM_CALL_MULTI_SOCKET too in the same style it works for
|
||||||
|
curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
|
||||||
|
#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
|
||||||
|
|
||||||
|
/* bitmask bits for CURLMOPT_PIPELINING */
|
||||||
|
#define CURLPIPE_NOTHING 0L
|
||||||
|
#define CURLPIPE_HTTP1 1L
|
||||||
|
#define CURLPIPE_MULTIPLEX 2L
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CURLMSG_NONE, /* first, not used */
|
||||||
|
CURLMSG_DONE, /* This easy handle has completed. 'result' contains
|
||||||
|
the CURLcode of the transfer */
|
||||||
|
CURLMSG_LAST /* last, not used */
|
||||||
|
} CURLMSG;
|
||||||
|
|
||||||
|
struct CURLMsg {
|
||||||
|
CURLMSG msg; /* what this message means */
|
||||||
|
CURL *easy_handle; /* the handle it concerns */
|
||||||
|
union {
|
||||||
|
void *whatever; /* message-specific data */
|
||||||
|
CURLcode result; /* return code for transfer */
|
||||||
|
} data;
|
||||||
|
};
|
||||||
|
typedef struct CURLMsg CURLMsg;
|
||||||
|
|
||||||
|
/* Based on poll(2) structure and values.
|
||||||
|
* We don't use pollfd and POLL* constants explicitly
|
||||||
|
* to cover platforms without poll(). */
|
||||||
|
#define CURL_WAIT_POLLIN 0x0001
|
||||||
|
#define CURL_WAIT_POLLPRI 0x0002
|
||||||
|
#define CURL_WAIT_POLLOUT 0x0004
|
||||||
|
|
||||||
|
struct curl_waitfd {
|
||||||
|
curl_socket_t fd;
|
||||||
|
short events;
|
||||||
|
short revents; /* not supported yet */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_init()
|
||||||
|
*
|
||||||
|
* Desc: inititalize multi-style curl usage
|
||||||
|
*
|
||||||
|
* Returns: a new CURLM handle to use in all 'curl_multi' functions.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLM *curl_multi_init(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_add_handle()
|
||||||
|
*
|
||||||
|
* Desc: add a standard curl handle to the multi stack
|
||||||
|
*
|
||||||
|
* Returns: CURLMcode type, general multi error code.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
||||||
|
CURL *curl_handle);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_remove_handle()
|
||||||
|
*
|
||||||
|
* Desc: removes a curl handle from the multi stack again
|
||||||
|
*
|
||||||
|
* Returns: CURLMcode type, general multi error code.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
|
||||||
|
CURL *curl_handle);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_fdset()
|
||||||
|
*
|
||||||
|
* Desc: Ask curl for its fd_set sets. The app can use these to select() or
|
||||||
|
* poll() on. We want curl_multi_perform() called as soon as one of
|
||||||
|
* them are ready.
|
||||||
|
*
|
||||||
|
* Returns: CURLMcode type, general multi error code.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||||
|
fd_set *read_fd_set,
|
||||||
|
fd_set *write_fd_set,
|
||||||
|
fd_set *exc_fd_set,
|
||||||
|
int *max_fd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_wait()
|
||||||
|
*
|
||||||
|
* Desc: Poll on all fds within a CURLM set as well as any
|
||||||
|
* additional fds passed to the function.
|
||||||
|
*
|
||||||
|
* Returns: CURLMcode type, general multi error code.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
|
||||||
|
struct curl_waitfd extra_fds[],
|
||||||
|
unsigned int extra_nfds,
|
||||||
|
int timeout_ms,
|
||||||
|
int *ret);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_poll()
|
||||||
|
*
|
||||||
|
* Desc: Poll on all fds within a CURLM set as well as any
|
||||||
|
* additional fds passed to the function.
|
||||||
|
*
|
||||||
|
* Returns: CURLMcode type, general multi error code.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_poll(CURLM *multi_handle,
|
||||||
|
struct curl_waitfd extra_fds[],
|
||||||
|
unsigned int extra_nfds,
|
||||||
|
int timeout_ms,
|
||||||
|
int *ret);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_wakeup()
|
||||||
|
*
|
||||||
|
* Desc: wakes up a sleeping curl_multi_poll call.
|
||||||
|
*
|
||||||
|
* Returns: CURLMcode type, general multi error code.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_perform()
|
||||||
|
*
|
||||||
|
* Desc: When the app thinks there's data available for curl it calls this
|
||||||
|
* function to read/write whatever there is right now. This returns
|
||||||
|
* as soon as the reads and writes are done. This function does not
|
||||||
|
* require that there actually is data available for reading or that
|
||||||
|
* data can be written, it can be called just in case. It returns
|
||||||
|
* the number of handles that still transfer data in the second
|
||||||
|
* argument's integer-pointer.
|
||||||
|
*
|
||||||
|
* Returns: CURLMcode type, general multi error code. *NOTE* that this only
|
||||||
|
* returns errors etc regarding the whole multi stack. There might
|
||||||
|
* still have occurred problems on individual transfers even when
|
||||||
|
* this returns OK.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
|
||||||
|
int *running_handles);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_cleanup()
|
||||||
|
*
|
||||||
|
* Desc: Cleans up and removes a whole multi stack. It does not free or
|
||||||
|
* touch any individual easy handles in any way. We need to define
|
||||||
|
* in what state those handles will be if this function is called
|
||||||
|
* in the middle of a transfer.
|
||||||
|
*
|
||||||
|
* Returns: CURLMcode type, general multi error code.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_info_read()
|
||||||
|
*
|
||||||
|
* Desc: Ask the multi handle if there's any messages/informationals from
|
||||||
|
* the individual transfers. Messages include informationals such as
|
||||||
|
* error code from the transfer or just the fact that a transfer is
|
||||||
|
* completed. More details on these should be written down as well.
|
||||||
|
*
|
||||||
|
* Repeated calls to this function will return a new struct each
|
||||||
|
* time, until a special "end of msgs" struct is returned as a signal
|
||||||
|
* that there is no more to get at this point.
|
||||||
|
*
|
||||||
|
* The data the returned pointer points to will not survive calling
|
||||||
|
* curl_multi_cleanup().
|
||||||
|
*
|
||||||
|
* The 'CURLMsg' struct is meant to be very simple and only contain
|
||||||
|
* very basic information. If more involved information is wanted,
|
||||||
|
* we will provide the particular "transfer handle" in that struct
|
||||||
|
* and that should/could/would be used in subsequent
|
||||||
|
* curl_easy_getinfo() calls (or similar). The point being that we
|
||||||
|
* must never expose complex structs to applications, as then we'll
|
||||||
|
* undoubtably get backwards compatibility problems in the future.
|
||||||
|
*
|
||||||
|
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
|
||||||
|
* of structs. It also writes the number of messages left in the
|
||||||
|
* queue (after this read) in the integer the second argument points
|
||||||
|
* to.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
|
||||||
|
int *msgs_in_queue);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_strerror()
|
||||||
|
*
|
||||||
|
* Desc: The curl_multi_strerror function may be used to turn a CURLMcode
|
||||||
|
* value into the equivalent human readable error string. This is
|
||||||
|
* useful for printing meaningful error messages.
|
||||||
|
*
|
||||||
|
* Returns: A pointer to a null-terminated error message.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_socket() and
|
||||||
|
* curl_multi_socket_all()
|
||||||
|
*
|
||||||
|
* Desc: An alternative version of curl_multi_perform() that allows the
|
||||||
|
* application to pass in one of the file descriptors that have been
|
||||||
|
* detected to have "action" on them and let libcurl perform.
|
||||||
|
* See man page for details.
|
||||||
|
*/
|
||||||
|
#define CURL_POLL_NONE 0
|
||||||
|
#define CURL_POLL_IN 1
|
||||||
|
#define CURL_POLL_OUT 2
|
||||||
|
#define CURL_POLL_INOUT 3
|
||||||
|
#define CURL_POLL_REMOVE 4
|
||||||
|
|
||||||
|
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
|
||||||
|
|
||||||
|
#define CURL_CSELECT_IN 0x01
|
||||||
|
#define CURL_CSELECT_OUT 0x02
|
||||||
|
#define CURL_CSELECT_ERR 0x04
|
||||||
|
|
||||||
|
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
|
||||||
|
curl_socket_t s, /* socket */
|
||||||
|
int what, /* see above */
|
||||||
|
void *userp, /* private callback
|
||||||
|
pointer */
|
||||||
|
void *socketp); /* private socket
|
||||||
|
pointer */
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_timer_callback
|
||||||
|
*
|
||||||
|
* Desc: Called by libcurl whenever the library detects a change in the
|
||||||
|
* maximum number of milliseconds the app is allowed to wait before
|
||||||
|
* curl_multi_socket() or curl_multi_perform() must be called
|
||||||
|
* (to allow libcurl's timed events to take place).
|
||||||
|
*
|
||||||
|
* Returns: The callback should return zero.
|
||||||
|
*/
|
||||||
|
typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
|
||||||
|
long timeout_ms, /* see above */
|
||||||
|
void *userp); /* private callback
|
||||||
|
pointer */
|
||||||
|
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
|
||||||
|
int *running_handles);
|
||||||
|
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
|
||||||
|
curl_socket_t s,
|
||||||
|
int ev_bitmask,
|
||||||
|
int *running_handles);
|
||||||
|
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
|
||||||
|
int *running_handles);
|
||||||
|
|
||||||
|
#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
|
||||||
|
/* This macro below was added in 7.16.3 to push users who recompile to use
|
||||||
|
the new curl_multi_socket_action() instead of the old curl_multi_socket()
|
||||||
|
*/
|
||||||
|
#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_timeout()
|
||||||
|
*
|
||||||
|
* Desc: Returns the maximum number of milliseconds the app is allowed to
|
||||||
|
* wait before curl_multi_socket() or curl_multi_perform() must be
|
||||||
|
* called (to allow libcurl's timed events to take place).
|
||||||
|
*
|
||||||
|
* Returns: CURLM error code.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
|
||||||
|
long *milliseconds);
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
/* This is the socket callback function pointer */
|
||||||
|
CURLOPT(CURLMOPT_SOCKETFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 1),
|
||||||
|
|
||||||
|
/* This is the argument passed to the socket callback */
|
||||||
|
CURLOPT(CURLMOPT_SOCKETDATA, CURLOPTTYPE_OBJECTPOINT, 2),
|
||||||
|
|
||||||
|
/* set to 1 to enable pipelining for this multi handle */
|
||||||
|
CURLOPT(CURLMOPT_PIPELINING, CURLOPTTYPE_LONG, 3),
|
||||||
|
|
||||||
|
/* This is the timer callback function pointer */
|
||||||
|
CURLOPT(CURLMOPT_TIMERFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 4),
|
||||||
|
|
||||||
|
/* This is the argument passed to the timer callback */
|
||||||
|
CURLOPT(CURLMOPT_TIMERDATA, CURLOPTTYPE_OBJECTPOINT, 5),
|
||||||
|
|
||||||
|
/* maximum number of entries in the connection cache */
|
||||||
|
CURLOPT(CURLMOPT_MAXCONNECTS, CURLOPTTYPE_LONG, 6),
|
||||||
|
|
||||||
|
/* maximum number of (pipelining) connections to one host */
|
||||||
|
CURLOPT(CURLMOPT_MAX_HOST_CONNECTIONS, CURLOPTTYPE_LONG, 7),
|
||||||
|
|
||||||
|
/* maximum number of requests in a pipeline */
|
||||||
|
CURLOPT(CURLMOPT_MAX_PIPELINE_LENGTH, CURLOPTTYPE_LONG, 8),
|
||||||
|
|
||||||
|
/* a connection with a content-length longer than this
|
||||||
|
will not be considered for pipelining */
|
||||||
|
CURLOPT(CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 9),
|
||||||
|
|
||||||
|
/* a connection with a chunk length longer than this
|
||||||
|
will not be considered for pipelining */
|
||||||
|
CURLOPT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE, CURLOPTTYPE_OFF_T, 10),
|
||||||
|
|
||||||
|
/* a list of site names(+port) that are blocked from pipelining */
|
||||||
|
CURLOPT(CURLMOPT_PIPELINING_SITE_BL, CURLOPTTYPE_OBJECTPOINT, 11),
|
||||||
|
|
||||||
|
/* a list of server types that are blocked from pipelining */
|
||||||
|
CURLOPT(CURLMOPT_PIPELINING_SERVER_BL, CURLOPTTYPE_OBJECTPOINT, 12),
|
||||||
|
|
||||||
|
/* maximum number of open connections in total */
|
||||||
|
CURLOPT(CURLMOPT_MAX_TOTAL_CONNECTIONS, CURLOPTTYPE_LONG, 13),
|
||||||
|
|
||||||
|
/* This is the server push callback function pointer */
|
||||||
|
CURLOPT(CURLMOPT_PUSHFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 14),
|
||||||
|
|
||||||
|
/* This is the argument passed to the server push callback */
|
||||||
|
CURLOPT(CURLMOPT_PUSHDATA, CURLOPTTYPE_OBJECTPOINT, 15),
|
||||||
|
|
||||||
|
/* maximum number of concurrent streams to support on a connection */
|
||||||
|
CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16),
|
||||||
|
|
||||||
|
CURLMOPT_LASTENTRY /* the last unused */
|
||||||
|
} CURLMoption;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_setopt()
|
||||||
|
*
|
||||||
|
* Desc: Sets options for the multi handle.
|
||||||
|
*
|
||||||
|
* Returns: CURLM error code.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
|
||||||
|
CURLMoption option, ...);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_multi_assign()
|
||||||
|
*
|
||||||
|
* Desc: This function sets an association in the multi handle between the
|
||||||
|
* given socket and a private pointer of the application. This is
|
||||||
|
* (only) useful for curl_multi_socket uses.
|
||||||
|
*
|
||||||
|
* Returns: CURLM error code.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
|
||||||
|
curl_socket_t sockfd, void *sockp);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name: curl_push_callback
|
||||||
|
*
|
||||||
|
* Desc: This callback gets called when a new stream is being pushed by the
|
||||||
|
* server. It approves or denies the new stream. It can also decide
|
||||||
|
* to completely fail the connection.
|
||||||
|
*
|
||||||
|
* Returns: CURL_PUSH_OK, CURL_PUSH_DENY or CURL_PUSH_ERROROUT
|
||||||
|
*/
|
||||||
|
#define CURL_PUSH_OK 0
|
||||||
|
#define CURL_PUSH_DENY 1
|
||||||
|
#define CURL_PUSH_ERROROUT 2 /* added in 7.72.0 */
|
||||||
|
|
||||||
|
struct curl_pushheaders; /* forward declaration only */
|
||||||
|
|
||||||
|
CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
|
||||||
|
size_t num);
|
||||||
|
CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
|
typedef int (*curl_push_callback)(CURL *parent,
|
||||||
|
CURL *easy,
|
||||||
|
size_t num_headers,
|
||||||
|
struct curl_pushheaders *headers,
|
||||||
|
void *userp);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* end of extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
68
libcurl/curl/options.h
Normal file
68
libcurl/curl/options.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#ifndef CURLINC_OPTIONS_H
|
||||||
|
#define CURLINC_OPTIONS_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at https://curl.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CURLOT_LONG, /* long (a range of values) */
|
||||||
|
CURLOT_VALUES, /* (a defined set or bitmask) */
|
||||||
|
CURLOT_OFF_T, /* curl_off_t (a range of values) */
|
||||||
|
CURLOT_OBJECT, /* pointer (void *) */
|
||||||
|
CURLOT_STRING, /* (char * to zero terminated buffer) */
|
||||||
|
CURLOT_SLIST, /* (struct curl_slist *) */
|
||||||
|
CURLOT_CBPTR, /* (void * passed as-is to a callback) */
|
||||||
|
CURLOT_BLOB, /* blob (struct curl_blob *) */
|
||||||
|
CURLOT_FUNCTION /* function pointer */
|
||||||
|
} curl_easytype;
|
||||||
|
|
||||||
|
/* Flag bits */
|
||||||
|
|
||||||
|
/* "alias" means it is provided for old programs to remain functional,
|
||||||
|
we prefer another name */
|
||||||
|
#define CURLOT_FLAG_ALIAS (1<<0)
|
||||||
|
|
||||||
|
/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size
|
||||||
|
to use for curl_easy_setopt() for the given id */
|
||||||
|
struct curl_easyoption {
|
||||||
|
const char *name;
|
||||||
|
CURLoption id;
|
||||||
|
curl_easytype type;
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
CURL_EXTERN const struct curl_easyoption *
|
||||||
|
curl_easy_option_by_name(const char *name);
|
||||||
|
|
||||||
|
CURL_EXTERN const struct curl_easyoption *
|
||||||
|
curl_easy_option_by_id (CURLoption id);
|
||||||
|
|
||||||
|
CURL_EXTERN const struct curl_easyoption *
|
||||||
|
curl_easy_option_next(const struct curl_easyoption *prev);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* end of extern "C" */
|
||||||
|
#endif
|
||||||
|
#endif /* CURLINC_OPTIONS_H */
|
33
libcurl/curl/stdcheaders.h
Normal file
33
libcurl/curl/stdcheaders.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef CURLINC_STDCHEADERS_H
|
||||||
|
#define CURLINC_STDCHEADERS_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at https://curl.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
size_t fread(void *, size_t, size_t, FILE *);
|
||||||
|
size_t fwrite(const void *, size_t, size_t, FILE *);
|
||||||
|
|
||||||
|
int strcasecmp(const char *, const char *);
|
||||||
|
int strncasecmp(const char *, const char *, size_t);
|
||||||
|
|
||||||
|
#endif /* CURLINC_STDCHEADERS_H */
|
504
libcurl/curl/system.h
Normal file
504
libcurl/curl/system.h
Normal file
@ -0,0 +1,504 @@
|
|||||||
|
#ifndef CURLINC_SYSTEM_H
|
||||||
|
#define CURLINC_SYSTEM_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at https://curl.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to keep one section per platform, compiler and architecture, otherwise,
|
||||||
|
* if an existing section is reused for a different one and later on the
|
||||||
|
* original is adjusted, probably the piggybacking one can be adversely
|
||||||
|
* changed.
|
||||||
|
*
|
||||||
|
* In order to differentiate between platforms/compilers/architectures use
|
||||||
|
* only compiler built in predefined preprocessor symbols.
|
||||||
|
*
|
||||||
|
* curl_off_t
|
||||||
|
* ----------
|
||||||
|
*
|
||||||
|
* For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
|
||||||
|
* wide signed integral data type. The width of this data type must remain
|
||||||
|
* constant and independent of any possible large file support settings.
|
||||||
|
*
|
||||||
|
* As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
|
||||||
|
* wide signed integral data type if there is no 64-bit type.
|
||||||
|
*
|
||||||
|
* As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
|
||||||
|
* only be violated if off_t is the only 64-bit data type available and the
|
||||||
|
* size of off_t is independent of large file support settings. Keep your
|
||||||
|
* build on the safe side avoiding an off_t gating. If you have a 64-bit
|
||||||
|
* off_t then take for sure that another 64-bit data type exists, dig deeper
|
||||||
|
* and you will find it.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__DJGPP__) || defined(__GO32__)
|
||||||
|
# if defined(__DJGPP__) && (__DJGPP__ > 1)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# else
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
|
||||||
|
#elif defined(__SALFORDC__)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
|
||||||
|
#elif defined(__BORLANDC__)
|
||||||
|
# if (__BORLANDC__ < 0x520)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# else
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
|
||||||
|
#elif defined(__TURBOC__)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
|
||||||
|
#elif defined(__WATCOMC__)
|
||||||
|
# if defined(__386__)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||||
|
# else
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
|
||||||
|
#elif defined(__POCC__)
|
||||||
|
# if (__POCC__ < 280)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# elif defined(_MSC_VER)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||||
|
# else
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
|
||||||
|
#elif defined(__LCC__)
|
||||||
|
# if defined(__e2k__) /* MCST eLbrus C Compiler */
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||||
|
# define CURL_PULL_SYS_TYPES_H 1
|
||||||
|
# define CURL_PULL_SYS_SOCKET_H 1
|
||||||
|
# else /* Local (or Little) C Compiler */
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#elif defined(__SYMBIAN32__)
|
||||||
|
# if defined(__EABI__) /* Treat all ARM compilers equally */
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# elif defined(__CW32__)
|
||||||
|
# pragma longlong on
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# elif defined(__VC32__)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
|
||||||
|
|
||||||
|
#elif defined(__MWERKS__)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
|
||||||
|
#elif defined(_WIN32_WCE)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
|
||||||
|
#elif defined(__MINGW32__)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||||
|
# define CURL_PULL_SYS_TYPES_H 1
|
||||||
|
# define CURL_PULL_WS2TCPIP_H 1
|
||||||
|
|
||||||
|
#elif defined(__VMS)
|
||||||
|
# if defined(__VAX)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# else
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
|
||||||
|
|
||||||
|
#elif defined(__OS400__)
|
||||||
|
# if defined(__ILEC400__)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||||
|
# define CURL_PULL_SYS_TYPES_H 1
|
||||||
|
# define CURL_PULL_SYS_SOCKET_H 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#elif defined(__MVS__)
|
||||||
|
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||||
|
# if defined(_ILP32)
|
||||||
|
# elif defined(_LP64)
|
||||||
|
# endif
|
||||||
|
# if defined(_LONG_LONG)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# elif defined(_LP64)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# else
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||||
|
# define CURL_PULL_SYS_TYPES_H 1
|
||||||
|
# define CURL_PULL_SYS_SOCKET_H 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#elif defined(__370__)
|
||||||
|
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||||
|
# if defined(_ILP32)
|
||||||
|
# elif defined(_LP64)
|
||||||
|
# endif
|
||||||
|
# if defined(_LONG_LONG)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# elif defined(_LP64)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# else
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||||
|
# define CURL_PULL_SYS_TYPES_H 1
|
||||||
|
# define CURL_PULL_SYS_SOCKET_H 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#elif defined(TPF)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
|
||||||
|
#elif defined(__TINYC__) /* also known as tcc */
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||||
|
# define CURL_PULL_SYS_TYPES_H 1
|
||||||
|
# define CURL_PULL_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* Oracle Solaris Studio */
|
||||||
|
# if !defined(__LP64) && (defined(__ILP32) || \
|
||||||
|
defined(__i386) || \
|
||||||
|
defined(__sparcv8) || \
|
||||||
|
defined(__sparcv8plus))
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# elif defined(__LP64) || \
|
||||||
|
defined(__amd64) || defined(__sparcv9)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||||
|
# define CURL_PULL_SYS_TYPES_H 1
|
||||||
|
# define CURL_PULL_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
#elif defined(__xlc__) /* IBM xlc compiler */
|
||||||
|
# if !defined(_LP64)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# else
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||||
|
# define CURL_PULL_SYS_TYPES_H 1
|
||||||
|
# define CURL_PULL_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* ===================================== */
|
||||||
|
/* KEEP MSVC THE PENULTIMATE ENTRY */
|
||||||
|
/* ===================================== */
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||||
|
# else
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
|
||||||
|
/* ===================================== */
|
||||||
|
/* KEEP GENERIC GCC THE LAST ENTRY */
|
||||||
|
/* ===================================== */
|
||||||
|
|
||||||
|
#elif defined(__GNUC__) && !defined(_SCO_DS)
|
||||||
|
# if !defined(__LP64__) && \
|
||||||
|
(defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \
|
||||||
|
defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \
|
||||||
|
defined(__sparc__) || defined(__mips__) || defined(__sh__) || \
|
||||||
|
defined(__XTENSA__) || \
|
||||||
|
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \
|
||||||
|
(defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L))
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||||
|
# elif defined(__LP64__) || \
|
||||||
|
defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
|
||||||
|
defined(__e2k__) || \
|
||||||
|
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
|
||||||
|
(defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# endif
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||||
|
# define CURL_PULL_SYS_TYPES_H 1
|
||||||
|
# define CURL_PULL_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* generic "safe guess" on old 32 bit style */
|
||||||
|
# define CURL_TYPEOF_CURL_OFF_T long
|
||||||
|
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||||
|
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_T L
|
||||||
|
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||||
|
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _AIX
|
||||||
|
/* AIX needs <sys/poll.h> */
|
||||||
|
#define CURL_PULL_SYS_POLL_H
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */
|
||||||
|
/* ws2tcpip.h is required here to properly make type definitions below. */
|
||||||
|
#ifdef CURL_PULL_WS2TCPIP_H
|
||||||
|
# include <winsock2.h>
|
||||||
|
# include <windows.h>
|
||||||
|
# include <ws2tcpip.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
|
||||||
|
/* sys/types.h is required here to properly make type definitions below. */
|
||||||
|
#ifdef CURL_PULL_SYS_TYPES_H
|
||||||
|
# include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
|
||||||
|
/* sys/socket.h is required here to properly make type definitions below. */
|
||||||
|
#ifdef CURL_PULL_SYS_SOCKET_H
|
||||||
|
# include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */
|
||||||
|
/* sys/poll.h is required here to properly make type definitions below. */
|
||||||
|
#ifdef CURL_PULL_SYS_POLL_H
|
||||||
|
# include <sys/poll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Data type definition of curl_socklen_t. */
|
||||||
|
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
|
||||||
|
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Data type definition of curl_off_t. */
|
||||||
|
|
||||||
|
#ifdef CURL_TYPEOF_CURL_OFF_T
|
||||||
|
typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
|
||||||
|
* these to be visible and exported by the external libcurl interface API,
|
||||||
|
* while also making them visible to the library internals, simply including
|
||||||
|
* curl_setup.h, without actually needing to include curl.h internally.
|
||||||
|
* If some day this section would grow big enough, all this should be moved
|
||||||
|
* to its own header file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Figure out if we can use the ## preprocessor operator, which is supported
|
||||||
|
* by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
|
||||||
|
* or __cplusplus so we need to carefully check for them too.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
|
||||||
|
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
|
||||||
|
defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
|
||||||
|
defined(__ILEC400__)
|
||||||
|
/* This compiler is believed to have an ISO compatible preprocessor */
|
||||||
|
#define CURL_ISOCPP
|
||||||
|
#else
|
||||||
|
/* This compiler is believed NOT to have an ISO compatible preprocessor */
|
||||||
|
#undef CURL_ISOCPP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macros for minimum-width signed and unsigned curl_off_t integer constants.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
|
||||||
|
# define CURLINC_OFF_T_C_HLPR2(x) x
|
||||||
|
# define CURLINC_OFF_T_C_HLPR1(x) CURLINC_OFF_T_C_HLPR2(x)
|
||||||
|
# define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \
|
||||||
|
CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
|
||||||
|
# define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val) ## \
|
||||||
|
CURLINC_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
|
||||||
|
#else
|
||||||
|
# ifdef CURL_ISOCPP
|
||||||
|
# define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
|
||||||
|
# else
|
||||||
|
# define CURLINC_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
|
||||||
|
# endif
|
||||||
|
# define CURLINC_OFF_T_C_HLPR1(Val,Suffix) CURLINC_OFF_T_C_HLPR2(Val,Suffix)
|
||||||
|
# define CURL_OFF_T_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
|
||||||
|
# define CURL_OFF_TU_C(Val) CURLINC_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CURLINC_SYSTEM_H */
|
705
libcurl/curl/typecheck-gcc.h
Normal file
705
libcurl/curl/typecheck-gcc.h
Normal file
@ -0,0 +1,705 @@
|
|||||||
|
#ifndef CURLINC_TYPECHECK_GCC_H
|
||||||
|
#define CURLINC_TYPECHECK_GCC_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at https://curl.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/* wraps curl_easy_setopt() with typechecking */
|
||||||
|
|
||||||
|
/* To add a new kind of warning, add an
|
||||||
|
* if(curlcheck_sometype_option(_curl_opt))
|
||||||
|
* if(!curlcheck_sometype(value))
|
||||||
|
* _curl_easy_setopt_err_sometype();
|
||||||
|
* block and define curlcheck_sometype_option, curlcheck_sometype and
|
||||||
|
* _curl_easy_setopt_err_sometype below
|
||||||
|
*
|
||||||
|
* NOTE: We use two nested 'if' statements here instead of the && operator, in
|
||||||
|
* order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
|
||||||
|
* when compiling with -Wlogical-op.
|
||||||
|
*
|
||||||
|
* To add an option that uses the same type as an existing option, you'll just
|
||||||
|
* need to extend the appropriate _curl_*_option macro
|
||||||
|
*/
|
||||||
|
#define curl_easy_setopt(handle, option, value) \
|
||||||
|
__extension__({ \
|
||||||
|
__typeof__(option) _curl_opt = option; \
|
||||||
|
if(__builtin_constant_p(_curl_opt)) { \
|
||||||
|
if(curlcheck_long_option(_curl_opt)) \
|
||||||
|
if(!curlcheck_long(value)) \
|
||||||
|
_curl_easy_setopt_err_long(); \
|
||||||
|
if(curlcheck_off_t_option(_curl_opt)) \
|
||||||
|
if(!curlcheck_off_t(value)) \
|
||||||
|
_curl_easy_setopt_err_curl_off_t(); \
|
||||||
|
if(curlcheck_string_option(_curl_opt)) \
|
||||||
|
if(!curlcheck_string(value)) \
|
||||||
|
_curl_easy_setopt_err_string(); \
|
||||||
|
if(curlcheck_write_cb_option(_curl_opt)) \
|
||||||
|
if(!curlcheck_write_cb(value)) \
|
||||||
|
_curl_easy_setopt_err_write_callback(); \
|
||||||
|
if((_curl_opt) == CURLOPT_RESOLVER_START_FUNCTION) \
|
||||||
|
if(!curlcheck_resolver_start_callback(value)) \
|
||||||
|
_curl_easy_setopt_err_resolver_start_callback(); \
|
||||||
|
if((_curl_opt) == CURLOPT_READFUNCTION) \
|
||||||
|
if(!curlcheck_read_cb(value)) \
|
||||||
|
_curl_easy_setopt_err_read_cb(); \
|
||||||
|
if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
|
||||||
|
if(!curlcheck_ioctl_cb(value)) \
|
||||||
|
_curl_easy_setopt_err_ioctl_cb(); \
|
||||||
|
if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
|
||||||
|
if(!curlcheck_sockopt_cb(value)) \
|
||||||
|
_curl_easy_setopt_err_sockopt_cb(); \
|
||||||
|
if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
|
||||||
|
if(!curlcheck_opensocket_cb(value)) \
|
||||||
|
_curl_easy_setopt_err_opensocket_cb(); \
|
||||||
|
if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
|
||||||
|
if(!curlcheck_progress_cb(value)) \
|
||||||
|
_curl_easy_setopt_err_progress_cb(); \
|
||||||
|
if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
|
||||||
|
if(!curlcheck_debug_cb(value)) \
|
||||||
|
_curl_easy_setopt_err_debug_cb(); \
|
||||||
|
if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
|
||||||
|
if(!curlcheck_ssl_ctx_cb(value)) \
|
||||||
|
_curl_easy_setopt_err_ssl_ctx_cb(); \
|
||||||
|
if(curlcheck_conv_cb_option(_curl_opt)) \
|
||||||
|
if(!curlcheck_conv_cb(value)) \
|
||||||
|
_curl_easy_setopt_err_conv_cb(); \
|
||||||
|
if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
|
||||||
|
if(!curlcheck_seek_cb(value)) \
|
||||||
|
_curl_easy_setopt_err_seek_cb(); \
|
||||||
|
if(curlcheck_cb_data_option(_curl_opt)) \
|
||||||
|
if(!curlcheck_cb_data(value)) \
|
||||||
|
_curl_easy_setopt_err_cb_data(); \
|
||||||
|
if((_curl_opt) == CURLOPT_ERRORBUFFER) \
|
||||||
|
if(!curlcheck_error_buffer(value)) \
|
||||||
|
_curl_easy_setopt_err_error_buffer(); \
|
||||||
|
if((_curl_opt) == CURLOPT_STDERR) \
|
||||||
|
if(!curlcheck_FILE(value)) \
|
||||||
|
_curl_easy_setopt_err_FILE(); \
|
||||||
|
if(curlcheck_postfields_option(_curl_opt)) \
|
||||||
|
if(!curlcheck_postfields(value)) \
|
||||||
|
_curl_easy_setopt_err_postfields(); \
|
||||||
|
if((_curl_opt) == CURLOPT_HTTPPOST) \
|
||||||
|
if(!curlcheck_arr((value), struct curl_httppost)) \
|
||||||
|
_curl_easy_setopt_err_curl_httpost(); \
|
||||||
|
if((_curl_opt) == CURLOPT_MIMEPOST) \
|
||||||
|
if(!curlcheck_ptr((value), curl_mime)) \
|
||||||
|
_curl_easy_setopt_err_curl_mimepost(); \
|
||||||
|
if(curlcheck_slist_option(_curl_opt)) \
|
||||||
|
if(!curlcheck_arr((value), struct curl_slist)) \
|
||||||
|
_curl_easy_setopt_err_curl_slist(); \
|
||||||
|
if((_curl_opt) == CURLOPT_SHARE) \
|
||||||
|
if(!curlcheck_ptr((value), CURLSH)) \
|
||||||
|
_curl_easy_setopt_err_CURLSH(); \
|
||||||
|
} \
|
||||||
|
curl_easy_setopt(handle, _curl_opt, value); \
|
||||||
|
})
|
||||||
|
|
||||||
|
/* wraps curl_easy_getinfo() with typechecking */
|
||||||
|
#define curl_easy_getinfo(handle, info, arg) \
|
||||||
|
__extension__({ \
|
||||||
|
__typeof__(info) _curl_info = info; \
|
||||||
|
if(__builtin_constant_p(_curl_info)) { \
|
||||||
|
if(curlcheck_string_info(_curl_info)) \
|
||||||
|
if(!curlcheck_arr((arg), char *)) \
|
||||||
|
_curl_easy_getinfo_err_string(); \
|
||||||
|
if(curlcheck_long_info(_curl_info)) \
|
||||||
|
if(!curlcheck_arr((arg), long)) \
|
||||||
|
_curl_easy_getinfo_err_long(); \
|
||||||
|
if(curlcheck_double_info(_curl_info)) \
|
||||||
|
if(!curlcheck_arr((arg), double)) \
|
||||||
|
_curl_easy_getinfo_err_double(); \
|
||||||
|
if(curlcheck_slist_info(_curl_info)) \
|
||||||
|
if(!curlcheck_arr((arg), struct curl_slist *)) \
|
||||||
|
_curl_easy_getinfo_err_curl_slist(); \
|
||||||
|
if(curlcheck_tlssessioninfo_info(_curl_info)) \
|
||||||
|
if(!curlcheck_arr((arg), struct curl_tlssessioninfo *)) \
|
||||||
|
_curl_easy_getinfo_err_curl_tlssesssioninfo(); \
|
||||||
|
if(curlcheck_certinfo_info(_curl_info)) \
|
||||||
|
if(!curlcheck_arr((arg), struct curl_certinfo *)) \
|
||||||
|
_curl_easy_getinfo_err_curl_certinfo(); \
|
||||||
|
if(curlcheck_socket_info(_curl_info)) \
|
||||||
|
if(!curlcheck_arr((arg), curl_socket_t)) \
|
||||||
|
_curl_easy_getinfo_err_curl_socket(); \
|
||||||
|
if(curlcheck_off_t_info(_curl_info)) \
|
||||||
|
if(!curlcheck_arr((arg), curl_off_t)) \
|
||||||
|
_curl_easy_getinfo_err_curl_off_t(); \
|
||||||
|
} \
|
||||||
|
curl_easy_getinfo(handle, _curl_info, arg); \
|
||||||
|
})
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For now, just make sure that the functions are called with three arguments
|
||||||
|
*/
|
||||||
|
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
|
||||||
|
#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
|
||||||
|
|
||||||
|
|
||||||
|
/* the actual warnings, triggered by calling the _curl_easy_setopt_err*
|
||||||
|
* functions */
|
||||||
|
|
||||||
|
/* To define a new warning, use _CURL_WARNING(identifier, "message") */
|
||||||
|
#define CURLWARNING(id, message) \
|
||||||
|
static void __attribute__((__warning__(message))) \
|
||||||
|
__attribute__((__unused__)) __attribute__((__noinline__)) \
|
||||||
|
id(void) { __asm__(""); }
|
||||||
|
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_long,
|
||||||
|
"curl_easy_setopt expects a long argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_curl_off_t,
|
||||||
|
"curl_easy_setopt expects a curl_off_t argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_string,
|
||||||
|
"curl_easy_setopt expects a "
|
||||||
|
"string ('char *' or char[]) argument for this option"
|
||||||
|
)
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_write_callback,
|
||||||
|
"curl_easy_setopt expects a curl_write_callback argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_resolver_start_callback,
|
||||||
|
"curl_easy_setopt expects a "
|
||||||
|
"curl_resolver_start_callback argument for this option"
|
||||||
|
)
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_read_cb,
|
||||||
|
"curl_easy_setopt expects a curl_read_callback argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_ioctl_cb,
|
||||||
|
"curl_easy_setopt expects a curl_ioctl_callback argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_sockopt_cb,
|
||||||
|
"curl_easy_setopt expects a curl_sockopt_callback argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_opensocket_cb,
|
||||||
|
"curl_easy_setopt expects a "
|
||||||
|
"curl_opensocket_callback argument for this option"
|
||||||
|
)
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_progress_cb,
|
||||||
|
"curl_easy_setopt expects a curl_progress_callback argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_debug_cb,
|
||||||
|
"curl_easy_setopt expects a curl_debug_callback argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_ssl_ctx_cb,
|
||||||
|
"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_conv_cb,
|
||||||
|
"curl_easy_setopt expects a curl_conv_callback argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_seek_cb,
|
||||||
|
"curl_easy_setopt expects a curl_seek_callback argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_cb_data,
|
||||||
|
"curl_easy_setopt expects a "
|
||||||
|
"private data pointer as argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_error_buffer,
|
||||||
|
"curl_easy_setopt expects a "
|
||||||
|
"char buffer of CURL_ERROR_SIZE as argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_FILE,
|
||||||
|
"curl_easy_setopt expects a 'FILE *' argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_postfields,
|
||||||
|
"curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_curl_httpost,
|
||||||
|
"curl_easy_setopt expects a 'struct curl_httppost *' "
|
||||||
|
"argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_curl_mimepost,
|
||||||
|
"curl_easy_setopt expects a 'curl_mime *' "
|
||||||
|
"argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_curl_slist,
|
||||||
|
"curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
|
||||||
|
CURLWARNING(_curl_easy_setopt_err_CURLSH,
|
||||||
|
"curl_easy_setopt expects a CURLSH* argument for this option")
|
||||||
|
|
||||||
|
CURLWARNING(_curl_easy_getinfo_err_string,
|
||||||
|
"curl_easy_getinfo expects a pointer to 'char *' for this info")
|
||||||
|
CURLWARNING(_curl_easy_getinfo_err_long,
|
||||||
|
"curl_easy_getinfo expects a pointer to long for this info")
|
||||||
|
CURLWARNING(_curl_easy_getinfo_err_double,
|
||||||
|
"curl_easy_getinfo expects a pointer to double for this info")
|
||||||
|
CURLWARNING(_curl_easy_getinfo_err_curl_slist,
|
||||||
|
"curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
|
||||||
|
CURLWARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
|
||||||
|
"curl_easy_getinfo expects a pointer to "
|
||||||
|
"'struct curl_tlssessioninfo *' for this info")
|
||||||
|
CURLWARNING(_curl_easy_getinfo_err_curl_certinfo,
|
||||||
|
"curl_easy_getinfo expects a pointer to "
|
||||||
|
"'struct curl_certinfo *' for this info")
|
||||||
|
CURLWARNING(_curl_easy_getinfo_err_curl_socket,
|
||||||
|
"curl_easy_getinfo expects a pointer to curl_socket_t for this info")
|
||||||
|
CURLWARNING(_curl_easy_getinfo_err_curl_off_t,
|
||||||
|
"curl_easy_getinfo expects a pointer to curl_off_t for this info")
|
||||||
|
|
||||||
|
/* groups of curl_easy_setops options that take the same type of argument */
|
||||||
|
|
||||||
|
/* To add a new option to one of the groups, just add
|
||||||
|
* (option) == CURLOPT_SOMETHING
|
||||||
|
* to the or-expression. If the option takes a long or curl_off_t, you don't
|
||||||
|
* have to do anything
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* evaluates to true if option takes a long argument */
|
||||||
|
#define curlcheck_long_option(option) \
|
||||||
|
(0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
|
||||||
|
|
||||||
|
#define curlcheck_off_t_option(option) \
|
||||||
|
(((option) > CURLOPTTYPE_OFF_T) && ((option) < CURLOPTTYPE_BLOB))
|
||||||
|
|
||||||
|
/* evaluates to true if option takes a char* argument */
|
||||||
|
#define curlcheck_string_option(option) \
|
||||||
|
((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
|
||||||
|
(option) == CURLOPT_ACCEPT_ENCODING || \
|
||||||
|
(option) == CURLOPT_ALTSVC || \
|
||||||
|
(option) == CURLOPT_CAINFO || \
|
||||||
|
(option) == CURLOPT_CAPATH || \
|
||||||
|
(option) == CURLOPT_COOKIE || \
|
||||||
|
(option) == CURLOPT_COOKIEFILE || \
|
||||||
|
(option) == CURLOPT_COOKIEJAR || \
|
||||||
|
(option) == CURLOPT_COOKIELIST || \
|
||||||
|
(option) == CURLOPT_CRLFILE || \
|
||||||
|
(option) == CURLOPT_CUSTOMREQUEST || \
|
||||||
|
(option) == CURLOPT_DEFAULT_PROTOCOL || \
|
||||||
|
(option) == CURLOPT_DNS_INTERFACE || \
|
||||||
|
(option) == CURLOPT_DNS_LOCAL_IP4 || \
|
||||||
|
(option) == CURLOPT_DNS_LOCAL_IP6 || \
|
||||||
|
(option) == CURLOPT_DNS_SERVERS || \
|
||||||
|
(option) == CURLOPT_DOH_URL || \
|
||||||
|
(option) == CURLOPT_EGDSOCKET || \
|
||||||
|
(option) == CURLOPT_FTPPORT || \
|
||||||
|
(option) == CURLOPT_FTP_ACCOUNT || \
|
||||||
|
(option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
|
||||||
|
(option) == CURLOPT_HSTS || \
|
||||||
|
(option) == CURLOPT_INTERFACE || \
|
||||||
|
(option) == CURLOPT_ISSUERCERT || \
|
||||||
|
(option) == CURLOPT_KEYPASSWD || \
|
||||||
|
(option) == CURLOPT_KRBLEVEL || \
|
||||||
|
(option) == CURLOPT_LOGIN_OPTIONS || \
|
||||||
|
(option) == CURLOPT_MAIL_AUTH || \
|
||||||
|
(option) == CURLOPT_MAIL_FROM || \
|
||||||
|
(option) == CURLOPT_NETRC_FILE || \
|
||||||
|
(option) == CURLOPT_NOPROXY || \
|
||||||
|
(option) == CURLOPT_PASSWORD || \
|
||||||
|
(option) == CURLOPT_PINNEDPUBLICKEY || \
|
||||||
|
(option) == CURLOPT_PRE_PROXY || \
|
||||||
|
(option) == CURLOPT_PROXY || \
|
||||||
|
(option) == CURLOPT_PROXYPASSWORD || \
|
||||||
|
(option) == CURLOPT_PROXYUSERNAME || \
|
||||||
|
(option) == CURLOPT_PROXYUSERPWD || \
|
||||||
|
(option) == CURLOPT_PROXY_CAINFO || \
|
||||||
|
(option) == CURLOPT_PROXY_CAPATH || \
|
||||||
|
(option) == CURLOPT_PROXY_CRLFILE || \
|
||||||
|
(option) == CURLOPT_PROXY_ISSUERCERT || \
|
||||||
|
(option) == CURLOPT_PROXY_KEYPASSWD || \
|
||||||
|
(option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
|
||||||
|
(option) == CURLOPT_PROXY_SERVICE_NAME || \
|
||||||
|
(option) == CURLOPT_PROXY_SSLCERT || \
|
||||||
|
(option) == CURLOPT_PROXY_SSLCERTTYPE || \
|
||||||
|
(option) == CURLOPT_PROXY_SSLKEY || \
|
||||||
|
(option) == CURLOPT_PROXY_SSLKEYTYPE || \
|
||||||
|
(option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \
|
||||||
|
(option) == CURLOPT_PROXY_TLS13_CIPHERS || \
|
||||||
|
(option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \
|
||||||
|
(option) == CURLOPT_PROXY_TLSAUTH_TYPE || \
|
||||||
|
(option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \
|
||||||
|
(option) == CURLOPT_RANDOM_FILE || \
|
||||||
|
(option) == CURLOPT_RANGE || \
|
||||||
|
(option) == CURLOPT_REFERER || \
|
||||||
|
(option) == CURLOPT_REQUEST_TARGET || \
|
||||||
|
(option) == CURLOPT_RTSP_SESSION_ID || \
|
||||||
|
(option) == CURLOPT_RTSP_STREAM_URI || \
|
||||||
|
(option) == CURLOPT_RTSP_TRANSPORT || \
|
||||||
|
(option) == CURLOPT_SASL_AUTHZID || \
|
||||||
|
(option) == CURLOPT_SERVICE_NAME || \
|
||||||
|
(option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
|
||||||
|
(option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
|
||||||
|
(option) == CURLOPT_SSH_KNOWNHOSTS || \
|
||||||
|
(option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
|
||||||
|
(option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
|
||||||
|
(option) == CURLOPT_SSLCERT || \
|
||||||
|
(option) == CURLOPT_SSLCERTTYPE || \
|
||||||
|
(option) == CURLOPT_SSLENGINE || \
|
||||||
|
(option) == CURLOPT_SSLKEY || \
|
||||||
|
(option) == CURLOPT_SSLKEYTYPE || \
|
||||||
|
(option) == CURLOPT_SSL_CIPHER_LIST || \
|
||||||
|
(option) == CURLOPT_TLS13_CIPHERS || \
|
||||||
|
(option) == CURLOPT_TLSAUTH_PASSWORD || \
|
||||||
|
(option) == CURLOPT_TLSAUTH_TYPE || \
|
||||||
|
(option) == CURLOPT_TLSAUTH_USERNAME || \
|
||||||
|
(option) == CURLOPT_UNIX_SOCKET_PATH || \
|
||||||
|
(option) == CURLOPT_URL || \
|
||||||
|
(option) == CURLOPT_USERAGENT || \
|
||||||
|
(option) == CURLOPT_USERNAME || \
|
||||||
|
(option) == CURLOPT_AWS_SIGV4 || \
|
||||||
|
(option) == CURLOPT_USERPWD || \
|
||||||
|
(option) == CURLOPT_XOAUTH2_BEARER || \
|
||||||
|
(option) == CURLOPT_SSL_EC_CURVES || \
|
||||||
|
0)
|
||||||
|
|
||||||
|
/* evaluates to true if option takes a curl_write_callback argument */
|
||||||
|
#define curlcheck_write_cb_option(option) \
|
||||||
|
((option) == CURLOPT_HEADERFUNCTION || \
|
||||||
|
(option) == CURLOPT_WRITEFUNCTION)
|
||||||
|
|
||||||
|
/* evaluates to true if option takes a curl_conv_callback argument */
|
||||||
|
#define curlcheck_conv_cb_option(option) \
|
||||||
|
((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
|
||||||
|
(option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
|
||||||
|
(option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
|
||||||
|
|
||||||
|
/* evaluates to true if option takes a data argument to pass to a callback */
|
||||||
|
#define curlcheck_cb_data_option(option) \
|
||||||
|
((option) == CURLOPT_CHUNK_DATA || \
|
||||||
|
(option) == CURLOPT_CLOSESOCKETDATA || \
|
||||||
|
(option) == CURLOPT_DEBUGDATA || \
|
||||||
|
(option) == CURLOPT_FNMATCH_DATA || \
|
||||||
|
(option) == CURLOPT_HEADERDATA || \
|
||||||
|
(option) == CURLOPT_HSTSREADDATA || \
|
||||||
|
(option) == CURLOPT_HSTSWRITEDATA || \
|
||||||
|
(option) == CURLOPT_INTERLEAVEDATA || \
|
||||||
|
(option) == CURLOPT_IOCTLDATA || \
|
||||||
|
(option) == CURLOPT_OPENSOCKETDATA || \
|
||||||
|
(option) == CURLOPT_PROGRESSDATA || \
|
||||||
|
(option) == CURLOPT_READDATA || \
|
||||||
|
(option) == CURLOPT_SEEKDATA || \
|
||||||
|
(option) == CURLOPT_SOCKOPTDATA || \
|
||||||
|
(option) == CURLOPT_SSH_KEYDATA || \
|
||||||
|
(option) == CURLOPT_SSL_CTX_DATA || \
|
||||||
|
(option) == CURLOPT_WRITEDATA || \
|
||||||
|
(option) == CURLOPT_RESOLVER_START_DATA || \
|
||||||
|
(option) == CURLOPT_TRAILERDATA || \
|
||||||
|
0)
|
||||||
|
|
||||||
|
/* evaluates to true if option takes a POST data argument (void* or char*) */
|
||||||
|
#define curlcheck_postfields_option(option) \
|
||||||
|
((option) == CURLOPT_POSTFIELDS || \
|
||||||
|
(option) == CURLOPT_COPYPOSTFIELDS || \
|
||||||
|
0)
|
||||||
|
|
||||||
|
/* evaluates to true if option takes a struct curl_slist * argument */
|
||||||
|
#define curlcheck_slist_option(option) \
|
||||||
|
((option) == CURLOPT_HTTP200ALIASES || \
|
||||||
|
(option) == CURLOPT_HTTPHEADER || \
|
||||||
|
(option) == CURLOPT_MAIL_RCPT || \
|
||||||
|
(option) == CURLOPT_POSTQUOTE || \
|
||||||
|
(option) == CURLOPT_PREQUOTE || \
|
||||||
|
(option) == CURLOPT_PROXYHEADER || \
|
||||||
|
(option) == CURLOPT_QUOTE || \
|
||||||
|
(option) == CURLOPT_RESOLVE || \
|
||||||
|
(option) == CURLOPT_TELNETOPTIONS || \
|
||||||
|
(option) == CURLOPT_CONNECT_TO || \
|
||||||
|
0)
|
||||||
|
|
||||||
|
/* groups of curl_easy_getinfo infos that take the same type of argument */
|
||||||
|
|
||||||
|
/* evaluates to true if info expects a pointer to char * argument */
|
||||||
|
#define curlcheck_string_info(info) \
|
||||||
|
(CURLINFO_STRING < (info) && (info) < CURLINFO_LONG && \
|
||||||
|
(info) != CURLINFO_PRIVATE)
|
||||||
|
|
||||||
|
/* evaluates to true if info expects a pointer to long argument */
|
||||||
|
#define curlcheck_long_info(info) \
|
||||||
|
(CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
|
||||||
|
|
||||||
|
/* evaluates to true if info expects a pointer to double argument */
|
||||||
|
#define curlcheck_double_info(info) \
|
||||||
|
(CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
|
||||||
|
|
||||||
|
/* true if info expects a pointer to struct curl_slist * argument */
|
||||||
|
#define curlcheck_slist_info(info) \
|
||||||
|
(((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
|
||||||
|
|
||||||
|
/* true if info expects a pointer to struct curl_tlssessioninfo * argument */
|
||||||
|
#define curlcheck_tlssessioninfo_info(info) \
|
||||||
|
(((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
|
||||||
|
|
||||||
|
/* true if info expects a pointer to struct curl_certinfo * argument */
|
||||||
|
#define curlcheck_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
|
||||||
|
|
||||||
|
/* true if info expects a pointer to struct curl_socket_t argument */
|
||||||
|
#define curlcheck_socket_info(info) \
|
||||||
|
(CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
|
||||||
|
|
||||||
|
/* true if info expects a pointer to curl_off_t argument */
|
||||||
|
#define curlcheck_off_t_info(info) \
|
||||||
|
(CURLINFO_OFF_T < (info))
|
||||||
|
|
||||||
|
|
||||||
|
/* typecheck helpers -- check whether given expression has requested type*/
|
||||||
|
|
||||||
|
/* For pointers, you can use the curlcheck_ptr/curlcheck_arr macros,
|
||||||
|
* otherwise define a new macro. Search for __builtin_types_compatible_p
|
||||||
|
* in the GCC manual.
|
||||||
|
* NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
|
||||||
|
* the actual expression passed to the curl_easy_setopt macro. This
|
||||||
|
* means that you can only apply the sizeof and __typeof__ operators, no
|
||||||
|
* == or whatsoever.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* XXX: should evaluate to true if expr is a pointer */
|
||||||
|
#define curlcheck_any_ptr(expr) \
|
||||||
|
(sizeof(expr) == sizeof(void *))
|
||||||
|
|
||||||
|
/* evaluates to true if expr is NULL */
|
||||||
|
/* XXX: must not evaluate expr, so this check is not accurate */
|
||||||
|
#define curlcheck_NULL(expr) \
|
||||||
|
(__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
|
||||||
|
|
||||||
|
/* evaluates to true if expr is type*, const type* or NULL */
|
||||||
|
#define curlcheck_ptr(expr, type) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), type *) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), const type *))
|
||||||
|
|
||||||
|
/* evaluates to true if expr is one of type[], type*, NULL or const type* */
|
||||||
|
#define curlcheck_arr(expr, type) \
|
||||||
|
(curlcheck_ptr((expr), type) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), type []))
|
||||||
|
|
||||||
|
/* evaluates to true if expr is a string */
|
||||||
|
#define curlcheck_string(expr) \
|
||||||
|
(curlcheck_arr((expr), char) || \
|
||||||
|
curlcheck_arr((expr), signed char) || \
|
||||||
|
curlcheck_arr((expr), unsigned char))
|
||||||
|
|
||||||
|
/* evaluates to true if expr is a long (no matter the signedness)
|
||||||
|
* XXX: for now, int is also accepted (and therefore short and char, which
|
||||||
|
* are promoted to int when passed to a variadic function) */
|
||||||
|
#define curlcheck_long(expr) \
|
||||||
|
(__builtin_types_compatible_p(__typeof__(expr), long) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), signed long) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), int) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), signed int) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), short) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), signed short) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), char) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), signed char) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), unsigned char))
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_off_t */
|
||||||
|
#define curlcheck_off_t(expr) \
|
||||||
|
(__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
|
||||||
|
|
||||||
|
/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
|
||||||
|
/* XXX: also check size of an char[] array? */
|
||||||
|
#define curlcheck_error_buffer(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), char *) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(expr), char[]))
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type (const) void* or (const) FILE* */
|
||||||
|
#if 0
|
||||||
|
#define curlcheck_cb_data(expr) \
|
||||||
|
(curlcheck_ptr((expr), void) || \
|
||||||
|
curlcheck_ptr((expr), FILE))
|
||||||
|
#else /* be less strict */
|
||||||
|
#define curlcheck_cb_data(expr) \
|
||||||
|
curlcheck_any_ptr(expr)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type FILE* */
|
||||||
|
#define curlcheck_FILE(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
(__builtin_types_compatible_p(__typeof__(expr), FILE *)))
|
||||||
|
|
||||||
|
/* evaluates to true if expr can be passed as POST data (void* or char*) */
|
||||||
|
#define curlcheck_postfields(expr) \
|
||||||
|
(curlcheck_ptr((expr), void) || \
|
||||||
|
curlcheck_arr((expr), char) || \
|
||||||
|
curlcheck_arr((expr), unsigned char))
|
||||||
|
|
||||||
|
/* helper: __builtin_types_compatible_p distinguishes between functions and
|
||||||
|
* function pointers, hide it */
|
||||||
|
#define curlcheck_cb_compatible(func, type) \
|
||||||
|
(__builtin_types_compatible_p(__typeof__(func), type) || \
|
||||||
|
__builtin_types_compatible_p(__typeof__(func) *, type))
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_resolver_start_callback */
|
||||||
|
#define curlcheck_resolver_start_callback(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_resolver_start_callback))
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_read_callback or "similar" */
|
||||||
|
#define curlcheck_read_cb(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), __typeof__(fread) *) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_read_callback) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_read_callback1) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_read_callback2) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_read_callback3) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_read_callback4) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_read_callback5) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_read_callback6))
|
||||||
|
typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
|
||||||
|
typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
|
||||||
|
typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
|
||||||
|
typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *);
|
||||||
|
typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
|
||||||
|
typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_write_callback or "similar" */
|
||||||
|
#define curlcheck_write_cb(expr) \
|
||||||
|
(curlcheck_read_cb(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), __typeof__(fwrite) *) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_write_callback) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_write_callback1) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_write_callback2) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_write_callback3) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_write_callback4) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_write_callback5) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_write_callback6))
|
||||||
|
typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
|
||||||
|
typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
|
||||||
|
const void *);
|
||||||
|
typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *);
|
||||||
|
typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *);
|
||||||
|
typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
|
||||||
|
const void *);
|
||||||
|
typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
|
||||||
|
#define curlcheck_ioctl_cb(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_ioctl_callback) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ioctl_callback1) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ioctl_callback2) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ioctl_callback3) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ioctl_callback4))
|
||||||
|
typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
|
||||||
|
typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
|
||||||
|
typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
|
||||||
|
typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
|
||||||
|
#define curlcheck_sockopt_cb(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_sockopt_callback) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_sockopt_callback1) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_sockopt_callback2))
|
||||||
|
typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
|
||||||
|
typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
|
||||||
|
curlsocktype);
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_opensocket_callback or
|
||||||
|
"similar" */
|
||||||
|
#define curlcheck_opensocket_cb(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_opensocket_callback) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_opensocket_callback1) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_opensocket_callback2) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_opensocket_callback3) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_opensocket_callback4))
|
||||||
|
typedef curl_socket_t (*_curl_opensocket_callback1)
|
||||||
|
(void *, curlsocktype, struct curl_sockaddr *);
|
||||||
|
typedef curl_socket_t (*_curl_opensocket_callback2)
|
||||||
|
(void *, curlsocktype, const struct curl_sockaddr *);
|
||||||
|
typedef curl_socket_t (*_curl_opensocket_callback3)
|
||||||
|
(const void *, curlsocktype, struct curl_sockaddr *);
|
||||||
|
typedef curl_socket_t (*_curl_opensocket_callback4)
|
||||||
|
(const void *, curlsocktype, const struct curl_sockaddr *);
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_progress_callback or "similar" */
|
||||||
|
#define curlcheck_progress_cb(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_progress_callback) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_progress_callback1) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_progress_callback2))
|
||||||
|
typedef int (*_curl_progress_callback1)(void *,
|
||||||
|
double, double, double, double);
|
||||||
|
typedef int (*_curl_progress_callback2)(const void *,
|
||||||
|
double, double, double, double);
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_debug_callback or "similar" */
|
||||||
|
#define curlcheck_debug_cb(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_debug_callback) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_debug_callback1) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_debug_callback2) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_debug_callback3) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_debug_callback4) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_debug_callback5) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_debug_callback6) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_debug_callback7) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_debug_callback8))
|
||||||
|
typedef int (*_curl_debug_callback1) (CURL *,
|
||||||
|
curl_infotype, char *, size_t, void *);
|
||||||
|
typedef int (*_curl_debug_callback2) (CURL *,
|
||||||
|
curl_infotype, char *, size_t, const void *);
|
||||||
|
typedef int (*_curl_debug_callback3) (CURL *,
|
||||||
|
curl_infotype, const char *, size_t, void *);
|
||||||
|
typedef int (*_curl_debug_callback4) (CURL *,
|
||||||
|
curl_infotype, const char *, size_t, const void *);
|
||||||
|
typedef int (*_curl_debug_callback5) (CURL *,
|
||||||
|
curl_infotype, unsigned char *, size_t, void *);
|
||||||
|
typedef int (*_curl_debug_callback6) (CURL *,
|
||||||
|
curl_infotype, unsigned char *, size_t, const void *);
|
||||||
|
typedef int (*_curl_debug_callback7) (CURL *,
|
||||||
|
curl_infotype, const unsigned char *, size_t, void *);
|
||||||
|
typedef int (*_curl_debug_callback8) (CURL *,
|
||||||
|
curl_infotype, const unsigned char *, size_t, const void *);
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
|
||||||
|
/* this is getting even messier... */
|
||||||
|
#define curlcheck_ssl_ctx_cb(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_ssl_ctx_callback) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback1) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback2) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback3) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback4) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback5) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback6) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback7) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_ssl_ctx_callback8))
|
||||||
|
typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
|
||||||
|
typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
|
||||||
|
typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
|
||||||
|
typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
|
||||||
|
const void *);
|
||||||
|
#ifdef HEADER_SSL_H
|
||||||
|
/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
|
||||||
|
* this will of course break if we're included before OpenSSL headers...
|
||||||
|
*/
|
||||||
|
typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX *, void *);
|
||||||
|
typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX *, const void *);
|
||||||
|
typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX *, void *);
|
||||||
|
typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX *,
|
||||||
|
const void *);
|
||||||
|
#else
|
||||||
|
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
|
||||||
|
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
|
||||||
|
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
|
||||||
|
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_conv_callback or "similar" */
|
||||||
|
#define curlcheck_conv_cb(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_conv_callback) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_conv_callback1) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_conv_callback2) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_conv_callback3) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_conv_callback4))
|
||||||
|
typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
|
||||||
|
typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
|
||||||
|
typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
|
||||||
|
typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
|
||||||
|
|
||||||
|
/* evaluates to true if expr is of type curl_seek_callback or "similar" */
|
||||||
|
#define curlcheck_seek_cb(expr) \
|
||||||
|
(curlcheck_NULL(expr) || \
|
||||||
|
curlcheck_cb_compatible((expr), curl_seek_callback) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_seek_callback1) || \
|
||||||
|
curlcheck_cb_compatible((expr), _curl_seek_callback2))
|
||||||
|
typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
|
||||||
|
typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CURLINC_TYPECHECK_GCC_H */
|
126
libcurl/curl/urlapi.h
Normal file
126
libcurl/curl/urlapi.h
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
#ifndef CURLINC_URLAPI_H
|
||||||
|
#define CURLINC_URLAPI_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at https://curl.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "curl.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* the error codes for the URL API */
|
||||||
|
typedef enum {
|
||||||
|
CURLUE_OK,
|
||||||
|
CURLUE_BAD_HANDLE, /* 1 */
|
||||||
|
CURLUE_BAD_PARTPOINTER, /* 2 */
|
||||||
|
CURLUE_MALFORMED_INPUT, /* 3 */
|
||||||
|
CURLUE_BAD_PORT_NUMBER, /* 4 */
|
||||||
|
CURLUE_UNSUPPORTED_SCHEME, /* 5 */
|
||||||
|
CURLUE_URLDECODE, /* 6 */
|
||||||
|
CURLUE_OUT_OF_MEMORY, /* 7 */
|
||||||
|
CURLUE_USER_NOT_ALLOWED, /* 8 */
|
||||||
|
CURLUE_UNKNOWN_PART, /* 9 */
|
||||||
|
CURLUE_NO_SCHEME, /* 10 */
|
||||||
|
CURLUE_NO_USER, /* 11 */
|
||||||
|
CURLUE_NO_PASSWORD, /* 12 */
|
||||||
|
CURLUE_NO_OPTIONS, /* 13 */
|
||||||
|
CURLUE_NO_HOST, /* 14 */
|
||||||
|
CURLUE_NO_PORT, /* 15 */
|
||||||
|
CURLUE_NO_QUERY, /* 16 */
|
||||||
|
CURLUE_NO_FRAGMENT /* 17 */
|
||||||
|
} CURLUcode;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CURLUPART_URL,
|
||||||
|
CURLUPART_SCHEME,
|
||||||
|
CURLUPART_USER,
|
||||||
|
CURLUPART_PASSWORD,
|
||||||
|
CURLUPART_OPTIONS,
|
||||||
|
CURLUPART_HOST,
|
||||||
|
CURLUPART_PORT,
|
||||||
|
CURLUPART_PATH,
|
||||||
|
CURLUPART_QUERY,
|
||||||
|
CURLUPART_FRAGMENT,
|
||||||
|
CURLUPART_ZONEID /* added in 7.65.0 */
|
||||||
|
} CURLUPart;
|
||||||
|
|
||||||
|
#define CURLU_DEFAULT_PORT (1<<0) /* return default port number */
|
||||||
|
#define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set,
|
||||||
|
if the port number matches the
|
||||||
|
default for the scheme */
|
||||||
|
#define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if
|
||||||
|
missing */
|
||||||
|
#define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */
|
||||||
|
#define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */
|
||||||
|
#define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */
|
||||||
|
#define CURLU_URLDECODE (1<<6) /* URL decode on get */
|
||||||
|
#define CURLU_URLENCODE (1<<7) /* URL encode on set */
|
||||||
|
#define CURLU_APPENDQUERY (1<<8) /* append a form style part */
|
||||||
|
#define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */
|
||||||
|
#define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the
|
||||||
|
scheme is unknown. */
|
||||||
|
#define CURLU_ALLOW_SPACE (1<<11) /* Allow spaces in the URL */
|
||||||
|
|
||||||
|
typedef struct Curl_URL CURLU;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* curl_url() creates a new CURLU handle and returns a pointer to it.
|
||||||
|
* Must be freed with curl_url_cleanup().
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLU *curl_url(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* curl_url_cleanup() frees the CURLU handle and related resources used for
|
||||||
|
* the URL parsing. It will not free strings previously returned with the URL
|
||||||
|
* API.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN void curl_url_cleanup(CURLU *handle);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* curl_url_dup() duplicates a CURLU handle and returns a new copy. The new
|
||||||
|
* handle must also be freed with curl_url_cleanup().
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLU *curl_url_dup(CURLU *in);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* curl_url_get() extracts a specific part of the URL from a CURLU
|
||||||
|
* handle. Returns error code. The returned pointer MUST be freed with
|
||||||
|
* curl_free() afterwards.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what,
|
||||||
|
char **part, unsigned int flags);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* curl_url_set() sets a specific part of the URL in a CURLU handle. Returns
|
||||||
|
* error code. The passed in string will be copied. Passing a NULL instead of
|
||||||
|
* a part string, clears that part.
|
||||||
|
*/
|
||||||
|
CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what,
|
||||||
|
const char *part, unsigned int flags);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* end of extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CURLINC_URLAPI_H */
|
105
libcurl/libcurl.def
Normal file
105
libcurl/libcurl.def
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
LIBRARY LIBCURL
|
||||||
|
EXPORTS
|
||||||
|
curl_dbg_accept
|
||||||
|
curl_dbg_calloc
|
||||||
|
curl_dbg_fclose
|
||||||
|
curl_dbg_fdopen
|
||||||
|
curl_dbg_fopen
|
||||||
|
curl_dbg_free
|
||||||
|
curl_dbg_log
|
||||||
|
curl_dbg_malloc
|
||||||
|
curl_dbg_mark_sclose
|
||||||
|
curl_dbg_memdebug
|
||||||
|
curl_dbg_memlimit
|
||||||
|
curl_dbg_realloc
|
||||||
|
curl_dbg_recv
|
||||||
|
curl_dbg_sclose
|
||||||
|
curl_dbg_send
|
||||||
|
curl_dbg_socket
|
||||||
|
curl_dbg_strdup
|
||||||
|
curl_easy_cleanup
|
||||||
|
curl_easy_duphandle
|
||||||
|
curl_easy_escape
|
||||||
|
curl_easy_getinfo
|
||||||
|
curl_easy_init
|
||||||
|
curl_easy_option_by_id
|
||||||
|
curl_easy_option_by_name
|
||||||
|
curl_easy_option_next
|
||||||
|
curl_easy_pause
|
||||||
|
curl_easy_perform
|
||||||
|
curl_easy_perform_ev
|
||||||
|
curl_easy_recv
|
||||||
|
curl_easy_reset
|
||||||
|
curl_easy_send
|
||||||
|
curl_easy_setopt
|
||||||
|
curl_easy_strerror
|
||||||
|
curl_easy_unescape
|
||||||
|
curl_easy_upkeep
|
||||||
|
curl_escape
|
||||||
|
curl_formadd
|
||||||
|
curl_formfree
|
||||||
|
curl_formget
|
||||||
|
curl_free
|
||||||
|
curl_getdate
|
||||||
|
curl_getenv
|
||||||
|
curl_global_cleanup
|
||||||
|
curl_global_init
|
||||||
|
curl_global_init_mem
|
||||||
|
curl_global_sslset
|
||||||
|
curl_maprintf
|
||||||
|
curl_mfprintf
|
||||||
|
curl_mime_addpart
|
||||||
|
curl_mime_data
|
||||||
|
curl_mime_data_cb
|
||||||
|
curl_mime_encoder
|
||||||
|
curl_mime_filedata
|
||||||
|
curl_mime_filename
|
||||||
|
curl_mime_free
|
||||||
|
curl_mime_headers
|
||||||
|
curl_mime_init
|
||||||
|
curl_mime_name
|
||||||
|
curl_mime_subparts
|
||||||
|
curl_mime_type
|
||||||
|
curl_mprintf
|
||||||
|
curl_msnprintf
|
||||||
|
curl_msprintf
|
||||||
|
curl_multi_add_handle
|
||||||
|
curl_multi_assign
|
||||||
|
curl_multi_cleanup
|
||||||
|
curl_multi_fdset
|
||||||
|
curl_multi_info_read
|
||||||
|
curl_multi_init
|
||||||
|
curl_multi_perform
|
||||||
|
curl_multi_poll
|
||||||
|
curl_multi_remove_handle
|
||||||
|
curl_multi_setopt
|
||||||
|
curl_multi_socket
|
||||||
|
curl_multi_socket_action
|
||||||
|
curl_multi_socket_all
|
||||||
|
curl_multi_strerror
|
||||||
|
curl_multi_timeout
|
||||||
|
curl_multi_wait
|
||||||
|
curl_multi_wakeup
|
||||||
|
curl_mvaprintf
|
||||||
|
curl_mvfprintf
|
||||||
|
curl_mvprintf
|
||||||
|
curl_mvsnprintf
|
||||||
|
curl_mvsprintf
|
||||||
|
curl_pushheader_byname
|
||||||
|
curl_pushheader_bynum
|
||||||
|
curl_share_cleanup
|
||||||
|
curl_share_init
|
||||||
|
curl_share_setopt
|
||||||
|
curl_share_strerror
|
||||||
|
curl_slist_append
|
||||||
|
curl_slist_free_all
|
||||||
|
curl_strequal
|
||||||
|
curl_strnequal
|
||||||
|
curl_unescape
|
||||||
|
curl_url
|
||||||
|
curl_url_cleanup
|
||||||
|
curl_url_dup
|
||||||
|
curl_url_get
|
||||||
|
curl_url_set
|
||||||
|
curl_version
|
||||||
|
curl_version_info
|
BIN
libcurl/libcurl.lib
Normal file
BIN
libcurl/libcurl.lib
Normal file
Binary file not shown.
@ -18,4 +18,5 @@ srcpp_popnhax := \
|
|||||||
SearchFile.cc \
|
SearchFile.cc \
|
||||||
translation.cc \
|
translation.cc \
|
||||||
omnimix_patch.cc \
|
omnimix_patch.cc \
|
||||||
custom_categs.cc
|
custom_categs.cc \
|
||||||
|
tachi.cc
|
||||||
|
@ -33,6 +33,9 @@ struct popnhax_config {
|
|||||||
bool guidese_off;
|
bool guidese_off;
|
||||||
bool local_favorites;
|
bool local_favorites;
|
||||||
char local_favorites_path[MAX_PATH-18]; // xx.yyyyyyyyyyyy.fav
|
char local_favorites_path[MAX_PATH-18]; // xx.yyyyyyyyyyyy.fav
|
||||||
|
bool tachi_scorehook;
|
||||||
|
bool tachi_scorehook_skip_omni;
|
||||||
|
bool tachi_rivals;
|
||||||
|
|
||||||
bool patch_db;
|
bool patch_db;
|
||||||
bool disable_multiboot;
|
bool disable_multiboot;
|
||||||
|
@ -18,6 +18,7 @@ void init_subcategories();
|
|||||||
void add_song_to_subcateg(uint32_t songid, subcategory_s* subcateg);
|
void add_song_to_subcateg(uint32_t songid, subcategory_s* subcateg);
|
||||||
subcategory_s* get_subcateg(const char *title);
|
subcategory_s* get_subcateg(const char *title);
|
||||||
|
|
||||||
|
bool is_a_custom(uint32_t songid);
|
||||||
bool patch_custom_categs(const char *dllFilename, struct popnhax_config *config);
|
bool patch_custom_categs(const char *dllFilename, struct popnhax_config *config);
|
||||||
bool patch_local_favorites(const char *dllFilename, uint8_t version, char *fav_folder, bool with_numpad9_patch);
|
bool patch_local_favorites(const char *dllFilename, uint8_t version, char *fav_folder, bool with_numpad9_patch);
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "translation.h"
|
#include "translation.h"
|
||||||
#include "custom_categs.h"
|
#include "custom_categs.h"
|
||||||
#include "omnimix_patch.h"
|
#include "omnimix_patch.h"
|
||||||
|
#include "tachi.h"
|
||||||
|
|
||||||
#include "tableinfo.h"
|
#include "tableinfo.h"
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
@ -35,7 +36,7 @@
|
|||||||
|
|
||||||
#include "SearchFile.h"
|
#include "SearchFile.h"
|
||||||
|
|
||||||
#define PROGRAM_VERSION "2.1"
|
#define PROGRAM_VERSION "2.2.dev"
|
||||||
|
|
||||||
const char *g_game_dll_fn = NULL;
|
const char *g_game_dll_fn = NULL;
|
||||||
char *g_config_fn = NULL;
|
char *g_config_fn = NULL;
|
||||||
@ -204,6 +205,12 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, local_favorite
|
|||||||
"/popnhax/local_favorites")
|
"/popnhax/local_favorites")
|
||||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_STR, struct popnhax_config, local_favorites_path,
|
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_STR, struct popnhax_config, local_favorites_path,
|
||||||
"/popnhax/local_favorites_path")
|
"/popnhax/local_favorites_path")
|
||||||
|
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, tachi_scorehook,
|
||||||
|
"/popnhax/tachi_scorehook")
|
||||||
|
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, tachi_rivals,
|
||||||
|
"/popnhax/tachi_rivals")
|
||||||
|
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, tachi_scorehook_skip_omni,
|
||||||
|
"/popnhax/tachi_scorehook_skip_omni")
|
||||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, ignore_music_limit,
|
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, ignore_music_limit,
|
||||||
"/popnhax/ignore_music_limit")
|
"/popnhax/ignore_music_limit")
|
||||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, high_framerate,
|
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, high_framerate,
|
||||||
@ -1988,7 +1995,7 @@ char *get_datecode_from_patches() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("ERROR: datecode_auto: could not find matching patch file\n");
|
LOG("WARNING: datecode_auto: could not find matching patch file (patch file can still be generated)\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8042,6 +8049,12 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
|||||||
LOG("popnhax: multiboot: auto disable local favorites patch (not compatible)\n");
|
LOG("popnhax: multiboot: auto disable local favorites patch (not compatible)\n");
|
||||||
config.local_favorites = false;
|
config.local_favorites = false;
|
||||||
}
|
}
|
||||||
|
if ((config.tachi_scorehook || config.tachi_rivals) && ( config.game_version < 24 || strcmp(config.force_datecode,"2016120400") <= 0 ) )
|
||||||
|
{
|
||||||
|
LOG("popnhax: multiboot: auto disable tachi hooks (not supported)\n");
|
||||||
|
config.tachi_scorehook = false;
|
||||||
|
config.tachi_rivals = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8331,6 +8344,49 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
|||||||
patch_hispeed_auto(config.hispeed_auto);
|
patch_hispeed_auto(config.hispeed_auto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.practice_mode && config.tachi_scorehook)
|
||||||
|
{
|
||||||
|
LOG("WARNING: tachi: scorehook not compatible with practice mode, disabling it.\n");
|
||||||
|
config.tachi_scorehook = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.tachi_scorehook || config.tachi_rivals)
|
||||||
|
{
|
||||||
|
SearchFile s;
|
||||||
|
bool found = false;
|
||||||
|
s.search(".", "conf", false);
|
||||||
|
auto result = s.getResult();
|
||||||
|
|
||||||
|
if ( result.size() > 0 )
|
||||||
|
{
|
||||||
|
for (uint16_t i=0; i<result.size(); i++) {
|
||||||
|
if (strstr(result[i].c_str(), ".\\_tachi.") == result[i].c_str())
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
LOG("WARNING: tachi: no config file found for tachi hooks ( _tachi.default.conf or _tachi.<friendid>.conf ), disabling them.\n");
|
||||||
|
config.tachi_scorehook = false;
|
||||||
|
config.tachi_rivals = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.tachi_scorehook)
|
||||||
|
{
|
||||||
|
patch_tachi_scorehook(g_game_dll_fn, config.pfree, config.hidden_is_offset, config.tachi_scorehook_skip_omni);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.tachi_rivals)
|
||||||
|
{
|
||||||
|
//must be called after scorehook
|
||||||
|
patch_tachi_rivals(g_game_dll_fn, config.tachi_scorehook);
|
||||||
|
}
|
||||||
|
|
||||||
if (config.time_rate)
|
if (config.time_rate)
|
||||||
patch_get_time(config.time_rate/100.);
|
patch_get_time(config.time_rate/100.);
|
||||||
|
|
||||||
|
1202
popnhax/tachi.cc
Normal file
1202
popnhax/tachi.cc
Normal file
File diff suppressed because it is too large
Load Diff
9
popnhax/tachi.h
Normal file
9
popnhax/tachi.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef __TACHI_H__
|
||||||
|
#define __TACHI_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
bool patch_tachi_scorehook(const char *dllFilename, bool pfree, bool hidden_is_offset, bool skip_omni);
|
||||||
|
bool patch_tachi_rivals(const char *dllFilename, bool scorehook);
|
||||||
|
|
||||||
|
#endif
|
469
util/chash.h
Normal file
469
util/chash.h
Normal file
@ -0,0 +1,469 @@
|
|||||||
|
/*
|
||||||
|
* C-Ware License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2022, C-Ware
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Redistributions of modified source code must append a copyright notice in
|
||||||
|
* the form of 'Copyright <YEAR> <NAME>' to each modified source file's
|
||||||
|
* copyright notice, and the standalone license file if one exists.
|
||||||
|
*
|
||||||
|
* A "redistribution" can be constituted as any version of the source code
|
||||||
|
* that is intended to comprise some other derivative work of this code. A
|
||||||
|
* fork created for the purpose of contributing to any version of the source
|
||||||
|
* does not constitute a truly "derivative work" and does not require listing.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CWARE_LIBCHASH_H
|
||||||
|
#define CWARE_LIBCHASH_H
|
||||||
|
|
||||||
|
#define CWARE_LIBCHASH_VERSION "2.0.0"
|
||||||
|
|
||||||
|
/* How big heap-allocated hashtables are by default */
|
||||||
|
#ifndef CHASH_INITIAL_SIZE
|
||||||
|
#define CHASH_INITIAL_SIZE 10
|
||||||
|
#elif CHASH_INITIAL_SIZE <= 0
|
||||||
|
"chash_init: default length must be greater than 0"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Calculates the next size of the hashtable. */
|
||||||
|
#ifndef CHASH_RESIZE
|
||||||
|
#define CHASH_RESIZE(size) \
|
||||||
|
((size) * 1.3)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The threshold that, when passed, will cause a resize */
|
||||||
|
#ifndef CHASH_LOAD_THRESHOLD
|
||||||
|
#define CHASH_LOAD_THRESHOLD 0.8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The type that is used for counters; useful for aligning hashtable
|
||||||
|
* length and capacity fields so type casting warnings do not appear */
|
||||||
|
#ifndef CHASH_COUNTER_TYPE
|
||||||
|
#define CHASH_COUNTER_TYPE int
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The name of the key field */
|
||||||
|
#ifndef CHASH_KEY_FIELD
|
||||||
|
#define CHASH_KEY_FIELD key
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The name of the value field */
|
||||||
|
#ifndef CHASH_VALUE_FIELD
|
||||||
|
#define CHASH_VALUE_FIELD value
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The name of the state field */
|
||||||
|
#ifndef CHASH_STATE_FIELD
|
||||||
|
#define CHASH_STATE_FIELD state
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The name of the buckets field */
|
||||||
|
#ifndef CHASH_BUCKETS_FIELD
|
||||||
|
#define CHASH_BUCKETS_FIELD buckets
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The name of the length field */
|
||||||
|
#ifndef CHASH_LENGTH_FIELD
|
||||||
|
#define CHASH_LENGTH_FIELD length
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The name of the capacity field */
|
||||||
|
#ifndef CHASH_CAPACITY_FIELD
|
||||||
|
#define CHASH_CAPACITY_FIELD capacity
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* State enums */
|
||||||
|
#define CHASH_UNFILLED 0
|
||||||
|
#define CHASH_FILLED 1
|
||||||
|
#define CHASH_TOMBSTONE 2
|
||||||
|
|
||||||
|
/* Built-ins */
|
||||||
|
|
||||||
|
#define chash_string_hash(key, hash) \
|
||||||
|
5031; \
|
||||||
|
do { \
|
||||||
|
int __CHASH_HINDEX = 0; \
|
||||||
|
\
|
||||||
|
for(__CHASH_HINDEX = 0; (key)[__CHASH_HINDEX] != '\0'; \
|
||||||
|
__CHASH_HINDEX++) { \
|
||||||
|
(hash) = (((hash) << 1) + (hash)) + (key)[__CHASH_HINDEX]; \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define chash_string_compare(cmp_a, cmp_b) \
|
||||||
|
(strcmp((cmp_a), (cmp_b)) == 0)
|
||||||
|
|
||||||
|
#define chash_default_init(bucket, _key, _value) \
|
||||||
|
(bucket).CHASH_KEY_FIELD = (_key); \
|
||||||
|
(bucket).CHASH_VALUE_FIELD = _value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* utility macros */
|
||||||
|
|
||||||
|
#define __chash_abs(x) \
|
||||||
|
((x) < 0 ? (x) * - 1 : (x))
|
||||||
|
|
||||||
|
#define __chash_hash(mod, _key, namespace) \
|
||||||
|
__CHASH_HASH = namespace ## _HASH((_key), __CHASH_HASH); \
|
||||||
|
__CHASH_HASH = __CHASH_HASH % (mod); \
|
||||||
|
__CHASH_HASH = __chash_abs(__CHASH_HASH);
|
||||||
|
|
||||||
|
#define __chash_probe(hashtable, _key, namespace) \
|
||||||
|
while(__CHASH_INDEX < (hashtable)->CHASH_CAPACITY_FIELD) { \
|
||||||
|
if((hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_STATE_FIELD == \
|
||||||
|
CHASH_UNFILLED) \
|
||||||
|
break; \
|
||||||
|
\
|
||||||
|
if((namespace ## _COMPARE((_key), \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_KEY_FIELD)) == 1) { \
|
||||||
|
\
|
||||||
|
__CHASH_INDEX = -1; \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
__CHASH_HASH = (__CHASH_HASH + 1) % (hashtable)->CHASH_CAPACITY_FIELD; \
|
||||||
|
__CHASH_INDEX++; \
|
||||||
|
} \
|
||||||
|
|
||||||
|
#define __chash_probe_to_unfilled(mod, _key, buffer, namespace) \
|
||||||
|
while(1) { \
|
||||||
|
if(buffer[__CHASH_HASH].CHASH_STATE_FIELD != CHASH_FILLED) \
|
||||||
|
break; \
|
||||||
|
\
|
||||||
|
if((namespace ## _COMPARE((_key), buffer[__CHASH_HASH].CHASH_KEY_FIELD)) \
|
||||||
|
== 1) \
|
||||||
|
break; \
|
||||||
|
\
|
||||||
|
__CHASH_HASH = (__CHASH_HASH + 1) % mod; \
|
||||||
|
} \
|
||||||
|
|
||||||
|
#define __chash_resize(hashtable, namespace) \
|
||||||
|
do { \
|
||||||
|
CHASH_COUNTER_TYPE __CHASH_INDEX = 0; \
|
||||||
|
namespace ## _BUCKET *__CHASH_BUCKETS = NULL; \
|
||||||
|
CHASH_COUNTER_TYPE __CHASH_NEXT_SIZE = (CHASH_COUNTER_TYPE) \
|
||||||
|
CHASH_RESIZE((hashtable)->CHASH_CAPACITY_FIELD); \
|
||||||
|
\
|
||||||
|
if((namespace ## _HEAP) == 0) { \
|
||||||
|
if((hashtable)->CHASH_LENGTH_FIELD != \
|
||||||
|
(hashtable)->CHASH_CAPACITY_FIELD) { \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
fprintf(stderr, "__chash_resize: hashtable is full. could not resize" \
|
||||||
|
" (%s:%i)\n", __FILE__, __LINE__); \
|
||||||
|
abort(); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
if((float) (hashtable)->CHASH_LENGTH_FIELD / \
|
||||||
|
(float) (hashtable)->CHASH_CAPACITY_FIELD < CHASH_LOAD_THRESHOLD) \
|
||||||
|
break; \
|
||||||
|
\
|
||||||
|
__CHASH_BUCKETS = (namespace ## _BUCKET *)malloc((size_t) (__CHASH_NEXT_SIZE \
|
||||||
|
* ((CHASH_COUNTER_TYPE) \
|
||||||
|
sizeof(namespace ## _BUCKET)))); \
|
||||||
|
memset(__CHASH_BUCKETS, 0, ((size_t) (__CHASH_NEXT_SIZE \
|
||||||
|
* ((CHASH_COUNTER_TYPE) \
|
||||||
|
sizeof(namespace ## _BUCKET))))); \
|
||||||
|
\
|
||||||
|
for(__CHASH_INDEX = 0; __CHASH_INDEX < (hashtable)->CHASH_CAPACITY_FIELD; \
|
||||||
|
__CHASH_INDEX++) { \
|
||||||
|
namespace ## _BUCKET __CHASH_NEW_KEY_BUCKET; \
|
||||||
|
memset(&__CHASH_NEW_KEY_BUCKET, 0, sizeof(namespace ## _BUCKET)); \
|
||||||
|
namespace ## _INIT(__CHASH_NEW_KEY_BUCKET, \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[__CHASH_INDEX].CHASH_KEY_FIELD, \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[__CHASH_INDEX].CHASH_VALUE_FIELD); \
|
||||||
|
\
|
||||||
|
if((hashtable)->CHASH_BUCKETS_FIELD[__CHASH_INDEX].CHASH_STATE_FIELD \
|
||||||
|
!= CHASH_FILLED) \
|
||||||
|
continue; \
|
||||||
|
\
|
||||||
|
__chash_hash(__CHASH_NEXT_SIZE, __CHASH_NEW_KEY_BUCKET.CHASH_KEY_FIELD, \
|
||||||
|
namespace); \
|
||||||
|
__chash_probe_to_unfilled(__CHASH_NEXT_SIZE, \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[__CHASH_INDEX].CHASH_KEY_FIELD, \
|
||||||
|
__CHASH_BUCKETS, namespace) \
|
||||||
|
\
|
||||||
|
__CHASH_BUCKETS[__CHASH_HASH] = __CHASH_NEW_KEY_BUCKET; \
|
||||||
|
__CHASH_BUCKETS[__CHASH_HASH].CHASH_STATE_FIELD = CHASH_FILLED; \
|
||||||
|
__CHASH_HASH = 0; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
free((hashtable)->CHASH_BUCKETS_FIELD); \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD = __CHASH_BUCKETS; \
|
||||||
|
(hashtable)->CHASH_CAPACITY_FIELD = __CHASH_NEXT_SIZE; \
|
||||||
|
__CHASH_HASH = 0; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define __chash_assert_nonnull(func, ptr) \
|
||||||
|
do { \
|
||||||
|
if((ptr) == NULL) { \
|
||||||
|
fprintf(stderr, #func ": " #ptr " cannot be null (%s:%i)\n", \
|
||||||
|
__FILE__, __LINE__); \
|
||||||
|
abort(); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* operations */
|
||||||
|
#define chash_init(hashtable, namespace) \
|
||||||
|
NULL; \
|
||||||
|
\
|
||||||
|
(hashtable) = (namespace ## _TYPE *) malloc(sizeof((*(hashtable)))); \
|
||||||
|
(hashtable)->CHASH_LENGTH_FIELD = 0; \
|
||||||
|
(hashtable)->CHASH_CAPACITY_FIELD = CHASH_INITIAL_SIZE; \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD = (namespace ## _BUCKET *) malloc(CHASH_INITIAL_SIZE \
|
||||||
|
* sizeof(*((hashtable)->CHASH_BUCKETS_FIELD))); \
|
||||||
|
memset((hashtable)->CHASH_BUCKETS_FIELD, 0, \
|
||||||
|
sizeof(*((hashtable)->CHASH_BUCKETS_FIELD)) * CHASH_INITIAL_SIZE)
|
||||||
|
|
||||||
|
#define chash_init_stack(hashtable, buffer, _length, namespace) \
|
||||||
|
(*(hashtable)); \
|
||||||
|
\
|
||||||
|
if((_length) <= 0) { \
|
||||||
|
fprintf(stderr, "chash_init_stack: hashtable cannot have a maximum " \
|
||||||
|
"length of 0 or less (%s:%i)\n", __FILE__, __LINE__); \
|
||||||
|
abort(); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
__chash_assert_nonnull(chash_init_stack, buffer); \
|
||||||
|
\
|
||||||
|
(hashtable)->CHASH_LENGTH_FIELD = 0; \
|
||||||
|
(hashtable)->CHASH_CAPACITY_FIELD = _length; \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD = buffer
|
||||||
|
|
||||||
|
#define chash_assign(hashtable, _key, _value, namespace) \
|
||||||
|
do { \
|
||||||
|
long __CHASH_HASH = 0; \
|
||||||
|
namespace ## _BUCKET __CHASH_KEY_BUCKET; \
|
||||||
|
memset(&__CHASH_KEY_BUCKET, 0, sizeof(namespace ## _BUCKET)); \
|
||||||
|
namespace ## _INIT(__CHASH_KEY_BUCKET, _key, _value); \
|
||||||
|
\
|
||||||
|
__chash_assert_nonnull(chash_assign, hashtable); \
|
||||||
|
__chash_assert_nonnull(chash_assign, (hashtable)->CHASH_BUCKETS_FIELD); \
|
||||||
|
__chash_resize(hashtable, namespace); \
|
||||||
|
__chash_hash((hashtable)->CHASH_CAPACITY_FIELD, _key, namespace); \
|
||||||
|
__chash_probe_to_unfilled((hashtable)->CHASH_CAPACITY_FIELD, \
|
||||||
|
(_key), (hashtable)->CHASH_BUCKETS_FIELD, namespace) \
|
||||||
|
\
|
||||||
|
if((hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_STATE_FIELD == \
|
||||||
|
CHASH_FILLED) { \
|
||||||
|
namespace ## _FREE_VALUE( \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_VALUE_FIELD); \
|
||||||
|
} else { \
|
||||||
|
(hashtable)->CHASH_LENGTH_FIELD++; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH] = __CHASH_KEY_BUCKET; \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_STATE_FIELD = \
|
||||||
|
CHASH_FILLED; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define chash_lookup(hashtable, _key, storage, namespace) \
|
||||||
|
(void)storage; \
|
||||||
|
\
|
||||||
|
do { \
|
||||||
|
int __CHASH_INDEX = 0; \
|
||||||
|
long __CHASH_HASH = 0; \
|
||||||
|
namespace ## _BUCKET __CHASH_KEY_BUCKET; \
|
||||||
|
memset(&__CHASH_KEY_BUCKET, 0, sizeof(namespace ## _BUCKET)); \
|
||||||
|
namespace ## _INIT(__CHASH_KEY_BUCKET, _key, \
|
||||||
|
__CHASH_KEY_BUCKET.CHASH_VALUE_FIELD); \
|
||||||
|
\
|
||||||
|
(void) __CHASH_KEY_BUCKET; \
|
||||||
|
\
|
||||||
|
__chash_assert_nonnull(chash_lookup, hashtable); \
|
||||||
|
__chash_assert_nonnull(chash_lookup, (hashtable)->CHASH_BUCKETS_FIELD); \
|
||||||
|
__chash_hash((hashtable)->CHASH_CAPACITY_FIELD, _key, namespace); \
|
||||||
|
__chash_probe(hashtable, _key, namespace) \
|
||||||
|
\
|
||||||
|
if(((hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_STATE_FIELD != \
|
||||||
|
CHASH_FILLED) || __CHASH_INDEX != -1) { \
|
||||||
|
fprintf(stderr, "chash_lookup: failed to find key in hashtable (%s:%i)" \
|
||||||
|
"\n", __FILE__, __LINE__); \
|
||||||
|
abort(); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
storage = (hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_VALUE_FIELD; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define chash_delete(hashtable, _key, namespace) \
|
||||||
|
do { \
|
||||||
|
int __CHASH_INDEX = 0; \
|
||||||
|
long __CHASH_HASH = 0; \
|
||||||
|
\
|
||||||
|
__chash_assert_nonnull(chash_delete, hashtable); \
|
||||||
|
__chash_assert_nonnull(chash_delete, (hashtable)->CHASH_BUCKETS_FIELD); \
|
||||||
|
__chash_hash((hashtable)->CHASH_CAPACITY_FIELD, _key, namespace); \
|
||||||
|
__chash_probe(hashtable, _key, namespace) \
|
||||||
|
\
|
||||||
|
if(((hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_STATE_FIELD != \
|
||||||
|
CHASH_FILLED) || __CHASH_INDEX != -1) { \
|
||||||
|
fprintf(stderr, "chash_delete: failed to find key in hashtable (%s:%i)" \
|
||||||
|
"\n", __FILE__, __LINE__); \
|
||||||
|
abort(); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
namespace ## _FREE_KEY((hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH] \
|
||||||
|
.CHASH_KEY_FIELD); \
|
||||||
|
namespace ## _FREE_VALUE( \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_VALUE_FIELD); \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_STATE_FIELD = \
|
||||||
|
CHASH_TOMBSTONE; \
|
||||||
|
(hashtable)->CHASH_LENGTH_FIELD--; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define chash_contains(hashtable, _key, storage, namespace) \
|
||||||
|
1; \
|
||||||
|
\
|
||||||
|
do { \
|
||||||
|
int __CHASH_INDEX = 0; \
|
||||||
|
long __CHASH_HASH = 0; \
|
||||||
|
\
|
||||||
|
__chash_assert_nonnull(chash_contents, hashtable); \
|
||||||
|
__chash_assert_nonnull(chash_contents, (hashtable)->CHASH_BUCKETS_FIELD); \
|
||||||
|
__chash_hash((hashtable)->CHASH_CAPACITY_FIELD, _key, namespace); \
|
||||||
|
__chash_probe(hashtable, _key, namespace) \
|
||||||
|
\
|
||||||
|
if(((hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_STATE_FIELD != \
|
||||||
|
CHASH_FILLED) || __CHASH_INDEX != -1) { \
|
||||||
|
storage = 0; \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define chash_lookup_bucket(hashtable, _key, storage, namespace) \
|
||||||
|
storage; \
|
||||||
|
\
|
||||||
|
do { \
|
||||||
|
CHASH_COUNTER_TYPE __CHASH_INDEX = 0; \
|
||||||
|
long __CHASH_HASH = 0; \
|
||||||
|
namespace ## _BUCKET __CHASH_KEY_BUCKET; \
|
||||||
|
memset(&__CHASH_KEY_BUCKET, 0, sizeof(namespace ## _BUCKET)); \
|
||||||
|
namespace ## _INIT(__CHASH_KEY_BUCKET, _key, \
|
||||||
|
__CHASH_KEY_BUCKET.CHASH_VALUE_FIELD); \
|
||||||
|
\
|
||||||
|
(void) __CHASH_KEY_BUCKET; \
|
||||||
|
\
|
||||||
|
__chash_assert_nonnull(chash_lookup_bucket, hashtable); \
|
||||||
|
__chash_assert_nonnull(chash_lookup_bucket, \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD); \
|
||||||
|
__chash_hash((hashtable)->CHASH_CAPACITY_FIELD, _key, namespace); \
|
||||||
|
__chash_probe(hashtable, _key, namespace) \
|
||||||
|
\
|
||||||
|
if(((hashtable)->CHASH_BUCKETS_FIELD[__CHASH_HASH].CHASH_STATE_FIELD != \
|
||||||
|
CHASH_FILLED) || __CHASH_INDEX != -1) { \
|
||||||
|
fprintf(stderr, "chash_lookup_bucket: failed to find key in hashtable" \
|
||||||
|
"(%s:%i) \n", __FILE__, __LINE__); \
|
||||||
|
abort(); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
storage = ((hashtable)->CHASH_BUCKETS_FIELD + __CHASH_HASH); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define chash_free(hashtable, namespace) \
|
||||||
|
do { \
|
||||||
|
__chash_assert_nonnull(chash_free, hashtable); \
|
||||||
|
__chash_assert_nonnull(chash_free, (hashtable)->CHASH_BUCKETS_FIELD); \
|
||||||
|
(hashtable)->CHASH_CAPACITY_FIELD--; \
|
||||||
|
\
|
||||||
|
while((hashtable)->CHASH_CAPACITY_FIELD != -1) { \
|
||||||
|
if((hashtable)->CHASH_BUCKETS_FIELD[(hashtable)->CHASH_CAPACITY_FIELD] \
|
||||||
|
.CHASH_STATE_FIELD != CHASH_FILLED) { \
|
||||||
|
(hashtable)->CHASH_CAPACITY_FIELD--; \
|
||||||
|
continue; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
namespace ##_FREE_KEY( \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[(hashtable)->CHASH_CAPACITY_FIELD] \
|
||||||
|
.CHASH_KEY_FIELD); \
|
||||||
|
namespace ##_FREE_VALUE( \
|
||||||
|
(hashtable)->CHASH_BUCKETS_FIELD[(hashtable)->CHASH_CAPACITY_FIELD] \
|
||||||
|
.CHASH_VALUE_FIELD); \
|
||||||
|
(hashtable)->CHASH_CAPACITY_FIELD--; \
|
||||||
|
(hashtable)->CHASH_LENGTH_FIELD--; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
if((namespace ## _HEAP) == 1) { \
|
||||||
|
free((hashtable)->CHASH_BUCKETS_FIELD); \
|
||||||
|
free((hashtable)); \
|
||||||
|
} \
|
||||||
|
} while(0);
|
||||||
|
|
||||||
|
#define chash_is_full(hashtable, namespace) \
|
||||||
|
(((hashtable)->CHASH_LENGTH_FIELD) == ((hashtable)->CHASH_CAPACITY_FIELD))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Iterator logic */
|
||||||
|
#define chash_iter(hashtable, i) \
|
||||||
|
for((i) = 0; (i) < (hashtable)->CHASH_CAPACITY_FIELD; (i)++)
|
||||||
|
|
||||||
|
#define chash_get(hashtable, key, value, i) \
|
||||||
|
if((hashtable)->CHASH_BUCKETS_FIELD[(i)].CHASH_STATE_FIELD != CHASH_FILLED) \
|
||||||
|
continue; \
|
||||||
|
\
|
||||||
|
(key) = (hashtable)->CHASH_BUCKETS_FIELD[(i)].CHASH_KEY_FIELD; \
|
||||||
|
(value) = (hashtable)->CHASH_BUCKETS_FIELD[(i)].CHASH_VALUE_FIELD
|
||||||
|
|
||||||
|
#endif
|
725
util/jsmn-find.h
Normal file
725
util/jsmn-find.h
Normal file
@ -0,0 +1,725 @@
|
|||||||
|
#ifndef JSMN_FIND_H
|
||||||
|
#define JSMN_FIND_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef JSMN_H
|
||||||
|
#error "jsmn-find.h should be included after jsmn.h"
|
||||||
|
#else
|
||||||
|
/** @brief JSON token description */
|
||||||
|
struct jsmnftok {
|
||||||
|
/** start position in JSON data string */
|
||||||
|
int pos;
|
||||||
|
/** length of token in JSON data string */
|
||||||
|
size_t len;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @brief JSON object */
|
||||||
|
typedef struct jsmnf_pair {
|
||||||
|
/** JSON type @see `jsmntype_t` at jsmn.h */
|
||||||
|
jsmntype_t type;
|
||||||
|
/** amount of children currently filled in */
|
||||||
|
int size;
|
||||||
|
/** children threshold capacity */
|
||||||
|
int capacity;
|
||||||
|
/** this pair's fields */
|
||||||
|
struct jsmnf_pair *fields;
|
||||||
|
/** the key of the pair */
|
||||||
|
struct jsmnftok k;
|
||||||
|
/** the value of the pair */
|
||||||
|
struct jsmnftok v;
|
||||||
|
/** current state of this pair */
|
||||||
|
int state;
|
||||||
|
} jsmnf_pair;
|
||||||
|
|
||||||
|
/** @brief Bucket (@ref jsmnf_pair) loader, keeps track of pair array
|
||||||
|
* position */
|
||||||
|
typedef struct jsmnf_loader {
|
||||||
|
/** next pair to allocate */
|
||||||
|
unsigned pairnext;
|
||||||
|
} jsmnf_loader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize a @ref jsmnf_loader
|
||||||
|
*
|
||||||
|
* @param[out] loader jsmnf_loader to be initialized
|
||||||
|
*/
|
||||||
|
JSMN_API void jsmnf_init(jsmnf_loader *loader);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Populate the @ref jsmnf_pair pairs from jsmn tokens
|
||||||
|
*
|
||||||
|
* @param[in,out] loader the @ref jsmnf_loader initialized with jsmnf_init()
|
||||||
|
* @param[in] js the JSON data string
|
||||||
|
* @param[in] tokens jsmn tokens initialized with jsmn_parse() /
|
||||||
|
* jsmn_parse_auto()
|
||||||
|
* @param[in] num_tokens amount of tokens initialized with jsmn_parse() /
|
||||||
|
* jsmn_parse_auto()
|
||||||
|
* @param[out] pairs jsmnf_pair pairs array
|
||||||
|
* @param[in] num_pairs maximum amount of pairs provided
|
||||||
|
* @return a `enum jsmnerr` value for error or the amount of `pairs` used
|
||||||
|
*/
|
||||||
|
JSMN_API int jsmnf_load(jsmnf_loader *loader,
|
||||||
|
const char *js,
|
||||||
|
const jsmntok_t tokens[],
|
||||||
|
unsigned num_tokens,
|
||||||
|
jsmnf_pair pairs[],
|
||||||
|
unsigned num_pairs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Find a @ref jsmnf_pair token by its associated key
|
||||||
|
*
|
||||||
|
* @param[in] head a @ref jsmnf_pair object or array loaded at jsmnf_start()
|
||||||
|
* @param[in] js the JSON data string
|
||||||
|
* @param[in] key the key too be matched
|
||||||
|
* @param[in] length length of the key too be matched
|
||||||
|
* @return the @ref jsmnf_pair `head`'s field matched to `key`, or NULL if
|
||||||
|
* not encountered
|
||||||
|
*/
|
||||||
|
JSMN_API jsmnf_pair *jsmnf_find(const jsmnf_pair *head,
|
||||||
|
const char *js,
|
||||||
|
const char key[],
|
||||||
|
int length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Find a @ref jsmnf_pair token by its full key path
|
||||||
|
*
|
||||||
|
* @param[in] head a @ref jsmnf_pair object or array loaded at jsmnf_start()
|
||||||
|
* @param[in] js the JSON data string
|
||||||
|
* @param[in] path an array of key path strings, from least to highest depth
|
||||||
|
* @param[in] depth the depth level of the last `path` key
|
||||||
|
* @return the @ref jsmnf_pair `head`'s field matched to `path`, or NULL if
|
||||||
|
* not encountered
|
||||||
|
*/
|
||||||
|
JSMN_API jsmnf_pair *jsmnf_find_path(const jsmnf_pair *head,
|
||||||
|
const char *js,
|
||||||
|
char *const path[],
|
||||||
|
unsigned depth);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Populate and automatically allocate the @ref jsmnf_pair pairs from
|
||||||
|
* jsmn tokens
|
||||||
|
* @brief jsmnf_load() counterpart that automatically allocates the necessary
|
||||||
|
* amount of pairs necessary for sorting the JSON tokens
|
||||||
|
*
|
||||||
|
* @param[in,out] loader the @ref jsmnf_loader initialized with jsmnf_init()
|
||||||
|
* @param[in] js the JSON data string
|
||||||
|
* @param[in] tokens jsmn tokens initialized with jsmn_parse() /
|
||||||
|
* jsmn_parse_auto()
|
||||||
|
* @param[in] num_tokens amount of tokens initialized with jsmn_parse() /
|
||||||
|
* jsmn_parse_auto()
|
||||||
|
* @param[out] p_pairs pointer to @ref jsmnf_pair to be dynamically increased
|
||||||
|
* @note must be `free()`'d once done being used
|
||||||
|
* @param[in,out] num_pairs initial amount of pairs provided
|
||||||
|
* @return a `enum jsmnerr` value for error or the amount of `pairs` used
|
||||||
|
*/
|
||||||
|
JSMN_API int jsmnf_load_auto(jsmnf_loader *loader,
|
||||||
|
const char *js,
|
||||||
|
const jsmntok_t tokens[],
|
||||||
|
unsigned num_tokens,
|
||||||
|
jsmnf_pair **p_pairs,
|
||||||
|
unsigned *num_pairs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief `jsmn_parse()` counterpart that automatically allocates the necessary
|
||||||
|
* amount of tokens necessary for parsing the JSON string
|
||||||
|
*
|
||||||
|
* @param[in,out] parser the `jsmn_parser` initialized with `jsmn_init()`
|
||||||
|
* @param[in] js the JSON data string
|
||||||
|
* @param[in] length the raw JSON string length
|
||||||
|
* @param[out] p_tokens pointer to `jsmntok_t` to be dynamically increased
|
||||||
|
* @note must be `free()`'d once done being used
|
||||||
|
* @param[in,out] num_tokens amount of tokens
|
||||||
|
* @return a `enum jsmnerr` value for error or the amount of `tokens` used
|
||||||
|
*/
|
||||||
|
JSMN_API int jsmn_parse_auto(jsmn_parser *parser,
|
||||||
|
const char *js,
|
||||||
|
size_t length,
|
||||||
|
jsmntok_t **p_tokens,
|
||||||
|
unsigned *num_tokens);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Utility function for unescaping a Unicode string
|
||||||
|
*
|
||||||
|
* @param[out] buf destination buffer
|
||||||
|
* @param[in] bufsize destination buffer size
|
||||||
|
* @param[in] src source string to be unescaped
|
||||||
|
* @param[in] length source string length
|
||||||
|
* @return length of unescaped string if successful or a negative jsmn error
|
||||||
|
* code on failure
|
||||||
|
*/
|
||||||
|
JSMN_API long jsmnf_unescape(char buf[],
|
||||||
|
size_t bufsize,
|
||||||
|
const char src[],
|
||||||
|
size_t length);
|
||||||
|
|
||||||
|
#ifndef JSMN_HEADER
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* key */
|
||||||
|
#define CHASH_KEY_FIELD k
|
||||||
|
/* value */
|
||||||
|
#define CHASH_VALUE_FIELD v
|
||||||
|
/* fields */
|
||||||
|
#define CHASH_BUCKETS_FIELD fields
|
||||||
|
/* members count */
|
||||||
|
#define CHASH_LENGTH_FIELD size
|
||||||
|
|
||||||
|
#include "chash.h"
|
||||||
|
|
||||||
|
#define _jsmnf_key_hash(key, hash) \
|
||||||
|
5031; \
|
||||||
|
do { \
|
||||||
|
unsigned __CHASH_HINDEX; \
|
||||||
|
for (__CHASH_HINDEX = 0; __CHASH_HINDEX < (key).len; \
|
||||||
|
++__CHASH_HINDEX) { \
|
||||||
|
(hash) = (((hash) << 1) + (hash)) \
|
||||||
|
+ _JSMNF_STRING_B[(key).pos + __CHASH_HINDEX]; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* compare jsmnf keys */
|
||||||
|
#define _jsmnf_key_compare(cmp_a, cmp_b) \
|
||||||
|
((cmp_a).len == (cmp_b).len \
|
||||||
|
&& !strncmp(_JSMNF_STRING_B + (cmp_a).pos, \
|
||||||
|
_JSMNF_STRING_A + (cmp_b).pos, (cmp_a).len))
|
||||||
|
|
||||||
|
#define _JSMNF_TABLE_HEAP 0
|
||||||
|
#define _JSMNF_TABLE_BUCKET struct jsmnf_pair
|
||||||
|
#define _JSMNF_TABLE_FREE_KEY(_key)
|
||||||
|
#define _JSMNF_TABLE_HASH(_key, _hash) _jsmnf_key_hash(_key, _hash)
|
||||||
|
#define _JSMNF_TABLE_FREE_VALUE(_value)
|
||||||
|
#define _JSMNF_TABLE_COMPARE(_cmp_a, _cmp_b) _jsmnf_key_compare(_cmp_a, _cmp_b)
|
||||||
|
#define _JSMNF_TABLE_INIT(_bucket, _key, _value) \
|
||||||
|
chash_default_init(_bucket, _key, _value)
|
||||||
|
|
||||||
|
JSMN_API void
|
||||||
|
jsmnf_init(jsmnf_loader *loader)
|
||||||
|
{
|
||||||
|
loader->pairnext = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _JSMNF_STRING_A js
|
||||||
|
#define _JSMNF_STRING_B js
|
||||||
|
|
||||||
|
static int
|
||||||
|
_jsmnf_load_pairs(struct jsmnf_loader *loader,
|
||||||
|
const char *js,
|
||||||
|
struct jsmnf_pair *curr,
|
||||||
|
const struct jsmntok *tok,
|
||||||
|
unsigned num_tokens,
|
||||||
|
struct jsmnf_pair *pairs,
|
||||||
|
unsigned num_pairs)
|
||||||
|
{
|
||||||
|
int offset = 0;
|
||||||
|
|
||||||
|
if (!num_tokens) return 0;
|
||||||
|
|
||||||
|
switch (tok->type) {
|
||||||
|
case JSMN_STRING:
|
||||||
|
case JSMN_PRIMITIVE:
|
||||||
|
break;
|
||||||
|
case JSMN_OBJECT:
|
||||||
|
case JSMN_ARRAY: {
|
||||||
|
const unsigned top_idx = loader->pairnext + (1 + tok->size),
|
||||||
|
bottom_idx = loader->pairnext;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (tok->size > (int)(num_pairs - bottom_idx)
|
||||||
|
|| top_idx > (num_pairs - bottom_idx))
|
||||||
|
{
|
||||||
|
return JSMN_ERROR_NOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
loader->pairnext = top_idx;
|
||||||
|
|
||||||
|
(void)chash_init_stack(curr, &pairs[bottom_idx], top_idx - bottom_idx,
|
||||||
|
_JSMNF_TABLE);
|
||||||
|
|
||||||
|
if (JSMN_OBJECT == tok->type) {
|
||||||
|
while (curr->size < tok->size) {
|
||||||
|
const struct jsmntok *_key = tok + 1 + offset;
|
||||||
|
struct jsmnftok key, value = { 0 };
|
||||||
|
|
||||||
|
key.pos = _key->start;
|
||||||
|
key.len = _key->end - _key->start;
|
||||||
|
|
||||||
|
/* skip Key token */
|
||||||
|
offset += 1;
|
||||||
|
|
||||||
|
/* _key->size > 0 means either an Object or Array */
|
||||||
|
if (_key->size > 0) {
|
||||||
|
const struct jsmntok *_value = tok + 1 + offset;
|
||||||
|
struct jsmnf_pair *found = NULL;
|
||||||
|
|
||||||
|
value.pos = _value->start;
|
||||||
|
value.len = _value->end - _value->start;
|
||||||
|
|
||||||
|
chash_assign(curr, key, value, _JSMNF_TABLE);
|
||||||
|
(void)chash_lookup_bucket(curr, key, found, _JSMNF_TABLE);
|
||||||
|
|
||||||
|
ret = _jsmnf_load_pairs(loader, js, found, _value,
|
||||||
|
num_tokens - offset, pairs,
|
||||||
|
num_pairs);
|
||||||
|
if (ret < 0) return ret;
|
||||||
|
|
||||||
|
offset += ret;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
chash_assign(curr, key, value, _JSMNF_TABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (JSMN_ARRAY == tok->type) {
|
||||||
|
for (; curr->size < tok->size; ++curr->size) {
|
||||||
|
const struct jsmntok *_value = tok + 1 + offset;
|
||||||
|
struct jsmnf_pair *element = curr->fields + curr->size;
|
||||||
|
struct jsmnftok value;
|
||||||
|
|
||||||
|
value.pos = _value->start;
|
||||||
|
value.len = _value->end - _value->start;
|
||||||
|
|
||||||
|
/* assign array element */
|
||||||
|
element->v = value;
|
||||||
|
element->state = CHASH_FILLED;
|
||||||
|
/* unused for array elements */
|
||||||
|
element->k.pos = 0;
|
||||||
|
element->k.len = 0;
|
||||||
|
|
||||||
|
ret = _jsmnf_load_pairs(loader, js, element, _value,
|
||||||
|
num_tokens - offset, pairs, num_pairs);
|
||||||
|
if (ret < 0) return ret;
|
||||||
|
|
||||||
|
offset += ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
case JSMN_UNDEFINED:
|
||||||
|
fputs("Error: JSMN_UNDEFINED token detected, jsmn_parse() failure\n",
|
||||||
|
stderr);
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
curr->type = tok->type;
|
||||||
|
|
||||||
|
return offset + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef _JSMNF_STRING_A
|
||||||
|
#undef _JSMNF_STRING_B
|
||||||
|
|
||||||
|
JSMN_API int
|
||||||
|
jsmnf_load(struct jsmnf_loader *loader,
|
||||||
|
const char *js,
|
||||||
|
const struct jsmntok tokens[],
|
||||||
|
unsigned num_tokens,
|
||||||
|
struct jsmnf_pair pairs[],
|
||||||
|
unsigned num_pairs)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!loader->pairnext) { /* first run, initialize pairs */
|
||||||
|
static const struct jsmnf_pair blank_pair = { (jsmntype_t)0 };
|
||||||
|
unsigned i = 0;
|
||||||
|
|
||||||
|
for (; i < num_pairs; ++i)
|
||||||
|
pairs[i] = blank_pair;
|
||||||
|
/* root */
|
||||||
|
pairs[0].v.pos = tokens->start;
|
||||||
|
pairs[0].v.len = tokens->end - tokens->start;
|
||||||
|
|
||||||
|
++loader->pairnext;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = _jsmnf_load_pairs(loader, js, pairs, tokens, num_tokens, pairs,
|
||||||
|
num_pairs);
|
||||||
|
|
||||||
|
/* TODO: rather than reseting pairnext keep the last 'bucket' ptr stored,
|
||||||
|
* so it can continue from the in the next try */
|
||||||
|
if (ret < 0) loader->pairnext = 0;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _JSMNF_STRING_A js
|
||||||
|
#define _JSMNF_STRING_B key
|
||||||
|
|
||||||
|
JSMN_API struct jsmnf_pair *
|
||||||
|
jsmnf_find(const struct jsmnf_pair *head,
|
||||||
|
const char *js,
|
||||||
|
const char key[],
|
||||||
|
int length)
|
||||||
|
{
|
||||||
|
struct jsmnf_pair *found = NULL;
|
||||||
|
|
||||||
|
if (!key || !head) return NULL;
|
||||||
|
|
||||||
|
if (JSMN_OBJECT == head->type) {
|
||||||
|
struct jsmnftok _key;
|
||||||
|
int contains;
|
||||||
|
|
||||||
|
_key.pos = 0;
|
||||||
|
_key.len = length;
|
||||||
|
|
||||||
|
contains = chash_contains(head, _key, contains, _JSMNF_TABLE);
|
||||||
|
if (contains) {
|
||||||
|
(void)chash_lookup_bucket(head, _key, found, _JSMNF_TABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (JSMN_ARRAY == head->type) {
|
||||||
|
char *endptr;
|
||||||
|
int idx = (int)strtol(key, &endptr, 10);
|
||||||
|
if (endptr != key && idx < head->size) found = head->fields + idx;
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef _JSMNF_STRING_A
|
||||||
|
#undef _JSMNF_STRING_B
|
||||||
|
|
||||||
|
JSMN_API struct jsmnf_pair *
|
||||||
|
jsmnf_find_path(const struct jsmnf_pair *head,
|
||||||
|
const char *js,
|
||||||
|
char *const path[],
|
||||||
|
unsigned depth)
|
||||||
|
{
|
||||||
|
const struct jsmnf_pair *iter = head;
|
||||||
|
struct jsmnf_pair *found = NULL;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < depth; ++i) {
|
||||||
|
if (!iter) continue;
|
||||||
|
found = jsmnf_find(iter, js, path[i], strlen(path[i]));
|
||||||
|
if (!found) break;
|
||||||
|
iter = found;
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RECALLOC_OR_ERROR(type, ptr, prev_size) \
|
||||||
|
do { \
|
||||||
|
const unsigned new_size = *(prev_size)*2; \
|
||||||
|
void *tmp = realloc((ptr), new_size * sizeof *(ptr)); \
|
||||||
|
if (!tmp) return JSMN_ERROR_NOMEM; \
|
||||||
|
(ptr) = (type) tmp; \
|
||||||
|
memset((ptr) + *(prev_size), 0, \
|
||||||
|
(new_size - *(prev_size)) * sizeof *(ptr)); \
|
||||||
|
*(prev_size) = new_size; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
JSMN_API int
|
||||||
|
jsmn_parse_auto(struct jsmn_parser *parser,
|
||||||
|
const char *js,
|
||||||
|
size_t length,
|
||||||
|
struct jsmntok **p_tokens,
|
||||||
|
unsigned *num_tokens)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (NULL == *p_tokens || 0 == *num_tokens) {
|
||||||
|
*p_tokens = (jsmntok *)calloc(1, sizeof **p_tokens);
|
||||||
|
*num_tokens = 1;
|
||||||
|
}
|
||||||
|
while (JSMN_ERROR_NOMEM
|
||||||
|
== (ret = jsmn_parse(parser, js, length, *p_tokens, *num_tokens)))
|
||||||
|
{
|
||||||
|
RECALLOC_OR_ERROR(jsmntok*, *p_tokens, num_tokens);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
JSMN_API int
|
||||||
|
jsmnf_load_auto(struct jsmnf_loader *loader,
|
||||||
|
const char *js,
|
||||||
|
const struct jsmntok tokens[],
|
||||||
|
unsigned num_tokens,
|
||||||
|
struct jsmnf_pair **p_pairs,
|
||||||
|
unsigned *num_pairs)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (NULL == *p_pairs || 0 == *num_pairs) {
|
||||||
|
*p_pairs = (jsmnf_pair *)calloc(1, sizeof **p_pairs);
|
||||||
|
*num_pairs = 1;
|
||||||
|
}
|
||||||
|
while (JSMN_ERROR_NOMEM
|
||||||
|
== (ret = jsmnf_load(loader, js, tokens, num_tokens, *p_pairs,
|
||||||
|
*num_pairs)))
|
||||||
|
{
|
||||||
|
RECALLOC_OR_ERROR(jsmnf_pair *, *p_pairs, num_pairs);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef RECALLOC_OR_ERROR
|
||||||
|
|
||||||
|
static int
|
||||||
|
_jsmnf_read_4_digits(char *s, const char *end, unsigned *p_hex)
|
||||||
|
{
|
||||||
|
char buf[5] = { 0 };
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (end - s < 4) return JSMN_ERROR_PART;
|
||||||
|
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
buf[i] = s[i];
|
||||||
|
if (('0' <= s[i] && s[i] <= '9') || ('A' <= s[i] && s[i] <= 'F')
|
||||||
|
|| ('a' <= s[i] && s[i] <= 'f'))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*p_hex = (unsigned)strtoul(buf, NULL, 16);
|
||||||
|
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _JSMNF_UTF16_IS_FIRST_SURROGATE(c) \
|
||||||
|
(0xD800 <= (unsigned)c && (unsigned)c <= 0xDBFF)
|
||||||
|
#define _JSMNF_UTF16_IS_SECOND_SURROGATE(c) \
|
||||||
|
(0xDC00 <= (unsigned)c && (unsigned)c <= 0xDFFF)
|
||||||
|
#define _JSMNF_UTF16_JOIN_SURROGATE(c1, c2) \
|
||||||
|
(((((unsigned long)c1 & 0x3FF) << 10) | ((unsigned)c2 & 0x3FF)) + 0x10000)
|
||||||
|
#define _JSMNF_UTF8_IS_VALID(c) \
|
||||||
|
(((unsigned long)c <= 0x10FFFF) \
|
||||||
|
&& ((unsigned long)c < 0xD800 || (unsigned long)c > 0xDFFF))
|
||||||
|
#define _JSMNF_UTF8_IS_TRAIL(c) (((unsigned char)c & 0xC0) == 0x80)
|
||||||
|
#define _JSMNF_UTF_ILLEGAL 0xFFFFFFFFu
|
||||||
|
|
||||||
|
static int
|
||||||
|
_jsmnf_utf8_trail_length(unsigned char c)
|
||||||
|
{
|
||||||
|
if (c < 128) return 0;
|
||||||
|
if (c < 194) return -1;
|
||||||
|
if (c < 224) return 1;
|
||||||
|
if (c < 240) return 2;
|
||||||
|
if (c <= 244) return 3;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_jsmnf_utf8_width(unsigned long value)
|
||||||
|
{
|
||||||
|
if (value <= 0x7F) return 1;
|
||||||
|
if (value <= 0x7FF) return 2;
|
||||||
|
if (value <= 0xFFFF) return 3;
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* See RFC 3629
|
||||||
|
Based on: http://www.w3.org/International/questions/qa-forms-utf-8 */
|
||||||
|
static unsigned long
|
||||||
|
_jsmnf_utf8_next(char **p, const char *end)
|
||||||
|
{
|
||||||
|
unsigned char lead, tmp;
|
||||||
|
int trail_size;
|
||||||
|
unsigned long c;
|
||||||
|
|
||||||
|
if (*p == end) return _JSMNF_UTF_ILLEGAL;
|
||||||
|
|
||||||
|
lead = **p;
|
||||||
|
(*p)++;
|
||||||
|
|
||||||
|
/* First byte is fully validated here */
|
||||||
|
trail_size = _jsmnf_utf8_trail_length(lead);
|
||||||
|
|
||||||
|
if (trail_size < 0) return _JSMNF_UTF_ILLEGAL;
|
||||||
|
|
||||||
|
/* Ok as only ASCII may be of size = 0 also optimize for ASCII text */
|
||||||
|
if (trail_size == 0) return lead;
|
||||||
|
|
||||||
|
c = lead & ((1 << (6 - trail_size)) - 1);
|
||||||
|
|
||||||
|
/* Read the rest */
|
||||||
|
switch (trail_size) {
|
||||||
|
case 3:
|
||||||
|
if (*p == end) return _JSMNF_UTF_ILLEGAL;
|
||||||
|
tmp = **p;
|
||||||
|
(*p)++;
|
||||||
|
if (!_JSMNF_UTF8_IS_TRAIL(tmp)) return _JSMNF_UTF_ILLEGAL;
|
||||||
|
c = (c << 6) | (tmp & 0x3F);
|
||||||
|
/* fall-through */
|
||||||
|
case 2:
|
||||||
|
if (*p == end) return _JSMNF_UTF_ILLEGAL;
|
||||||
|
tmp = **p;
|
||||||
|
(*p)++;
|
||||||
|
if (!_JSMNF_UTF8_IS_TRAIL(tmp)) return _JSMNF_UTF_ILLEGAL;
|
||||||
|
c = (c << 6) | (tmp & 0x3F);
|
||||||
|
/* fall-through */
|
||||||
|
case 1:
|
||||||
|
if (*p == end) return _JSMNF_UTF_ILLEGAL;
|
||||||
|
tmp = **p;
|
||||||
|
(*p)++;
|
||||||
|
if (!_JSMNF_UTF8_IS_TRAIL(tmp)) return _JSMNF_UTF_ILLEGAL;
|
||||||
|
c = (c << 6) | (tmp & 0x3F);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check code point validity: no surrogates and valid range */
|
||||||
|
if (!_JSMNF_UTF8_IS_VALID(c)) return _JSMNF_UTF_ILLEGAL;
|
||||||
|
|
||||||
|
/* make sure it is the most compact representation */
|
||||||
|
if (_jsmnf_utf8_width(c) != trail_size + 1) return _JSMNF_UTF_ILLEGAL;
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static long
|
||||||
|
_jsmnf_utf8_validate(char *p, const char *end)
|
||||||
|
{
|
||||||
|
const char *start = p;
|
||||||
|
while (p != end) {
|
||||||
|
if (_jsmnf_utf8_next(&p, end) == _JSMNF_UTF_ILLEGAL)
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
return (long)(end - start);
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned
|
||||||
|
_jsmnf_utf8_encode(unsigned long value, char utf8_seq[4])
|
||||||
|
{
|
||||||
|
if (value <= 0x7F) {
|
||||||
|
utf8_seq[0] = value;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (value <= 0x7FF) {
|
||||||
|
utf8_seq[0] = (value >> 6) | 0xC0;
|
||||||
|
utf8_seq[1] = (value & 0x3F) | 0x80;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (value <= 0xFFFF) {
|
||||||
|
utf8_seq[0] = (value >> 12) | 0xE0;
|
||||||
|
utf8_seq[1] = ((value >> 6) & 0x3F) | 0x80;
|
||||||
|
utf8_seq[2] = (value & 0x3F) | 0x80;
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
utf8_seq[0] = (value >> 18) | 0xF0;
|
||||||
|
utf8_seq[1] = ((value >> 12) & 0x3F) | 0x80;
|
||||||
|
utf8_seq[2] = ((value >> 6) & 0x3F) | 0x80;
|
||||||
|
utf8_seq[3] = (value & 0x3F) | 0x80;
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_jsmnf_utf8_append(unsigned long hex, char *buf_tok, const char *buf_end)
|
||||||
|
{
|
||||||
|
char utf8_seq[4];
|
||||||
|
unsigned utf8_seqlen = _jsmnf_utf8_encode(hex, utf8_seq);
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
if ((buf_tok + utf8_seqlen) >= buf_end) return JSMN_ERROR_NOMEM;
|
||||||
|
|
||||||
|
for (i = 0; i < utf8_seqlen; ++i)
|
||||||
|
buf_tok[i] = utf8_seq[i];
|
||||||
|
return utf8_seqlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define BUF_PUSH(buf_tok, c, buf_end) \
|
||||||
|
do { \
|
||||||
|
if (buf_tok >= buf_end) return JSMN_ERROR_NOMEM; \
|
||||||
|
*buf_tok++ = c; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
JSMN_API long
|
||||||
|
jsmnf_unescape(char buf[], size_t bufsize, const char src[], size_t len)
|
||||||
|
{
|
||||||
|
char *src_tok = (char *)src, *const src_end = src_tok + len;
|
||||||
|
char *buf_tok = buf, *const buf_end = buf + bufsize;
|
||||||
|
int second_surrogate_expected = 0;
|
||||||
|
unsigned first_surrogate = 0;
|
||||||
|
|
||||||
|
while (*src_tok && src_tok < src_end) {
|
||||||
|
char c = *src_tok++;
|
||||||
|
|
||||||
|
if (0 <= c && c <= 0x1F) return JSMN_ERROR_INVAL;
|
||||||
|
|
||||||
|
if (c != '\\') {
|
||||||
|
if (second_surrogate_expected) return JSMN_ERROR_INVAL;
|
||||||
|
BUF_PUSH(buf_tok, c, buf_end);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* expects escaping but src is a well-formed string */
|
||||||
|
if (!*src_tok || src_tok >= src_end) return JSMN_ERROR_PART;
|
||||||
|
|
||||||
|
c = *src_tok++;
|
||||||
|
|
||||||
|
if (second_surrogate_expected && c != 'u') return JSMN_ERROR_INVAL;
|
||||||
|
|
||||||
|
switch (c) {
|
||||||
|
case '"':
|
||||||
|
case '\\':
|
||||||
|
case '/':
|
||||||
|
BUF_PUSH(buf_tok, c, buf_end);
|
||||||
|
break;
|
||||||
|
case 'b':
|
||||||
|
BUF_PUSH(buf_tok, '\b', buf_end);
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
BUF_PUSH(buf_tok, '\f', buf_end);
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
BUF_PUSH(buf_tok, '\n', buf_end);
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
BUF_PUSH(buf_tok, '\r', buf_end);
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
BUF_PUSH(buf_tok, '\t', buf_end);
|
||||||
|
break;
|
||||||
|
case 'u': {
|
||||||
|
unsigned hex;
|
||||||
|
int ret = _jsmnf_read_4_digits(src_tok, src_end, &hex);
|
||||||
|
|
||||||
|
if (ret != 4) return ret;
|
||||||
|
|
||||||
|
src_tok += ret;
|
||||||
|
|
||||||
|
if (second_surrogate_expected) {
|
||||||
|
if (!_JSMNF_UTF16_IS_SECOND_SURROGATE(hex))
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
|
||||||
|
ret = _jsmnf_utf8_append(
|
||||||
|
_JSMNF_UTF16_JOIN_SURROGATE(first_surrogate, hex), buf_tok,
|
||||||
|
buf_end);
|
||||||
|
if (ret < 0) return ret;
|
||||||
|
|
||||||
|
buf_tok += ret;
|
||||||
|
|
||||||
|
second_surrogate_expected = 0;
|
||||||
|
}
|
||||||
|
else if (_JSMNF_UTF16_IS_FIRST_SURROGATE(hex)) {
|
||||||
|
second_surrogate_expected = 1;
|
||||||
|
first_surrogate = hex;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ret = _jsmnf_utf8_append(hex, buf_tok, buf_end);
|
||||||
|
if (ret < 0) return ret;
|
||||||
|
|
||||||
|
buf_tok += ret;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
default:
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _jsmnf_utf8_validate(buf, buf_tok);
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef BUF_PUSH
|
||||||
|
|
||||||
|
#endif /* JSMN_HEADER */
|
||||||
|
#endif /* JSMN_H */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* JSMN_FIND_H */
|
471
util/jsmn.h
Normal file
471
util/jsmn.h
Normal file
@ -0,0 +1,471 @@
|
|||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010 Serge Zaitsev
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
#ifndef JSMN_H
|
||||||
|
#define JSMN_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef JSMN_STATIC
|
||||||
|
#define JSMN_API static
|
||||||
|
#else
|
||||||
|
#define JSMN_API extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON type identifier. Basic types are:
|
||||||
|
* o Object
|
||||||
|
* o Array
|
||||||
|
* o String
|
||||||
|
* o Other primitive: number, boolean (true/false) or null
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
JSMN_UNDEFINED = 0,
|
||||||
|
JSMN_OBJECT = 1 << 0,
|
||||||
|
JSMN_ARRAY = 1 << 1,
|
||||||
|
JSMN_STRING = 1 << 2,
|
||||||
|
JSMN_PRIMITIVE = 1 << 3
|
||||||
|
} jsmntype_t;
|
||||||
|
|
||||||
|
enum jsmnerr {
|
||||||
|
/* Not enough tokens were provided */
|
||||||
|
JSMN_ERROR_NOMEM = -1,
|
||||||
|
/* Invalid character inside JSON string */
|
||||||
|
JSMN_ERROR_INVAL = -2,
|
||||||
|
/* The string is not a full JSON packet, more bytes expected */
|
||||||
|
JSMN_ERROR_PART = -3
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON token description.
|
||||||
|
* type type (object, array, string etc.)
|
||||||
|
* start start position in JSON data string
|
||||||
|
* end end position in JSON data string
|
||||||
|
*/
|
||||||
|
typedef struct jsmntok {
|
||||||
|
jsmntype_t type;
|
||||||
|
int start;
|
||||||
|
int end;
|
||||||
|
int size;
|
||||||
|
#ifdef JSMN_PARENT_LINKS
|
||||||
|
int parent;
|
||||||
|
#endif
|
||||||
|
} jsmntok_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON parser. Contains an array of token blocks available. Also stores
|
||||||
|
* the string being parsed now and current position in that string.
|
||||||
|
*/
|
||||||
|
typedef struct jsmn_parser {
|
||||||
|
unsigned int pos; /* offset in the JSON string */
|
||||||
|
unsigned int toknext; /* next token to allocate */
|
||||||
|
int toksuper; /* superior token node, e.g. parent object or array */
|
||||||
|
} jsmn_parser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create JSON parser over an array of tokens
|
||||||
|
*/
|
||||||
|
JSMN_API void jsmn_init(jsmn_parser *parser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run JSON parser. It parses a JSON data string into and array of tokens, each
|
||||||
|
* describing
|
||||||
|
* a single JSON object.
|
||||||
|
*/
|
||||||
|
JSMN_API int jsmn_parse(jsmn_parser *parser, const char *js, const size_t len,
|
||||||
|
jsmntok_t *tokens, const unsigned int num_tokens);
|
||||||
|
|
||||||
|
#ifndef JSMN_HEADER
|
||||||
|
/**
|
||||||
|
* Allocates a fresh unused token from the token pool.
|
||||||
|
*/
|
||||||
|
static jsmntok_t *jsmn_alloc_token(jsmn_parser *parser, jsmntok_t *tokens,
|
||||||
|
const size_t num_tokens) {
|
||||||
|
jsmntok_t *tok;
|
||||||
|
if (parser->toknext >= num_tokens) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
tok = &tokens[parser->toknext++];
|
||||||
|
tok->start = tok->end = -1;
|
||||||
|
tok->size = 0;
|
||||||
|
#ifdef JSMN_PARENT_LINKS
|
||||||
|
tok->parent = -1;
|
||||||
|
#endif
|
||||||
|
return tok;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fills token type and boundaries.
|
||||||
|
*/
|
||||||
|
static void jsmn_fill_token(jsmntok_t *token, const jsmntype_t type,
|
||||||
|
const int start, const int end) {
|
||||||
|
token->type = type;
|
||||||
|
token->start = start;
|
||||||
|
token->end = end;
|
||||||
|
token->size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fills next available token with JSON primitive.
|
||||||
|
*/
|
||||||
|
static int jsmn_parse_primitive(jsmn_parser *parser, const char *js,
|
||||||
|
const size_t len, jsmntok_t *tokens,
|
||||||
|
const size_t num_tokens) {
|
||||||
|
jsmntok_t *token;
|
||||||
|
int start;
|
||||||
|
|
||||||
|
start = parser->pos;
|
||||||
|
|
||||||
|
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
|
||||||
|
switch (js[parser->pos]) {
|
||||||
|
#ifndef JSMN_STRICT
|
||||||
|
/* In strict mode primitive must be followed by "," or "}" or "]" */
|
||||||
|
case ':':
|
||||||
|
#endif
|
||||||
|
case '\t':
|
||||||
|
case '\r':
|
||||||
|
case '\n':
|
||||||
|
case ' ':
|
||||||
|
case ',':
|
||||||
|
case ']':
|
||||||
|
case '}':
|
||||||
|
goto found;
|
||||||
|
default:
|
||||||
|
/* to quiet a warning from gcc*/
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (js[parser->pos] < 32 || js[parser->pos] >= 127) {
|
||||||
|
parser->pos = start;
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef JSMN_STRICT
|
||||||
|
/* In strict mode primitive must be followed by a comma/object/array */
|
||||||
|
parser->pos = start;
|
||||||
|
return JSMN_ERROR_PART;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
found:
|
||||||
|
if (tokens == NULL) {
|
||||||
|
parser->pos--;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
token = jsmn_alloc_token(parser, tokens, num_tokens);
|
||||||
|
if (token == NULL) {
|
||||||
|
parser->pos = start;
|
||||||
|
return JSMN_ERROR_NOMEM;
|
||||||
|
}
|
||||||
|
jsmn_fill_token(token, JSMN_PRIMITIVE, start, parser->pos);
|
||||||
|
#ifdef JSMN_PARENT_LINKS
|
||||||
|
token->parent = parser->toksuper;
|
||||||
|
#endif
|
||||||
|
parser->pos--;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fills next token with JSON string.
|
||||||
|
*/
|
||||||
|
static int jsmn_parse_string(jsmn_parser *parser, const char *js,
|
||||||
|
const size_t len, jsmntok_t *tokens,
|
||||||
|
const size_t num_tokens) {
|
||||||
|
jsmntok_t *token;
|
||||||
|
|
||||||
|
int start = parser->pos;
|
||||||
|
|
||||||
|
/* Skip starting quote */
|
||||||
|
parser->pos++;
|
||||||
|
|
||||||
|
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
|
||||||
|
char c = js[parser->pos];
|
||||||
|
|
||||||
|
/* Quote: end of string */
|
||||||
|
if (c == '\"') {
|
||||||
|
if (tokens == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
token = jsmn_alloc_token(parser, tokens, num_tokens);
|
||||||
|
if (token == NULL) {
|
||||||
|
parser->pos = start;
|
||||||
|
return JSMN_ERROR_NOMEM;
|
||||||
|
}
|
||||||
|
jsmn_fill_token(token, JSMN_STRING, start + 1, parser->pos);
|
||||||
|
#ifdef JSMN_PARENT_LINKS
|
||||||
|
token->parent = parser->toksuper;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Backslash: Quoted symbol expected */
|
||||||
|
if (c == '\\' && parser->pos + 1 < len) {
|
||||||
|
int i;
|
||||||
|
parser->pos++;
|
||||||
|
switch (js[parser->pos]) {
|
||||||
|
/* Allowed escaped symbols */
|
||||||
|
case '\"':
|
||||||
|
case '/':
|
||||||
|
case '\\':
|
||||||
|
case 'b':
|
||||||
|
case 'f':
|
||||||
|
case 'r':
|
||||||
|
case 'n':
|
||||||
|
case 't':
|
||||||
|
break;
|
||||||
|
/* Allows escaped symbol \uXXXX */
|
||||||
|
case 'u':
|
||||||
|
parser->pos++;
|
||||||
|
for (i = 0; i < 4 && parser->pos < len && js[parser->pos] != '\0';
|
||||||
|
i++) {
|
||||||
|
/* If it isn't a hex character we have an error */
|
||||||
|
if (!((js[parser->pos] >= 48 && js[parser->pos] <= 57) || /* 0-9 */
|
||||||
|
(js[parser->pos] >= 65 && js[parser->pos] <= 70) || /* A-F */
|
||||||
|
(js[parser->pos] >= 97 && js[parser->pos] <= 102))) { /* a-f */
|
||||||
|
parser->pos = start;
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
parser->pos++;
|
||||||
|
}
|
||||||
|
parser->pos--;
|
||||||
|
break;
|
||||||
|
/* Unexpected symbol */
|
||||||
|
default:
|
||||||
|
parser->pos = start;
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parser->pos = start;
|
||||||
|
return JSMN_ERROR_PART;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse JSON string and fill tokens.
|
||||||
|
*/
|
||||||
|
JSMN_API int jsmn_parse(jsmn_parser *parser, const char *js, const size_t len,
|
||||||
|
jsmntok_t *tokens, const unsigned int num_tokens) {
|
||||||
|
int r;
|
||||||
|
int i;
|
||||||
|
jsmntok_t *token;
|
||||||
|
int count = parser->toknext;
|
||||||
|
|
||||||
|
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
|
||||||
|
char c;
|
||||||
|
jsmntype_t type;
|
||||||
|
|
||||||
|
c = js[parser->pos];
|
||||||
|
switch (c) {
|
||||||
|
case '{':
|
||||||
|
case '[':
|
||||||
|
count++;
|
||||||
|
if (tokens == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
token = jsmn_alloc_token(parser, tokens, num_tokens);
|
||||||
|
if (token == NULL) {
|
||||||
|
return JSMN_ERROR_NOMEM;
|
||||||
|
}
|
||||||
|
if (parser->toksuper != -1) {
|
||||||
|
jsmntok_t *t = &tokens[parser->toksuper];
|
||||||
|
#ifdef JSMN_STRICT
|
||||||
|
/* In strict mode an object or array can't become a key */
|
||||||
|
if (t->type == JSMN_OBJECT) {
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
t->size++;
|
||||||
|
#ifdef JSMN_PARENT_LINKS
|
||||||
|
token->parent = parser->toksuper;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
token->type = (c == '{' ? JSMN_OBJECT : JSMN_ARRAY);
|
||||||
|
token->start = parser->pos;
|
||||||
|
parser->toksuper = parser->toknext - 1;
|
||||||
|
break;
|
||||||
|
case '}':
|
||||||
|
case ']':
|
||||||
|
if (tokens == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
type = (c == '}' ? JSMN_OBJECT : JSMN_ARRAY);
|
||||||
|
#ifdef JSMN_PARENT_LINKS
|
||||||
|
if (parser->toknext < 1) {
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
token = &tokens[parser->toknext - 1];
|
||||||
|
for (;;) {
|
||||||
|
if (token->start != -1 && token->end == -1) {
|
||||||
|
if (token->type != type) {
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
token->end = parser->pos + 1;
|
||||||
|
parser->toksuper = token->parent;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (token->parent == -1) {
|
||||||
|
if (token->type != type || parser->toksuper == -1) {
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
token = &tokens[token->parent];
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
for (i = parser->toknext - 1; i >= 0; i--) {
|
||||||
|
token = &tokens[i];
|
||||||
|
if (token->start != -1 && token->end == -1) {
|
||||||
|
if (token->type != type) {
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
parser->toksuper = -1;
|
||||||
|
token->end = parser->pos + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Error if unmatched closing bracket */
|
||||||
|
if (i == -1) {
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
for (; i >= 0; i--) {
|
||||||
|
token = &tokens[i];
|
||||||
|
if (token->start != -1 && token->end == -1) {
|
||||||
|
parser->toksuper = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case '\"':
|
||||||
|
r = jsmn_parse_string(parser, js, len, tokens, num_tokens);
|
||||||
|
if (r < 0) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
if (parser->toksuper != -1 && tokens != NULL) {
|
||||||
|
tokens[parser->toksuper].size++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '\t':
|
||||||
|
case '\r':
|
||||||
|
case '\n':
|
||||||
|
case ' ':
|
||||||
|
break;
|
||||||
|
case ':':
|
||||||
|
parser->toksuper = parser->toknext - 1;
|
||||||
|
break;
|
||||||
|
case ',':
|
||||||
|
if (tokens != NULL && parser->toksuper != -1 &&
|
||||||
|
tokens[parser->toksuper].type != JSMN_ARRAY &&
|
||||||
|
tokens[parser->toksuper].type != JSMN_OBJECT) {
|
||||||
|
#ifdef JSMN_PARENT_LINKS
|
||||||
|
parser->toksuper = tokens[parser->toksuper].parent;
|
||||||
|
#else
|
||||||
|
for (i = parser->toknext - 1; i >= 0; i--) {
|
||||||
|
if (tokens[i].type == JSMN_ARRAY || tokens[i].type == JSMN_OBJECT) {
|
||||||
|
if (tokens[i].start != -1 && tokens[i].end == -1) {
|
||||||
|
parser->toksuper = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#ifdef JSMN_STRICT
|
||||||
|
/* In strict mode primitives are: numbers and booleans */
|
||||||
|
case '-':
|
||||||
|
case '0':
|
||||||
|
case '1':
|
||||||
|
case '2':
|
||||||
|
case '3':
|
||||||
|
case '4':
|
||||||
|
case '5':
|
||||||
|
case '6':
|
||||||
|
case '7':
|
||||||
|
case '8':
|
||||||
|
case '9':
|
||||||
|
case 't':
|
||||||
|
case 'f':
|
||||||
|
case 'n':
|
||||||
|
/* And they must not be keys of the object */
|
||||||
|
if (tokens != NULL && parser->toksuper != -1) {
|
||||||
|
const jsmntok_t *t = &tokens[parser->toksuper];
|
||||||
|
if (t->type == JSMN_OBJECT ||
|
||||||
|
(t->type == JSMN_STRING && t->size != 0)) {
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* In non-strict mode every unquoted value is a primitive */
|
||||||
|
default:
|
||||||
|
#endif
|
||||||
|
r = jsmn_parse_primitive(parser, js, len, tokens, num_tokens);
|
||||||
|
if (r < 0) {
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
if (parser->toksuper != -1 && tokens != NULL) {
|
||||||
|
tokens[parser->toksuper].size++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
#ifdef JSMN_STRICT
|
||||||
|
/* Unexpected char in strict mode */
|
||||||
|
default:
|
||||||
|
return JSMN_ERROR_INVAL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tokens != NULL) {
|
||||||
|
for (i = parser->toknext - 1; i >= 0; i--) {
|
||||||
|
/* Unmatched opened object or array */
|
||||||
|
if (tokens[i].start != -1 && tokens[i].end == -1) {
|
||||||
|
return JSMN_ERROR_PART;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new parser based over a given buffer with an array of tokens
|
||||||
|
* available.
|
||||||
|
*/
|
||||||
|
JSMN_API void jsmn_init(jsmn_parser *parser) {
|
||||||
|
parser->pos = 0;
|
||||||
|
parser->toknext = 0;
|
||||||
|
parser->toksuper = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* JSMN_HEADER */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* JSMN_H */
|
Loading…
Reference in New Issue
Block a user