feat: build proect for restproxy
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
TOPDIR:=.
|
||||
TGT:=./restproxy
|
||||
TGT:=../bin/restproxy
|
||||
|
||||
DIR=$(TOPDIR)
|
||||
SRCS=$(foreach dir, $(DIR), $(wildcard $(dir)/*.c))
|
||||
OBJS:=$(patsubst %.c,%.o,$(SRCS))
|
||||
|
||||
|
||||
|
||||
DIR_LIBEVENT = ./third-lib/libevent/include/
|
||||
DIR_JSON = ./third-lib/json-lib/inc/
|
||||
DIR_JSON = ./third-lib/libmjson/src/
|
||||
DIR_CURL = ./third-lib/libcurl/include/curl/
|
||||
|
||||
INCDIR = $(foreach dir, $(DIR), -I $(dir)/ )
|
||||
@@ -16,17 +14,63 @@ INCDIR += -I $(DIR_LIBEVENT)
|
||||
INCDIR += -I $(DIR_JSON)
|
||||
INCDIR += -I $(DIR_CURL)
|
||||
|
||||
LIBS = ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient ./third-lib/libcurl/lib/libcurl.a -lrt -lcrypto -lssl -lpthread ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/json-lib/libmjson.a -L/usr/local/lib -lglib-2.0 -lz
|
||||
LIBS = ./dba/lib/libdba.a ./smcli_client/lib/libclient.a
|
||||
LIBS += ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a
|
||||
LIBS += /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib
|
||||
LIBS += -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0
|
||||
LIBS += ./third-lib/libevent/.libs/libevent.a ./third-lib/libevent/.libs/libevent_pthreads.a
|
||||
LIBS += ./third-lib/libcurl/lib/.libs/libcurl.a ./third-lib/libmjson/src/.libs/libmjson.a
|
||||
LIBS += -lssl -lcrypto -lzstd -lidn2 -lz
|
||||
|
||||
CFLAGS = -Wall -g -DX86_64 -DTEST_RESTPROXY $(LIBS)
|
||||
# Determine OS version
|
||||
# OS_VERSION=$(shell lsb_release -rs)
|
||||
|
||||
# ifeq ($(OS_VERSION),22.04)
|
||||
# LIBS += /usr/lib/x86_64-linux-gnu/libevent.a /usr/lib/x86_64-linux-gnu/libevent_pthreads.a
|
||||
# LIBS += ./third-lib/libcurl/lib/libcurl.a ./third-lib/json-lib/libmjson.a
|
||||
# LIBS += -lssl -lcrypto -lzstd -lidn2 -lz
|
||||
# else ifeq ($(OS_VERSION),12.04)
|
||||
# LIBS += ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a
|
||||
# LIBS += ./third-lib/libcurl/lib/libcurl.a ./third-lib/json-lib/libmjson.a
|
||||
# LIBS += -lssl -lcrypto -lzstd -lidn2 -lz
|
||||
# endif
|
||||
|
||||
CFLAGS = -Wall -g -DX86_64 -DTEST_RESTPROXY $(LIBS)
|
||||
|
||||
CC = gcc
|
||||
|
||||
$(TGT):$(OBJS)
|
||||
$(TGT):$(OBJS) lib_all 3rdlib_all
|
||||
$(CC) -o $(TGT) $(CFLAGS) $(SRCS) $(INCDIR) $(LIBS)
|
||||
chmod a+x $(TGT)
|
||||
|
||||
$(OBJS):%.o:%.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $< $(INCDIR)
|
||||
|
||||
all: $(TGT)
|
||||
|
||||
clean_all: clean lib_clean 3rdlib_clean
|
||||
|
||||
lib_all:
|
||||
$(MAKE) -C ./smcli_client
|
||||
$(MAKE) -C ./pstn_cli
|
||||
$(MAKE) -C ./tcp
|
||||
$(MAKE) -C ./dba
|
||||
|
||||
3rdlib_all:
|
||||
$(MAKE) -C ./third-lib/libevent
|
||||
$(MAKE) -C ./third-lib/libcurl
|
||||
$(MAKE) -C ./third-lib/libmjson
|
||||
|
||||
lib_clean:
|
||||
$(MAKE) -C ./smcli_client clean
|
||||
$(MAKE) -C ./pstn_cli clean
|
||||
$(MAKE) -C ./tcp clean
|
||||
$(MAKE) -C ./dba clean
|
||||
|
||||
3rdlib_clean:
|
||||
$(MAKE) -C ./third-lib/libevent clean
|
||||
$(MAKE) -C ./third-lib/libcurl clean
|
||||
$(MAKE) -C ./third-lib/libmjson clean
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJS) $(TGT)
|
||||
|
||||
Binary file not shown.
@@ -16,18 +16,29 @@ PLT_LIB = -DDEBUG
|
||||
APP_LIB =
|
||||
LIB_ADD =
|
||||
|
||||
GLIB_PATH = /usr/include/glib-2.0
|
||||
GLIB_CONFIG_PATH = /usr/lib/x86_64-linux-gnu/glib-2.0/include
|
||||
|
||||
SRC_PATH = ./src
|
||||
INC_PATH = ./src/include
|
||||
PLT_PATH = ../../plat
|
||||
APP_PATH = ../../mss
|
||||
PLT_PATH = ../../../ocs/plat
|
||||
APP_PATH = ../../../ocs/mss
|
||||
INC_PATH += -I$(PLT_PATH)/snmp/src -I$(PLT_PATH)/radius/src/include -I$(GLIB_PATH) -I$(GLIB_CONFIG_PATH)
|
||||
|
||||
OBJ_ADD =
|
||||
TEST_OBJ_PATH =
|
||||
|
||||
PREPROC_CMD =
|
||||
POSTPROC_CMD =
|
||||
# Add MySQL include and library paths
|
||||
MYSQL_INCLUDE_PATH := /usr/include/mysql
|
||||
MYSQL_LIB_PATH := /usr/lib/x86_64-linux-gnu
|
||||
MYSQL_LIBS := -lmysqlclient -lpthread -lz -lm -lrt -ldl
|
||||
DEBUG_CFLAGS += -I$(MYSQL_INCLUDE_PATH) -I$(INC_PATH)
|
||||
DEBUG_LINK_CFLAGS += -L$(MYSQL_LIB_PATH) -lmysqlclient -lpthread -lz -lm -lrt -ldl
|
||||
RELEASE_CFLAGS += -I$(MYSQL_INCLUDE_PATH) -I$(INC_PATH)
|
||||
RELEASE_LINK_CFLAGS += -L$(MYSQL_LIB_PATH) -lmysqlclient -lpthread -lz -lm -lrt -ldl
|
||||
|
||||
##---------------------------------------------------------------------##
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make configuration(Customer define)
|
||||
@@ -50,4 +61,5 @@ COVER_REPORT_PATH = ./output
|
||||
## include makefile.rules (Do not change)
|
||||
##
|
||||
##--------------------------------------
|
||||
include ./scripts/Makefile.rules
|
||||
MAKE_INCLUDE = ../inc
|
||||
include ${MAKE_INCLUDE}/Makefile.rules
|
||||
|
||||
@@ -7,7 +7,12 @@
|
||||
|
||||
#include <string.h>
|
||||
#include "md5.h"
|
||||
#include "radius_md5.h"
|
||||
|
||||
#ifndef _T_BYTE
|
||||
#define _T_BYTE
|
||||
typedef unsigned char BYTE;
|
||||
#endif
|
||||
|
||||
const int blocksize = 64;
|
||||
const int hashsize = 16;
|
||||
|
||||
21
proxy_c/dba/src/include/md5.h
Normal file
21
proxy_c/dba/src/include/md5.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef SQUID_MD5_H
|
||||
#define SQUID_MD5_H
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
|
||||
typedef struct SquidMD5Context {
|
||||
uint32_t buf[4];
|
||||
uint32_t bytes[2];
|
||||
uint32_t in[16];
|
||||
}SquidMD5_CTX;
|
||||
|
||||
void SquidMD5Init(struct SquidMD5Context *context);
|
||||
void SquidMD5Update(struct SquidMD5Context *context, const void *buf, unsigned len);
|
||||
void SquidMD5Final(uint8_t digest[16], struct SquidMD5Context *context);
|
||||
void SQUID_MD5Transform(uint32_t buf[4], uint32_t const in[16]); // void SquidMD5Transform(uint32_t buf[4], uint32_t const in[16]);
|
||||
|
||||
#define SQUID_MD5_DIGEST_LENGTH 16
|
||||
|
||||
#endif /** SQUID_MD5_H */
|
||||
90
proxy_c/dba/src/include/radius_md5.h
Normal file
90
proxy_c/dba/src/include/radius_md5.h
Normal file
@@ -0,0 +1,90 @@
|
||||
//md5.h
|
||||
/***********************************************************************/
|
||||
/** md5.h -- header file for implementation of MD5 **/
|
||||
/** RSA Data Security, Inc. MD5 Message-Digest Algorithm **/
|
||||
/** Created: 2/17/90 RLR **/
|
||||
/** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **/
|
||||
/** Revised (for MD5): RLR 4/27/91 **/
|
||||
/** -- G modified to have y&~z instead of y&z **/
|
||||
/** -- FF, GG, HH modified to add in last register done **/
|
||||
/** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **/
|
||||
/** -- distinct additive constant for each step **/
|
||||
/** -- round 4 added, working mod 7 **/
|
||||
/***********************************************************************/
|
||||
|
||||
/***********************************************************************/
|
||||
/** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **/
|
||||
/** **/
|
||||
/** License to copy and use this software is granted provided that **/
|
||||
/** it is identified as the "RSA Data Security, Inc. MD5 Message- **/
|
||||
/** Digest Algorithm" in all material mentioning or referencing this **/
|
||||
/** software or this function. **/
|
||||
/** **/
|
||||
/** License is also granted to make and use derivative works **/
|
||||
/** provided that such works are identified as "derived from the RSA **/
|
||||
/** Data Security, Inc. MD5 Message-Digest Algorithm" in all **/
|
||||
/** material mentioning or referencing the derived work. **/
|
||||
/** **/
|
||||
/** RSA Data Security, Inc. makes no representations concerning **/
|
||||
/** either the merchantability of this software or the suitability **/
|
||||
/** of this software for any particular purpose. It is provided "as **/
|
||||
/** is" without express or implied warranty of any kind. **/
|
||||
/** **/
|
||||
/** These notices must be retained in any copies of any part of this **/
|
||||
/** documentation and/or software. **/
|
||||
/***********************************************************************/
|
||||
|
||||
#ifndef _RADIUS_MD5_H
|
||||
#define _RADIUS_MD5_H
|
||||
|
||||
#ifndef _T_BYTE
|
||||
#define _T_BYTE
|
||||
typedef unsigned char BYTE;
|
||||
#endif
|
||||
|
||||
/* typedef a 32-bit type */
|
||||
//typedef unsigned long int UINT4;
|
||||
typedef unsigned int UINT4;
|
||||
|
||||
#define S11 7
|
||||
#define S12 12
|
||||
#define S13 17
|
||||
#define S14 22
|
||||
|
||||
#define S21 5
|
||||
#define S22 9
|
||||
#define S23 14
|
||||
#define S24 20
|
||||
|
||||
#define S31 4
|
||||
#define S32 11
|
||||
#define S33 16
|
||||
#define S34 23
|
||||
|
||||
#define S41 6
|
||||
#define S42 10
|
||||
#define S43 15
|
||||
#define S44 21
|
||||
|
||||
/* Data structure for MD5 (Message-Digest) computation */
|
||||
typedef struct _MD5_CTX
|
||||
{
|
||||
UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
|
||||
UINT4 buf[4]; /* scratch buffer */
|
||||
unsigned char in[64]; /* input buffer */
|
||||
unsigned char digest[16]; /* actual digest after MD5Final call */
|
||||
} MD5_CTX;
|
||||
|
||||
void radius_MD5Init (MD5_CTX *);
|
||||
void radius_MD5Update (MD5_CTX *,unsigned char *,unsigned int);
|
||||
void radius_MD5Final (MD5_CTX *);
|
||||
void radius_MD5Transform(UINT4 *,UINT4 *);
|
||||
void radius_get_md5_str(char *dest, char *org, int len);
|
||||
void radius_get_md5_hex(char *dest, char *org, int len);
|
||||
void radius_get_hmac_md5_hex(BYTE *dest, BYTE *org, int org_len, BYTE *key, int key_len);
|
||||
|
||||
#endif
|
||||
/***********************************************************************/
|
||||
/** End of md5.h **/
|
||||
/***********************************************************************/
|
||||
|
||||
58
proxy_c/inc/Makefile.backup
Executable file
58
proxy_c/inc/Makefile.backup
Executable file
@@ -0,0 +1,58 @@
|
||||
|
||||
##----------------------------------------------------------##
|
||||
## ##
|
||||
## Universal Makefile Backup Function ##
|
||||
## ##
|
||||
## Created : Wei Liu 07/06/20 ##
|
||||
## Revision: [Last]Wei Liu 07/07/07 ##
|
||||
## ##
|
||||
##----------------------------------------------------------##
|
||||
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make backup
|
||||
##
|
||||
##--------------------------------------
|
||||
# backup
|
||||
TIME_STR = ${shell date +%y%m%d_%H%M%S}
|
||||
VER_STR = $(sed -n '/$(MODULE)_VERSION/'p ./src/include/$(MODULE).h | \
|
||||
awk -F '[{,}]' $(print $2 $3 $4 ) )
|
||||
BACK_PATH := ../../../r9_bak
|
||||
BACK_PATH := $(BACK_PATH)/$(TYPE)/$(MODULE)
|
||||
BACK_NAME = $(MODULE)_$(VER_STR)_$(TIME_STR).tgz
|
||||
LS = ls -tl
|
||||
|
||||
version:
|
||||
@echo $(VER_STR)
|
||||
|
||||
backfile ?= *
|
||||
|
||||
ifeq "$(backfile)" "*"
|
||||
backfile =$(wildcard $(BACK_PATH)/*.tgz)
|
||||
CHECK_BACK_FILE =$(backfile)
|
||||
else
|
||||
CHECK_BACK_FILE =$(shell find $(BACK_PATH) -name $(backfile))
|
||||
endif
|
||||
|
||||
bk: clean
|
||||
@$(MKDIR) -p $(BACK_PATH) --mode=0777
|
||||
@echo Backuping $(MODULE)... $(BACK_PATH)/$(BACK_NAME)
|
||||
@tar czvf $(BACK_PATH)/$(BACK_NAME) ./src ./ut ./doc ./Makefile
|
||||
|
||||
lsbk:
|
||||
@$(LS) $(BACK_PATH)
|
||||
|
||||
rmbk:
|
||||
ifneq "$(CHECK_BACK_FILE)" ""
|
||||
@rm -rf $(BACK_PATH)/$(backfile)
|
||||
@$(LS) $(BACK_PATH)
|
||||
endif
|
||||
|
||||
unzip:
|
||||
ifneq "$(CHECK_BACK_FILE)" ""
|
||||
@tar czvf $(BACK_PATH)/$(BACK_NAME) ./src ./ut ./doc ./Makefile
|
||||
@tar zxvf $(BACK_PATH)/$(backfile)
|
||||
@ls $(BACK_PATH)
|
||||
endif
|
||||
|
||||
101
proxy_c/inc/Makefile.cov
Executable file
101
proxy_c/inc/Makefile.cov
Executable file
@@ -0,0 +1,101 @@
|
||||
|
||||
##----------------------------------------------------------##
|
||||
## ##
|
||||
## Universal Makefile Lcov Function ##
|
||||
## ##
|
||||
## Created : Wei Liu 07/04/11 ##
|
||||
## Revision: [Last]Wei Liu 07/07/09 ##
|
||||
## ##
|
||||
##----------------------------------------------------------##
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## COVER define
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
ifeq "$(COVER_NEED)" "yes"
|
||||
|
||||
COVER := /usr/bin/lcov
|
||||
GENHTML := /usr/bin/genhtml
|
||||
GENDESC := /usr/bin/gendesc
|
||||
GENPNG := /usr/bin/genpng
|
||||
|
||||
##Depending on the presence of the GD.pm perl module, we can use the
|
||||
##special option '--frames' for genhtml
|
||||
USE_GENPNG := $(shell $(GENPNG) --help >/dev/null 2>/dev/null; echo $$?)
|
||||
|
||||
ifeq ($(USE_GENPNG),0)
|
||||
FRAMES := --frames
|
||||
else
|
||||
FRAMES :=
|
||||
endif
|
||||
|
||||
##COV_SETFLAG := --zerocounters --path . -q --directory .
|
||||
COV_SETFLAG := --zerocounters -q --directory ../obj
|
||||
COV_SET := $(COVER) $(COV_SETFLAG)
|
||||
|
||||
COVER_REPORT_PATH ?= $(UTDIR)/output
|
||||
|
||||
INFO_FILE = $(COVER_REPORT_PATH)/$(MODULE).info
|
||||
DSP_FILE = $(MODULE)_test_descriptions.txt
|
||||
|
||||
COV_OUTSET = --capture --directory ../obj \
|
||||
--output-file $(INFO_FILE)\
|
||||
--test-name $(MODULE) -q \
|
||||
--base-directory ../
|
||||
|
||||
COV_HTMLSET= $(INFO_FILE) \
|
||||
--output-directory $(COVER_REPORT_PATH)\
|
||||
--title $(MODULE) \
|
||||
--show-details $(FRAMES) \
|
||||
--legend -q --num-spaces 4
|
||||
COV_OUTPUT = $(COVER) $(COV_OUTSET)
|
||||
|
||||
|
||||
COV_DOC_PATH := /usr/local/include/cov
|
||||
|
||||
endif
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make Test
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
test:
|
||||
@echo -e "\n================================Test start======================================\n"
|
||||
ifeq "$(BUILD)" "exef"
|
||||
ifeq "$(COVER_NEED)" "yes"
|
||||
@$(MKDIR) -p $(COVER_REPORT_PATH) --mode=0777
|
||||
@cp -rf $(COV_DOC_PATH)/lcovrc $(COV_DOC_PATH)/lcov_html_header\
|
||||
$(COV_DOC_PATH)/lcov_html_foot /etc/
|
||||
@cp -rf /usr/local/include/cgprof/cgprof /usr/local/bin/cgprof
|
||||
@$(COV_SET)
|
||||
$(OUTFILE)
|
||||
gprof $(OUTFILE) gmon.out -p | cgprof -Tps
|
||||
@$(COV_OUTPUT)
|
||||
@LANG=C $(GENHTML) $(COV_HTMLSET)
|
||||
@echo
|
||||
@echo -e "||---------------------------------------------------------------"
|
||||
@echo -e "|| Test cover report generated on the paht $(COVER_REPORT_PATH). "
|
||||
@echo -e "|| Point a web browser at index.html to see results. "
|
||||
@echo -e "||---------------------------------------------------------------"
|
||||
else
|
||||
@echo "COVER_NEED: $(COVER_NEED)BUILD: $(BUILD) "
|
||||
$(OUTFILE)
|
||||
endif
|
||||
@echo -e "\n================================Test End========================================\n"
|
||||
else
|
||||
@echo -e "||---------------------------------------------------------------"
|
||||
@echo -e "|| This is not exef project! "
|
||||
@echo -e "||---------------------------------------------------------------"
|
||||
@echo "This is not exef project!"
|
||||
endif
|
||||
|
||||
cleanlcov:
|
||||
@$(COV_SET) --reset
|
||||
|
||||
retest: cleanlcov test
|
||||
|
||||
|
||||
28
proxy_c/inc/Makefile.doxygen
Executable file
28
proxy_c/inc/Makefile.doxygen
Executable file
@@ -0,0 +1,28 @@
|
||||
|
||||
##----------------------------------------------------------##
|
||||
## ##
|
||||
## Universal Makefile Documentation Function ##
|
||||
## ##
|
||||
## Created : Wei Liu 07/06/30 ##
|
||||
## Revision: [Last]Wei Liu 07/07/07 ##
|
||||
## ##
|
||||
##----------------------------------------------------------##
|
||||
|
||||
VER_STR ?= 9.0
|
||||
DOXYGEN_DOC_PATH := /usr/local/include/doc
|
||||
|
||||
|
||||
define PREPARE_DOXYGEN
|
||||
sed 's/MODULE/$(MODULE)/g' $(1) | sed 's/VER_STR/$(VER_STR)/g' >> ./doc/doxygen.conf
|
||||
endef
|
||||
|
||||
define MAKE_DOC
|
||||
@echo
|
||||
@echo -e "Generate documnet of $(MODULE)\t\t\t Please Waiting..."
|
||||
@$(call PREPARE_DOXYGEN, $(DOXYGEN_DOC_PATH)/doxygen.conf)
|
||||
@doxygen ./doc/doxygen.conf
|
||||
@cp -rf $(DOXYGEN_DOC_PATH)/view_chm.bat ./doc/html
|
||||
@echo
|
||||
@echo ==================================Doxygen End===================================
|
||||
endef
|
||||
|
||||
379
proxy_c/inc/Makefile.indent
Executable file
379
proxy_c/inc/Makefile.indent
Executable file
@@ -0,0 +1,379 @@
|
||||
|
||||
##----------------------------------------------------------##
|
||||
## ##
|
||||
## Universal Makefile Indenting fuction ##
|
||||
## ##
|
||||
## Created : Wei Liu 07/04/30 ##
|
||||
## Revision: [Last]Wei Liu 07/07/07 ##
|
||||
## ##
|
||||
##----------------------------------------------------------##
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make indenting program flags
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
##-bad<61><64>--blank-lines-after-declarations <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA><EFBFBD><EFBFBD>Ͽհ<CFBF><D5B0>С<EFBFBD>
|
||||
BAD_FLAG :=
|
||||
##-bad
|
||||
|
||||
##-bap<61><70>--blank-lines-after-procedures <20><><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͽհ<CFBF><D5B0>С<EFBFBD>
|
||||
BAP_FLAG :=
|
||||
##-bap
|
||||
|
||||
##-bbb<62><62>--blank-lines-after-block-comments <20><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͽհ<CFBF><D5B0>С<EFBFBD>
|
||||
BBB_FLAG :=
|
||||
##-bbb
|
||||
|
||||
##--break-before-boolean-operator bbo <20>ϳ<EFBFBD><CFB3><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||||
BBO_FLAG :=
|
||||
|
||||
##-bc<62><63>--blank-lines-after-commas <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6>ż<EFBFBD><C5BC><EFBFBD><EFBFBD>С<EFBFBD>
|
||||
BC_FLAG :=
|
||||
|
||||
##-bl<62><6C>--braces-after-if-line <20><>if(<28><><EFBFBD><EFBFBD>else,for<6F>ȵ<EFBFBD>)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD>"{"<22>Գ<EFBFBD>һ<EFBFBD>С<EFBFBD>
|
||||
BL_FLAG := -bl
|
||||
|
||||
##-bli<<3C><><EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD>><3E><>--brace-indent<<3C><><EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD>> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>{}<7D><><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD><EFBFBD><EFBFBD>
|
||||
BLI_FLAG := -bli4
|
||||
|
||||
##--braces-after-struct-decl-line bls <20><><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9>"struct"<22><>"{"<22><><EFBFBD><EFBFBD>
|
||||
BLS_FLAG := -bls
|
||||
|
||||
##-br<62><72>--braces-on-if-line <20><>if(<28><><EFBFBD><EFBFBD>else,for<6F>ȵ<EFBFBD>)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>˶ε<CBB6>"{"<22>Գ<EFBFBD>һ<EFBFBD>С<EFBFBD>
|
||||
BR_FLAG :=
|
||||
|
||||
##-bs<62><73>--blank-before-sizeof <20><><EFBFBD><EFBFBD>sizeof֮<66><D6AE><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
||||
BS_FLAG :=
|
||||
|
||||
##`-cbin'
|
||||
##`--case-brace-indentationn'
|
||||
##Indent braces after a case label N spaces.
|
||||
CBI_FLAG := -cbi5
|
||||
|
||||
##-c<<3C><><EFBFBD><EFBFBD>><3E><>--comment-indentation<<3C><><EFBFBD><EFBFBD>> <20><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
CW_FLAG := -c33
|
||||
|
||||
##-cd<<3C><><EFBFBD><EFBFBD>><3E><>--declaration-comment-column<<3C><><EFBFBD><EFBFBD>> <20><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
CD_FLAG := -cd33
|
||||
|
||||
##-cdb<64><62>--comment-delimiters-on-blank-lines <20><>ע<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Գ<EFBFBD>һ<EFBFBD>С<EFBFBD>
|
||||
CDB_FLAG :=
|
||||
|
||||
##-ce<63><65>--cuddle-else <20><><EFBFBD><EFBFBD>else<73><65><EFBFBD><EFBFBD>"}"(ifִ<66><D6B4><EFBFBD><EFBFBD><EFBFBD>εĽ<CEB5>β)֮<>ᡣ
|
||||
CE_FLAG :=
|
||||
|
||||
##-ci<<3C><><EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD>><3E><>--continuation-indentation<<3C><><EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD>> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD><EFBFBD><EFBFBD>
|
||||
CI_FLAG :=
|
||||
##-ci4
|
||||
|
||||
##-cli<<3C><><EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD>><3E><>--case-indentation-<<3C><><EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD>> <20><>ʹ<EFBFBD><CAB9>caseʱ<65><CAB1>switch<63><68><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD><EFBFBD><EFBFBD>
|
||||
CLI_FLAG := -cli0
|
||||
|
||||
##-cp<<3C><><EFBFBD><EFBFBD>><3E><>-else-endif-column<<3C><><EFBFBD><EFBFBD>> <20><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>else<73><65>elseif<69><66><EFBFBD><EFBFBD><EFBFBD>Ҳඨ<D2B2><E0B6A8><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
CP_FLAG := -cp33
|
||||
|
||||
##-cs<63><73>--space-after-cast <20><><EFBFBD><EFBFBD>cast֮<74><D6AE><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
||||
CS_FLAG := -cs
|
||||
|
||||
##-d<<3C><><EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD>><3E><>-line-comments-indentation<<3C><><EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD>> <20><><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2>Ƿ<EFBFBD><C7B7>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD>ע<EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD><EFBFBD>
|
||||
D_FLAG :=
|
||||
##-d0
|
||||
|
||||
##-di<<3C><><EFBFBD><EFBFBD>><3E><>--declaration-indentation<<3C><><EFBFBD><EFBFBD>> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>εı<CEB5><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
DI_FLAG :=
|
||||
##-di4
|
||||
|
||||
##-fc1<63><31>--format-first-column-comments <20><><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>ǰ<EFBFBD>˵<EFBFBD>ע<EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>
|
||||
FC1_FLAG := -fc1
|
||||
|
||||
|
||||
##-fca<63><61>--format-all-comments <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD>͵ĸ<CDB5>ʽ<EFBFBD><CABD>
|
||||
FCA_FLAG :=
|
||||
|
||||
##-gnu<6E><75>--gnu-style <20><>ָ<EFBFBD><D6B8>ʹ<EFBFBD><CAB9>GNU<4E>ĸ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ΪԤ<CEAA><D4A4>ֵ<EFBFBD><D6B5>
|
||||
GNU_FLAG :=
|
||||
|
||||
##-kr<6B><72>--k-and-r-style <20><>ָ<EFBFBD><D6B8>ʹ<EFBFBD><CAB9>Kernighan&Ritchie<69>ĸ<EFBFBD>ʽ<EFBFBD><CABD>
|
||||
KR_FLAG :=
|
||||
|
||||
##-orig<69><67>--original <20><>ʹ<EFBFBD><CAB9>Berkeley<65>ĸ<EFBFBD>ʽ<EFBFBD><CABD>
|
||||
ORG_STYLE :=
|
||||
|
||||
##-i<<3C><><EFBFBD><EFBFBD>><3E><>--indent-level<<3C><><EFBFBD><EFBFBD>> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĸ<C5B5><C4B8><EFBFBD><EFBFBD><EFBFBD>
|
||||
I_FLAG := -i4
|
||||
|
||||
##-ip<<3C><><EFBFBD><EFBFBD>><3E><>--parameter-indentation<<3C><><EFBFBD><EFBFBD>> <20><><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD><EFBFBD>
|
||||
IP_FLAG := -ip4
|
||||
|
||||
##--line-length 75 l75 <20><>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>75
|
||||
LINE_FLAG :=
|
||||
|
||||
##`-lcn'
|
||||
##`--comment-line-lengthn'
|
||||
##Set maximum line length for comment formatting to n.
|
||||
LCN_FLAG :=
|
||||
|
||||
##`-lps'
|
||||
##`--leave-preprocessor-space'
|
||||
##Leave space between `#' and preprocessor directive.
|
||||
LPS_FLAG :=
|
||||
|
||||
##-lp<6C><70>--continue-at-parentheses <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD><D0B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>λ<EFBFBD><CEBB><EFBFBD>ݴ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>
|
||||
LP_FLAG :=
|
||||
|
||||
##--break-function-decl-args nbfda <20>رգ<D8B1><D5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>һ<EFBFBD><D2BB>һ<EFBFBD><D2BB>
|
||||
NBFDA_FLAG := -nbfda
|
||||
|
||||
##-nbad<61><64>--no-blank-lines-after-declarations <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<E1B2BB><D2AA><EFBFBD>Ͽհ<CFBF><D5B0>С<EFBFBD>
|
||||
NBAD_FLAG :=
|
||||
|
||||
##-nbap<61><70>--no-blank-lines-after-procedures <20><><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD>Ҫ<E1B2BB><D2AA><EFBFBD>Ͽհ<CFBF><D5B0>С<EFBFBD>
|
||||
NBAP_FLAG :=
|
||||
|
||||
##-nbbb<62><62>--no-blank-lines-after-block-comments <20><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<E1B2BB><D2AA><EFBFBD>Ͽհ<CFBF><D5B0>С<EFBFBD>
|
||||
NBBB_FLAG :=
|
||||
|
||||
##-nbc<62><63>--no-blank-lines-after-commas <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>ֶ<EFBFBD><D6B6>ţ<EFBFBD><C5A3>Ծɲ<D4BE>Ҫ<EFBFBD><D2AA><EFBFBD>С<EFBFBD>
|
||||
NBC_FLAG := -nbc
|
||||
|
||||
##-ncdb<64><62>--no-comment-delimiters-on-blank-lines <20><>ע<EFBFBD>ͷ<EFBFBD><CDB7>Ų<EFBFBD>Ҫ<EFBFBD>Գ<EFBFBD>һ<EFBFBD>С<EFBFBD>
|
||||
NCBD_FLAG := -ncdb
|
||||
|
||||
##--cuddle-do-while ncdw "do --- while"<22><>"while"<22><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>"}"<22><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||||
NCDW_FLAG := -ncdw
|
||||
|
||||
##-nce<63><65>--dont-cuddle-else <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>else<73><65><EFBFBD><EFBFBD>"}"֮<>ᡣ
|
||||
NCE_FLAG :=
|
||||
##-nce
|
||||
|
||||
##-ncs<63><73>--no-space-after-casts <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>cast֮<74><D6AE><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
||||
NCS_FLAG :=
|
||||
|
||||
##-nfc1<63><31>--dont-format-first-column-comments <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>ǰ<EFBFBD>˵<EFBFBD>ע<EFBFBD>͡<EFBFBD>
|
||||
NFC1_FLAG :=
|
||||
|
||||
##-nfca<63><61>--dont-format-comments <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ʽ<EFBFBD><CABD><EFBFBD>κε<CEBA>ע<EFBFBD>͡<EFBFBD>
|
||||
NFCA_FLAG := -nfca
|
||||
|
||||
##--honour-newlines hnl Prefer to break long lines at the position of newlines in the input
|
||||
HNL_FLAG := -hnl
|
||||
|
||||
##-nip<69><70>--no-parameter-indentation <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>š<EFBFBD>
|
||||
NIP_FLAG :=
|
||||
|
||||
##-nlp<6C><70>--dont-line-up-parentheses <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD><D0B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>λ<EFBFBD><CEBB>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>
|
||||
NLP_FLAG :=
|
||||
|
||||
##-npcs<63><73>--no-space-after-function-call-names <20><><EFBFBD>ڵ<EFBFBD><DAB5>õĺ<C3B5><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD>ᣬ<EFBFBD><E1A3AC>Ҫ<EFBFBD><D2AA><EFBFBD>Ͽո<CFBF><D5B8><EFBFBD>
|
||||
NPCS_FLAG :=
|
||||
|
||||
##-npro<72><6F>--ignore-profile <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ȡindent<6E><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>.indent.pro<72><6F>
|
||||
NPRO_FLAG := -npro
|
||||
|
||||
##-nprs<72><73>--space-after-procedure-calls <20><><EFBFBD><EFBFBD>"<22><>"<22><>"<22><>"ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD> <20><>
|
||||
NPRS_FLAG := -nprs
|
||||
|
||||
##-npsl<73><6C>--dont-break-procedure-type <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>ͬһ<CDAC>С<EFBFBD>
|
||||
NPSL_FLAG := -npsl
|
||||
|
||||
##--space-after-for saf for<6F><72><EFBFBD><EFBFBD><EFBFBD>пո<D0BF>
|
||||
SAF_FLAG := -saf
|
||||
|
||||
##--space-after-if sai if<69><66><EFBFBD><EFBFBD><EFBFBD>пո<D0BF>
|
||||
SAI_FLAG := -sai
|
||||
|
||||
##--space-after-while saw while<6C><65><EFBFBD><EFBFBD><EFBFBD>пո<D0BF>
|
||||
SAW_FLAG := -saw
|
||||
|
||||
##-nsc<73><63>--dont-star-comments <20><>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>Ҫ<E0B2BB><D2AA><EFBFBD><EFBFBD><EFBFBD>Ǻ<EFBFBD>(*)<29><>
|
||||
NSC_FLAG := -nsc
|
||||
|
||||
##-nsob<6F><62>--leave-optional-semicolon <20><><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĿհ<C4BF><D5B0>С<EFBFBD>
|
||||
NSOB_FLAG :=
|
||||
|
||||
##-nss<73><73>--dont-space-special-semicolon <20><><EFBFBD><EFBFBD>for<6F><72>while<6C><65><EFBFBD>ν<EFBFBD><CEBD><EFBFBD>һ<EFBFBD><D2BB>ʱ<EFBFBD><CAB1><EFBFBD>ڷֺ<DAB7>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>Ͽո<CFBF><D5B8><EFBFBD>
|
||||
NSS_FLAG := -nss
|
||||
|
||||
##-nv<6E><76>--no-verbosity <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
||||
NV_FLAG := -nv
|
||||
|
||||
##`-nut'
|
||||
##`--no-tabs'
|
||||
##Use spaces instead of tabs.
|
||||
NUT_FLAG :=
|
||||
##-nut
|
||||
|
||||
##-pcs<63><73>--space-after-procedure-calls <20><><EFBFBD>ڵ<EFBFBD><DAB5>õĺ<C3B5><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"("֮<><D6AE><EFBFBD><EFBFBD><EFBFBD>Ͽո<CFBF><D5B8><EFBFBD>
|
||||
PCS_FLAG := -pcs
|
||||
|
||||
##`-prs'
|
||||
##`--space-after-parentheses'
|
||||
##Put a space after every '(' and before every ')'.
|
||||
PRS_FLAG :=
|
||||
|
||||
##`-pin'
|
||||
##`--paren-indentationn'
|
||||
##Specify the extra indentation per open parentheses '(' when a statement is broken.
|
||||
PI_FLAG :=
|
||||
##-pi4
|
||||
|
||||
##-psl<73><6C>--procnames-start-lines <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>ǰһ<C7B0>С<EFBFBD>
|
||||
PSL_FLAG :=
|
||||
|
||||
##-sc<73><63>--start-left-side-of-comments <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǻ<EFBFBD>(*)<29><>
|
||||
SC_FLAG :=
|
||||
|
||||
##-sob<6F><62>--swallow-optional-blank-lines <20><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>ŵĿհ<C4BF><D5B0>С<EFBFBD>
|
||||
SOB_FLAG := -sob
|
||||
|
||||
## -sbin, --struct-brace-indentationn
|
||||
## Indent braces of a struct, union or enum N spaces.
|
||||
SBI_FLAGE := -sbi4
|
||||
|
||||
##-ss<73><73>--space-special-semicolon <20><><EFBFBD><EFBFBD>for<6F><72>swile<6C><65><EFBFBD>ν<EFBFBD><CEBD><EFBFBD>һ<EFBFBD><D2BB>ʱ<EFBFBD><CAB1><EFBFBD>ڷֺ<DAB7>ǰ<EFBFBD><C7B0><EFBFBD>Ͽո<CFBF><D5B8><EFBFBD>
|
||||
SS_FLAG := -ss
|
||||
|
||||
##-st<73><74>--standard-output <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>ڱ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>
|
||||
ST_FLAG :=
|
||||
|
||||
##-T <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>š<EFBFBD>
|
||||
T_FLAG := -T
|
||||
|
||||
##-ts<<3C><><EFBFBD><EFBFBD>><3E><>--tab-size<<3C><><EFBFBD><EFBFBD>> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>tab<61>ij<EFBFBD><C4B3>ȡ<EFBFBD>
|
||||
TS_FLAG := -ts4
|
||||
##-ts4
|
||||
|
||||
##--use-tabs ut ʹ<><CAB9>tab<61><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
UT_FLAG := -ut
|
||||
##-ut
|
||||
|
||||
##-v<><76>--verbose <20><>ִ<EFBFBD><D6B4>ʱ<EFBFBD><CAB1>ʾ<EFBFBD><CABE>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
||||
V_FLAG := -v
|
||||
|
||||
|
||||
##-version <20><><EFBFBD><EFBFBD>ʾ<EFBFBD>汾<EFBFBD><E6B1BE>Ϣ<EFBFBD><CFA2>
|
||||
VER_FLAG :=
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
##δʵ<CEB4>ֵķ<D6B5><C4B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
##1,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿո<D3BF> (<28><>ʵ<EFBFBD><CAB5>)
|
||||
##2, else <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
##3, ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
##4<><34>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>ע<EFBFBD>Ͷ<EFBFBD>
|
||||
|
||||
## indent flags
|
||||
## -bad -bap -bbb -bbo -bl -bli4 -bls -bs -c33 -cd33 -ce -ci4 -cli0
|
||||
## -cp33 -cs -d0 -di4 -fc1 -hnl -i4 -ip4 -lp -nbc -ncdb -nbfda -ncdw
|
||||
## -nfc1 -nfca -npro -npsl -nsc -nv -pcs -saf -sai -saw -sob -ss -T -ts4 -ut
|
||||
|
||||
INDENT_FLAGS1 := $(GNU_FLAG) \
|
||||
$(KR_FLAG) \
|
||||
$(ORG_STYLE) \
|
||||
$(BAD_FLAG) \
|
||||
$(BAP_FLAG) \
|
||||
$(BBB_FLAG) \
|
||||
$(BBO_FLAG) \
|
||||
$(BC_FLAG) \
|
||||
$(BL_FLAG) \
|
||||
$(BLI_FLAG) \
|
||||
$(BLS_FLAG) \
|
||||
$(BR_FLAG) \
|
||||
$(BS_FLAG) \
|
||||
$(CBI_FLAG) \
|
||||
$(CW_FLAG) \
|
||||
$(CD_FLAG) \
|
||||
$(CDB_FLAG) \
|
||||
$(CE_FLAG) \
|
||||
$(CI_FLAG) \
|
||||
$(CLI_FLAG) \
|
||||
$(CP_FLAG) \
|
||||
$(CS_FLAG) \
|
||||
$(D_FLAG) \
|
||||
$(DI_FLAG) \
|
||||
$(FC1_FLAG) \
|
||||
$(FCA_FLAG) \
|
||||
$(HNL_FLAG) \
|
||||
$(I_FLAG) \
|
||||
$(IP_FLAG) \
|
||||
$(LINE_FLAG ) \
|
||||
$(LP_FLAG) \
|
||||
$(NBAD_FLAG) \
|
||||
$(NBAP_FLAG) \
|
||||
$(NBBB_FLAG) \
|
||||
$(NBC_FLAG) \
|
||||
$(NCBD_FLAG) \
|
||||
$(NBFDA_FLAG) \
|
||||
$(NCDW_FLAG) \
|
||||
$(NCE_FLAG) \
|
||||
$(NCS_FLAG) \
|
||||
$(NFC1_FLAG) \
|
||||
$(NFCA_FLAG) \
|
||||
$(NIP_FLAG) \
|
||||
$(NLP_FLAG) \
|
||||
$(NPCS_FLAG) \
|
||||
$(NPRO_FLAG) \
|
||||
$(NPRS_FLAG) \
|
||||
$(NPSL_FLAG) \
|
||||
$(NSC_FLAG) \
|
||||
$(NSOB_FLAG) \
|
||||
$(NSS_FLAG) \
|
||||
$(NV_FLAG) \
|
||||
$(PCS_FLAG) \
|
||||
$(PI_FLAG) \
|
||||
$(PSL_FLAG) \
|
||||
$(PRS_FLAG) \
|
||||
$(SAF_FLAG) \
|
||||
$(SAI_FLAG) \
|
||||
$(SAW_FLAG) \
|
||||
$(SBI_FLAGE) \
|
||||
$(SC_FLAG) \
|
||||
$(SOB_FLAG) \
|
||||
$(SS_FLAG) \
|
||||
$(ST_FLAG) \
|
||||
$(T_FLAG) \
|
||||
$(TS_FLAG) \
|
||||
$(UT_FLAG) \
|
||||
$(V_FLAG) \
|
||||
$(VER_FLAG) \
|
||||
$(NUT_FLAG)
|
||||
|
||||
INDENT_FLAGS = -kr -i4
|
||||
|
||||
|
||||
##$(warning $(INDENT_FLAGS) $(1))
|
||||
##--------------------------------------
|
||||
##
|
||||
## MAKE_INDENT template
|
||||
##
|
||||
##------------------------------------
|
||||
|
||||
define INDENT_FILE
|
||||
|
||||
indent $(INDENT_FLAGS) $(1)
|
||||
|
||||
endef
|
||||
|
||||
define MAKE_INDENT
|
||||
@echo
|
||||
@echo "[Indent flags ]: $(INDENT_FLAGS)"
|
||||
@echo ""
|
||||
$(foreach file,$(1),$(call INDENT_FILE, $(file)))
|
||||
@echo
|
||||
@echo ===================================Indent End===================================
|
||||
endef
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
347
proxy_c/inc/Makefile.rules
Executable file
347
proxy_c/inc/Makefile.rules
Executable file
@@ -0,0 +1,347 @@
|
||||
|
||||
##----------------------------------------------------------##
|
||||
## ##
|
||||
## Universal Makefile Rules ##
|
||||
## ##
|
||||
##----------------------------------------------------------##
|
||||
|
||||
|
||||
UMAKE_VERSION := V2.0
|
||||
|
||||
##-------------------------------------
|
||||
##
|
||||
## Work Directory : /usr/local/include
|
||||
## Default Target : all
|
||||
##
|
||||
##-------------------------------------
|
||||
default: all
|
||||
.PHONY: all clean rebuild test indent splint doc \
|
||||
dir config check bk lsbk rmbk unzip umakever usage\
|
||||
FORCE
|
||||
.SUFFIXES:
|
||||
|
||||
umakever:
|
||||
@echo "Universal Makefile (UMake) Version: $(UMAKE_VERSION)"
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Makefile CFG defination check
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
ifeq "$(MODULE)" ""
|
||||
$(error Please input the module name (MODULE = )in makefile. )
|
||||
endif
|
||||
|
||||
ifeq "$(CFG)" ""
|
||||
CFG=debug
|
||||
$(warnning No configuration specified for CFG. Defaulting to $(MODULE) - debug. )
|
||||
endif
|
||||
|
||||
ifeq "$(BUILD)" ""
|
||||
BUILD=lib
|
||||
$(warnning No configuration specified for BUILD. Defaulting to create lib$(MODULE).a. )
|
||||
endif
|
||||
|
||||
ifeq "$(SRC_PATH)" ""
|
||||
SRC_PATH=.
|
||||
$(warnning No configuration specified for SRC_PATH. Defaulting to ./. )
|
||||
endif
|
||||
|
||||
COVER_NEED ?= no
|
||||
PLT_PATH ?= ../../plat
|
||||
APP_PATH ?= ../../app
|
||||
TYPE ?= plat
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Gcc Flag for debug or release
|
||||
##
|
||||
##--------------------------------------
|
||||
CC := gcc
|
||||
GCC_CFLAGS := -Wall -MM
|
||||
AR_LINK := ar -r
|
||||
|
||||
RELS_FLAGS_ADD += -DNDEBUG
|
||||
RELEASE_CFLAGS += -g -Wall -I. $(RELS_FLAGS_ADD)
|
||||
RELEASE_LINK_CFLAGS = -g $(RELS_FLAGS_ADD) -o
|
||||
DEBUG_CFLAGS += -g -Wall -rdynamic -DDEBUG -I. $(DBUG_FLAGS_ADD)
|
||||
DEBUG_LINK_CFLAGS = -g -rdynamic -DDEBUG -o
|
||||
|
||||
ifeq "$(COVER_NEED)" "yes"
|
||||
DEBUG_CFLAGS += -fprofile-arcs -ftest-coverage -pg
|
||||
endif
|
||||
|
||||
GCC_CFLAGS=$(DEBUG_CFLAGS)
|
||||
GCC_LINK_CFLAGS=$(DEBUG_LINK_CFLAGS)
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Project setting
|
||||
##
|
||||
##--------------------------------------
|
||||
OBJDIR:=./obj
|
||||
LIBDIR:=./lib
|
||||
UTDIR :=./ut
|
||||
DOCDIR:=./doc
|
||||
DIRBUILD=$(OBJDIR)
|
||||
|
||||
ifeq "$(BUILD)" "lib"
|
||||
BINDIR:=./bin
|
||||
OUTFILE=$(LIBDIR)/lib$(MODULE).a
|
||||
DIRNEED=$(UTDIR) $(DOCDIR)
|
||||
DIRBUILD+=$(LIBDIR)
|
||||
else
|
||||
BINDIR:=.
|
||||
OUTFILE=$(BINDIR)/$(MODULE)
|
||||
DIRNEED=
|
||||
DIRBUILD+=$(BINDIR)
|
||||
endif
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## source , object and dependencies files
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
SRC_SUBDIR := $(shell find $(SRC_PATH) -type d)
|
||||
|
||||
vpath %.c $(SRC_SUBDIR)
|
||||
vpath %.o $(OBJDIR)
|
||||
vpath %.d $(OBJDIR)
|
||||
|
||||
SRC_FULL_PATH = $(foreach dir,$(SRC_SUBDIR),$(wildcard $(dir)/*.c))
|
||||
SRC_FILES = $(foreach file, $(notdir $(SRC_FULL_PATH)) ,$(OBJDIR)/$(file))
|
||||
COMMON_OBJ = $(SRC_FILES:%.c=%.o)
|
||||
|
||||
TEST_OBJ_PATH ?= ../../obj
|
||||
|
||||
TEST_OBJ = $(foreach dir,$(TEST_OBJ_PATH),$(wildcard $(dir)/*.o))
|
||||
|
||||
OBJ=$(COMMON_OBJ) $(OBJ_ADD)
|
||||
ALL_OBJ := $(OBJ) $(TEST_OBJ)
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Lib setting
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
ifeq "$(COVER_NEED)" "yes"
|
||||
LIBCOVER=-lgcov
|
||||
endif
|
||||
|
||||
MODULE_PLT_LIB=$(foreach lib,$(PLT_LIB), -L$(PLT_PATH)/$(lib)/lib/ -l$(lib) )
|
||||
MODULE_PLT_LIB+=-lm
|
||||
|
||||
|
||||
MODULE_APP_LIB=$(foreach lib,$(APP_LIB),-L$(APP_PATH)/$(lib)/lib -l$(lib))
|
||||
|
||||
ifneq (,$(findstring hlr,$(PLT_LIB)))
|
||||
MODULE_APP_LIB=
|
||||
##-L../app/ae/src/lib -lpubfunc
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring auceir,$(PLT_LIB)))
|
||||
MODULE_APP_LIB=
|
||||
##-L../app/ae/src/lib -lpubfunc -L../usr/lib -la3a8 -ldl -lpopt
|
||||
endif
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Rules
|
||||
##
|
||||
##--------------------------------------
|
||||
CCFLAG_SWITCH ?= off
|
||||
CC_COMPILE =$(CC) $(GCC_CFLAGS) -c $< -o $@
|
||||
CC_PRG_LINK=$(CC) $(GCC_LINK_CFLAGS) $(OUTFILE) $(ALL_OBJ) $(LIBCOVER) $(MODULE_APP_LIB) $(MODULE_PLT_LIB) $(LIB_ADD)
|
||||
CC_LIB_LINK=$(AR_LINK) $(OUTFILE) $(ALL_OBJ)
|
||||
|
||||
COMPILE=$(CC_COMPILE)
|
||||
PRG_LINK=$(CC_PRG_LINK)
|
||||
LIB_LINK=$(CC_LIB_LINK)
|
||||
|
||||
ifeq "$(BUILD)" "exef"
|
||||
LINK=$(PRG_LINK)
|
||||
else
|
||||
LINK=$(LIB_LINK)
|
||||
endif
|
||||
|
||||
# Build rules
|
||||
|
||||
all: preproc start dir $(ALL_OBJ) #prtdebug
|
||||
@echo Linking :$(OUTFILE)
|
||||
ifeq "$(CCFLAG_SWITCH)" "off"
|
||||
@$(LINK)
|
||||
else
|
||||
$(LINK)
|
||||
endif
|
||||
@$(POSTPROC_CMD)
|
||||
@echo -e "\n================================================================================\n"
|
||||
|
||||
sinclude $(DEPENDS)
|
||||
|
||||
release : CC_COMPILE =$(CC) $(RELEASE_CFLAGS) -c $< -o $@
|
||||
release : CC_PRG_LINK=$(CC) $(RELEASE_LINK_CFLAGS) $(OUTFILE) $(ALL_OBJ) $(MODULE_APP_LIB) $(MODULE_PLT_LIB) $(LIB_ADD)
|
||||
release : all
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make command to use for dependencies
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
MAKE :=make
|
||||
RM :=rm
|
||||
MKDIR :=mkdir
|
||||
|
||||
preproc:
|
||||
@$(PREPROC_CMD)
|
||||
|
||||
start:
|
||||
@echo -e "\n================================================================================\n"
|
||||
@echo "[Building Project]: $(notdir $(MODULE))"
|
||||
ifeq "$(CCFLAG_SWITCH)" "off"
|
||||
@echo "Show Gcc Flags switch = OFF"
|
||||
endif
|
||||
|
||||
prtdebug:
|
||||
@echo "$(MODULE)-$(BUILD)[$(CFG)] build source file:" "$(SRC_FULL_PATH)"
|
||||
@echo SRC_SUBDIR: $(SRC_SUBDIR)
|
||||
@echo SRC_FULL_PATH : $(SRC_FULL_PATH)
|
||||
@echo SRC_FILES : $(SRC_FILES)
|
||||
@echo ALL_OBJ : $(ALL_OBJ)
|
||||
@echo LIB:$(MODULE_PLT_LIB)
|
||||
@echo PLT_LIB: $(PLT_LIB)
|
||||
@echo CCFLAG_SWITCH :$(CCFLAG_SWITCH)
|
||||
|
||||
config: dir
|
||||
|
||||
dir:
|
||||
@$(foreach dir,$(DIRNEED),$(MKDIR) -p $(DIRNEED) --mode=0777; )
|
||||
@$(foreach dir,$(DIRBUILD),$(MKDIR) -p $(dir) --mode=0777; )
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make Rebuild and clean
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
ifneq "$(PROJ)" ""
|
||||
FRIEND_PROJ := $(shell )
|
||||
endif
|
||||
|
||||
jumprebuild:
|
||||
ifneq "$(PROJ)" ""
|
||||
@cd $(FRIEND_PROJ); mak rebuild ; cd -
|
||||
endif
|
||||
|
||||
# Rebuild this project
|
||||
rebuild: jumprebuild cleanall all
|
||||
|
||||
# Clean this project and all dependencies
|
||||
cleanall: clean
|
||||
|
||||
# Clean this project
|
||||
clean:
|
||||
@echo -e "||--------------------------------------------------------------- "
|
||||
@echo -e "|| Umake clean gcc , lcov, doxygen generated and temporary files. "
|
||||
@echo -e "||--------------------------------------------------------------- "
|
||||
@$(RM) -rf $(OBJDIR) $(OUTFILE) $(COVER_REPORT_PATH) ./doc/doxygen.conf ./doc/html ./doc/latex ./doc/rtf $(foreach dir,$(SRC_SUBDIR),$(dir)/*~)
|
||||
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## indent Makefile.indent
|
||||
##
|
||||
##--------------------------------------
|
||||
include ${MAKE_INCLUDE}/Makefile.indent
|
||||
|
||||
indent:
|
||||
@chmod 777 $(SRC_FULL_PATH)
|
||||
@echo ===================================Indent START=================================
|
||||
@echo
|
||||
@echo "[Indent source file ]: $(SRC_FULL_PATH)"
|
||||
$(call MAKE_INDENT , $(SRC_FULL_PATH))
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## splint makefile.splint
|
||||
##
|
||||
##--------------------------------------
|
||||
include ${MAKE_INCLUDE}/Makefile.splint
|
||||
|
||||
SPLINT_FLAG_SWITCH ?= off
|
||||
|
||||
splint:
|
||||
@chmod 777 $(SRC_FULL_PATH)
|
||||
@echo =================================Splint START==================================
|
||||
@echo
|
||||
ifeq "$(SPLINT_FLAG_SWITCH)" "on"
|
||||
@echo "[Splint flags ]: $(SPLINT_FLAGS)"
|
||||
endif
|
||||
@echo "[Lint Clean Project]: $(notdir $(MODULE))"
|
||||
$(call MAKE_SPLINT, $(SRC_FULL_PATH))
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## doc Makefile.doxygen
|
||||
##
|
||||
##--------------------------------------
|
||||
include ${MAKE_INCLUDE}/Makefile.doxygen
|
||||
|
||||
doc:
|
||||
@chmod 777 $(SRC_FULL_PATH)
|
||||
@echo ==================================Doxygen START=================================
|
||||
@echo
|
||||
$(call MAKE_DOC, $(SRC_FULL_PATH))
|
||||
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## backup Makefile.backup
|
||||
##
|
||||
##--------------------------------------
|
||||
include ${MAKE_INCLUDE}/Makefile.backup
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## cov Makefile.cov
|
||||
##
|
||||
##--------------------------------------
|
||||
include ${MAKE_INCLUDE}/Makefile.cov
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## usage Makefile.usage
|
||||
##
|
||||
##--------------------------------------
|
||||
include ${MAKE_INCLUDE}/Makefile.usage
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make dependencies
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
$(OBJDIR)/%.d:%.c
|
||||
@$(CC) $< -MM -MD -o $@
|
||||
|
||||
$(OBJDIR)/%.o:%.c
|
||||
|
||||
ifeq "$(CCFLAG_SWITCH)" "off"
|
||||
@echo -e "building: $(notdir $@) \t\t\t\t please wait ..."
|
||||
@$(COMPILE)
|
||||
else
|
||||
$(COMPILE)
|
||||
endif
|
||||
|
||||
DEPENDS=$(COMMON_OBJ:.o=.d)
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make force
|
||||
##
|
||||
##--------------------------------------
|
||||
FORCE:
|
||||
|
||||
288
proxy_c/inc/Makefile.splint
Executable file
288
proxy_c/inc/Makefile.splint
Executable file
@@ -0,0 +1,288 @@
|
||||
|
||||
##----------------------------------------------------------##
|
||||
## ##
|
||||
## Universal Makefile Splint Function ##
|
||||
## ##
|
||||
## Created : Wei Liu 07/05/20 ##
|
||||
## Revision: [Last]Wei Liu 07/07/07 ##
|
||||
## ##
|
||||
##----------------------------------------------------------##
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make splinting program flags
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
##<23>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ϣ
|
||||
SFLAG_HINTS := #-hints
|
||||
|
||||
##<23>Ƿ<EFBFBD><C7B7>ÿ<EFBFBD><C3BF><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
SFLAG_INCLUDE := +single-include
|
||||
#+never-include
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>ʲô<CAB2><C3B4>
|
||||
SFLAG_LIB := +posixlib
|
||||
##+nolib +nof -warnposix
|
||||
##+unixlib
|
||||
##+posixlib
|
||||
#+nolib +nof -warnposix
|
||||
##+nof
|
||||
##+unixlib
|
||||
##+which_lib
|
||||
|
||||
##
|
||||
SFLAG_DUMP :=
|
||||
##dump ./include/public.h ./include/pub_base.h ./include/includes.h
|
||||
SFLAG_LOAD :=
|
||||
##+load /usr/share/splint/lib/unixstrict.lcd
|
||||
##load ./include/public.h ./include/pub_base.h ./include/includes.h
|
||||
|
||||
SFLAG_DIR :=
|
||||
##-I/work/r9/plat/public/src/include/splint
|
||||
##-I/work/r9/plat/public/src/include/splint
|
||||
##-I /usr/local/work/r9/plat/public/src/include/
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>ģʽ
|
||||
SFLAG_TYPE := -strict
|
||||
|
||||
##<23>Թ<EFBFBD><D4B9><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
SFLAG_SYS_HEADERS := +skip_sys_headers
|
||||
SFLAG_ISO_HEADERS :=
|
||||
#+skip_iso_headers
|
||||
SFLAG_POSIX_HEADERS :=
|
||||
##+skip_posix_headers
|
||||
|
||||
##ÿ<><C3BF>ͷ<EFBFBD>ļ<EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||||
SFLAG_SINGLE_INCLUDE := +singleinclude
|
||||
|
||||
##ϵͳ<CFB5>ļ<EFBFBD>Ŀ¼
|
||||
SFLAG_SYS_DIR :=
|
||||
##+sys-dirs /work/r9/plat/public/src/include/splint
|
||||
|
||||
##<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
||||
SFLAG_PROTO_PARAMNAME := -protoparamname
|
||||
|
||||
##<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SFLAG_UNDERSCORE := -isoreserved -isoreservedinternal
|
||||
|
||||
## <20><>"/*"<22><>"*/"<22><><EFBFBD>ٴ<EFBFBD>ʹ<EFBFBD><CAB9>"/*"<22><>"*/"
|
||||
SFLAG_NESTCOMMENT := -nestcomment
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>δ˵<CEB4><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SFLAG_EXPORT_VAR := -exportvar
|
||||
SFLAG_EXPORT_FCN := -exportfcn
|
||||
SFLAG_EXPORT_TYPE := -exporttype
|
||||
SFLAG_EXPORT_CONST := -exportconst
|
||||
|
||||
##<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>ΪBOOL<4F><4C>
|
||||
SFLAG_LIKELY_BOOL := -likelybool
|
||||
|
||||
##<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SFLAG_CHAR_INT := +charint
|
||||
SFLAG_BOOL_INT := +boolint
|
||||
|
||||
##Report memory transfer errors for initializations to read-only string literals
|
||||
SFLAG_READONLY_TRANS := -readonlytrans
|
||||
|
||||
##A string literal is assigned to a char array that smaller than the string literal needs
|
||||
SFLAG_STRING_SMALLER := -stringliteralsmaller
|
||||
|
||||
##A variable declared outside a macro body starts with the macro-var-prefix
|
||||
SFLAG_MACRO_PREFIX := -macrovarprefixexclude
|
||||
|
||||
##Initializer does not define all elements of a declared array
|
||||
SFLAG_INITAL_ELEMENT := -initallelements
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>
|
||||
SFLAG_PARAM_TYPE := -type
|
||||
|
||||
##Report modification errors in functions declared without a modifies clause
|
||||
SFLAG_MODIFY := -modnomods
|
||||
|
||||
##Use of a checked global in a function with no globals list
|
||||
SFLAG_GLOBAL := -glob-noglobs
|
||||
|
||||
##Use of internal state in function with no globals list
|
||||
SFLAG_INTERNAL_GLOBS := -internal-globs-noglobs
|
||||
|
||||
##Implicit checked qualifier on global variables and qualifier file static scope variables with no checking annotation
|
||||
SFLAG_CHECK_GLOBAL := -imp-checkedstrict-globs -imp-checkedstrict_statics
|
||||
|
||||
##Undocumented modification of a checked global variable in a function with no modifies clause
|
||||
SFLAG_CHECK_GLOBAL_MODIFY := -mod-globs-nomods
|
||||
|
||||
##Storage declared with observer may be modified through a call to an unconstrained function
|
||||
SFLAG_OBSERVER_MODIFY := -mod-observer-uncon
|
||||
|
||||
##<23><><EFBFBD>Է<EFBFBD><D4B7><EFBFBD>ֵ
|
||||
SFLAG_IGNORE_RETVAL := -retval
|
||||
|
||||
##while,if and for statement is not a block
|
||||
SFLAG_WHILE_BLOCK := -whileblock
|
||||
SFLAG_IF_BLOCK := -ifblock
|
||||
SFLAG_FOR_BLOCK := -forblock
|
||||
|
||||
##There is no finals else following an else if construct
|
||||
SFLAG_ELSEIF_COMPLETE := -elseifcomplete
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>
|
||||
SFLAG_POINT_ARITH := -ptrarith -nullptrarith
|
||||
|
||||
##An unconstrained function is called in a function body where modifications are checked.
|
||||
SFLAG_UNCONSTRAIN_MODIFY := -mod-uncon-nomods
|
||||
|
||||
##NO effect of unconstrained functions
|
||||
SFLAG_EFFECT_UNCONSTRAIN := -no-effect-uncon
|
||||
|
||||
##Type-mismatch in parameter corresponding to format code in a printflike or scanflike function
|
||||
SFLAG_FORMAT-TYPE := -format-type
|
||||
|
||||
##An actual parameter that is passed as a unique formal parameter is aliased by another parameter or global variable
|
||||
SFLAG_ALIASING := -alias-unique -ret-alias#-may-alias-unique
|
||||
|
||||
##Transfer Errors flag
|
||||
SFLAG_STORAGE_TRANSFER := -onlytrans -temptrans -unqualified-trans -immediatetrans
|
||||
|
||||
##Report errors for break statements inside a nested while, for or switch
|
||||
SFLAG_DEEP_BREAK := -deep-break #-switch-switch-break -loop-loop-break
|
||||
|
||||
##Storage has inconsistent states of alternate paths through a branch
|
||||
SFLAG_INCONSISTENT_BRANCH := -branch-state
|
||||
|
||||
##There is a non-empty case in a switch not followed by a break.
|
||||
##Likely infinite loop is detected
|
||||
##Likely infinite loop is detected. Loop test or body calls an unconstrained function that may produce an undetected modification
|
||||
SFLAG_PROBLEMATIC_CTR := -case-break -infloops -infloopsuncon
|
||||
|
||||
##An expression may be undefined because a sub-expression contains a call to an unconstrained function (no modifies clause)
|
||||
##that may modify something that may be modified or used by another sub-expression
|
||||
SFLAG_UNDEFINED_EVALORDER := -eval-order-uncon
|
||||
|
||||
##Only storage transferred to an unqualified global or static reference.
|
||||
##This may lead to a memory leak, since the new reference is not necessarily released
|
||||
SFLAG_INITIALIZERS := -only-unq-global-trans
|
||||
|
||||
##Primitive operation does not type check strictly
|
||||
SFLAG_PRIMITIVE_OPERA := -strict-ops -bitwise-signed
|
||||
|
||||
##Unused Declarations <20><>δʹ<CEB4>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SFLAG_DECLARARIONS := -field-use -fcnuse -param-use -typeuse -varuse -enummemuse
|
||||
|
||||
##Function, variable, iterator or constant declared but never defined (δ<><CEB4>ʼ<EFBFBD><CABC>)
|
||||
SFLAG_COMPLETE_PRG := -decl-undef
|
||||
|
||||
##A declaration is exported but not used outside this module or not appear in a header file
|
||||
SFLAG_EXPORTS := -export-local -export-header
|
||||
|
||||
##<23><>warning<6E><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>splint_warn<72><6E>
|
||||
SFLAG_WARN_FILE := #+warning-stream splint_warn
|
||||
|
||||
##<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>splint_error<6F><72>
|
||||
SFLAG_ERROR_FILE := #+error-stream splint_error
|
||||
|
||||
##<23>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
SFLAG_STREAM_OVERWRITE := -streamoverwrite
|
||||
|
||||
##An abstract type defined in M.h (or specified in M.lcl) is accessible in M.c
|
||||
SFLAG_ACCESS := -access-module
|
||||
|
||||
##Function definition is in old style syntax. Standard prototype syntax is preferred.
|
||||
SFLAG_ISO_CONFORMANCE := #-old-style
|
||||
|
||||
##Use of function that may lead to buffer overflow
|
||||
SFLAG_BUFFER := -bufferoverflowhigh
|
||||
|
||||
##A function is declared without a parameter list prototype
|
||||
SFLAG_FUNC_NOPARAM := -noparams
|
||||
|
||||
##Operand of sizeof operator is a type
|
||||
SFLAG_SIZEOF_TYPE := -sizeoftype
|
||||
|
||||
##Storage derivable from a parameter, return value or global variable is not completely defined
|
||||
SFLAG_COMP_DEF := -compdef
|
||||
|
||||
##Behavior of an expression is unspecified or implementation-dependent
|
||||
##because sub-expressions contain interfering side effects that may be evaluated in any order
|
||||
SFLAG_EVAL_ORDER := -eval-order
|
||||
|
||||
##try to recover code
|
||||
SFLAG_TRY_TO_RECOVER := #+trytorecover
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>NULLָ<4C><D6B8>
|
||||
SFLAG_NULL_RET := -nullret
|
||||
|
||||
##A possibly null pointer is reachable from a parameter or global variable that is not declared using a /*@null@*/ annotation
|
||||
SFLAG_NULL_STATE := -nullstate
|
||||
|
||||
##The value of a location that may not be initialized on some execution path is used
|
||||
SFLAG_USE_BEFORE_DEF := -usedef
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>֪<EFBFBD><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Format parameter is not known at compile-time <20><><EFBFBD><EFBFBD>:sprintf(mgcpAsciTempBuf, msg)
|
||||
SFLAG_FORMAT_CONST := -format-const
|
||||
|
||||
##Argument to exit has implementation defined behavior. The only valid arguments to exit are EXIT_SUCCESS, EXIT_FAILURE and 0.
|
||||
##An error is reported if Splint can determine statically that the argument to exit is not one of these
|
||||
SFLAG_EXIT_ARG := -exitarg
|
||||
|
||||
##An extern declaration is used inside a function body
|
||||
SFLAG_EXTERN := -nested-extern
|
||||
|
||||
|
||||
|
||||
SFLAG_OLD_STTLE := -oldstyle
|
||||
|
||||
|
||||
SFLAG_SHIFT_NEG := -shiftnegative
|
||||
|
||||
|
||||
SFLAG_PREPROC := -preproc
|
||||
|
||||
##all splint flags
|
||||
|
||||
SPLINT_FLAGS := $(SFLAG_LIB) $(SFLAG_TYPE) $(SFLAG_SYS_HEADERS) $(SFLAG_ISO_HEADERS)\
|
||||
$(SFLAG_POSIX_HEADERS) $(SFLAG_SINGLEINCLUDE) $(SFLAG_WARN)\
|
||||
$(SFLAG_UNDERSCORE) $(SFLAG_NESTCOMMENT) $(SFLAG_EVAL_ORDER)\
|
||||
$(SFLAG_PROTO_PARAMNAME) $(SFLAG_EXPORT_VAR) $(SFLAG_EXPORT_FCN)\
|
||||
$(SFLAG_EXPORT_TYPE) $(SFLAG_LIKELY_BOOL) $(SFLAG_CHAR_INT)\
|
||||
$(SFLAG_READONLY_TRANS) $(SFLAG_STRING_SMALLER) $(SFLAG_MACRO_PREFIX)\
|
||||
$(SFLAG_INITAL_ELEMENT) $(SFLAG_PARAM_TYPE) $(SFLAG_GLOBAL)\
|
||||
$(SFLAG_CHECK_GLOBAL) $(SFLAG_CHECK_GLOBAL_MODIFY) $(SFLAG_IGNORE_RETVAL)\
|
||||
$(SFLAG_INTERNAL_GLOBS) $(SFLAG_MODIFY) $(SFLAG_BOOL_INT)\
|
||||
$(SFLAG_WHILE_BLOCK) $(SFLAG_HINTS) $(SFLAG_IF_BLOCK) $(SFLAG_FOR_BLOCK)\
|
||||
$(SFLAG_POINT_ARITH) $(SFLAG_ELSEIF_COMPLETE) $(SFLAG_UNCONSTRAIN_MODIFY)\
|
||||
$(SFLAG_EFFECT_UNCONSTRAIN) $(SFLAG_OBSERVER_MODIFY)\
|
||||
$(SFLAG_FORMAT-TYPE) $(SFLAG_ALIASING) $(SFLAG_STORAGE_TRANSFER)\
|
||||
$(SFLAG_DEEP_BREAK) $(SFLAG_INCONSISTENT_BRANCH) $(SFLAG_PROBLEMATIC_CTR)\
|
||||
$(SFLAG_UNDEFINED_EVALORDER) $(SFLAG_INITIALIZERS) $(SFLAG_PRIMITIVE_OPERA)\
|
||||
$(SFLAG_DECLARARIONS) $(SFLAG_COMPLETE_PRG) $(SFLAG_EXPORTS) $(SFLAG_INCLUDE)\
|
||||
$(SFLAG_STREAM_OVERWRITE) $(SFLAG_WARN_FILE) $(SFLAG_ERROR_FILE)\
|
||||
$(SFLAG_ACCESS) $(SFLAG_ISO_CONFORMANCE) $(SFLAG_BUFFER) $(SFLAG_SIZEOF_TYPE)\
|
||||
$(SFLAG_COMP_DEF) $(SFLAG_FUNC_NOPARAM) $(SFLAG_TRY_TO_RECOVER)\
|
||||
$(SFLAG_EXPORT_CONST) $(SFLAG_DUMP) $(SFLAG_LOAD) $(SFLAG_NULL_RET)\
|
||||
$(SFLAG_NULL_STATE) $(SFLAG_USE_BEFORE_DEF) $(SFLAG_FORMAT_CONST)\
|
||||
$(SFLAG_EXIT_ARG) $(SFLAG_EXTERN) $(SFLAG_OLD_STTLE) $(SFLAG_DIR)\
|
||||
$(SFLAG_SHIFT_NEG) $(SFLAG_PREPROC)
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## MAKE_INDENT template
|
||||
##
|
||||
##------------------------------------
|
||||
|
||||
define SPLINT_FILE
|
||||
@echo -e "Splinting: $(notdir $(1)) \t\t\t please wait ..."
|
||||
@nohup splint $(SPLINT_FLAGS) $(1) | sed '$d' | sed '1,2d' |\
|
||||
sed '/Splint /d' | sed '/Finished /d' |\
|
||||
sed '/Cannot continue/d'
|
||||
|
||||
endef
|
||||
|
||||
##@echo $(SPLINT_FLAGS)
|
||||
define MAKE_SPLINT
|
||||
@echo
|
||||
|
||||
$(foreach file,$(1),$(call SPLINT_FILE, $(file)))
|
||||
@echo
|
||||
@echo =======================================End======================================
|
||||
endef
|
||||
36
proxy_c/inc/Makefile.usage
Executable file
36
proxy_c/inc/Makefile.usage
Executable file
@@ -0,0 +1,36 @@
|
||||
|
||||
##----------------------------------------------------------##
|
||||
## ##
|
||||
## Universal Makefile usage ##
|
||||
## ##
|
||||
## Created : Wei Liu 07/04/11 ##
|
||||
## Revision: [Last]Wei Liu 07/07/09 ##
|
||||
## ##
|
||||
##----------------------------------------------------------##
|
||||
|
||||
##-------------------------------------
|
||||
##
|
||||
## Universal Makefile Usage
|
||||
##
|
||||
##-------------------------------------
|
||||
|
||||
usage:
|
||||
@echo "usage: [make ] = make all "
|
||||
@echo "usage: [make all ] "
|
||||
@echo "usage: [make clean ] "
|
||||
@echo "usage: [make rebuild ] "
|
||||
@echo "usage: [make test ] "
|
||||
@echo "usage: [make indent ] "
|
||||
@echo "usage: [make splint ] "
|
||||
@echo "usage: [make prtdebug ] "
|
||||
@echo "usage: [make dir ] "
|
||||
@echo "usage: [make config ] = make dir now "
|
||||
@echo "usage: [make check ] = not supported now "
|
||||
@echo "usage: [make bk ] "
|
||||
@echo "usage: [make lsbk ] "
|
||||
@echo "usage: [make rmbk backfile=*/[filename]] "
|
||||
@echo "usage: [make unzip backfile=[filename] ] "
|
||||
@echo "usage: [make version ] "
|
||||
@echo "usage: [make umakever ] "
|
||||
|
||||
|
||||
222
proxy_c/make.log
Normal file
222
proxy_c/make.log
Normal file
@@ -0,0 +1,222 @@
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o common.o common.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o curl_adaptor.o curl_adaptor.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o log.o log.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o main.o main.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o mini_cli.o mini_cli.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o rest_proxy.o rest_proxy.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
rest_proxy.c: In function ‘rest_update_plan_info_proc’:
|
||||
rest_proxy.c:658:13: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
|
||||
658 | int rc;
|
||||
| ^~
|
||||
At top level:
|
||||
rest_proxy.c:456:14: warning: ‘test_total_plan_value’ defined but not used [-Wunused-variable]
|
||||
456 | static u64 test_total_plan_value=0x100000000, test_used_plan_value=0;
|
||||
| ^~~~~~~~~~~~~~~~~~~~~
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o rest_proxy_conf.o rest_proxy_conf.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o rest_proxy_print.o rest_proxy_print.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o rest_proxy_stat.o rest_proxy_stat.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o restapi.o restapi.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
restapi.c:3078:12: warning: ‘decode_rest_update_sess_info’ defined but not used [-Wunused-function]
|
||||
3078 | static int decode_rest_update_sess_info(u8 *buf, int len, _rest_msg_s *ptr)
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
restapi.c:2369:12: warning: ‘decode_rest_update_recharge_card_res’ defined but not used [-Wunused-function]
|
||||
2369 | static int decode_rest_update_recharge_card_res(u8 *buf, int len, _rest_msg_s *ptr)
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
restapi.c:2326:12: warning: ‘decode_rest_update_recharge_card’ defined but not used [-Wunused-function]
|
||||
2326 | static int decode_rest_update_recharge_card(u8 *buf, int len, _rest_msg_s *ptr)
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o selfcare_config.o selfcare_config.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o selfcare_endecode.o selfcare_endecode.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o selfcare_httpsrv.o selfcare_httpsrv.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o selfcare_proxy.o selfcare_proxy.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o selfcare_res.o selfcare_res.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o selfcare_udp.o selfcare_udp.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
selfcare_udp.c:73:12: warning: ‘_selfcare_udp_inittask’ defined but not used [-Wunused-function]
|
||||
73 | static int _selfcare_udp_inittask()
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o sock_if.o sock_if.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz -c -o utils_queue.o utils_queue.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/
|
||||
gcc: warning: ./dba/lib/libdba.a: linker input file unused because linking not done
|
||||
gcc: warning: ./smcli_client/lib/libclient.a: linker input file unused because linking not done
|
||||
gcc: warning: ./pstn_cli/lib/libpstncli.a: linker input file unused because linking not done
|
||||
gcc: warning: ./tcp/lib/libtcp.a: linker input file unused because linking not done
|
||||
gcc: warning: /usr/lib/x86_64-linux-gnu/libidn.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libevent/lib/libevent_pthreads.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libcurl/lib/libcurl.a: linker input file unused because linking not done
|
||||
gcc: warning: ./third-lib/libmjson/lib/libmjson.a: linker input file unused because linking not done
|
||||
gcc -o ../bin/restproxy -Wall -g -DX86_64 -DTEST_RESTPROXY ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz ./common.c ./curl_adaptor.c ./log.c ./main.c ./mini_cli.c ./rest_proxy.c ./rest_proxy_conf.c ./rest_proxy_print.c ./rest_proxy_stat.c ./restapi.c ./selfcare_config.c ./selfcare_endecode.c ./selfcare_httpsrv.c ./selfcare_proxy.c ./selfcare_res.c ./selfcare_udp.c ./sock_if.c ./utils_queue.c -I ./ -I ./third-lib/libevent/include/ -I ./third-lib/libmjson/include/ -I ./third-lib/libcurl/include/curl/ ./dba/lib/libdba.a ./smcli_client/lib/libclient.a ./pstn_cli/lib/libpstncli.a ./tcp/lib/libtcp.a /usr/lib/x86_64-linux-gnu/libidn.a -I/usr/include/mysql -L/usr/local/lib -L/usr/lib64/mysql -lmysqlclient -lrt -lpthread -lglib-2.0 ./third-lib/libevent/lib/libevent.a ./third-lib/libevent/lib/libevent_pthreads.a ./third-lib/libcurl/lib/libcurl.a ./third-lib/libmjson/lib/libmjson.a -lssl -lcrypto -lzstd -lidn2 -lz
|
||||
./rest_proxy.c: In function ‘rest_update_plan_info_proc’:
|
||||
./rest_proxy.c:658:13: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
|
||||
658 | int rc;
|
||||
| ^~
|
||||
At top level:
|
||||
./rest_proxy.c:456:14: warning: ‘test_total_plan_value’ defined but not used [-Wunused-variable]
|
||||
456 | static u64 test_total_plan_value=0x100000000, test_used_plan_value=0;
|
||||
| ^~~~~~~~~~~~~~~~~~~~~
|
||||
./restapi.c:3078:12: warning: ‘decode_rest_update_sess_info’ defined but not used [-Wunused-function]
|
||||
3078 | static int decode_rest_update_sess_info(u8 *buf, int len, _rest_msg_s *ptr)
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
./restapi.c:2369:12: warning: ‘decode_rest_update_recharge_card_res’ defined but not used [-Wunused-function]
|
||||
2369 | static int decode_rest_update_recharge_card_res(u8 *buf, int len, _rest_msg_s *ptr)
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
./restapi.c:2326:12: warning: ‘decode_rest_update_recharge_card’ defined but not used [-Wunused-function]
|
||||
2326 | static int decode_rest_update_recharge_card(u8 *buf, int len, _rest_msg_s *ptr)
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
./selfcare_udp.c:73:12: warning: ‘_selfcare_udp_inittask’ defined but not used [-Wunused-function]
|
||||
73 | static int _selfcare_udp_inittask()
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~
|
||||
chmod a+x ../bin/restproxy
|
||||
BIN
proxy_c/pkg.tgz
BIN
proxy_c/pkg.tgz
Binary file not shown.
@@ -50,4 +50,5 @@ COVER_REPORT_PATH = ./output
|
||||
## include makefile.rules (Do not change)
|
||||
##
|
||||
##--------------------------------------
|
||||
include ./scripts/Makefile.rules
|
||||
MAKE_INCLUDE = ../inc
|
||||
include ${MAKE_INCLUDE}/Makefile.rules
|
||||
|
||||
@@ -50,4 +50,5 @@ COVER_REPORT_PATH = ./output
|
||||
## include makefile.rules (Do not change)
|
||||
##
|
||||
##--------------------------------------
|
||||
include ./scripts/Makefile.rules
|
||||
MAKE_INCLUDE = ../inc
|
||||
include ${MAKE_INCLUDE}/Makefile.rules
|
||||
|
||||
@@ -95,4 +95,5 @@ COVER_REPORT_PATH = ./output
|
||||
## include makefile.rules (Do not change)
|
||||
##
|
||||
##--------------------------------------
|
||||
include Makefile.rules
|
||||
MAKE_INCLUDE = ../inc
|
||||
include ${MAKE_INCLUDE}/Makefile.rules
|
||||
|
||||
Binary file not shown.
@@ -1,44 +0,0 @@
|
||||
release = no
|
||||
cover = no
|
||||
CC = gcc
|
||||
CPP = g++
|
||||
LD = ld
|
||||
AR = ar
|
||||
CP = cp
|
||||
|
||||
ifeq ($(release), no)
|
||||
CFLAGS += -Wall -Werror -g -fPIC
|
||||
else
|
||||
CFLAGS += -Wall -Werror -O3 -fPIC
|
||||
endif
|
||||
|
||||
LIB_DIR = ./lib
|
||||
CSRC_DIR = ./src
|
||||
OBJ_DIR = ./obj
|
||||
|
||||
CSRCS = $(wildcard $(CSRC_DIR)/*.c)
|
||||
COBJS := $(patsubst %.c, $(OBJ_DIR)/%.o, $(notdir $(CSRCS)))
|
||||
|
||||
TARGET_LIB = $(OBJ_DIR)/libjson.a
|
||||
|
||||
all : chkobjdir $(TARGET_LIB)
|
||||
|
||||
chkobjdir:
|
||||
@if test ! -d $(OBJ_DIR); \
|
||||
then \
|
||||
mkdir $(OBJ_DIR);\
|
||||
fi
|
||||
|
||||
$(OBJ_DIR)/%.o : $(CSRC_DIR)/%.c
|
||||
@echo "COMPILE $<"
|
||||
@$(CC) -fPIC $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(TARGET_LIB) : $(COBJS)
|
||||
@echo "AR $(TARGET_LIB)"
|
||||
@$(AR) cr $(TARGET_LIB) $(COBJS)
|
||||
@$(CP) $(TARGET_LIB) $(LIB_DIR)
|
||||
|
||||
.PHONY:clean
|
||||
clean:
|
||||
@echo "CLEAN $(TARGET_LIB)"
|
||||
@rm -rf $(TARGET_LIB) $(OBJ_DIR)
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* $Id: arraylist.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Internal methods for working with json_type_array objects.
|
||||
* Although this is exposed by the json_object_get_array() method,
|
||||
* it is not recommended for direct use.
|
||||
*/
|
||||
#ifndef _arraylist_h_
|
||||
#define _arraylist_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ARRAY_LIST_DEFAULT_SIZE 32
|
||||
|
||||
typedef void (array_list_free_fn) (void *data);
|
||||
|
||||
struct array_list
|
||||
{
|
||||
void **array;
|
||||
size_t length;
|
||||
size_t size;
|
||||
array_list_free_fn *free_fn;
|
||||
};
|
||||
typedef struct array_list array_list;
|
||||
|
||||
extern struct array_list*
|
||||
array_list_new(array_list_free_fn *free_fn);
|
||||
|
||||
extern void
|
||||
array_list_free(struct array_list *al);
|
||||
|
||||
extern void*
|
||||
array_list_get_idx(struct array_list *al, size_t i);
|
||||
|
||||
extern int
|
||||
array_list_put_idx(struct array_list *al, size_t i, void *data);
|
||||
|
||||
extern int
|
||||
array_list_add(struct array_list *al, void *data);
|
||||
|
||||
extern size_t
|
||||
array_list_length(struct array_list *al);
|
||||
|
||||
extern void
|
||||
array_list_sort(struct array_list *arr, int(*compar)(const void *, const void *));
|
||||
|
||||
extern void* array_list_bsearch(const void **key,
|
||||
struct array_list *arr,
|
||||
int (*sort_fn)(const void *, const void *));
|
||||
|
||||
extern int
|
||||
array_list_del_idx(struct array_list *arr, size_t idx, size_t count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* $Id: json.h,v 1.6 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
* Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief A convenience header that may be included instead of other individual ones.
|
||||
*/
|
||||
#ifndef _json_h_
|
||||
#define _json_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* BEGIN lihua 2018-07-11 PN: 屏蔽此行 */
|
||||
#if 0
|
||||
#include "debug.h"
|
||||
#endif
|
||||
/* BEGIN lihua 2018-07-11 */
|
||||
#include "linkhash.h"
|
||||
#include "arraylist.h"
|
||||
#include "json_util.h"
|
||||
#include "json_object.h"
|
||||
#include "json_pointer.h"
|
||||
#include "json_tokener.h"
|
||||
#include "json_object_iterator.h"
|
||||
#include "json_c_version.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012,2017 Eric Haszlakiewicz
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Methods for retrieving the json-c version.
|
||||
*/
|
||||
#ifndef _json_c_version_h_
|
||||
#define _json_c_version_h_
|
||||
|
||||
#define JSON_C_MAJOR_VERSION 0
|
||||
#define JSON_C_MINOR_VERSION 13
|
||||
#define JSON_C_MICRO_VERSION 99
|
||||
#define JSON_C_VERSION_NUM ((JSON_C_MAJOR_VERSION << 16) | \
|
||||
(JSON_C_MINOR_VERSION << 8) | \
|
||||
JSON_C_MICRO_VERSION)
|
||||
#define JSON_C_VERSION "0.13.99"
|
||||
|
||||
/**
|
||||
* @see JSON_C_VERSION
|
||||
* @return the version of the json-c library as a string
|
||||
*/
|
||||
const char *json_c_version(void); /* Returns JSON_C_VERSION */
|
||||
|
||||
/**
|
||||
* The json-c version encoded into an int, with the low order 8 bits
|
||||
* being the micro version, the next higher 8 bits being the minor version
|
||||
* and the next higher 8 bits being the major version.
|
||||
* For example, 7.12.99 would be 0x00070B63.
|
||||
*
|
||||
* @see JSON_C_VERSION_NUM
|
||||
* @return the version of the json-c library as an int
|
||||
*/
|
||||
int json_c_version_num(void); /* Returns JSON_C_VERSION_NUM */
|
||||
|
||||
#endif
|
||||
@@ -1,4 +0,0 @@
|
||||
/* json_config.h. Generated from json_config.h.in by configure. */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define JSON_C_HAVE_INTTYPES_H 1
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
#ifndef _json_inttypes_h_
|
||||
#define _json_inttypes_h_
|
||||
|
||||
#include "json_config.h"
|
||||
|
||||
#ifdef JSON_C_HAVE_INTTYPES_H
|
||||
/* inttypes.h includes stdint.h */
|
||||
#include <inttypes.h>
|
||||
|
||||
#else
|
||||
#include <stdint.h>
|
||||
|
||||
#define PRId64 "I64d"
|
||||
#define SCNd64 "I64d"
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,240 +0,0 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file json_object_iterator.h
|
||||
*
|
||||
* Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
* @brief An API for iterating over json_type_object objects,
|
||||
* styled to be familiar to C++ programmers.
|
||||
* Unlike json_object_object_foreach() and
|
||||
* json_object_object_foreachC(), this avoids the need to expose
|
||||
* json-c internals like lh_entry.
|
||||
*
|
||||
* API attributes: <br>
|
||||
* * Thread-safe: NO<br>
|
||||
* * Reentrant: NO
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef JSON_OBJECT_ITERATOR_H
|
||||
#define JSON_OBJECT_ITERATOR_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Forward declaration for the opaque iterator information.
|
||||
*/
|
||||
struct json_object_iter_info_;
|
||||
|
||||
/**
|
||||
* The opaque iterator that references a name/value pair within
|
||||
* a JSON Object instance or the "end" iterator value.
|
||||
*/
|
||||
struct json_object_iterator {
|
||||
const void* opaque_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* forward declaration of json-c's JSON value instance structure
|
||||
*/
|
||||
struct json_object;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes an iterator structure to a "default" value that
|
||||
* is convenient for initializing an iterator variable to a
|
||||
* default state (e.g., initialization list in a class'
|
||||
* constructor).
|
||||
*
|
||||
* @code
|
||||
* struct json_object_iterator iter = json_object_iter_init_default();
|
||||
* MyClass() : iter_(json_object_iter_init_default())
|
||||
* @endcode
|
||||
*
|
||||
* @note The initialized value doesn't reference any specific
|
||||
* pair, is considered an invalid iterator, and MUST NOT
|
||||
* be passed to any json-c API that expects a valid
|
||||
* iterator.
|
||||
*
|
||||
* @note User and internal code MUST NOT make any assumptions
|
||||
* about and dependencies on the value of the "default"
|
||||
* iterator value.
|
||||
*
|
||||
* @return json_object_iterator
|
||||
*/
|
||||
struct json_object_iterator
|
||||
json_object_iter_init_default(void);
|
||||
|
||||
/** Retrieves an iterator to the first pair of the JSON Object.
|
||||
*
|
||||
* @warning Any modification of the underlying pair invalidates all
|
||||
* iterators to that pair.
|
||||
*
|
||||
* @param obj JSON Object instance (MUST be of type json_object)
|
||||
*
|
||||
* @return json_object_iterator If the JSON Object has at
|
||||
* least one pair, on return, the iterator refers
|
||||
* to the first pair. If the JSON Object doesn't
|
||||
* have any pairs, the returned iterator is
|
||||
* equivalent to the "end" iterator for the same
|
||||
* JSON Object instance.
|
||||
*
|
||||
* @code
|
||||
* struct json_object_iterator it;
|
||||
* struct json_object_iterator itEnd;
|
||||
* struct json_object* obj;
|
||||
*
|
||||
* obj = json_tokener_parse("{'first':'george', 'age':100}");
|
||||
* it = json_object_iter_begin(obj);
|
||||
* itEnd = json_object_iter_end(obj);
|
||||
*
|
||||
* while (!json_object_iter_equal(&it, &itEnd)) {
|
||||
* printf("%s\n",
|
||||
* json_object_iter_peek_name(&it));
|
||||
* json_object_iter_next(&it);
|
||||
* }
|
||||
*
|
||||
* @endcode
|
||||
*/
|
||||
struct json_object_iterator
|
||||
json_object_iter_begin(struct json_object* obj);
|
||||
|
||||
/** Retrieves the iterator that represents the position beyond the
|
||||
* last pair of the given JSON Object instance.
|
||||
*
|
||||
* @warning Do NOT write code that assumes that the "end"
|
||||
* iterator value is NULL, even if it is so in a
|
||||
* particular instance of the implementation.
|
||||
*
|
||||
* @note The reason we do not (and MUST NOT) provide
|
||||
* "json_object_iter_is_end(json_object_iterator* iter)"
|
||||
* type of API is because it would limit the underlying
|
||||
* representation of name/value containment (or force us
|
||||
* to add additional, otherwise unnecessary, fields to
|
||||
* the iterator structure). The "end" iterator and the
|
||||
* equality test method, on the other hand, permit us to
|
||||
* cleanly abstract pretty much any reasonable underlying
|
||||
* representation without burdening the iterator
|
||||
* structure with unnecessary data.
|
||||
*
|
||||
* @note For performance reasons, memorize the "end" iterator prior
|
||||
* to any loop.
|
||||
*
|
||||
* @param obj JSON Object instance (MUST be of type json_object)
|
||||
*
|
||||
* @return json_object_iterator On return, the iterator refers
|
||||
* to the "end" of the Object instance's pairs
|
||||
* (i.e., NOT the last pair, but "beyond the last
|
||||
* pair" value)
|
||||
*/
|
||||
struct json_object_iterator
|
||||
json_object_iter_end(const struct json_object* obj);
|
||||
|
||||
/** Returns an iterator to the next pair, if any
|
||||
*
|
||||
* @warning Any modification of the underlying pair
|
||||
* invalidates all iterators to that pair.
|
||||
*
|
||||
* @param iter [IN/OUT] Pointer to iterator that references a
|
||||
* name/value pair; MUST be a valid, non-end iterator.
|
||||
* WARNING: bad things will happen if invalid or "end"
|
||||
* iterator is passed. Upon return will contain the
|
||||
* reference to the next pair if there is one; if there
|
||||
* are no more pairs, will contain the "end" iterator
|
||||
* value, which may be compared against the return value
|
||||
* of json_object_iter_end() for the same JSON Object
|
||||
* instance.
|
||||
*/
|
||||
void
|
||||
json_object_iter_next(struct json_object_iterator* iter);
|
||||
|
||||
|
||||
/** Returns a const pointer to the name of the pair referenced
|
||||
* by the given iterator.
|
||||
*
|
||||
* @param iter pointer to iterator that references a name/value
|
||||
* pair; MUST be a valid, non-end iterator.
|
||||
*
|
||||
* @warning bad things will happen if an invalid or
|
||||
* "end" iterator is passed.
|
||||
*
|
||||
* @return const char* Pointer to the name of the referenced
|
||||
* name/value pair. The name memory belongs to the
|
||||
* name/value pair, will be freed when the pair is
|
||||
* deleted or modified, and MUST NOT be modified or
|
||||
* freed by the user.
|
||||
*/
|
||||
const char*
|
||||
json_object_iter_peek_name(const struct json_object_iterator* iter);
|
||||
|
||||
|
||||
/** Returns a pointer to the json-c instance representing the
|
||||
* value of the referenced name/value pair, without altering
|
||||
* the instance's reference count.
|
||||
*
|
||||
* @param iter pointer to iterator that references a name/value
|
||||
* pair; MUST be a valid, non-end iterator.
|
||||
*
|
||||
* @warning bad things will happen if invalid or
|
||||
* "end" iterator is passed.
|
||||
*
|
||||
* @return struct json_object* Pointer to the json-c value
|
||||
* instance of the referenced name/value pair; the
|
||||
* value's reference count is not changed by this
|
||||
* function: if you plan to hold on to this json-c node,
|
||||
* take a look at json_object_get() and
|
||||
* json_object_put(). IMPORTANT: json-c API represents
|
||||
* the JSON Null value as a NULL json_object instance
|
||||
* pointer.
|
||||
*/
|
||||
struct json_object*
|
||||
json_object_iter_peek_value(const struct json_object_iterator* iter);
|
||||
|
||||
|
||||
/** Tests two iterators for equality. Typically used to test
|
||||
* for end of iteration by comparing an iterator to the
|
||||
* corresponding "end" iterator (that was derived from the same
|
||||
* JSON Object instance).
|
||||
*
|
||||
* @note The reason we do not (and MUST NOT) provide
|
||||
* "json_object_iter_is_end(json_object_iterator* iter)"
|
||||
* type of API is because it would limit the underlying
|
||||
* representation of name/value containment (or force us
|
||||
* to add additional, otherwise unnecessary, fields to
|
||||
* the iterator structure). The equality test method, on
|
||||
* the other hand, permits us to cleanly abstract pretty
|
||||
* much any reasonable underlying representation.
|
||||
*
|
||||
* @param iter1 Pointer to first valid, non-NULL iterator
|
||||
* @param iter2 POinter to second valid, non-NULL iterator
|
||||
*
|
||||
* @warning if a NULL iterator pointer or an uninitialized
|
||||
* or invalid iterator, or iterators derived from
|
||||
* different JSON Object instances are passed, bad things
|
||||
* will happen!
|
||||
*
|
||||
* @return json_bool non-zero if iterators are equal (i.e., both
|
||||
* reference the same name/value pair or are both at
|
||||
* "end"); zero if they are not equal.
|
||||
*/
|
||||
json_bool
|
||||
json_object_iter_equal(const struct json_object_iterator* iter1,
|
||||
const struct json_object_iterator* iter2);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* JSON_OBJECT_ITERATOR_H */
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Alexadru Ardelean.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief JSON Pointer (RFC 6901) implementation for retrieving
|
||||
* objects from a json-c object tree.
|
||||
*/
|
||||
#ifndef _json_pointer_h_
|
||||
#define _json_pointer_h_
|
||||
|
||||
#include "json_object.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Retrieves a JSON sub-object from inside another JSON object
|
||||
* using the JSON pointer notation as defined in RFC 6901
|
||||
* https://tools.ietf.org/html/rfc6901
|
||||
*
|
||||
* The returned JSON sub-object is equivalent to parsing manually the
|
||||
* 'obj' JSON tree ; i.e. it's not a new object that is created, but rather
|
||||
* a pointer inside the JSON tree.
|
||||
*
|
||||
* Internally, this is equivalent to doing a series of 'json_object_object_get()'
|
||||
* and 'json_object_array_get_idx()' along the given 'path'.
|
||||
*
|
||||
* Note that the 'path' string supports 'printf()' type arguments, so, whatever
|
||||
* is added after the 'res' param will be treated as an argument for 'path'
|
||||
* Example: json_pointer_get(obj, "/foo/%d/%s", &res, 0, bar)
|
||||
* This means, that you need to escape '%' with '%%' (just like in printf())
|
||||
*
|
||||
* @param obj the json_object instance/tree from where to retrieve sub-objects
|
||||
* @param path a (RFC6901) string notation for the sub-object to retrieve
|
||||
* @param res a pointer where to store a reference to the json_object
|
||||
* associated with the given path
|
||||
*
|
||||
* @return negative if an error (or not found), or 0 if succeeded
|
||||
*/
|
||||
int json_pointer_get(struct json_object *obj, const char *path, struct json_object **res);
|
||||
|
||||
/**
|
||||
* This is a variant of 'json_pointer_get()' that supports printf() style arguments.
|
||||
*
|
||||
* Example: json_pointer_getf(obj, res, "/foo/%d/%s", 0, bak)
|
||||
* This also means that you need to escape '%' with '%%' (just like in printf())
|
||||
*
|
||||
* Please take into consideration all recommended 'printf()' format security
|
||||
* aspects when using this function.
|
||||
*
|
||||
* @param obj the json_object instance/tree to which to add a sub-object
|
||||
* @param res a pointer where to store a reference to the json_object
|
||||
* associated with the given path
|
||||
* @param path_fmt a printf() style format for the path
|
||||
*
|
||||
* @return negative if an error (or not found), or 0 if succeeded
|
||||
*/
|
||||
int json_pointer_getf(struct json_object *obj, struct json_object **res, const char *path_fmt, ...);
|
||||
|
||||
/**
|
||||
* Sets JSON object 'value' in the 'obj' tree at the location specified
|
||||
* by the 'path'. 'path' is JSON pointer notation as defined in RFC 6901
|
||||
* https://tools.ietf.org/html/rfc6901
|
||||
*
|
||||
* Note that 'obj' is a double pointer, mostly for the "" (empty string)
|
||||
* case, where the entire JSON object would be replaced by 'value'.
|
||||
* In the case of the "" path, the object at '*obj' will have it's refcount
|
||||
* decremented with 'json_object_put()' and the 'value' object will be assigned to it.
|
||||
*
|
||||
* For other cases (JSON sub-objects) ownership of 'value' will be transferred into
|
||||
* '*obj' via 'json_object_object_add()' & 'json_object_array_put_idx()', so the
|
||||
* only time the refcount should be decremented for 'value' is when the return value of
|
||||
* 'json_pointer_set()' is negative (meaning the 'value' object did not get set into '*obj').
|
||||
*
|
||||
* That also implies that 'json_pointer_set()' does not do any refcount incrementing.
|
||||
* (Just that single decrement that was mentioned above).
|
||||
*
|
||||
* Note that the 'path' string supports 'printf()' type arguments, so, whatever
|
||||
* is added after the 'value' param will be treated as an argument for 'path'
|
||||
* Example: json_pointer_set(obj, "/foo/%d/%s", value, 0, bak)
|
||||
* This means, that you need to escape '%' with '%%' (just like in printf())
|
||||
*
|
||||
* @param obj the json_object instance/tree to which to add a sub-object
|
||||
* @param path a (RFC6901) string notation for the sub-object to set in the tree
|
||||
* @param value object to set at path
|
||||
*
|
||||
* @return negative if an error (or not found), or 0 if succeeded
|
||||
*/
|
||||
int json_pointer_set(struct json_object **obj, const char *path, struct json_object *value);
|
||||
|
||||
/**
|
||||
* This is a variant of 'json_pointer_set()' that supports printf() style arguments.
|
||||
*
|
||||
* Example: json_pointer_setf(obj, value, "/foo/%d/%s", 0, bak)
|
||||
* This also means that you need to escape '%' with '%%' (just like in printf())
|
||||
*
|
||||
* Please take into consideration all recommended 'printf()' format security
|
||||
* aspects when using this function.
|
||||
*
|
||||
* @param obj the json_object instance/tree to which to add a sub-object
|
||||
* @param value object to set at path
|
||||
* @param path_fmt a printf() style format for the path
|
||||
*
|
||||
* @return negative if an error (or not found), or 0 if succeeded
|
||||
*/
|
||||
int json_pointer_setf(struct json_object **obj, struct json_object *value, const char *path_fmt, ...);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* $Id: json_tokener.h,v 1.10 2006/07/25 03:24:50 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Methods to parse an input string into a tree of json_object objects.
|
||||
*/
|
||||
#ifndef _json_tokener_h_
|
||||
#define _json_tokener_h_
|
||||
|
||||
#include <stddef.h>
|
||||
#include "json_object.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum json_tokener_error {
|
||||
json_tokener_success,
|
||||
json_tokener_continue,
|
||||
json_tokener_error_depth,
|
||||
json_tokener_error_parse_eof,
|
||||
json_tokener_error_parse_unexpected,
|
||||
json_tokener_error_parse_null,
|
||||
json_tokener_error_parse_boolean,
|
||||
json_tokener_error_parse_number,
|
||||
json_tokener_error_parse_array,
|
||||
json_tokener_error_parse_object_key_name,
|
||||
json_tokener_error_parse_object_key_sep,
|
||||
json_tokener_error_parse_object_value_sep,
|
||||
json_tokener_error_parse_string,
|
||||
json_tokener_error_parse_comment,
|
||||
json_tokener_error_size
|
||||
};
|
||||
|
||||
enum json_tokener_state {
|
||||
json_tokener_state_eatws,
|
||||
json_tokener_state_start,
|
||||
json_tokener_state_finish,
|
||||
json_tokener_state_null,
|
||||
json_tokener_state_comment_start,
|
||||
json_tokener_state_comment,
|
||||
json_tokener_state_comment_eol,
|
||||
json_tokener_state_comment_end,
|
||||
json_tokener_state_string,
|
||||
json_tokener_state_string_escape,
|
||||
json_tokener_state_escape_unicode,
|
||||
json_tokener_state_boolean,
|
||||
json_tokener_state_number,
|
||||
json_tokener_state_array,
|
||||
json_tokener_state_array_add,
|
||||
json_tokener_state_array_sep,
|
||||
json_tokener_state_object_field_start,
|
||||
json_tokener_state_object_field,
|
||||
json_tokener_state_object_field_end,
|
||||
json_tokener_state_object_value,
|
||||
json_tokener_state_object_value_add,
|
||||
json_tokener_state_object_sep,
|
||||
json_tokener_state_array_after_sep,
|
||||
json_tokener_state_object_field_start_after_sep,
|
||||
json_tokener_state_inf
|
||||
};
|
||||
|
||||
struct json_tokener_srec
|
||||
{
|
||||
enum json_tokener_state state, saved_state;
|
||||
struct json_object *obj;
|
||||
struct json_object *current;
|
||||
char *obj_field_name;
|
||||
};
|
||||
|
||||
#define JSON_TOKENER_DEFAULT_DEPTH 32
|
||||
|
||||
struct json_tokener
|
||||
{
|
||||
char *str;
|
||||
struct printbuf *pb;
|
||||
int max_depth, depth, is_double, st_pos, char_offset;
|
||||
enum json_tokener_error err;
|
||||
unsigned int ucs_char;
|
||||
char quote_char;
|
||||
struct json_tokener_srec *stack;
|
||||
int flags;
|
||||
};
|
||||
/**
|
||||
* @deprecated Unused in json-c code
|
||||
*/
|
||||
typedef struct json_tokener json_tokener;
|
||||
|
||||
/**
|
||||
* Be strict when parsing JSON input. Use caution with
|
||||
* this flag as what is considered valid may become more
|
||||
* restrictive from one release to the next, causing your
|
||||
* code to fail on previously working input.
|
||||
*
|
||||
* This flag is not set by default.
|
||||
*
|
||||
* @see json_tokener_set_flags()
|
||||
*/
|
||||
#define JSON_TOKENER_STRICT 0x01
|
||||
|
||||
/**
|
||||
* Given an error previously returned by json_tokener_get_error(),
|
||||
* return a human readable description of the error.
|
||||
*
|
||||
* @return a generic error message is returned if an invalid error value is provided.
|
||||
*/
|
||||
const char *json_tokener_error_desc(enum json_tokener_error jerr);
|
||||
|
||||
/**
|
||||
* Retrieve the error caused by the last call to json_tokener_parse_ex(),
|
||||
* or json_tokener_success if there is no error.
|
||||
*
|
||||
* When parsing a JSON string in pieces, if the tokener is in the middle
|
||||
* of parsing this will return json_tokener_continue.
|
||||
*
|
||||
* See also json_tokener_error_desc().
|
||||
*/
|
||||
JSON_EXPORT enum json_tokener_error json_tokener_get_error(struct json_tokener *tok);
|
||||
|
||||
JSON_EXPORT struct json_tokener* json_tokener_new(void);
|
||||
JSON_EXPORT struct json_tokener* json_tokener_new_ex(int depth);
|
||||
JSON_EXPORT void json_tokener_free(struct json_tokener *tok);
|
||||
JSON_EXPORT void json_tokener_reset(struct json_tokener *tok);
|
||||
JSON_EXPORT struct json_object* json_tokener_parse(const char *str);
|
||||
JSON_EXPORT struct json_object* json_tokener_parse_verbose(const char *str, enum json_tokener_error *error);
|
||||
|
||||
/**
|
||||
* Set flags that control how parsing will be done.
|
||||
*/
|
||||
JSON_EXPORT void json_tokener_set_flags(struct json_tokener *tok, int flags);
|
||||
|
||||
/**
|
||||
* Parse a string and return a non-NULL json_object if a valid JSON value
|
||||
* is found. The string does not need to be a JSON object or array;
|
||||
* it can also be a string, number or boolean value.
|
||||
*
|
||||
* A partial JSON string can be parsed. If the parsing is incomplete,
|
||||
* NULL will be returned and json_tokener_get_error() will return
|
||||
* json_tokener_continue.
|
||||
* json_tokener_parse_ex() can then be called with additional bytes in str
|
||||
* to continue the parsing.
|
||||
*
|
||||
* If json_tokener_parse_ex() returns NULL and the error is anything other than
|
||||
* json_tokener_continue, a fatal error has occurred and parsing must be
|
||||
* halted. Then, the tok object must not be reused until json_tokener_reset() is
|
||||
* called.
|
||||
*
|
||||
* When a valid JSON value is parsed, a non-NULL json_object will be
|
||||
* returned. Also, json_tokener_get_error() will return json_tokener_success.
|
||||
* Be sure to check the type with json_object_is_type() or
|
||||
* json_object_get_type() before using the object.
|
||||
*
|
||||
* @b XXX this shouldn't use internal fields:
|
||||
* Trailing characters after the parsed value do not automatically cause an
|
||||
* error. It is up to the caller to decide whether to treat this as an
|
||||
* error or to handle the additional characters, perhaps by parsing another
|
||||
* json value starting from that point.
|
||||
*
|
||||
* Extra characters can be detected by comparing the tok->char_offset against
|
||||
* the length of the last len parameter passed in.
|
||||
*
|
||||
* The tokener does \b not maintain an internal buffer so the caller is
|
||||
* responsible for calling json_tokener_parse_ex with an appropriate str
|
||||
* parameter starting with the extra characters.
|
||||
*
|
||||
* This interface is presently not 64-bit clean due to the int len argument
|
||||
* so the function limits the maximum string size to INT32_MAX (2GB).
|
||||
* If the function is called with len == -1 then strlen is called to check
|
||||
* the string length is less than INT32_MAX (2GB)
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
json_object *jobj = NULL;
|
||||
const char *mystring = NULL;
|
||||
int stringlen = 0;
|
||||
enum json_tokener_error jerr;
|
||||
do {
|
||||
mystring = ... // get JSON string, e.g. read from file, etc...
|
||||
stringlen = strlen(mystring);
|
||||
jobj = json_tokener_parse_ex(tok, mystring, stringlen);
|
||||
} while ((jerr = json_tokener_get_error(tok)) == json_tokener_continue);
|
||||
if (jerr != json_tokener_success)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", json_tokener_error_desc(jerr));
|
||||
// Handle errors, as appropriate for your application.
|
||||
}
|
||||
if (tok->char_offset < stringlen) // XXX shouldn't access internal fields
|
||||
{
|
||||
// Handle extra characters after parsed object as desired.
|
||||
// e.g. issue an error, parse another object from that point, etc...
|
||||
}
|
||||
// Success, use jobj here.
|
||||
|
||||
@endcode
|
||||
*
|
||||
* @param tok a json_tokener previously allocated with json_tokener_new()
|
||||
* @param str an string with any valid JSON expression, or portion of. This does not need to be null terminated.
|
||||
* @param len the length of str
|
||||
*/
|
||||
JSON_EXPORT struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
|
||||
const char *str, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* $Id: json_util.h,v 1.4 2006/01/30 23:07:57 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Miscllaneous utility functions and macros.
|
||||
*/
|
||||
#ifndef _json_util_h_
|
||||
#define _json_util_h_
|
||||
|
||||
#include "json_object.h"
|
||||
|
||||
#ifndef json_min
|
||||
#define json_min(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef json_max
|
||||
#define json_max(a,b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define JSON_FILE_BUF_SIZE 4096
|
||||
|
||||
/* utility functions */
|
||||
/**
|
||||
* Read the full contents of the given file, then convert it to a
|
||||
* json_object using json_tokener_parse().
|
||||
*
|
||||
* Returns -1 if something fails. See json_util_get_last_err() for details.
|
||||
*/
|
||||
extern struct json_object* json_object_from_file(const char *filename);
|
||||
|
||||
/**
|
||||
* Create a JSON object from already opened file descriptor.
|
||||
*
|
||||
* This function can be helpful, when you opened the file already,
|
||||
* e.g. when you have a temp file.
|
||||
* Note, that the fd must be readable at the actual position, i.e.
|
||||
* use lseek(fd, 0, SEEK_SET) before.
|
||||
*
|
||||
* Returns -1 if something fails. See json_util_get_last_err() for details.
|
||||
*/
|
||||
extern struct json_object* json_object_from_fd(int fd);
|
||||
|
||||
/**
|
||||
* Equivalent to:
|
||||
* json_object_to_file_ext(filename, obj, JSON_C_TO_STRING_PLAIN);
|
||||
*
|
||||
* Returns -1 if something fails. See json_util_get_last_err() for details.
|
||||
*/
|
||||
extern int json_object_to_file(const char *filename, struct json_object *obj);
|
||||
|
||||
/**
|
||||
* Open and truncate the given file, creating it if necessary, then
|
||||
* convert the json_object to a string and write it to the file.
|
||||
*
|
||||
* Returns -1 if something fails. See json_util_get_last_err() for details.
|
||||
*/
|
||||
extern int json_object_to_file_ext(const char *filename, struct json_object *obj, int flags);
|
||||
|
||||
/**
|
||||
* Convert the json_object to a string and write it to the file descriptor.
|
||||
* Handles partial writes and will keep writing until done, or an error
|
||||
* occurs.
|
||||
*
|
||||
* @param fd an open, writable file descriptor to write to
|
||||
* @param obj the object to serializer and write
|
||||
* @param flags flags to pass to json_object_to_json_string_ext()
|
||||
* @return -1 if something fails. See json_util_get_last_err() for details.
|
||||
*/
|
||||
extern int json_object_to_fd(int fd, struct json_object *obj, int flags);
|
||||
|
||||
/**
|
||||
* Return the last error from various json-c functions, including:
|
||||
* json_object_to_file{,_ext}, json_object_to_fd() or
|
||||
* json_object_from_{file,fd}, or NULL if there is none.
|
||||
*/
|
||||
const char *json_util_get_last_err(void);
|
||||
|
||||
|
||||
extern int json_parse_int64(const char *buf, int64_t *retval);
|
||||
extern int json_parse_double(const char *buf, double *retval);
|
||||
|
||||
/**
|
||||
* Return a string describing the type of the object.
|
||||
* e.g. "int", or "object", etc...
|
||||
*/
|
||||
extern const char *json_type_to_name(enum json_type o_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,381 +0,0 @@
|
||||
/*
|
||||
* $Id: linkhash.h,v 1.6 2006/01/30 23:07:57 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
* Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Internal methods for working with json_type_object objects. Although
|
||||
* this is exposed by the json_object_get_object() function and within the
|
||||
* json_object_iter type, it is not recommended for direct use.
|
||||
*/
|
||||
#ifndef _linkhash_h_
|
||||
#define _linkhash_h_
|
||||
|
||||
#include "json_object.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* golden prime used in hash functions
|
||||
*/
|
||||
#define LH_PRIME 0x9e370001UL
|
||||
|
||||
/**
|
||||
* The fraction of filled hash buckets until an insert will cause the table
|
||||
* to be resized.
|
||||
* This can range from just above 0 up to 1.0.
|
||||
*/
|
||||
#define LH_LOAD_FACTOR 0.66
|
||||
|
||||
/**
|
||||
* sentinel pointer value for empty slots
|
||||
*/
|
||||
#define LH_EMPTY (void*)-1
|
||||
|
||||
/**
|
||||
* sentinel pointer value for freed slots
|
||||
*/
|
||||
#define LH_FREED (void*)-2
|
||||
|
||||
/**
|
||||
* default string hash function
|
||||
*/
|
||||
#define JSON_C_STR_HASH_DFLT 0
|
||||
|
||||
/**
|
||||
* perl-like string hash function
|
||||
*/
|
||||
#define JSON_C_STR_HASH_PERLLIKE 1
|
||||
|
||||
/**
|
||||
* This function sets the hash function to be used for strings.
|
||||
* Must be one of the JSON_C_STR_HASH_* values.
|
||||
* @returns 0 - ok, -1 if parameter was invalid
|
||||
*/
|
||||
int json_global_set_string_hash(const int h);
|
||||
|
||||
struct lh_entry;
|
||||
|
||||
/**
|
||||
* callback function prototypes
|
||||
*/
|
||||
typedef void (lh_entry_free_fn) (struct lh_entry *e);
|
||||
/**
|
||||
* callback function prototypes
|
||||
*/
|
||||
typedef unsigned long (lh_hash_fn) (const void *k);
|
||||
/**
|
||||
* callback function prototypes
|
||||
*/
|
||||
typedef int (lh_equal_fn) (const void *k1, const void *k2);
|
||||
|
||||
/**
|
||||
* An entry in the hash table
|
||||
*/
|
||||
struct lh_entry {
|
||||
/**
|
||||
* The key. Use lh_entry_k() instead of accessing this directly.
|
||||
*/
|
||||
const void *k;
|
||||
/**
|
||||
* A flag for users of linkhash to know whether or not they
|
||||
* need to free k.
|
||||
*/
|
||||
int k_is_constant;
|
||||
/**
|
||||
* The value. Use lh_entry_v() instead of accessing this directly.
|
||||
*/
|
||||
const void *v;
|
||||
/**
|
||||
* The next entry
|
||||
*/
|
||||
struct lh_entry *next;
|
||||
/**
|
||||
* The previous entry.
|
||||
*/
|
||||
struct lh_entry *prev;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The hash table structure.
|
||||
*/
|
||||
struct lh_table {
|
||||
/**
|
||||
* Size of our hash.
|
||||
*/
|
||||
int size;
|
||||
/**
|
||||
* Numbers of entries.
|
||||
*/
|
||||
int count;
|
||||
|
||||
/**
|
||||
* The first entry.
|
||||
*/
|
||||
struct lh_entry *head;
|
||||
|
||||
/**
|
||||
* The last entry.
|
||||
*/
|
||||
struct lh_entry *tail;
|
||||
|
||||
struct lh_entry *table;
|
||||
|
||||
/**
|
||||
* A pointer onto the function responsible for freeing an entry.
|
||||
*/
|
||||
lh_entry_free_fn *free_fn;
|
||||
lh_hash_fn *hash_fn;
|
||||
lh_equal_fn *equal_fn;
|
||||
};
|
||||
typedef struct lh_table lh_table;
|
||||
|
||||
|
||||
/**
|
||||
* Convenience list iterator.
|
||||
*/
|
||||
#define lh_foreach(table, entry) \
|
||||
for(entry = table->head; entry; entry = entry->next)
|
||||
|
||||
/**
|
||||
* lh_foreach_safe allows calling of deletion routine while iterating.
|
||||
*
|
||||
* @param table a struct lh_table * to iterate over
|
||||
* @param entry a struct lh_entry * variable to hold each element
|
||||
* @param tmp a struct lh_entry * variable to hold a temporary pointer to the next element
|
||||
*/
|
||||
#define lh_foreach_safe(table, entry, tmp) \
|
||||
for(entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a new linkhash table.
|
||||
*
|
||||
* @param size initial table size. The table is automatically resized
|
||||
* although this incurs a performance penalty.
|
||||
* @param free_fn callback function used to free memory for entries
|
||||
* when lh_table_free or lh_table_delete is called.
|
||||
* If NULL is provided, then memory for keys and values
|
||||
* must be freed by the caller.
|
||||
* @param hash_fn function used to hash keys. 2 standard ones are defined:
|
||||
* lh_ptr_hash and lh_char_hash for hashing pointer values
|
||||
* and C strings respectively.
|
||||
* @param equal_fn comparison function to compare keys. 2 standard ones defined:
|
||||
* lh_ptr_hash and lh_char_hash for comparing pointer values
|
||||
* and C strings respectively.
|
||||
* @return On success, a pointer to the new linkhash table is returned.
|
||||
* On error, a null pointer is returned.
|
||||
*/
|
||||
extern struct lh_table* lh_table_new(int size,
|
||||
lh_entry_free_fn *free_fn,
|
||||
lh_hash_fn *hash_fn,
|
||||
lh_equal_fn *equal_fn);
|
||||
|
||||
/**
|
||||
* Convenience function to create a new linkhash table with char keys.
|
||||
*
|
||||
* @param size initial table size.
|
||||
* @param free_fn callback function used to free memory for entries.
|
||||
* @return On success, a pointer to the new linkhash table is returned.
|
||||
* On error, a null pointer is returned.
|
||||
*/
|
||||
extern struct lh_table* lh_kchar_table_new(int size,
|
||||
lh_entry_free_fn *free_fn);
|
||||
|
||||
|
||||
/**
|
||||
* Convenience function to create a new linkhash table with ptr keys.
|
||||
*
|
||||
* @param size initial table size.
|
||||
* @param free_fn callback function used to free memory for entries.
|
||||
* @return On success, a pointer to the new linkhash table is returned.
|
||||
* On error, a null pointer is returned.
|
||||
*/
|
||||
extern struct lh_table* lh_kptr_table_new(int size,
|
||||
lh_entry_free_fn *free_fn);
|
||||
|
||||
|
||||
/**
|
||||
* Free a linkhash table.
|
||||
*
|
||||
* If a lh_entry_free_fn callback free function was provided then it is
|
||||
* called for all entries in the table.
|
||||
*
|
||||
* @param t table to free.
|
||||
*/
|
||||
extern void lh_table_free(struct lh_table *t);
|
||||
|
||||
|
||||
/**
|
||||
* Insert a record into the table.
|
||||
*
|
||||
* @param t the table to insert into.
|
||||
* @param k a pointer to the key to insert.
|
||||
* @param v a pointer to the value to insert.
|
||||
*
|
||||
* @return On success, <code>0</code> is returned.
|
||||
* On error, a negative value is returned.
|
||||
*/
|
||||
extern int lh_table_insert(struct lh_table *t, const void *k, const void *v);
|
||||
|
||||
|
||||
/**
|
||||
* Insert a record into the table using a precalculated key hash.
|
||||
*
|
||||
* The hash h, which should be calculated with lh_get_hash() on k, is provided by
|
||||
* the caller, to allow for optimization when multiple operations with the same
|
||||
* key are known to be needed.
|
||||
*
|
||||
* @param t the table to insert into.
|
||||
* @param k a pointer to the key to insert.
|
||||
* @param v a pointer to the value to insert.
|
||||
* @param h hash value of the key to insert
|
||||
* @param opts if set to JSON_C_OBJECT_KEY_IS_CONSTANT, sets lh_entry.k_is_constant
|
||||
* so t's free function knows to avoid freeing the key.
|
||||
*/
|
||||
extern int lh_table_insert_w_hash(struct lh_table *t, const void *k, const void *v, const unsigned long h, const unsigned opts);
|
||||
|
||||
|
||||
/**
|
||||
* Lookup a record in the table.
|
||||
*
|
||||
* @param t the table to lookup
|
||||
* @param k a pointer to the key to lookup
|
||||
* @return a pointer to the record structure of the value or NULL if it does not exist.
|
||||
*/
|
||||
extern struct lh_entry* lh_table_lookup_entry(struct lh_table *t, const void *k);
|
||||
|
||||
/**
|
||||
* Lookup a record in the table using a precalculated key hash.
|
||||
*
|
||||
* The hash h, which should be calculated with lh_get_hash() on k, is provided by
|
||||
* the caller, to allow for optimization when multiple operations with the same
|
||||
* key are known to be needed.
|
||||
*
|
||||
* @param t the table to lookup
|
||||
* @param k a pointer to the key to lookup
|
||||
* @param h hash value of the key to lookup
|
||||
* @return a pointer to the record structure of the value or NULL if it does not exist.
|
||||
*/
|
||||
extern struct lh_entry* lh_table_lookup_entry_w_hash(struct lh_table *t, const void *k, const unsigned long h);
|
||||
|
||||
/**
|
||||
* Lookup a record in the table.
|
||||
*
|
||||
* @param t the table to lookup
|
||||
* @param k a pointer to the key to lookup
|
||||
* @param v a pointer to a where to store the found value (set to NULL if it doesn't exist).
|
||||
* @return whether or not the key was found
|
||||
*/
|
||||
extern json_bool lh_table_lookup_ex(struct lh_table *t, const void *k, void **v);
|
||||
|
||||
/**
|
||||
* Delete a record from the table.
|
||||
*
|
||||
* If a callback free function is provided then it is called for the
|
||||
* for the item being deleted.
|
||||
* @param t the table to delete from.
|
||||
* @param e a pointer to the entry to delete.
|
||||
* @return 0 if the item was deleted.
|
||||
* @return -1 if it was not found.
|
||||
*/
|
||||
extern int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e);
|
||||
|
||||
|
||||
/**
|
||||
* Delete a record from the table.
|
||||
*
|
||||
* If a callback free function is provided then it is called for the
|
||||
* for the item being deleted.
|
||||
* @param t the table to delete from.
|
||||
* @param k a pointer to the key to delete.
|
||||
* @return 0 if the item was deleted.
|
||||
* @return -1 if it was not found.
|
||||
*/
|
||||
extern int lh_table_delete(struct lh_table *t, const void *k);
|
||||
|
||||
extern int lh_table_length(struct lh_table *t);
|
||||
|
||||
/**
|
||||
* Resizes the specified table.
|
||||
*
|
||||
* @param t Pointer to table to resize.
|
||||
* @param new_size New table size. Must be positive.
|
||||
*
|
||||
* @return On success, <code>0</code> is returned.
|
||||
* On error, a negative value is returned.
|
||||
*/
|
||||
int lh_table_resize(struct lh_table *t, int new_size);
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Don't use this outside of linkhash.h:
|
||||
*/
|
||||
#if !defined(_MSC_VER) || (_MSC_VER > 1800)
|
||||
/* VS2010 can't handle inline funcs, so skip it there */
|
||||
#define _LH_INLINE inline
|
||||
#else
|
||||
#define _LH_INLINE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Calculate the hash of a key for a given table.
|
||||
*
|
||||
* This is an exension to support functions that need to calculate
|
||||
* the hash several times and allows them to do it just once and then pass
|
||||
* in the hash to all utility functions. Depending on use case, this can be a
|
||||
* considerable performance improvement.
|
||||
* @param t the table (used to obtain hash function)
|
||||
* @param k a pointer to the key to lookup
|
||||
* @return the key's hash
|
||||
*/
|
||||
static _LH_INLINE unsigned long lh_get_hash(const struct lh_table *t, const void *k)
|
||||
{
|
||||
return t->hash_fn(k);
|
||||
}
|
||||
|
||||
#undef _LH_INLINE
|
||||
|
||||
/**
|
||||
* @deprecated Don't use this outside of linkhash.h:
|
||||
*/
|
||||
#ifdef __UNCONST
|
||||
#define _LH_UNCONST(a) __UNCONST(a)
|
||||
#else
|
||||
#define _LH_UNCONST(a) ((void *)(uintptr_t)(const void *)(a))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return a non-const version of lh_entry.k.
|
||||
*
|
||||
* lh_entry.k is const to indicate and help ensure that linkhash itself doesn't modify
|
||||
* it, but callers are allowed to do what they want with it.
|
||||
* See also lh_entry.k_is_constant
|
||||
*/
|
||||
#define lh_entry_k(entry) _LH_UNCONST((entry)->k)
|
||||
|
||||
/**
|
||||
* Return a non-const version of lh_entry.v.
|
||||
*
|
||||
* v is const to indicate and help ensure that linkhash itself doesn't modify
|
||||
* it, but callers are allowed to do what they want with it.
|
||||
*/
|
||||
#define lh_entry_v(entry) _LH_UNCONST((entry)->v)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* $Id: printbuf.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
|
||||
* The copyrights to the contents of this file are licensed under the MIT License
|
||||
* (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Internal string buffer handing. Unless you're writing a
|
||||
* json_object_to_json_string_fn implementation for use with
|
||||
* json_object_set_serializer() direct use of this is not
|
||||
* recommended.
|
||||
*/
|
||||
#ifndef _printbuf_h_
|
||||
#define _printbuf_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct printbuf {
|
||||
char *buf;
|
||||
int bpos;
|
||||
int size;
|
||||
};
|
||||
typedef struct printbuf printbuf;
|
||||
|
||||
extern struct printbuf*
|
||||
printbuf_new(void);
|
||||
|
||||
/* As an optimization, printbuf_memappend_fast() is defined as a macro
|
||||
* that handles copying data if the buffer is large enough; otherwise
|
||||
* it invokes printbuf_memappend() which performs the heavy
|
||||
* lifting of realloc()ing the buffer and copying data.
|
||||
*
|
||||
* Your code should not use printbuf_memappend() directly unless it
|
||||
* checks the return code. Use printbuf_memappend_fast() instead.
|
||||
*/
|
||||
extern int
|
||||
printbuf_memappend(struct printbuf *p, const char *buf, int size);
|
||||
|
||||
#define printbuf_memappend_fast(p, bufptr, bufsize) \
|
||||
do { \
|
||||
if ((p->size - p->bpos) > bufsize) { \
|
||||
memcpy(p->buf + p->bpos, (bufptr), bufsize); \
|
||||
p->bpos += bufsize; \
|
||||
p->buf[p->bpos]= '\0'; \
|
||||
} else { printbuf_memappend(p, (bufptr), bufsize); } \
|
||||
} while (0)
|
||||
|
||||
#define printbuf_length(p) ((p)->bpos)
|
||||
|
||||
/**
|
||||
* Results in a compile error if the argument is not a string literal.
|
||||
*/
|
||||
#define _printbuf_check_literal(mystr) ("" mystr)
|
||||
|
||||
/**
|
||||
* This is an optimization wrapper around printbuf_memappend() that is useful
|
||||
* for appending string literals. Since the size of string constants is known
|
||||
* at compile time, using this macro can avoid a costly strlen() call. This is
|
||||
* especially helpful when a constant string must be appended many times. If
|
||||
* you got here because of a compilation error caused by passing something
|
||||
* other than a string literal, use printbuf_memappend_fast() in conjunction
|
||||
* with strlen().
|
||||
*
|
||||
* See also:
|
||||
* printbuf_memappend_fast()
|
||||
* printbuf_memappend()
|
||||
* sprintbuf()
|
||||
*/
|
||||
#define printbuf_strappend(pb, str) \
|
||||
printbuf_memappend ((pb), _printbuf_check_literal(str), sizeof(str) - 1)
|
||||
|
||||
/**
|
||||
* Set len bytes of the buffer to charvalue, starting at offset offset.
|
||||
* Similar to calling memset(x, charvalue, len);
|
||||
*
|
||||
* The memory allocated for the buffer is extended as necessary.
|
||||
*
|
||||
* If offset is -1, this starts at the end of the current data in the buffer.
|
||||
*/
|
||||
extern int
|
||||
printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len);
|
||||
|
||||
/**
|
||||
* Formatted print to printbuf.
|
||||
*
|
||||
* This function is the most expensive of the available functions for appending
|
||||
* string data to a printbuf and should be used only where convenience is more
|
||||
* important than speed. Avoid using this function in high performance code or
|
||||
* tight loops; in these scenarios, consider using snprintf() with a static
|
||||
* buffer in conjunction with one of the printbuf_*append() functions.
|
||||
*
|
||||
* See also:
|
||||
* printbuf_memappend_fast()
|
||||
* printbuf_memappend()
|
||||
* printbuf_strappend()
|
||||
*/
|
||||
extern int
|
||||
sprintbuf(struct printbuf *p, const char *msg, ...);
|
||||
|
||||
extern void
|
||||
printbuf_reset(struct printbuf *p);
|
||||
|
||||
extern void
|
||||
printbuf_free(struct printbuf *p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,146 +0,0 @@
|
||||
/*
|
||||
* $Id: arraylist.c,v 1.4 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config_json_c.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#endif /* STDC_HEADERS */
|
||||
|
||||
#if defined(HAVE_STRINGS_H) && !defined(_STRING_H) && !defined(__USE_BSD)
|
||||
# include <strings.h>
|
||||
#endif /* HAVE_STRINGS_H */
|
||||
|
||||
#ifndef SIZE_T_MAX
|
||||
#if SIZEOF_SIZE_T == SIZEOF_INT
|
||||
#define SIZE_T_MAX UINT_MAX
|
||||
#elif SIZEOF_SIZE_T == SIZEOF_LONG
|
||||
#define SIZE_T_MAX ULONG_MAX
|
||||
#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
|
||||
#define SIZE_T_MAX ULLONG_MAX
|
||||
#else
|
||||
#error Unable to determine size of size_t
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "arraylist.h"
|
||||
|
||||
struct array_list*
|
||||
array_list_new(array_list_free_fn *free_fn)
|
||||
{
|
||||
struct array_list *arr;
|
||||
|
||||
arr = (struct array_list*)calloc(1, sizeof(struct array_list));
|
||||
if(!arr) return NULL;
|
||||
arr->size = ARRAY_LIST_DEFAULT_SIZE;
|
||||
arr->length = 0;
|
||||
arr->free_fn = free_fn;
|
||||
if(!(arr->array = (void**)calloc(sizeof(void*), arr->size))) {
|
||||
free(arr);
|
||||
return NULL;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
extern void
|
||||
array_list_free(struct array_list *arr)
|
||||
{
|
||||
size_t i;
|
||||
for(i = 0; i < arr->length; i++)
|
||||
if(arr->array[i]) arr->free_fn(arr->array[i]);
|
||||
free(arr->array);
|
||||
free(arr);
|
||||
}
|
||||
|
||||
void*
|
||||
array_list_get_idx(struct array_list *arr, size_t i)
|
||||
{
|
||||
if(i >= arr->length) return NULL;
|
||||
return arr->array[i];
|
||||
}
|
||||
|
||||
static int array_list_expand_internal(struct array_list *arr, size_t max)
|
||||
{
|
||||
void *t;
|
||||
size_t new_size;
|
||||
|
||||
if(max < arr->size) return 0;
|
||||
/* Avoid undefined behaviour on size_t overflow */
|
||||
if( arr->size >= SIZE_T_MAX / 2 )
|
||||
new_size = max;
|
||||
else
|
||||
{
|
||||
new_size = arr->size << 1;
|
||||
if (new_size < max)
|
||||
new_size = max;
|
||||
}
|
||||
if (new_size > (~((size_t)0)) / sizeof(void*)) return -1;
|
||||
if (!(t = realloc(arr->array, new_size*sizeof(void*)))) return -1;
|
||||
arr->array = (void**)t;
|
||||
(void)memset(arr->array + arr->size, 0, (new_size-arr->size)*sizeof(void*));
|
||||
arr->size = new_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
array_list_put_idx(struct array_list *arr, size_t idx, void *data)
|
||||
{
|
||||
if (idx > SIZE_T_MAX - 1 ) return -1;
|
||||
if(array_list_expand_internal(arr, idx+1)) return -1;
|
||||
if(idx < arr->length && arr->array[idx])
|
||||
arr->free_fn(arr->array[idx]);
|
||||
arr->array[idx] = data;
|
||||
if(arr->length <= idx) arr->length = idx + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
array_list_add(struct array_list *arr, void *data)
|
||||
{
|
||||
return array_list_put_idx(arr, arr->length, data);
|
||||
}
|
||||
|
||||
void
|
||||
array_list_sort(struct array_list *arr, int(*sort_fn)(const void *, const void *))
|
||||
{
|
||||
qsort(arr->array, arr->length, sizeof(arr->array[0]), sort_fn);
|
||||
}
|
||||
|
||||
void* array_list_bsearch(const void **key, struct array_list *arr,
|
||||
int (*sort_fn)(const void *, const void *))
|
||||
{
|
||||
return bsearch(key, arr->array, arr->length, sizeof(arr->array[0]),
|
||||
sort_fn);
|
||||
}
|
||||
|
||||
size_t
|
||||
array_list_length(struct array_list *arr)
|
||||
{
|
||||
return arr->length;
|
||||
}
|
||||
|
||||
int
|
||||
array_list_del_idx( struct array_list *arr, size_t idx, size_t count )
|
||||
{
|
||||
size_t i, stop;
|
||||
|
||||
stop = idx + count;
|
||||
if ( idx >= arr->length || stop > arr->length ) return -1;
|
||||
for ( i = idx; i < stop; ++i ) {
|
||||
if ( arr->array[i] ) arr->free_fn( arr->array[i] );
|
||||
}
|
||||
memmove( arr->array + idx, arr->array + stop, (arr->length - stop) * sizeof(void*) );
|
||||
arr->length -= count;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* $Id: arraylist.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Internal methods for working with json_type_array objects.
|
||||
* Although this is exposed by the json_object_get_array() method,
|
||||
* it is not recommended for direct use.
|
||||
*/
|
||||
#ifndef _arraylist_h_
|
||||
#define _arraylist_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ARRAY_LIST_DEFAULT_SIZE 32
|
||||
|
||||
typedef void (array_list_free_fn) (void *data);
|
||||
|
||||
struct array_list
|
||||
{
|
||||
void **array;
|
||||
size_t length;
|
||||
size_t size;
|
||||
array_list_free_fn *free_fn;
|
||||
};
|
||||
typedef struct array_list array_list;
|
||||
|
||||
extern struct array_list*
|
||||
array_list_new(array_list_free_fn *free_fn);
|
||||
|
||||
extern void
|
||||
array_list_free(struct array_list *al);
|
||||
|
||||
extern void*
|
||||
array_list_get_idx(struct array_list *al, size_t i);
|
||||
|
||||
extern int
|
||||
array_list_put_idx(struct array_list *al, size_t i, void *data);
|
||||
|
||||
extern int
|
||||
array_list_add(struct array_list *al, void *data);
|
||||
|
||||
extern size_t
|
||||
array_list_length(struct array_list *al);
|
||||
|
||||
extern void
|
||||
array_list_sort(struct array_list *arr, int(*compar)(const void *, const void *));
|
||||
|
||||
extern void* array_list_bsearch(const void **key,
|
||||
struct array_list *arr,
|
||||
int (*sort_fn)(const void *, const void *));
|
||||
|
||||
extern int
|
||||
array_list_del_idx(struct array_list *arr, size_t idx, size_t count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,200 +0,0 @@
|
||||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Enable RDRAND Hardware RNG Hash Seed */
|
||||
/* #undef ENABLE_RDRAND */
|
||||
|
||||
/* Enable partial threading support */
|
||||
/* #undef ENABLE_THREADING */
|
||||
|
||||
/* Define if .gnu.warning accepts long strings. */
|
||||
/* #undef HAS_GNU_WARNING_LONG */
|
||||
|
||||
/* Has atomic builtins */
|
||||
#define HAVE_ATOMIC_BUILTINS 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `INFINITY', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL_INFINITY 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL_ISINF 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL_ISNAN 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `nan', and to 0 if you don't. */
|
||||
#define HAVE_DECL_NAN 1
|
||||
|
||||
/* Define to 1 if you have the declaration of `_finite', and to 0 if you
|
||||
don't. */
|
||||
#define HAVE_DECL__FINITE 0
|
||||
|
||||
/* Define to 1 if you have the declaration of `_isnan', and to 0 if you don't.
|
||||
*/
|
||||
#define HAVE_DECL__ISNAN 0
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
||||
/* #undef HAVE_DOPRNT */
|
||||
|
||||
/* Define to 1 if you have the <endian.h> header file. */
|
||||
#define HAVE_ENDIAN_H 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#define HAVE_LOCALE_H 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `open' function. */
|
||||
#define HAVE_OPEN 1
|
||||
|
||||
/* Define to 1 if you have the `realloc' function. */
|
||||
#define HAVE_REALLOC 1
|
||||
|
||||
/* Define to 1 if you have the `setlocale' function. */
|
||||
#define HAVE_SETLOCALE 1
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#define HAVE_STDARG_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strncasecmp' function. */
|
||||
#define HAVE_STRNCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the <syslog.h> header file. */
|
||||
#define HAVE_SYSLOG_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/cdefs.h> header file. */
|
||||
#define HAVE_SYS_CDEFS_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the `uselocale' function. */
|
||||
#define HAVE_USELOCALE 1
|
||||
|
||||
/* Define to 1 if you have the `vasprintf' function. */
|
||||
//#define HAVE_VASPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `vprintf' function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `vsyslog' function. */
|
||||
#define HAVE_VSYSLOG 1
|
||||
|
||||
/* Define to 1 if you have the <xlocale.h> header file. */
|
||||
#define HAVE_XLOCALE_H 1
|
||||
|
||||
/* Have __thread */
|
||||
#define HAVE___THREAD 1
|
||||
|
||||
/* Public define for json_inttypes.h */
|
||||
#define JSON_C_HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "json-c"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "json-c@googlegroups.com"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "json-c"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "json-c 0.13.99"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "json-c"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "0.13.99"
|
||||
|
||||
/* The number of bytes in type int */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The number of bytes in type int64_t */
|
||||
#define SIZEOF_INT64_T 8
|
||||
|
||||
/* The number of bytes in type long */
|
||||
#define SIZEOF_LONG 8
|
||||
|
||||
/* The number of bytes in type long long */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* The number of bytes in type size_t */
|
||||
#define SIZEOF_SIZE_T 8
|
||||
|
||||
/* Specifier for __thread */
|
||||
#define SPEC___THREAD __thread
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "0.13.99"
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* $Id: debug.c,v 1.5 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config_json_c.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if HAVE_SYSLOG_H
|
||||
# include <syslog.h>
|
||||
#endif /* HAVE_SYSLOG_H */
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif /* HAVE_SYS_PARAM_H */
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
static int _syslog = 0;
|
||||
static int _debug = 0;
|
||||
|
||||
void mc_set_debug(int debug) { _debug = debug; }
|
||||
int mc_get_debug(void) { return _debug; }
|
||||
|
||||
extern void mc_set_syslog(int syslog)
|
||||
{
|
||||
_syslog = syslog;
|
||||
}
|
||||
|
||||
void mc_debug(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
if(_debug) {
|
||||
va_start(ap, msg);
|
||||
#if HAVE_VSYSLOG
|
||||
if(_syslog) {
|
||||
vsyslog(LOG_DEBUG, msg, ap);
|
||||
} else
|
||||
#endif
|
||||
vprintf(msg, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
|
||||
void mc_error(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
#if HAVE_VSYSLOG
|
||||
if(_syslog) {
|
||||
vsyslog(LOG_ERR, msg, ap);
|
||||
} else
|
||||
#endif
|
||||
vfprintf(stderr, msg, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void mc_info(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
#if HAVE_VSYSLOG
|
||||
if(_syslog) {
|
||||
vsyslog(LOG_INFO, msg, ap);
|
||||
} else
|
||||
#endif
|
||||
vfprintf(stderr, msg, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* $Id: debug.h,v 1.5 2006/01/30 23:07:57 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
* Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
#ifndef _DEBUG_H_
|
||||
#define _DEBUG_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void mc_set_debug(int debug);
|
||||
extern int mc_get_debug(void);
|
||||
|
||||
extern void mc_set_syslog(int syslog);
|
||||
|
||||
extern void mc_debug(const char *msg, ...);
|
||||
extern void mc_error(const char *msg, ...);
|
||||
extern void mc_info(const char *msg, ...);
|
||||
|
||||
#ifndef __STRING
|
||||
#define __STRING(x) #x
|
||||
#endif
|
||||
|
||||
#ifndef PARSER_BROKEN_FIXED
|
||||
|
||||
#define JASSERT(cond) do {} while(0)
|
||||
|
||||
#else
|
||||
|
||||
#define JASSERT(cond) do { \
|
||||
if (!(cond)) { \
|
||||
mc_error("cjson assert failure %s:%d : cond \"" __STRING(cond) "failed\n", __FILE__, __LINE__); \
|
||||
*(int *)0 = 1;\
|
||||
abort(); \
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
#endif
|
||||
|
||||
#define MC_ERROR(x, ...) mc_error(x, ##__VA_ARGS__)
|
||||
|
||||
#ifdef MC_MAINTAINER_MODE
|
||||
#define MC_SET_DEBUG(x) mc_set_debug(x)
|
||||
#define MC_GET_DEBUG() mc_get_debug()
|
||||
#define MC_SET_SYSLOG(x) mc_set_syslog(x)
|
||||
#define MC_DEBUG(x, ...) mc_debug(x, ##__VA_ARGS__)
|
||||
#define MC_INFO(x, ...) mc_info(x, ##__VA_ARGS__)
|
||||
#else
|
||||
#define MC_SET_DEBUG(x) if (0) mc_set_debug(x)
|
||||
#define MC_GET_DEBUG() (0)
|
||||
#define MC_SET_SYSLOG(x) if (0) mc_set_syslog(x)
|
||||
#define MC_DEBUG(x, ...) if (0) mc_debug(x, ##__VA_ARGS__)
|
||||
#define MC_INFO(x, ...) if (0) mc_info(x, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* $Id: json.h,v 1.6 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
* Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief A convenience header that may be included instead of other individual ones.
|
||||
*/
|
||||
#ifndef _json_h_
|
||||
#define _json_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
#include "linkhash.h"
|
||||
#include "arraylist.h"
|
||||
#include "json_util.h"
|
||||
#include "json_object.h"
|
||||
#include "json_pointer.h"
|
||||
#include "json_tokener.h"
|
||||
#include "json_object_iterator.h"
|
||||
#include "json_c_version.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Eric Haszlakiewicz
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*/
|
||||
#include "config_json_c.h"
|
||||
|
||||
#include "json_c_version.h"
|
||||
|
||||
const char *json_c_version(void)
|
||||
{
|
||||
return JSON_C_VERSION;
|
||||
}
|
||||
|
||||
int json_c_version_num(void)
|
||||
{
|
||||
return JSON_C_VERSION_NUM;
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012,2017 Eric Haszlakiewicz
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Methods for retrieving the json-c version.
|
||||
*/
|
||||
#ifndef _json_c_version_h_
|
||||
#define _json_c_version_h_
|
||||
|
||||
#define JSON_C_MAJOR_VERSION 0
|
||||
#define JSON_C_MINOR_VERSION 13
|
||||
#define JSON_C_MICRO_VERSION 99
|
||||
#define JSON_C_VERSION_NUM ((JSON_C_MAJOR_VERSION << 16) | \
|
||||
(JSON_C_MINOR_VERSION << 8) | \
|
||||
JSON_C_MICRO_VERSION)
|
||||
#define JSON_C_VERSION "0.13.99"
|
||||
|
||||
/**
|
||||
* @see JSON_C_VERSION
|
||||
* @return the version of the json-c library as a string
|
||||
*/
|
||||
const char *json_c_version(void); /* Returns JSON_C_VERSION */
|
||||
|
||||
/**
|
||||
* The json-c version encoded into an int, with the low order 8 bits
|
||||
* being the micro version, the next higher 8 bits being the minor version
|
||||
* and the next higher 8 bits being the major version.
|
||||
* For example, 7.12.99 would be 0x00070B63.
|
||||
*
|
||||
* @see JSON_C_VERSION_NUM
|
||||
* @return the version of the json-c library as an int
|
||||
*/
|
||||
int json_c_version_num(void); /* Returns JSON_C_VERSION_NUM */
|
||||
|
||||
#endif
|
||||
@@ -1,4 +0,0 @@
|
||||
/* json_config.h. Generated from json_config.h.in by configure. */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define JSON_C_HAVE_INTTYPES_H 1
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
#ifndef _json_inttypes_h_
|
||||
#define _json_inttypes_h_
|
||||
|
||||
#include "json_config.h"
|
||||
|
||||
#ifdef JSON_C_HAVE_INTTYPES_H
|
||||
/* inttypes.h includes stdint.h */
|
||||
#include <inttypes.h>
|
||||
|
||||
#else
|
||||
#include <stdint.h>
|
||||
|
||||
#define PRId64 "I64d"
|
||||
#define SCNd64 "I64d"
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,163 +0,0 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file json_object_iterator.c
|
||||
*
|
||||
* Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "json.h"
|
||||
#include "json_object_private.h"
|
||||
|
||||
#include "json_object_iterator.h"
|
||||
|
||||
/**
|
||||
* How It Works
|
||||
*
|
||||
* For each JSON Object, json-c maintains a linked list of zero
|
||||
* or more lh_entry (link-hash entry) structures inside the
|
||||
* Object's link-hash table (lh_table).
|
||||
*
|
||||
* Each lh_entry structure on the JSON Object's linked list
|
||||
* represents a single name/value pair. The "next" field of the
|
||||
* last lh_entry in the list is set to NULL, which terminates
|
||||
* the list.
|
||||
*
|
||||
* We represent a valid iterator that refers to an actual
|
||||
* name/value pair via a pointer to the pair's lh_entry
|
||||
* structure set as the iterator's opaque_ field.
|
||||
*
|
||||
* We follow json-c's current pair list representation by
|
||||
* representing a valid "end" iterator (one that refers past the
|
||||
* last pair) with a NULL value in the iterator's opaque_ field.
|
||||
*
|
||||
* A JSON Object without any pairs in it will have the "head"
|
||||
* field of its lh_table structure set to NULL. For such an
|
||||
* object, json_object_iter_begin will return an iterator with
|
||||
* the opaque_ field set to NULL, which is equivalent to the
|
||||
* "end" iterator.
|
||||
*
|
||||
* When iterating, we simply update the iterator's opaque_ field
|
||||
* to point to the next lh_entry structure in the linked list.
|
||||
* opaque_ will become NULL once we iterate past the last pair
|
||||
* in the list, which makes the iterator equivalent to the "end"
|
||||
* iterator.
|
||||
*/
|
||||
|
||||
/// Our current representation of the "end" iterator;
|
||||
///
|
||||
/// @note May not always be NULL
|
||||
static const void* kObjectEndIterValue = NULL;
|
||||
|
||||
/**
|
||||
* ****************************************************************************
|
||||
*/
|
||||
struct json_object_iterator
|
||||
json_object_iter_begin(struct json_object* obj)
|
||||
{
|
||||
struct json_object_iterator iter;
|
||||
struct lh_table* pTable;
|
||||
|
||||
/// @note json_object_get_object will return NULL if passed NULL
|
||||
/// or a non-json_type_object instance
|
||||
pTable = json_object_get_object(obj);
|
||||
JASSERT(NULL != pTable);
|
||||
|
||||
/// @note For a pair-less Object, head is NULL, which matches our
|
||||
/// definition of the "end" iterator
|
||||
iter.opaque_ = pTable->head;
|
||||
return iter;
|
||||
}
|
||||
|
||||
/**
|
||||
* ****************************************************************************
|
||||
*/
|
||||
struct json_object_iterator
|
||||
json_object_iter_end(const struct json_object* obj)
|
||||
{
|
||||
struct json_object_iterator iter;
|
||||
|
||||
JASSERT(NULL != obj);
|
||||
JASSERT(json_object_is_type(obj, json_type_object));
|
||||
|
||||
iter.opaque_ = kObjectEndIterValue;
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
||||
/**
|
||||
* ****************************************************************************
|
||||
*/
|
||||
void
|
||||
json_object_iter_next(struct json_object_iterator* iter)
|
||||
{
|
||||
JASSERT(NULL != iter);
|
||||
JASSERT(kObjectEndIterValue != iter->opaque_);
|
||||
|
||||
iter->opaque_ = ((const struct lh_entry *)iter->opaque_)->next;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ****************************************************************************
|
||||
*/
|
||||
const char*
|
||||
json_object_iter_peek_name(const struct json_object_iterator* iter)
|
||||
{
|
||||
JASSERT(NULL != iter);
|
||||
JASSERT(kObjectEndIterValue != iter->opaque_);
|
||||
|
||||
return (const char*)(((const struct lh_entry *)iter->opaque_)->k);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ****************************************************************************
|
||||
*/
|
||||
struct json_object*
|
||||
json_object_iter_peek_value(const struct json_object_iterator* iter)
|
||||
{
|
||||
JASSERT(NULL != iter);
|
||||
JASSERT(kObjectEndIterValue != iter->opaque_);
|
||||
|
||||
return (struct json_object*)lh_entry_v((const struct lh_entry *)iter->opaque_);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ****************************************************************************
|
||||
*/
|
||||
json_bool
|
||||
json_object_iter_equal(const struct json_object_iterator* iter1,
|
||||
const struct json_object_iterator* iter2)
|
||||
{
|
||||
JASSERT(NULL != iter1);
|
||||
JASSERT(NULL != iter2);
|
||||
|
||||
return (iter1->opaque_ == iter2->opaque_);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ****************************************************************************
|
||||
*/
|
||||
struct json_object_iterator
|
||||
json_object_iter_init_default(void)
|
||||
{
|
||||
struct json_object_iterator iter;
|
||||
|
||||
/**
|
||||
* @note Make this a negative, invalid value, such that
|
||||
* accidental access to it would likely be trapped by the
|
||||
* hardware as an invalid address.
|
||||
*/
|
||||
iter.opaque_ = NULL;
|
||||
|
||||
return iter;
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file json_object_iterator.h
|
||||
*
|
||||
* Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
* @brief An API for iterating over json_type_object objects,
|
||||
* styled to be familiar to C++ programmers.
|
||||
* Unlike json_object_object_foreach() and
|
||||
* json_object_object_foreachC(), this avoids the need to expose
|
||||
* json-c internals like lh_entry.
|
||||
*
|
||||
* API attributes: <br>
|
||||
* * Thread-safe: NO<br>
|
||||
* * Reentrant: NO
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef JSON_OBJECT_ITERATOR_H
|
||||
#define JSON_OBJECT_ITERATOR_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Forward declaration for the opaque iterator information.
|
||||
*/
|
||||
struct json_object_iter_info_;
|
||||
|
||||
/**
|
||||
* The opaque iterator that references a name/value pair within
|
||||
* a JSON Object instance or the "end" iterator value.
|
||||
*/
|
||||
struct json_object_iterator {
|
||||
const void* opaque_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* forward declaration of json-c's JSON value instance structure
|
||||
*/
|
||||
struct json_object;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes an iterator structure to a "default" value that
|
||||
* is convenient for initializing an iterator variable to a
|
||||
* default state (e.g., initialization list in a class'
|
||||
* constructor).
|
||||
*
|
||||
* @code
|
||||
* struct json_object_iterator iter = json_object_iter_init_default();
|
||||
* MyClass() : iter_(json_object_iter_init_default())
|
||||
* @endcode
|
||||
*
|
||||
* @note The initialized value doesn't reference any specific
|
||||
* pair, is considered an invalid iterator, and MUST NOT
|
||||
* be passed to any json-c API that expects a valid
|
||||
* iterator.
|
||||
*
|
||||
* @note User and internal code MUST NOT make any assumptions
|
||||
* about and dependencies on the value of the "default"
|
||||
* iterator value.
|
||||
*
|
||||
* @return json_object_iterator
|
||||
*/
|
||||
struct json_object_iterator
|
||||
json_object_iter_init_default(void);
|
||||
|
||||
/** Retrieves an iterator to the first pair of the JSON Object.
|
||||
*
|
||||
* @warning Any modification of the underlying pair invalidates all
|
||||
* iterators to that pair.
|
||||
*
|
||||
* @param obj JSON Object instance (MUST be of type json_object)
|
||||
*
|
||||
* @return json_object_iterator If the JSON Object has at
|
||||
* least one pair, on return, the iterator refers
|
||||
* to the first pair. If the JSON Object doesn't
|
||||
* have any pairs, the returned iterator is
|
||||
* equivalent to the "end" iterator for the same
|
||||
* JSON Object instance.
|
||||
*
|
||||
* @code
|
||||
* struct json_object_iterator it;
|
||||
* struct json_object_iterator itEnd;
|
||||
* struct json_object* obj;
|
||||
*
|
||||
* obj = json_tokener_parse("{'first':'george', 'age':100}");
|
||||
* it = json_object_iter_begin(obj);
|
||||
* itEnd = json_object_iter_end(obj);
|
||||
*
|
||||
* while (!json_object_iter_equal(&it, &itEnd)) {
|
||||
* printf("%s\n",
|
||||
* json_object_iter_peek_name(&it));
|
||||
* json_object_iter_next(&it);
|
||||
* }
|
||||
*
|
||||
* @endcode
|
||||
*/
|
||||
struct json_object_iterator
|
||||
json_object_iter_begin(struct json_object* obj);
|
||||
|
||||
/** Retrieves the iterator that represents the position beyond the
|
||||
* last pair of the given JSON Object instance.
|
||||
*
|
||||
* @warning Do NOT write code that assumes that the "end"
|
||||
* iterator value is NULL, even if it is so in a
|
||||
* particular instance of the implementation.
|
||||
*
|
||||
* @note The reason we do not (and MUST NOT) provide
|
||||
* "json_object_iter_is_end(json_object_iterator* iter)"
|
||||
* type of API is because it would limit the underlying
|
||||
* representation of name/value containment (or force us
|
||||
* to add additional, otherwise unnecessary, fields to
|
||||
* the iterator structure). The "end" iterator and the
|
||||
* equality test method, on the other hand, permit us to
|
||||
* cleanly abstract pretty much any reasonable underlying
|
||||
* representation without burdening the iterator
|
||||
* structure with unnecessary data.
|
||||
*
|
||||
* @note For performance reasons, memorize the "end" iterator prior
|
||||
* to any loop.
|
||||
*
|
||||
* @param obj JSON Object instance (MUST be of type json_object)
|
||||
*
|
||||
* @return json_object_iterator On return, the iterator refers
|
||||
* to the "end" of the Object instance's pairs
|
||||
* (i.e., NOT the last pair, but "beyond the last
|
||||
* pair" value)
|
||||
*/
|
||||
struct json_object_iterator
|
||||
json_object_iter_end(const struct json_object* obj);
|
||||
|
||||
/** Returns an iterator to the next pair, if any
|
||||
*
|
||||
* @warning Any modification of the underlying pair
|
||||
* invalidates all iterators to that pair.
|
||||
*
|
||||
* @param iter [IN/OUT] Pointer to iterator that references a
|
||||
* name/value pair; MUST be a valid, non-end iterator.
|
||||
* WARNING: bad things will happen if invalid or "end"
|
||||
* iterator is passed. Upon return will contain the
|
||||
* reference to the next pair if there is one; if there
|
||||
* are no more pairs, will contain the "end" iterator
|
||||
* value, which may be compared against the return value
|
||||
* of json_object_iter_end() for the same JSON Object
|
||||
* instance.
|
||||
*/
|
||||
void
|
||||
json_object_iter_next(struct json_object_iterator* iter);
|
||||
|
||||
|
||||
/** Returns a const pointer to the name of the pair referenced
|
||||
* by the given iterator.
|
||||
*
|
||||
* @param iter pointer to iterator that references a name/value
|
||||
* pair; MUST be a valid, non-end iterator.
|
||||
*
|
||||
* @warning bad things will happen if an invalid or
|
||||
* "end" iterator is passed.
|
||||
*
|
||||
* @return const char* Pointer to the name of the referenced
|
||||
* name/value pair. The name memory belongs to the
|
||||
* name/value pair, will be freed when the pair is
|
||||
* deleted or modified, and MUST NOT be modified or
|
||||
* freed by the user.
|
||||
*/
|
||||
const char*
|
||||
json_object_iter_peek_name(const struct json_object_iterator* iter);
|
||||
|
||||
|
||||
/** Returns a pointer to the json-c instance representing the
|
||||
* value of the referenced name/value pair, without altering
|
||||
* the instance's reference count.
|
||||
*
|
||||
* @param iter pointer to iterator that references a name/value
|
||||
* pair; MUST be a valid, non-end iterator.
|
||||
*
|
||||
* @warning bad things will happen if invalid or
|
||||
* "end" iterator is passed.
|
||||
*
|
||||
* @return struct json_object* Pointer to the json-c value
|
||||
* instance of the referenced name/value pair; the
|
||||
* value's reference count is not changed by this
|
||||
* function: if you plan to hold on to this json-c node,
|
||||
* take a look at json_object_get() and
|
||||
* json_object_put(). IMPORTANT: json-c API represents
|
||||
* the JSON Null value as a NULL json_object instance
|
||||
* pointer.
|
||||
*/
|
||||
struct json_object*
|
||||
json_object_iter_peek_value(const struct json_object_iterator* iter);
|
||||
|
||||
|
||||
/** Tests two iterators for equality. Typically used to test
|
||||
* for end of iteration by comparing an iterator to the
|
||||
* corresponding "end" iterator (that was derived from the same
|
||||
* JSON Object instance).
|
||||
*
|
||||
* @note The reason we do not (and MUST NOT) provide
|
||||
* "json_object_iter_is_end(json_object_iterator* iter)"
|
||||
* type of API is because it would limit the underlying
|
||||
* representation of name/value containment (or force us
|
||||
* to add additional, otherwise unnecessary, fields to
|
||||
* the iterator structure). The equality test method, on
|
||||
* the other hand, permits us to cleanly abstract pretty
|
||||
* much any reasonable underlying representation.
|
||||
*
|
||||
* @param iter1 Pointer to first valid, non-NULL iterator
|
||||
* @param iter2 POinter to second valid, non-NULL iterator
|
||||
*
|
||||
* @warning if a NULL iterator pointer or an uninitialized
|
||||
* or invalid iterator, or iterators derived from
|
||||
* different JSON Object instances are passed, bad things
|
||||
* will happen!
|
||||
*
|
||||
* @return json_bool non-zero if iterators are equal (i.e., both
|
||||
* reference the same name/value pair or are both at
|
||||
* "end"); zero if they are not equal.
|
||||
*/
|
||||
json_bool
|
||||
json_object_iter_equal(const struct json_object_iterator* iter1,
|
||||
const struct json_object_iterator* iter2);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* JSON_OBJECT_ITERATOR_H */
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* $Id: json_object_private.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
#ifndef _json_object_private_h_
|
||||
#define _json_object_private_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LEN_DIRECT_STRING_DATA 32 /**< how many bytes are directly stored in json_object for strings? */
|
||||
|
||||
typedef void (json_object_private_delete_fn)(struct json_object *o);
|
||||
|
||||
struct json_object
|
||||
{
|
||||
enum json_type o_type;
|
||||
json_object_private_delete_fn *_delete;
|
||||
json_object_to_json_string_fn *_to_json_string;
|
||||
uint_fast32_t _ref_count;
|
||||
struct printbuf *_pb;
|
||||
union data {
|
||||
json_bool c_boolean;
|
||||
double c_double;
|
||||
int64_t c_int64;
|
||||
struct lh_table *c_object;
|
||||
struct array_list *c_array;
|
||||
struct {
|
||||
union {
|
||||
/* optimize: if we have small strings, we can store them
|
||||
* directly. This saves considerable CPU cycles AND memory.
|
||||
*/
|
||||
char *ptr;
|
||||
char data[LEN_DIRECT_STRING_DATA];
|
||||
} str;
|
||||
int len;
|
||||
} c_string;
|
||||
} o;
|
||||
json_object_delete_fn *_user_delete;
|
||||
void *_userdata;
|
||||
};
|
||||
|
||||
void _json_c_set_last_err(const char *err_fmt, ...);
|
||||
|
||||
extern const char *json_number_chars;
|
||||
extern const char *json_hex_chars;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,327 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Alexandru Ardelean.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config_json_c.h"
|
||||
|
||||
#include "strerror_override.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "json_pointer.h"
|
||||
#include "strdup_compat.h"
|
||||
#include "vasprintf_compat.h"
|
||||
|
||||
/**
|
||||
* JavaScript Object Notation (JSON) Pointer
|
||||
* RFC 6901 - https://tools.ietf.org/html/rfc6901
|
||||
*/
|
||||
|
||||
static void string_replace_all_occurrences_with_char(char *s, const char *occur, char repl_char)
|
||||
{
|
||||
int slen = strlen(s);
|
||||
int skip = strlen(occur) - 1; /* length of the occurence, minus the char we're replacing */
|
||||
char *p = s;
|
||||
while ((p = strstr(p, occur))) {
|
||||
*p = repl_char;
|
||||
p++;
|
||||
slen -= skip;
|
||||
memmove(p, (p + skip), slen - (p - s) + 1); /* includes null char too */
|
||||
}
|
||||
}
|
||||
|
||||
static int is_valid_index(struct json_object *jo, const char *path, int32_t *idx)
|
||||
{
|
||||
int i, len = strlen(path);
|
||||
/* this code-path optimizes a bit, for when we reference the 0-9 index range in a JSON array
|
||||
and because leading zeros not allowed */
|
||||
if (len == 1) {
|
||||
if (isdigit((int)path[0])) {
|
||||
*idx = (path[0] - '0');
|
||||
goto check_oob;
|
||||
}
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
/* leading zeros not allowed per RFC */
|
||||
if (path[0] == '0') {
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
/* RFC states base-10 decimals */
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!isdigit((int)path[i])) {
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*idx = strtol(path, NULL, 10);
|
||||
if (*idx < 0) {
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
check_oob:
|
||||
len = json_object_array_length(jo);
|
||||
if (*idx >= len) {
|
||||
errno = ENOENT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int json_pointer_get_single_path(struct json_object *obj, char *path, struct json_object **value)
|
||||
{
|
||||
if (json_object_is_type(obj, json_type_array)) {
|
||||
int32_t idx;
|
||||
if (!is_valid_index(obj, path, &idx))
|
||||
return -1;
|
||||
obj = json_object_array_get_idx(obj, idx);
|
||||
if (obj) {
|
||||
if (value)
|
||||
*value = obj;
|
||||
return 0;
|
||||
}
|
||||
/* Entry not found */
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* RFC states that we first must eval all ~1 then all ~0 */
|
||||
string_replace_all_occurrences_with_char(path, "~1", '/');
|
||||
string_replace_all_occurrences_with_char(path, "~0", '~');
|
||||
|
||||
if (!json_object_object_get_ex(obj, path, value)) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int json_pointer_set_single_path(
|
||||
struct json_object *parent,
|
||||
const char *path,
|
||||
struct json_object *value)
|
||||
{
|
||||
if (json_object_is_type(parent, json_type_array)) {
|
||||
int32_t idx;
|
||||
/* RFC (Chapter 4) states that '-' may be used to add new elements to an array */
|
||||
if (path[0] == '-' && path[1] == '\0')
|
||||
return json_object_array_add(parent, value);
|
||||
if (!is_valid_index(parent, path, &idx))
|
||||
return -1;
|
||||
return json_object_array_put_idx(parent, idx, value);
|
||||
}
|
||||
|
||||
/* path replacements should have been done in json_pointer_get_single_path(),
|
||||
and we should still be good here */
|
||||
if (json_object_is_type(parent, json_type_object))
|
||||
return json_object_object_add(parent, path, value);
|
||||
|
||||
/* Getting here means that we tried to "dereference" a primitive JSON type (like string, int, bool).
|
||||
i.e. add a sub-object to it */
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int json_pointer_get_recursive(
|
||||
struct json_object *obj,
|
||||
char *path,
|
||||
struct json_object **value)
|
||||
{
|
||||
char *endp;
|
||||
int rc;
|
||||
|
||||
/* All paths (on each recursion level must have a leading '/' */
|
||||
if (path[0] != '/') {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
path++;
|
||||
|
||||
endp = strchr(path, '/');
|
||||
if (endp)
|
||||
*endp = '\0';
|
||||
|
||||
/* If we err-ed here, return here */
|
||||
if ((rc = json_pointer_get_single_path(obj, path, &obj)))
|
||||
return rc;
|
||||
|
||||
if (endp) {
|
||||
*endp = '/'; /* Put the slash back, so that the sanity check passes on next recursion level */
|
||||
return json_pointer_get_recursive(obj, endp, value);
|
||||
}
|
||||
|
||||
/* We should be at the end of the recursion here */
|
||||
if (value)
|
||||
*value = obj;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int json_pointer_get(struct json_object *obj, const char *path, struct json_object **res)
|
||||
{
|
||||
char *path_copy = NULL;
|
||||
int rc;
|
||||
|
||||
if (!obj || !path) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (path[0] == '\0') {
|
||||
if (res)
|
||||
*res = obj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* pass a working copy to the recursive call */
|
||||
if (!(path_copy = strdup(path))) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
rc = json_pointer_get_recursive(obj, path_copy, res);
|
||||
free(path_copy);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int json_pointer_getf(struct json_object *obj, struct json_object **res, const char *path_fmt, ...)
|
||||
{
|
||||
char *path_copy = NULL;
|
||||
int rc = 0;
|
||||
va_list args;
|
||||
|
||||
if (!obj || !path_fmt) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
va_start(args, path_fmt);
|
||||
rc = vasprintf(&path_copy, path_fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if (path_copy[0] == '\0') {
|
||||
if (res)
|
||||
*res = obj;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rc = json_pointer_get_recursive(obj, path_copy, res);
|
||||
out:
|
||||
free(path_copy);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int json_pointer_set(struct json_object **obj, const char *path, struct json_object *value)
|
||||
{
|
||||
const char *endp;
|
||||
char *path_copy = NULL;
|
||||
struct json_object *set = NULL;
|
||||
int rc;
|
||||
|
||||
if (!obj || !path) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (path[0] == '\0') {
|
||||
json_object_put(*obj);
|
||||
*obj = value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (path[0] != '/') {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If there's only 1 level to set, stop here */
|
||||
if ((endp = strrchr(path, '/')) == path) {
|
||||
path++;
|
||||
return json_pointer_set_single_path(*obj, path, value);
|
||||
}
|
||||
|
||||
/* pass a working copy to the recursive call */
|
||||
if (!(path_copy = strdup(path))) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
path_copy[endp - path] = '\0';
|
||||
rc = json_pointer_get_recursive(*obj, path_copy, &set);
|
||||
free(path_copy);
|
||||
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
endp++;
|
||||
return json_pointer_set_single_path(set, endp, value);
|
||||
}
|
||||
|
||||
int json_pointer_setf(struct json_object **obj, struct json_object *value, const char *path_fmt, ...)
|
||||
{
|
||||
char *endp;
|
||||
char *path_copy = NULL;
|
||||
struct json_object *set = NULL;
|
||||
va_list args;
|
||||
int rc = 0;
|
||||
|
||||
if (!obj || !path_fmt) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* pass a working copy to the recursive call */
|
||||
va_start(args, path_fmt);
|
||||
rc = vasprintf(&path_copy, path_fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
if (path_copy[0] == '\0') {
|
||||
json_object_put(*obj);
|
||||
*obj = value;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (path_copy[0] != '/') {
|
||||
errno = EINVAL;
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* If there's only 1 level to set, stop here */
|
||||
if ((endp = strrchr(path_copy, '/')) == path_copy) {
|
||||
set = *obj;
|
||||
goto set_single_path;
|
||||
}
|
||||
|
||||
*endp = '\0';
|
||||
rc = json_pointer_get_recursive(*obj, path_copy, &set);
|
||||
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
set_single_path:
|
||||
endp++;
|
||||
rc = json_pointer_set_single_path(set, endp, value);
|
||||
out:
|
||||
free(path_copy);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Alexadru Ardelean.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief JSON Pointer (RFC 6901) implementation for retrieving
|
||||
* objects from a json-c object tree.
|
||||
*/
|
||||
#ifndef _json_pointer_h_
|
||||
#define _json_pointer_h_
|
||||
|
||||
#include "json_object.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Retrieves a JSON sub-object from inside another JSON object
|
||||
* using the JSON pointer notation as defined in RFC 6901
|
||||
* https://tools.ietf.org/html/rfc6901
|
||||
*
|
||||
* The returned JSON sub-object is equivalent to parsing manually the
|
||||
* 'obj' JSON tree ; i.e. it's not a new object that is created, but rather
|
||||
* a pointer inside the JSON tree.
|
||||
*
|
||||
* Internally, this is equivalent to doing a series of 'json_object_object_get()'
|
||||
* and 'json_object_array_get_idx()' along the given 'path'.
|
||||
*
|
||||
* Note that the 'path' string supports 'printf()' type arguments, so, whatever
|
||||
* is added after the 'res' param will be treated as an argument for 'path'
|
||||
* Example: json_pointer_get(obj, "/foo/%d/%s", &res, 0, bar)
|
||||
* This means, that you need to escape '%' with '%%' (just like in printf())
|
||||
*
|
||||
* @param obj the json_object instance/tree from where to retrieve sub-objects
|
||||
* @param path a (RFC6901) string notation for the sub-object to retrieve
|
||||
* @param res a pointer where to store a reference to the json_object
|
||||
* associated with the given path
|
||||
*
|
||||
* @return negative if an error (or not found), or 0 if succeeded
|
||||
*/
|
||||
int json_pointer_get(struct json_object *obj, const char *path, struct json_object **res);
|
||||
|
||||
/**
|
||||
* This is a variant of 'json_pointer_get()' that supports printf() style arguments.
|
||||
*
|
||||
* Example: json_pointer_getf(obj, res, "/foo/%d/%s", 0, bak)
|
||||
* This also means that you need to escape '%' with '%%' (just like in printf())
|
||||
*
|
||||
* Please take into consideration all recommended 'printf()' format security
|
||||
* aspects when using this function.
|
||||
*
|
||||
* @param obj the json_object instance/tree to which to add a sub-object
|
||||
* @param res a pointer where to store a reference to the json_object
|
||||
* associated with the given path
|
||||
* @param path_fmt a printf() style format for the path
|
||||
*
|
||||
* @return negative if an error (or not found), or 0 if succeeded
|
||||
*/
|
||||
int json_pointer_getf(struct json_object *obj, struct json_object **res, const char *path_fmt, ...);
|
||||
|
||||
/**
|
||||
* Sets JSON object 'value' in the 'obj' tree at the location specified
|
||||
* by the 'path'. 'path' is JSON pointer notation as defined in RFC 6901
|
||||
* https://tools.ietf.org/html/rfc6901
|
||||
*
|
||||
* Note that 'obj' is a double pointer, mostly for the "" (empty string)
|
||||
* case, where the entire JSON object would be replaced by 'value'.
|
||||
* In the case of the "" path, the object at '*obj' will have it's refcount
|
||||
* decremented with 'json_object_put()' and the 'value' object will be assigned to it.
|
||||
*
|
||||
* For other cases (JSON sub-objects) ownership of 'value' will be transferred into
|
||||
* '*obj' via 'json_object_object_add()' & 'json_object_array_put_idx()', so the
|
||||
* only time the refcount should be decremented for 'value' is when the return value of
|
||||
* 'json_pointer_set()' is negative (meaning the 'value' object did not get set into '*obj').
|
||||
*
|
||||
* That also implies that 'json_pointer_set()' does not do any refcount incrementing.
|
||||
* (Just that single decrement that was mentioned above).
|
||||
*
|
||||
* Note that the 'path' string supports 'printf()' type arguments, so, whatever
|
||||
* is added after the 'value' param will be treated as an argument for 'path'
|
||||
* Example: json_pointer_set(obj, "/foo/%d/%s", value, 0, bak)
|
||||
* This means, that you need to escape '%' with '%%' (just like in printf())
|
||||
*
|
||||
* @param obj the json_object instance/tree to which to add a sub-object
|
||||
* @param path a (RFC6901) string notation for the sub-object to set in the tree
|
||||
* @param value object to set at path
|
||||
*
|
||||
* @return negative if an error (or not found), or 0 if succeeded
|
||||
*/
|
||||
int json_pointer_set(struct json_object **obj, const char *path, struct json_object *value);
|
||||
|
||||
/**
|
||||
* This is a variant of 'json_pointer_set()' that supports printf() style arguments.
|
||||
*
|
||||
* Example: json_pointer_setf(obj, value, "/foo/%d/%s", 0, bak)
|
||||
* This also means that you need to escape '%' with '%%' (just like in printf())
|
||||
*
|
||||
* Please take into consideration all recommended 'printf()' format security
|
||||
* aspects when using this function.
|
||||
*
|
||||
* @param obj the json_object instance/tree to which to add a sub-object
|
||||
* @param value object to set at path
|
||||
* @param path_fmt a printf() style format for the path
|
||||
*
|
||||
* @return negative if an error (or not found), or 0 if succeeded
|
||||
*/
|
||||
int json_pointer_setf(struct json_object **obj, struct json_object *value, const char *path_fmt, ...);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,997 +0,0 @@
|
||||
/*
|
||||
* $Id: json_tokener.c,v 1.20 2006/07/25 03:24:50 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
|
||||
* The copyrights to the contents of this file are licensed under the MIT License
|
||||
* (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
#include "config_json_c.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "math_compat.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "debug.h"
|
||||
#include "printbuf.h"
|
||||
#include "arraylist.h"
|
||||
#include "json_inttypes.h"
|
||||
#include "json_object.h"
|
||||
#include "json_object_private.h"
|
||||
#include "json_tokener.h"
|
||||
#include "json_util.h"
|
||||
#include "strdup_compat.h"
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif /* HAVE_LOCALE_H */
|
||||
#ifdef HAVE_XLOCALE_H
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
|
||||
#define jt_hexdigit(x) (((x) <= '9') ? (x) - '0' : ((x) & 7) + 9)
|
||||
|
||||
#if !HAVE_STRNCASECMP && defined(_MSC_VER)
|
||||
/* MSC has the version as _strnicmp */
|
||||
# define strncasecmp _strnicmp
|
||||
#elif !HAVE_STRNCASECMP
|
||||
# error You do not have strncasecmp on your system.
|
||||
#endif /* HAVE_STRNCASECMP */
|
||||
|
||||
/* Use C99 NAN by default; if not available, nan("") should work too. */
|
||||
#ifndef NAN
|
||||
#define NAN nan("")
|
||||
#endif /* !NAN */
|
||||
|
||||
static const char json_null_str[] = "null";
|
||||
static const int json_null_str_len = sizeof(json_null_str) - 1;
|
||||
static const char json_inf_str[] = "Infinity";
|
||||
static const char json_inf_str_lower[] = "infinity";
|
||||
static const unsigned int json_inf_str_len = sizeof(json_inf_str) - 1;
|
||||
static const char json_nan_str[] = "NaN";
|
||||
static const int json_nan_str_len = sizeof(json_nan_str) - 1;
|
||||
static const char json_true_str[] = "true";
|
||||
static const int json_true_str_len = sizeof(json_true_str) - 1;
|
||||
static const char json_false_str[] = "false";
|
||||
static const int json_false_str_len = sizeof(json_false_str) - 1;
|
||||
|
||||
static const char* json_tokener_errors[] = {
|
||||
"success",
|
||||
"continue",
|
||||
"nesting too deep",
|
||||
"unexpected end of data",
|
||||
"unexpected character",
|
||||
"null expected",
|
||||
"boolean expected",
|
||||
"number expected",
|
||||
"array value separator ',' expected",
|
||||
"quoted object property name expected",
|
||||
"object property name separator ':' expected",
|
||||
"object value separator ',' expected",
|
||||
"invalid string sequence",
|
||||
"expected comment",
|
||||
"buffer size overflow"
|
||||
};
|
||||
|
||||
const char *json_tokener_error_desc(enum json_tokener_error jerr)
|
||||
{
|
||||
int jerr_int = (int) jerr;
|
||||
if (jerr_int < 0 ||
|
||||
jerr_int >= (int)(sizeof(json_tokener_errors) / sizeof(json_tokener_errors[0])))
|
||||
return "Unknown error, "
|
||||
"invalid json_tokener_error value passed to json_tokener_error_desc()";
|
||||
return json_tokener_errors[jerr];
|
||||
}
|
||||
|
||||
enum json_tokener_error json_tokener_get_error(struct json_tokener *tok)
|
||||
{
|
||||
return tok->err;
|
||||
}
|
||||
|
||||
/* Stuff for decoding unicode sequences */
|
||||
#define IS_HIGH_SURROGATE(uc) (((uc) & 0xFC00) == 0xD800)
|
||||
#define IS_LOW_SURROGATE(uc) (((uc) & 0xFC00) == 0xDC00)
|
||||
#define DECODE_SURROGATE_PAIR(hi,lo) ((((hi) & 0x3FF) << 10) + ((lo) & 0x3FF) + 0x10000)
|
||||
static unsigned char utf8_replacement_char[3] = { 0xEF, 0xBF, 0xBD };
|
||||
|
||||
struct json_tokener* json_tokener_new_ex(int depth)
|
||||
{
|
||||
struct json_tokener *tok;
|
||||
|
||||
tok = (struct json_tokener*)calloc(1, sizeof(struct json_tokener));
|
||||
if (!tok) return NULL;
|
||||
tok->stack = (struct json_tokener_srec *) calloc(depth,
|
||||
sizeof(struct json_tokener_srec));
|
||||
if (!tok->stack) {
|
||||
free(tok);
|
||||
return NULL;
|
||||
}
|
||||
tok->pb = printbuf_new();
|
||||
tok->max_depth = depth;
|
||||
json_tokener_reset(tok);
|
||||
return tok;
|
||||
}
|
||||
|
||||
struct json_tokener* json_tokener_new(void)
|
||||
{
|
||||
return json_tokener_new_ex(JSON_TOKENER_DEFAULT_DEPTH);
|
||||
}
|
||||
|
||||
void json_tokener_free(struct json_tokener *tok)
|
||||
{
|
||||
json_tokener_reset(tok);
|
||||
if (tok->pb) printbuf_free(tok->pb);
|
||||
free(tok->stack);
|
||||
free(tok);
|
||||
}
|
||||
|
||||
static void json_tokener_reset_level(struct json_tokener *tok, int depth)
|
||||
{
|
||||
tok->stack[depth].state = json_tokener_state_eatws;
|
||||
tok->stack[depth].saved_state = json_tokener_state_start;
|
||||
json_object_put(tok->stack[depth].current);
|
||||
tok->stack[depth].current = NULL;
|
||||
free(tok->stack[depth].obj_field_name);
|
||||
tok->stack[depth].obj_field_name = NULL;
|
||||
}
|
||||
|
||||
void json_tokener_reset(struct json_tokener *tok)
|
||||
{
|
||||
int i;
|
||||
if (!tok)
|
||||
return;
|
||||
|
||||
for(i = tok->depth; i >= 0; i--)
|
||||
json_tokener_reset_level(tok, i);
|
||||
tok->depth = 0;
|
||||
tok->err = json_tokener_success;
|
||||
}
|
||||
|
||||
struct json_object* json_tokener_parse(const char *str)
|
||||
{
|
||||
enum json_tokener_error jerr_ignored;
|
||||
struct json_object* obj;
|
||||
obj = json_tokener_parse_verbose(str, &jerr_ignored);
|
||||
return obj;
|
||||
}
|
||||
|
||||
struct json_object* json_tokener_parse_verbose(const char *str,
|
||||
enum json_tokener_error *error)
|
||||
{
|
||||
struct json_tokener* tok;
|
||||
struct json_object* obj;
|
||||
|
||||
tok = json_tokener_new();
|
||||
if (!tok)
|
||||
return NULL;
|
||||
obj = json_tokener_parse_ex(tok, str, -1);
|
||||
*error = tok->err;
|
||||
if(tok->err != json_tokener_success) {
|
||||
if (obj != NULL)
|
||||
json_object_put(obj);
|
||||
obj = NULL;
|
||||
}
|
||||
|
||||
json_tokener_free(tok);
|
||||
return obj;
|
||||
}
|
||||
|
||||
#define state tok->stack[tok->depth].state
|
||||
#define saved_state tok->stack[tok->depth].saved_state
|
||||
#define current tok->stack[tok->depth].current
|
||||
#define obj_field_name tok->stack[tok->depth].obj_field_name
|
||||
|
||||
/* Optimization:
|
||||
* json_tokener_parse_ex() consumed a lot of CPU in its main loop,
|
||||
* iterating character-by character. A large performance boost is
|
||||
* achieved by using tighter loops to locally handle units such as
|
||||
* comments and strings. Loops that handle an entire token within
|
||||
* their scope also gather entire strings and pass them to
|
||||
* printbuf_memappend() in a single call, rather than calling
|
||||
* printbuf_memappend() one char at a time.
|
||||
*
|
||||
* PEEK_CHAR() and ADVANCE_CHAR() macros are used for code that is
|
||||
* common to both the main loop and the tighter loops.
|
||||
*/
|
||||
|
||||
/* PEEK_CHAR(dest, tok) macro:
|
||||
* Peeks at the current char and stores it in dest.
|
||||
* Returns 1 on success, sets tok->err and returns 0 if no more chars.
|
||||
* Implicit inputs: str, len vars
|
||||
*/
|
||||
#define PEEK_CHAR(dest, tok) \
|
||||
(((tok)->char_offset == len) ? \
|
||||
(((tok)->depth == 0 && \
|
||||
state == json_tokener_state_eatws && \
|
||||
saved_state == json_tokener_state_finish \
|
||||
) ? \
|
||||
(((tok)->err = json_tokener_success), 0) \
|
||||
: \
|
||||
(((tok)->err = json_tokener_continue), 0) \
|
||||
) : \
|
||||
(((dest) = *str), 1) \
|
||||
)
|
||||
|
||||
/* ADVANCE_CHAR() macro:
|
||||
* Incrementes str & tok->char_offset.
|
||||
* For convenience of existing conditionals, returns the old value of c (0 on eof)
|
||||
* Implicit inputs: c var
|
||||
*/
|
||||
#define ADVANCE_CHAR(str, tok) \
|
||||
( ++(str), ((tok)->char_offset)++, c)
|
||||
|
||||
|
||||
/* End optimization macro defs */
|
||||
|
||||
|
||||
struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
|
||||
const char *str, int len)
|
||||
{
|
||||
struct json_object *obj = NULL;
|
||||
char c = '\1';
|
||||
#ifdef HAVE_USELOCALE
|
||||
locale_t oldlocale = uselocale(NULL);
|
||||
locale_t newloc;
|
||||
#elif defined(HAVE_SETLOCALE)
|
||||
char *oldlocale = NULL;
|
||||
#endif
|
||||
|
||||
tok->char_offset = 0;
|
||||
tok->err = json_tokener_success;
|
||||
|
||||
/* this interface is presently not 64-bit clean due to the int len argument
|
||||
and the internal printbuf interface that takes 32-bit int len arguments
|
||||
so the function limits the maximum string size to INT32_MAX (2GB).
|
||||
If the function is called with len == -1 then strlen is called to check
|
||||
the string length is less than INT32_MAX (2GB) */
|
||||
if ((len < -1) || (len == -1 && strlen(str) > INT32_MAX)) {
|
||||
tok->err = json_tokener_error_size;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_USELOCALE
|
||||
{
|
||||
locale_t duploc = duplocale(oldlocale);
|
||||
newloc = newlocale(LC_NUMERIC, "C", duploc);
|
||||
// XXX at least Debian 8.4 has a bug in newlocale where it doesn't
|
||||
// change the decimal separator unless you set LC_TIME!
|
||||
if (newloc)
|
||||
{
|
||||
duploc = newloc; // original duploc has been freed by newlocale()
|
||||
newloc = newlocale(LC_TIME, "C", duploc);
|
||||
}
|
||||
if (newloc == NULL)
|
||||
{
|
||||
freelocale(duploc);
|
||||
return NULL;
|
||||
}
|
||||
uselocale(newloc);
|
||||
}
|
||||
#elif defined(HAVE_SETLOCALE)
|
||||
{
|
||||
char *tmplocale;
|
||||
tmplocale = setlocale(LC_NUMERIC, NULL);
|
||||
if (tmplocale) oldlocale = strdup(tmplocale);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
}
|
||||
#endif
|
||||
|
||||
while (PEEK_CHAR(c, tok)) {
|
||||
|
||||
redo_char:
|
||||
switch(state) {
|
||||
|
||||
case json_tokener_state_eatws:
|
||||
/* Advance until we change state */
|
||||
while (isspace((int)c)) {
|
||||
if ((!ADVANCE_CHAR(str, tok)) || (!PEEK_CHAR(c, tok)))
|
||||
goto out;
|
||||
}
|
||||
if(c == '/' && !(tok->flags & JSON_TOKENER_STRICT)) {
|
||||
printbuf_reset(tok->pb);
|
||||
printbuf_memappend_fast(tok->pb, &c, 1);
|
||||
state = json_tokener_state_comment_start;
|
||||
} else {
|
||||
state = saved_state;
|
||||
goto redo_char;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_start:
|
||||
switch(c) {
|
||||
case '{':
|
||||
state = json_tokener_state_eatws;
|
||||
saved_state = json_tokener_state_object_field_start;
|
||||
current = json_object_new_object();
|
||||
if(current == NULL)
|
||||
goto out;
|
||||
break;
|
||||
case '[':
|
||||
state = json_tokener_state_eatws;
|
||||
saved_state = json_tokener_state_array;
|
||||
current = json_object_new_array();
|
||||
if(current == NULL)
|
||||
goto out;
|
||||
break;
|
||||
case 'I':
|
||||
case 'i':
|
||||
state = json_tokener_state_inf;
|
||||
printbuf_reset(tok->pb);
|
||||
tok->st_pos = 0;
|
||||
goto redo_char;
|
||||
case 'N':
|
||||
case 'n':
|
||||
state = json_tokener_state_null; // or NaN
|
||||
printbuf_reset(tok->pb);
|
||||
tok->st_pos = 0;
|
||||
goto redo_char;
|
||||
case '\'':
|
||||
if (tok->flags & JSON_TOKENER_STRICT) {
|
||||
/* in STRICT mode only double-quote are allowed */
|
||||
tok->err = json_tokener_error_parse_unexpected;
|
||||
goto out;
|
||||
}
|
||||
/* FALLTHRU */
|
||||
case '"':
|
||||
state = json_tokener_state_string;
|
||||
printbuf_reset(tok->pb);
|
||||
tok->quote_char = c;
|
||||
break;
|
||||
case 'T':
|
||||
case 't':
|
||||
case 'F':
|
||||
case 'f':
|
||||
state = json_tokener_state_boolean;
|
||||
printbuf_reset(tok->pb);
|
||||
tok->st_pos = 0;
|
||||
goto redo_char;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case '-':
|
||||
state = json_tokener_state_number;
|
||||
printbuf_reset(tok->pb);
|
||||
tok->is_double = 0;
|
||||
goto redo_char;
|
||||
default:
|
||||
tok->err = json_tokener_error_parse_unexpected;
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_finish:
|
||||
if(tok->depth == 0) goto out;
|
||||
obj = json_object_get(current);
|
||||
json_tokener_reset_level(tok, tok->depth);
|
||||
tok->depth--;
|
||||
goto redo_char;
|
||||
|
||||
case json_tokener_state_inf: /* aka starts with 'i' (or 'I', or "-i", or "-I") */
|
||||
{
|
||||
/* If we were guaranteed to have len set, then we could (usually) handle
|
||||
* the entire "Infinity" check in a single strncmp (strncasecmp), but
|
||||
* since len might be -1 (i.e. "read until \0"), we need to check it
|
||||
* a character at a time.
|
||||
* Trying to handle it both ways would make this code considerably more
|
||||
* complicated with likely little performance benefit.
|
||||
*/
|
||||
int is_negative = 0;
|
||||
const char *_json_inf_str = json_inf_str;
|
||||
if (!(tok->flags & JSON_TOKENER_STRICT))
|
||||
_json_inf_str = json_inf_str_lower;
|
||||
|
||||
/* Note: tok->st_pos must be 0 when state is set to json_tokener_state_inf */
|
||||
while (tok->st_pos < (int)json_inf_str_len)
|
||||
{
|
||||
char inf_char = *str;
|
||||
if (!(tok->flags & JSON_TOKENER_STRICT))
|
||||
inf_char = tolower((int)*str);
|
||||
if (inf_char != _json_inf_str[tok->st_pos])
|
||||
{
|
||||
tok->err = json_tokener_error_parse_unexpected;
|
||||
goto out;
|
||||
}
|
||||
tok->st_pos++;
|
||||
(void)ADVANCE_CHAR(str, tok);
|
||||
if (!PEEK_CHAR(c, tok))
|
||||
{
|
||||
/* out of input chars, for now at least */
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
/* We checked the full length of "Infinity", so create the object.
|
||||
* When handling -Infinity, the number parsing code will have dropped
|
||||
* the "-" into tok->pb for us, so check it now.
|
||||
*/
|
||||
if (printbuf_length(tok->pb) > 0 && *(tok->pb->buf) == '-')
|
||||
{
|
||||
is_negative = 1;
|
||||
}
|
||||
current = json_object_new_double(is_negative
|
||||
? -INFINITY : INFINITY);
|
||||
if (current == NULL)
|
||||
goto out;
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
goto redo_char;
|
||||
|
||||
}
|
||||
break;
|
||||
case json_tokener_state_null: /* aka starts with 'n' */
|
||||
{
|
||||
int size;
|
||||
int size_nan;
|
||||
printbuf_memappend_fast(tok->pb, &c, 1);
|
||||
size = json_min(tok->st_pos+1, json_null_str_len);
|
||||
size_nan = json_min(tok->st_pos+1, json_nan_str_len);
|
||||
if((!(tok->flags & JSON_TOKENER_STRICT) &&
|
||||
strncasecmp(json_null_str, tok->pb->buf, size) == 0)
|
||||
|| (strncmp(json_null_str, tok->pb->buf, size) == 0)
|
||||
) {
|
||||
if (tok->st_pos == json_null_str_len) {
|
||||
current = NULL;
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
goto redo_char;
|
||||
}
|
||||
}
|
||||
else if ((!(tok->flags & JSON_TOKENER_STRICT) &&
|
||||
strncasecmp(json_nan_str, tok->pb->buf, size_nan) == 0) ||
|
||||
(strncmp(json_nan_str, tok->pb->buf, size_nan) == 0)
|
||||
)
|
||||
{
|
||||
if (tok->st_pos == json_nan_str_len)
|
||||
{
|
||||
current = json_object_new_double(NAN);
|
||||
if (current == NULL)
|
||||
goto out;
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
goto redo_char;
|
||||
}
|
||||
} else {
|
||||
tok->err = json_tokener_error_parse_null;
|
||||
goto out;
|
||||
}
|
||||
tok->st_pos++;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_comment_start:
|
||||
if(c == '*') {
|
||||
state = json_tokener_state_comment;
|
||||
} else if(c == '/') {
|
||||
state = json_tokener_state_comment_eol;
|
||||
} else {
|
||||
tok->err = json_tokener_error_parse_comment;
|
||||
goto out;
|
||||
}
|
||||
printbuf_memappend_fast(tok->pb, &c, 1);
|
||||
break;
|
||||
|
||||
case json_tokener_state_comment:
|
||||
{
|
||||
/* Advance until we change state */
|
||||
const char *case_start = str;
|
||||
while(c != '*') {
|
||||
if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) {
|
||||
printbuf_memappend_fast(tok->pb, case_start, str-case_start);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
printbuf_memappend_fast(tok->pb, case_start, 1+str-case_start);
|
||||
state = json_tokener_state_comment_end;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_comment_eol:
|
||||
{
|
||||
/* Advance until we change state */
|
||||
const char *case_start = str;
|
||||
while(c != '\n') {
|
||||
if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) {
|
||||
printbuf_memappend_fast(tok->pb, case_start, str-case_start);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
printbuf_memappend_fast(tok->pb, case_start, str-case_start);
|
||||
MC_DEBUG("json_tokener_comment: %s\n", tok->pb->buf);
|
||||
state = json_tokener_state_eatws;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_comment_end:
|
||||
printbuf_memappend_fast(tok->pb, &c, 1);
|
||||
if(c == '/') {
|
||||
MC_DEBUG("json_tokener_comment: %s\n", tok->pb->buf);
|
||||
state = json_tokener_state_eatws;
|
||||
} else {
|
||||
state = json_tokener_state_comment;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_string:
|
||||
{
|
||||
/* Advance until we change state */
|
||||
const char *case_start = str;
|
||||
while(1) {
|
||||
if(c == tok->quote_char) {
|
||||
printbuf_memappend_fast(tok->pb, case_start, str-case_start);
|
||||
current = json_object_new_string_len(tok->pb->buf, tok->pb->bpos);
|
||||
if(current == NULL)
|
||||
goto out;
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
break;
|
||||
} else if(c == '\\') {
|
||||
printbuf_memappend_fast(tok->pb, case_start, str-case_start);
|
||||
saved_state = json_tokener_state_string;
|
||||
state = json_tokener_state_string_escape;
|
||||
break;
|
||||
}
|
||||
if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) {
|
||||
printbuf_memappend_fast(tok->pb, case_start, str-case_start);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_string_escape:
|
||||
switch(c) {
|
||||
case '"':
|
||||
case '\\':
|
||||
case '/':
|
||||
printbuf_memappend_fast(tok->pb, &c, 1);
|
||||
state = saved_state;
|
||||
break;
|
||||
case 'b':
|
||||
case 'n':
|
||||
case 'r':
|
||||
case 't':
|
||||
case 'f':
|
||||
if(c == 'b') printbuf_memappend_fast(tok->pb, "\b", 1);
|
||||
else if(c == 'n') printbuf_memappend_fast(tok->pb, "\n", 1);
|
||||
else if(c == 'r') printbuf_memappend_fast(tok->pb, "\r", 1);
|
||||
else if(c == 't') printbuf_memappend_fast(tok->pb, "\t", 1);
|
||||
else if(c == 'f') printbuf_memappend_fast(tok->pb, "\f", 1);
|
||||
state = saved_state;
|
||||
break;
|
||||
case 'u':
|
||||
tok->ucs_char = 0;
|
||||
tok->st_pos = 0;
|
||||
state = json_tokener_state_escape_unicode;
|
||||
break;
|
||||
default:
|
||||
tok->err = json_tokener_error_parse_string;
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_escape_unicode:
|
||||
{
|
||||
unsigned int got_hi_surrogate = 0;
|
||||
|
||||
/* Handle a 4-byte sequence, or two sequences if a surrogate pair */
|
||||
while(1) {
|
||||
if (c && strchr(json_hex_chars, c)) {
|
||||
tok->ucs_char += ((unsigned int)jt_hexdigit(c) << ((3-tok->st_pos++)*4));
|
||||
if(tok->st_pos == 4) {
|
||||
unsigned char unescaped_utf[4];
|
||||
|
||||
if (got_hi_surrogate) {
|
||||
if (IS_LOW_SURROGATE(tok->ucs_char)) {
|
||||
/* Recalculate the ucs_char, then fall thru to process normally */
|
||||
tok->ucs_char = DECODE_SURROGATE_PAIR(got_hi_surrogate, tok->ucs_char);
|
||||
} else {
|
||||
/* Hi surrogate was not followed by a low surrogate */
|
||||
/* Replace the hi and process the rest normally */
|
||||
printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3);
|
||||
}
|
||||
got_hi_surrogate = 0;
|
||||
}
|
||||
|
||||
if (tok->ucs_char < 0x80) {
|
||||
unescaped_utf[0] = tok->ucs_char;
|
||||
printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 1);
|
||||
} else if (tok->ucs_char < 0x800) {
|
||||
unescaped_utf[0] = 0xc0 | (tok->ucs_char >> 6);
|
||||
unescaped_utf[1] = 0x80 | (tok->ucs_char & 0x3f);
|
||||
printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 2);
|
||||
} else if (IS_HIGH_SURROGATE(tok->ucs_char)) {
|
||||
/* Got a high surrogate. Remember it and look for the
|
||||
* the beginning of another sequence, which should be the
|
||||
* low surrogate.
|
||||
*/
|
||||
got_hi_surrogate = tok->ucs_char;
|
||||
/* Not at end, and the next two chars should be "\u" */
|
||||
if ((len == -1 || len > (tok->char_offset + 2)) &&
|
||||
// str[0] != '0' && // implied by json_hex_chars, above.
|
||||
(str[1] == '\\') &&
|
||||
(str[2] == 'u'))
|
||||
{
|
||||
/* Advance through the 16 bit surrogate, and move on to the
|
||||
* next sequence. The next step is to process the following
|
||||
* characters.
|
||||
*/
|
||||
if( !ADVANCE_CHAR(str, tok) || !ADVANCE_CHAR(str, tok) ) {
|
||||
printbuf_memappend_fast(tok->pb,
|
||||
(char*) utf8_replacement_char, 3);
|
||||
}
|
||||
/* Advance to the first char of the next sequence and
|
||||
* continue processing with the next sequence.
|
||||
*/
|
||||
if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) {
|
||||
printbuf_memappend_fast(tok->pb,
|
||||
(char*) utf8_replacement_char, 3);
|
||||
goto out;
|
||||
}
|
||||
tok->ucs_char = 0;
|
||||
tok->st_pos = 0;
|
||||
continue; /* other json_tokener_state_escape_unicode */
|
||||
} else {
|
||||
/* Got a high surrogate without another sequence following
|
||||
* it. Put a replacement char in for the hi surrogate
|
||||
* and pretend we finished.
|
||||
*/
|
||||
printbuf_memappend_fast(tok->pb,
|
||||
(char*) utf8_replacement_char, 3);
|
||||
}
|
||||
} else if (IS_LOW_SURROGATE(tok->ucs_char)) {
|
||||
/* Got a low surrogate not preceded by a high */
|
||||
printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3);
|
||||
} else if (tok->ucs_char < 0x10000) {
|
||||
unescaped_utf[0] = 0xe0 | (tok->ucs_char >> 12);
|
||||
unescaped_utf[1] = 0x80 | ((tok->ucs_char >> 6) & 0x3f);
|
||||
unescaped_utf[2] = 0x80 | (tok->ucs_char & 0x3f);
|
||||
printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 3);
|
||||
} else if (tok->ucs_char < 0x110000) {
|
||||
unescaped_utf[0] = 0xf0 | ((tok->ucs_char >> 18) & 0x07);
|
||||
unescaped_utf[1] = 0x80 | ((tok->ucs_char >> 12) & 0x3f);
|
||||
unescaped_utf[2] = 0x80 | ((tok->ucs_char >> 6) & 0x3f);
|
||||
unescaped_utf[3] = 0x80 | (tok->ucs_char & 0x3f);
|
||||
printbuf_memappend_fast(tok->pb, (char*)unescaped_utf, 4);
|
||||
} else {
|
||||
/* Don't know what we got--insert the replacement char */
|
||||
printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3);
|
||||
}
|
||||
state = saved_state;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
tok->err = json_tokener_error_parse_string;
|
||||
goto out;
|
||||
}
|
||||
if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) {
|
||||
if (got_hi_surrogate) /* Clean up any pending chars */
|
||||
printbuf_memappend_fast(tok->pb, (char*)utf8_replacement_char, 3);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_boolean:
|
||||
{
|
||||
int size1, size2;
|
||||
printbuf_memappend_fast(tok->pb, &c, 1);
|
||||
size1 = json_min(tok->st_pos+1, json_true_str_len);
|
||||
size2 = json_min(tok->st_pos+1, json_false_str_len);
|
||||
if((!(tok->flags & JSON_TOKENER_STRICT) &&
|
||||
strncasecmp(json_true_str, tok->pb->buf, size1) == 0)
|
||||
|| (strncmp(json_true_str, tok->pb->buf, size1) == 0)
|
||||
) {
|
||||
if(tok->st_pos == json_true_str_len) {
|
||||
current = json_object_new_boolean(1);
|
||||
if(current == NULL)
|
||||
goto out;
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
goto redo_char;
|
||||
}
|
||||
} else if((!(tok->flags & JSON_TOKENER_STRICT) &&
|
||||
strncasecmp(json_false_str, tok->pb->buf, size2) == 0)
|
||||
|| (strncmp(json_false_str, tok->pb->buf, size2) == 0)) {
|
||||
if(tok->st_pos == json_false_str_len) {
|
||||
current = json_object_new_boolean(0);
|
||||
if(current == NULL)
|
||||
goto out;
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
goto redo_char;
|
||||
}
|
||||
} else {
|
||||
tok->err = json_tokener_error_parse_boolean;
|
||||
goto out;
|
||||
}
|
||||
tok->st_pos++;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_number:
|
||||
{
|
||||
/* Advance until we change state */
|
||||
const char *case_start = str;
|
||||
int case_len=0;
|
||||
int is_exponent=0;
|
||||
int negativesign_next_possible_location=1;
|
||||
while(c && strchr(json_number_chars, c)) {
|
||||
++case_len;
|
||||
|
||||
/* non-digit characters checks */
|
||||
/* note: since the main loop condition to get here was
|
||||
an input starting with 0-9 or '-', we are
|
||||
protected from input starting with '.' or
|
||||
e/E. */
|
||||
if (c == '.') {
|
||||
if (tok->is_double != 0) {
|
||||
/* '.' can only be found once, and out of the exponent part.
|
||||
Thus, if the input is already flagged as double, it
|
||||
is invalid. */
|
||||
tok->err = json_tokener_error_parse_number;
|
||||
goto out;
|
||||
}
|
||||
tok->is_double = 1;
|
||||
}
|
||||
if (c == 'e' || c == 'E') {
|
||||
if (is_exponent != 0) {
|
||||
/* only one exponent possible */
|
||||
tok->err = json_tokener_error_parse_number;
|
||||
goto out;
|
||||
}
|
||||
is_exponent = 1;
|
||||
tok->is_double = 1;
|
||||
/* the exponent part can begin with a negative sign */
|
||||
negativesign_next_possible_location = case_len + 1;
|
||||
}
|
||||
if (c == '-' && case_len != negativesign_next_possible_location) {
|
||||
/* If the negative sign is not where expected (ie
|
||||
start of input or start of exponent part), the
|
||||
input is invalid. */
|
||||
tok->err = json_tokener_error_parse_number;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) {
|
||||
printbuf_memappend_fast(tok->pb, case_start, case_len);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
if (case_len>0)
|
||||
printbuf_memappend_fast(tok->pb, case_start, case_len);
|
||||
|
||||
// Check for -Infinity
|
||||
if (tok->pb->buf[0] == '-' && case_len <= 1 &&
|
||||
(c == 'i' || c == 'I'))
|
||||
{
|
||||
state = json_tokener_state_inf;
|
||||
tok->st_pos = 0;
|
||||
goto redo_char;
|
||||
}
|
||||
}
|
||||
{
|
||||
int64_t num64;
|
||||
double numd;
|
||||
if (!tok->is_double && json_parse_int64(tok->pb->buf, &num64) == 0) {
|
||||
if (num64 && tok->pb->buf[0]=='0' &&
|
||||
(tok->flags & JSON_TOKENER_STRICT)) {
|
||||
/* in strict mode, number must not start with 0 */
|
||||
tok->err = json_tokener_error_parse_number;
|
||||
goto out;
|
||||
}
|
||||
current = json_object_new_int64(num64);
|
||||
if(current == NULL)
|
||||
goto out;
|
||||
}
|
||||
else if(tok->is_double && json_parse_double(tok->pb->buf, &numd) == 0)
|
||||
{
|
||||
current = json_object_new_double_s(numd, tok->pb->buf);
|
||||
if(current == NULL)
|
||||
goto out;
|
||||
} else {
|
||||
tok->err = json_tokener_error_parse_number;
|
||||
goto out;
|
||||
}
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
goto redo_char;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_array_after_sep:
|
||||
case json_tokener_state_array:
|
||||
if(c == ']') {
|
||||
if (state == json_tokener_state_array_after_sep &&
|
||||
(tok->flags & JSON_TOKENER_STRICT))
|
||||
{
|
||||
tok->err = json_tokener_error_parse_unexpected;
|
||||
goto out;
|
||||
}
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
} else {
|
||||
if(tok->depth >= tok->max_depth-1) {
|
||||
tok->err = json_tokener_error_depth;
|
||||
goto out;
|
||||
}
|
||||
state = json_tokener_state_array_add;
|
||||
tok->depth++;
|
||||
json_tokener_reset_level(tok, tok->depth);
|
||||
goto redo_char;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_array_add:
|
||||
if( json_object_array_add(current, obj) != 0 )
|
||||
goto out;
|
||||
saved_state = json_tokener_state_array_sep;
|
||||
state = json_tokener_state_eatws;
|
||||
goto redo_char;
|
||||
|
||||
case json_tokener_state_array_sep:
|
||||
if(c == ']') {
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
} else if(c == ',') {
|
||||
saved_state = json_tokener_state_array_after_sep;
|
||||
state = json_tokener_state_eatws;
|
||||
} else {
|
||||
tok->err = json_tokener_error_parse_array;
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_object_field_start:
|
||||
case json_tokener_state_object_field_start_after_sep:
|
||||
if(c == '}') {
|
||||
if (state == json_tokener_state_object_field_start_after_sep &&
|
||||
(tok->flags & JSON_TOKENER_STRICT))
|
||||
{
|
||||
tok->err = json_tokener_error_parse_unexpected;
|
||||
goto out;
|
||||
}
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
} else if (c == '"' || c == '\'') {
|
||||
tok->quote_char = c;
|
||||
printbuf_reset(tok->pb);
|
||||
state = json_tokener_state_object_field;
|
||||
} else {
|
||||
tok->err = json_tokener_error_parse_object_key_name;
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_object_field:
|
||||
{
|
||||
/* Advance until we change state */
|
||||
const char *case_start = str;
|
||||
while(1) {
|
||||
if(c == tok->quote_char) {
|
||||
printbuf_memappend_fast(tok->pb, case_start, str-case_start);
|
||||
obj_field_name = strdup(tok->pb->buf);
|
||||
saved_state = json_tokener_state_object_field_end;
|
||||
state = json_tokener_state_eatws;
|
||||
break;
|
||||
} else if(c == '\\') {
|
||||
printbuf_memappend_fast(tok->pb, case_start, str-case_start);
|
||||
saved_state = json_tokener_state_object_field;
|
||||
state = json_tokener_state_string_escape;
|
||||
break;
|
||||
}
|
||||
if (!ADVANCE_CHAR(str, tok) || !PEEK_CHAR(c, tok)) {
|
||||
printbuf_memappend_fast(tok->pb, case_start, str-case_start);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_object_field_end:
|
||||
if(c == ':') {
|
||||
saved_state = json_tokener_state_object_value;
|
||||
state = json_tokener_state_eatws;
|
||||
} else {
|
||||
tok->err = json_tokener_error_parse_object_key_sep;
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
|
||||
case json_tokener_state_object_value:
|
||||
if(tok->depth >= tok->max_depth-1) {
|
||||
tok->err = json_tokener_error_depth;
|
||||
goto out;
|
||||
}
|
||||
state = json_tokener_state_object_value_add;
|
||||
tok->depth++;
|
||||
json_tokener_reset_level(tok, tok->depth);
|
||||
goto redo_char;
|
||||
|
||||
case json_tokener_state_object_value_add:
|
||||
json_object_object_add(current, obj_field_name, obj);
|
||||
free(obj_field_name);
|
||||
obj_field_name = NULL;
|
||||
saved_state = json_tokener_state_object_sep;
|
||||
state = json_tokener_state_eatws;
|
||||
goto redo_char;
|
||||
|
||||
case json_tokener_state_object_sep:
|
||||
/* { */
|
||||
if(c == '}') {
|
||||
saved_state = json_tokener_state_finish;
|
||||
state = json_tokener_state_eatws;
|
||||
} else if(c == ',') {
|
||||
saved_state = json_tokener_state_object_field_start_after_sep;
|
||||
state = json_tokener_state_eatws;
|
||||
} else {
|
||||
tok->err = json_tokener_error_parse_object_value_sep;
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
if (!ADVANCE_CHAR(str, tok))
|
||||
goto out;
|
||||
} /* while(PEEK_CHAR) */
|
||||
|
||||
out:
|
||||
if (c &&
|
||||
(state == json_tokener_state_finish) &&
|
||||
(tok->depth == 0) &&
|
||||
(tok->flags & JSON_TOKENER_STRICT)) {
|
||||
/* unexpected char after JSON data */
|
||||
tok->err = json_tokener_error_parse_unexpected;
|
||||
}
|
||||
if (!c) { /* We hit an eof char (0) */
|
||||
if(state != json_tokener_state_finish &&
|
||||
saved_state != json_tokener_state_finish)
|
||||
tok->err = json_tokener_error_parse_eof;
|
||||
}
|
||||
|
||||
#ifdef HAVE_USELOCALE
|
||||
uselocale(oldlocale);
|
||||
freelocale(newloc);
|
||||
#elif defined(HAVE_SETLOCALE)
|
||||
setlocale(LC_NUMERIC, oldlocale);
|
||||
free(oldlocale);
|
||||
#endif
|
||||
|
||||
if (tok->err == json_tokener_success)
|
||||
{
|
||||
json_object *ret = json_object_get(current);
|
||||
int ii;
|
||||
|
||||
/* Partially reset, so we parse additional objects on subsequent calls. */
|
||||
for(ii = tok->depth; ii >= 0; ii--)
|
||||
json_tokener_reset_level(tok, ii);
|
||||
return ret;
|
||||
}
|
||||
|
||||
MC_DEBUG("json_tokener_parse_ex: error %s at offset %d\n",
|
||||
json_tokener_errors[tok->err], tok->char_offset);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void json_tokener_set_flags(struct json_tokener *tok, int flags)
|
||||
{
|
||||
tok->flags = flags;
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* $Id: json_tokener.h,v 1.10 2006/07/25 03:24:50 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Methods to parse an input string into a tree of json_object objects.
|
||||
*/
|
||||
#ifndef _json_tokener_h_
|
||||
#define _json_tokener_h_
|
||||
|
||||
#include <stddef.h>
|
||||
#include "json_object.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum json_tokener_error {
|
||||
json_tokener_success,
|
||||
json_tokener_continue,
|
||||
json_tokener_error_depth,
|
||||
json_tokener_error_parse_eof,
|
||||
json_tokener_error_parse_unexpected,
|
||||
json_tokener_error_parse_null,
|
||||
json_tokener_error_parse_boolean,
|
||||
json_tokener_error_parse_number,
|
||||
json_tokener_error_parse_array,
|
||||
json_tokener_error_parse_object_key_name,
|
||||
json_tokener_error_parse_object_key_sep,
|
||||
json_tokener_error_parse_object_value_sep,
|
||||
json_tokener_error_parse_string,
|
||||
json_tokener_error_parse_comment,
|
||||
json_tokener_error_size
|
||||
};
|
||||
|
||||
enum json_tokener_state {
|
||||
json_tokener_state_eatws,
|
||||
json_tokener_state_start,
|
||||
json_tokener_state_finish,
|
||||
json_tokener_state_null,
|
||||
json_tokener_state_comment_start,
|
||||
json_tokener_state_comment,
|
||||
json_tokener_state_comment_eol,
|
||||
json_tokener_state_comment_end,
|
||||
json_tokener_state_string,
|
||||
json_tokener_state_string_escape,
|
||||
json_tokener_state_escape_unicode,
|
||||
json_tokener_state_boolean,
|
||||
json_tokener_state_number,
|
||||
json_tokener_state_array,
|
||||
json_tokener_state_array_add,
|
||||
json_tokener_state_array_sep,
|
||||
json_tokener_state_object_field_start,
|
||||
json_tokener_state_object_field,
|
||||
json_tokener_state_object_field_end,
|
||||
json_tokener_state_object_value,
|
||||
json_tokener_state_object_value_add,
|
||||
json_tokener_state_object_sep,
|
||||
json_tokener_state_array_after_sep,
|
||||
json_tokener_state_object_field_start_after_sep,
|
||||
json_tokener_state_inf
|
||||
};
|
||||
|
||||
struct json_tokener_srec
|
||||
{
|
||||
enum json_tokener_state state, saved_state;
|
||||
struct json_object *obj;
|
||||
struct json_object *current;
|
||||
char *obj_field_name;
|
||||
};
|
||||
|
||||
#define JSON_TOKENER_DEFAULT_DEPTH 32
|
||||
|
||||
struct json_tokener
|
||||
{
|
||||
char *str;
|
||||
struct printbuf *pb;
|
||||
int max_depth, depth, is_double, st_pos, char_offset;
|
||||
enum json_tokener_error err;
|
||||
unsigned int ucs_char;
|
||||
char quote_char;
|
||||
struct json_tokener_srec *stack;
|
||||
int flags;
|
||||
};
|
||||
/**
|
||||
* @deprecated Unused in json-c code
|
||||
*/
|
||||
typedef struct json_tokener json_tokener;
|
||||
|
||||
/**
|
||||
* Be strict when parsing JSON input. Use caution with
|
||||
* this flag as what is considered valid may become more
|
||||
* restrictive from one release to the next, causing your
|
||||
* code to fail on previously working input.
|
||||
*
|
||||
* This flag is not set by default.
|
||||
*
|
||||
* @see json_tokener_set_flags()
|
||||
*/
|
||||
#define JSON_TOKENER_STRICT 0x01
|
||||
|
||||
/**
|
||||
* Given an error previously returned by json_tokener_get_error(),
|
||||
* return a human readable description of the error.
|
||||
*
|
||||
* @return a generic error message is returned if an invalid error value is provided.
|
||||
*/
|
||||
const char *json_tokener_error_desc(enum json_tokener_error jerr);
|
||||
|
||||
/**
|
||||
* Retrieve the error caused by the last call to json_tokener_parse_ex(),
|
||||
* or json_tokener_success if there is no error.
|
||||
*
|
||||
* When parsing a JSON string in pieces, if the tokener is in the middle
|
||||
* of parsing this will return json_tokener_continue.
|
||||
*
|
||||
* See also json_tokener_error_desc().
|
||||
*/
|
||||
JSON_EXPORT enum json_tokener_error json_tokener_get_error(struct json_tokener *tok);
|
||||
|
||||
JSON_EXPORT struct json_tokener* json_tokener_new(void);
|
||||
JSON_EXPORT struct json_tokener* json_tokener_new_ex(int depth);
|
||||
JSON_EXPORT void json_tokener_free(struct json_tokener *tok);
|
||||
JSON_EXPORT void json_tokener_reset(struct json_tokener *tok);
|
||||
JSON_EXPORT struct json_object* json_tokener_parse(const char *str);
|
||||
JSON_EXPORT struct json_object* json_tokener_parse_verbose(const char *str, enum json_tokener_error *error);
|
||||
|
||||
/**
|
||||
* Set flags that control how parsing will be done.
|
||||
*/
|
||||
JSON_EXPORT void json_tokener_set_flags(struct json_tokener *tok, int flags);
|
||||
|
||||
/**
|
||||
* Parse a string and return a non-NULL json_object if a valid JSON value
|
||||
* is found. The string does not need to be a JSON object or array;
|
||||
* it can also be a string, number or boolean value.
|
||||
*
|
||||
* A partial JSON string can be parsed. If the parsing is incomplete,
|
||||
* NULL will be returned and json_tokener_get_error() will return
|
||||
* json_tokener_continue.
|
||||
* json_tokener_parse_ex() can then be called with additional bytes in str
|
||||
* to continue the parsing.
|
||||
*
|
||||
* If json_tokener_parse_ex() returns NULL and the error is anything other than
|
||||
* json_tokener_continue, a fatal error has occurred and parsing must be
|
||||
* halted. Then, the tok object must not be reused until json_tokener_reset() is
|
||||
* called.
|
||||
*
|
||||
* When a valid JSON value is parsed, a non-NULL json_object will be
|
||||
* returned. Also, json_tokener_get_error() will return json_tokener_success.
|
||||
* Be sure to check the type with json_object_is_type() or
|
||||
* json_object_get_type() before using the object.
|
||||
*
|
||||
* @b XXX this shouldn't use internal fields:
|
||||
* Trailing characters after the parsed value do not automatically cause an
|
||||
* error. It is up to the caller to decide whether to treat this as an
|
||||
* error or to handle the additional characters, perhaps by parsing another
|
||||
* json value starting from that point.
|
||||
*
|
||||
* Extra characters can be detected by comparing the tok->char_offset against
|
||||
* the length of the last len parameter passed in.
|
||||
*
|
||||
* The tokener does \b not maintain an internal buffer so the caller is
|
||||
* responsible for calling json_tokener_parse_ex with an appropriate str
|
||||
* parameter starting with the extra characters.
|
||||
*
|
||||
* This interface is presently not 64-bit clean due to the int len argument
|
||||
* so the function limits the maximum string size to INT32_MAX (2GB).
|
||||
* If the function is called with len == -1 then strlen is called to check
|
||||
* the string length is less than INT32_MAX (2GB)
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
json_object *jobj = NULL;
|
||||
const char *mystring = NULL;
|
||||
int stringlen = 0;
|
||||
enum json_tokener_error jerr;
|
||||
do {
|
||||
mystring = ... // get JSON string, e.g. read from file, etc...
|
||||
stringlen = strlen(mystring);
|
||||
jobj = json_tokener_parse_ex(tok, mystring, stringlen);
|
||||
} while ((jerr = json_tokener_get_error(tok)) == json_tokener_continue);
|
||||
if (jerr != json_tokener_success)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", json_tokener_error_desc(jerr));
|
||||
// Handle errors, as appropriate for your application.
|
||||
}
|
||||
if (tok->char_offset < stringlen) // XXX shouldn't access internal fields
|
||||
{
|
||||
// Handle extra characters after parsed object as desired.
|
||||
// e.g. issue an error, parse another object from that point, etc...
|
||||
}
|
||||
// Success, use jobj here.
|
||||
|
||||
@endcode
|
||||
*
|
||||
* @param tok a json_tokener previously allocated with json_tokener_new()
|
||||
* @param str an string with any valid JSON expression, or portion of. This does not need to be null terminated.
|
||||
* @param len the length of str
|
||||
*/
|
||||
JSON_EXPORT struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
|
||||
const char *str, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,243 +0,0 @@
|
||||
/*
|
||||
* $Id: json_util.c,v 1.4 2006/01/30 23:07:57 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config_json_c.h"
|
||||
#undef realloc
|
||||
|
||||
#include "strerror_override.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif /* HAVE_SYS_TYPES_H */
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif /* HAVE_SYS_STAT_H */
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif /* HAVE_FCNTL_H */
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#ifdef WIN32
|
||||
# if MSC_VER < 1800
|
||||
/* strtoll is available only since Visual Studio 2013 */
|
||||
# define strtoll _strtoi64
|
||||
# endif
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# include <io.h>
|
||||
#endif /* defined(WIN32) */
|
||||
|
||||
#if !defined(HAVE_OPEN) && defined(WIN32)
|
||||
# define open _open
|
||||
#endif
|
||||
|
||||
#include "snprintf_compat.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "printbuf.h"
|
||||
#include "json_inttypes.h"
|
||||
#include "json_object.h"
|
||||
#include "json_tokener.h"
|
||||
#include "json_util.h"
|
||||
|
||||
static int _json_object_to_fd(int fd, struct json_object *obj, int flags, const char *filename);
|
||||
|
||||
static char _last_err[256] = "";
|
||||
|
||||
const char *json_util_get_last_err()
|
||||
{
|
||||
if (_last_err[0] == '\0')
|
||||
return NULL;
|
||||
return _last_err;
|
||||
}
|
||||
|
||||
void _json_c_set_last_err(const char *err_fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, err_fmt);
|
||||
// Ignore (attempted) overruns from snprintf
|
||||
(void)vsnprintf(_last_err, sizeof(_last_err), err_fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
struct json_object* json_object_from_fd(int fd)
|
||||
{
|
||||
struct printbuf *pb;
|
||||
struct json_object *obj;
|
||||
char buf[JSON_FILE_BUF_SIZE];
|
||||
int ret;
|
||||
|
||||
if(!(pb = printbuf_new())) {
|
||||
_json_c_set_last_err("json_object_from_file: printbuf_new failed\n");
|
||||
return NULL;
|
||||
}
|
||||
while((ret = read(fd, buf, JSON_FILE_BUF_SIZE)) > 0) {
|
||||
printbuf_memappend(pb, buf, ret);
|
||||
}
|
||||
if(ret < 0) {
|
||||
_json_c_set_last_err("json_object_from_fd: error reading fd %d: %s\n", fd, strerror(errno));
|
||||
printbuf_free(pb);
|
||||
return NULL;
|
||||
}
|
||||
obj = json_tokener_parse(pb->buf);
|
||||
printbuf_free(pb);
|
||||
return obj;
|
||||
}
|
||||
|
||||
struct json_object* json_object_from_file(const char *filename)
|
||||
{
|
||||
struct json_object *obj;
|
||||
int fd;
|
||||
|
||||
if((fd = open(filename, O_RDONLY)) < 0) {
|
||||
_json_c_set_last_err("json_object_from_file: error opening file %s: %s\n",
|
||||
filename, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
obj = json_object_from_fd(fd);
|
||||
close(fd);
|
||||
return obj;
|
||||
}
|
||||
|
||||
/* extended "format and write to file" function */
|
||||
|
||||
int json_object_to_file_ext(const char *filename, struct json_object *obj, int flags)
|
||||
{
|
||||
int fd, ret;
|
||||
int saved_errno;
|
||||
|
||||
if (!obj) {
|
||||
_json_c_set_last_err("json_object_to_file: object is null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0644)) < 0) {
|
||||
_json_c_set_last_err("json_object_to_file: error opening file %s: %s\n",
|
||||
filename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
ret = _json_object_to_fd(fd, obj, flags, filename);
|
||||
saved_errno = errno;
|
||||
close(fd);
|
||||
errno = saved_errno;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int json_object_to_fd(int fd, struct json_object *obj, int flags)
|
||||
{
|
||||
if (!obj) {
|
||||
_json_c_set_last_err("json_object_to_fd: object is null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return _json_object_to_fd(fd, obj, flags, NULL);
|
||||
}
|
||||
static int _json_object_to_fd(int fd, struct json_object *obj, int flags, const char *filename)
|
||||
{
|
||||
int ret;
|
||||
const char *json_str;
|
||||
unsigned int wpos, wsize;
|
||||
|
||||
filename = filename ? filename : "(fd)";
|
||||
|
||||
if (!(json_str = json_object_to_json_string_ext(obj,flags))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
wsize = (unsigned int)(strlen(json_str) & UINT_MAX); /* CAW: probably unnecessary, but the most 64bit safe */
|
||||
wpos = 0;
|
||||
while(wpos < wsize) {
|
||||
if((ret = write(fd, json_str + wpos, wsize-wpos)) < 0) {
|
||||
_json_c_set_last_err("json_object_to_file: error writing file %s: %s\n",
|
||||
filename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* because of the above check for ret < 0, we can safely cast and add */
|
||||
wpos += (unsigned int)ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// backwards compatible "format and write to file" function
|
||||
|
||||
int json_object_to_file(const char *filename, struct json_object *obj)
|
||||
{
|
||||
return json_object_to_file_ext(filename, obj, JSON_C_TO_STRING_PLAIN);
|
||||
}
|
||||
|
||||
int json_parse_double(const char *buf, double *retval)
|
||||
{
|
||||
char *end;
|
||||
*retval = strtod(buf, &end);
|
||||
return end == buf ? 1 : 0;
|
||||
}
|
||||
|
||||
int json_parse_int64(const char *buf, int64_t *retval)
|
||||
{
|
||||
char *end = NULL;
|
||||
int64_t val;
|
||||
|
||||
errno = 0;
|
||||
val = strtoll(buf, &end, 10);
|
||||
if (end != buf)
|
||||
*retval = val;
|
||||
return ((val == 0 && errno != 0) || (end == buf)) ? 1 : 0;
|
||||
}
|
||||
|
||||
#ifndef HAVE_REALLOC
|
||||
void* rpl_realloc(void* p, size_t n)
|
||||
{
|
||||
if (n == 0)
|
||||
n = 1;
|
||||
if (p == 0)
|
||||
return malloc(n);
|
||||
return realloc(p, n);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define NELEM(a) (sizeof(a) / sizeof(a[0]))
|
||||
static const char* json_type_name[] = {
|
||||
/* If you change this, be sure to update the enum json_type definition too */
|
||||
"null",
|
||||
"boolean",
|
||||
"double",
|
||||
"int",
|
||||
"object",
|
||||
"array",
|
||||
"string",
|
||||
};
|
||||
|
||||
const char *json_type_to_name(enum json_type o_type)
|
||||
{
|
||||
int o_type_int = (int)o_type;
|
||||
if (o_type_int < 0 || o_type_int >= (int)NELEM(json_type_name))
|
||||
{
|
||||
_json_c_set_last_err("json_type_to_name: type %d is out of range [0,%d]\n", o_type, NELEM(json_type_name));
|
||||
return NULL;
|
||||
}
|
||||
return json_type_name[o_type];
|
||||
}
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* $Id: json_util.h,v 1.4 2006/01/30 23:07:57 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Miscllaneous utility functions and macros.
|
||||
*/
|
||||
#ifndef _json_util_h_
|
||||
#define _json_util_h_
|
||||
|
||||
#include "json_object.h"
|
||||
|
||||
#ifndef json_min
|
||||
#define json_min(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef json_max
|
||||
#define json_max(a,b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define JSON_FILE_BUF_SIZE 4096
|
||||
|
||||
/* utility functions */
|
||||
/**
|
||||
* Read the full contents of the given file, then convert it to a
|
||||
* json_object using json_tokener_parse().
|
||||
*
|
||||
* Returns -1 if something fails. See json_util_get_last_err() for details.
|
||||
*/
|
||||
extern struct json_object* json_object_from_file(const char *filename);
|
||||
|
||||
/**
|
||||
* Create a JSON object from already opened file descriptor.
|
||||
*
|
||||
* This function can be helpful, when you opened the file already,
|
||||
* e.g. when you have a temp file.
|
||||
* Note, that the fd must be readable at the actual position, i.e.
|
||||
* use lseek(fd, 0, SEEK_SET) before.
|
||||
*
|
||||
* Returns -1 if something fails. See json_util_get_last_err() for details.
|
||||
*/
|
||||
extern struct json_object* json_object_from_fd(int fd);
|
||||
|
||||
/**
|
||||
* Equivalent to:
|
||||
* json_object_to_file_ext(filename, obj, JSON_C_TO_STRING_PLAIN);
|
||||
*
|
||||
* Returns -1 if something fails. See json_util_get_last_err() for details.
|
||||
*/
|
||||
extern int json_object_to_file(const char *filename, struct json_object *obj);
|
||||
|
||||
/**
|
||||
* Open and truncate the given file, creating it if necessary, then
|
||||
* convert the json_object to a string and write it to the file.
|
||||
*
|
||||
* Returns -1 if something fails. See json_util_get_last_err() for details.
|
||||
*/
|
||||
extern int json_object_to_file_ext(const char *filename, struct json_object *obj, int flags);
|
||||
|
||||
/**
|
||||
* Convert the json_object to a string and write it to the file descriptor.
|
||||
* Handles partial writes and will keep writing until done, or an error
|
||||
* occurs.
|
||||
*
|
||||
* @param fd an open, writable file descriptor to write to
|
||||
* @param obj the object to serializer and write
|
||||
* @param flags flags to pass to json_object_to_json_string_ext()
|
||||
* @return -1 if something fails. See json_util_get_last_err() for details.
|
||||
*/
|
||||
extern int json_object_to_fd(int fd, struct json_object *obj, int flags);
|
||||
|
||||
/**
|
||||
* Return the last error from various json-c functions, including:
|
||||
* json_object_to_file{,_ext}, json_object_to_fd() or
|
||||
* json_object_from_{file,fd}, or NULL if there is none.
|
||||
*/
|
||||
const char *json_util_get_last_err(void);
|
||||
|
||||
|
||||
extern int json_parse_int64(const char *buf, int64_t *retval);
|
||||
extern int json_parse_double(const char *buf, double *retval);
|
||||
|
||||
/**
|
||||
* Return a string describing the type of the object.
|
||||
* e.g. "int", or "object", etc...
|
||||
*/
|
||||
extern const char *json_type_to_name(enum json_type o_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Eric Haszlakiewicz
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "config_json_c.h"
|
||||
#include "json_inttypes.h"
|
||||
#include "json_object.h"
|
||||
#include "json_visit.h"
|
||||
#include "linkhash.h"
|
||||
|
||||
static int _json_c_visit(json_object *jso, json_object *parent_jso,
|
||||
const char *jso_key, size_t *jso_index,
|
||||
json_c_visit_userfunc *userfunc, void *userarg);
|
||||
|
||||
int json_c_visit(json_object *jso, int future_flags,
|
||||
json_c_visit_userfunc *userfunc, void *userarg)
|
||||
{
|
||||
int ret = _json_c_visit(jso, NULL, NULL, NULL, userfunc, userarg);
|
||||
switch(ret)
|
||||
{
|
||||
case JSON_C_VISIT_RETURN_CONTINUE:
|
||||
case JSON_C_VISIT_RETURN_SKIP:
|
||||
case JSON_C_VISIT_RETURN_POP:
|
||||
case JSON_C_VISIT_RETURN_STOP:
|
||||
return 0;
|
||||
default:
|
||||
return JSON_C_VISIT_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
static int _json_c_visit(json_object *jso, json_object *parent_jso,
|
||||
const char *jso_key, size_t *jso_index,
|
||||
json_c_visit_userfunc *userfunc, void *userarg)
|
||||
{
|
||||
int userret = userfunc(jso, 0, parent_jso, jso_key, jso_index, userarg);
|
||||
switch(userret)
|
||||
{
|
||||
case JSON_C_VISIT_RETURN_CONTINUE:
|
||||
break;
|
||||
case JSON_C_VISIT_RETURN_SKIP:
|
||||
case JSON_C_VISIT_RETURN_POP:
|
||||
case JSON_C_VISIT_RETURN_STOP:
|
||||
case JSON_C_VISIT_RETURN_ERROR:
|
||||
return userret;
|
||||
default:
|
||||
fprintf(stderr, "ERROR: invalid return value from json_c_visit userfunc: %d\n", userret);
|
||||
return JSON_C_VISIT_RETURN_ERROR;
|
||||
}
|
||||
|
||||
switch(json_object_get_type(jso))
|
||||
{
|
||||
case json_type_null:
|
||||
case json_type_boolean:
|
||||
case json_type_double:
|
||||
case json_type_int:
|
||||
case json_type_string:
|
||||
// we already called userfunc above, move on to the next object
|
||||
return JSON_C_VISIT_RETURN_CONTINUE;
|
||||
|
||||
case json_type_object:
|
||||
{
|
||||
json_object_object_foreach(jso, key, child)
|
||||
{
|
||||
userret = _json_c_visit(child, jso, key, NULL, userfunc, userarg);
|
||||
if (userret == JSON_C_VISIT_RETURN_POP)
|
||||
break;
|
||||
if (userret == JSON_C_VISIT_RETURN_STOP ||
|
||||
userret == JSON_C_VISIT_RETURN_ERROR)
|
||||
return userret;
|
||||
if (userret != JSON_C_VISIT_RETURN_CONTINUE &&
|
||||
userret != JSON_C_VISIT_RETURN_SKIP)
|
||||
{
|
||||
fprintf(stderr, "INTERNAL ERROR: _json_c_visit returned %d\n", userret);
|
||||
return JSON_C_VISIT_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case json_type_array:
|
||||
{
|
||||
size_t array_len = json_object_array_length(jso);
|
||||
size_t ii;
|
||||
for (ii = 0; ii < array_len; ii++)
|
||||
{
|
||||
json_object *child = json_object_array_get_idx(jso, ii);
|
||||
userret = _json_c_visit(child, jso, NULL, &ii, userfunc, userarg);
|
||||
if (userret == JSON_C_VISIT_RETURN_POP)
|
||||
break;
|
||||
if (userret == JSON_C_VISIT_RETURN_STOP ||
|
||||
userret == JSON_C_VISIT_RETURN_ERROR)
|
||||
return userret;
|
||||
if (userret != JSON_C_VISIT_RETURN_CONTINUE &&
|
||||
userret != JSON_C_VISIT_RETURN_SKIP)
|
||||
{
|
||||
fprintf(stderr, "INTERNAL ERROR: _json_c_visit returned %d\n", userret);
|
||||
return JSON_C_VISIT_RETURN_ERROR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fprintf(stderr, "INTERNAL ERROR: _json_c_visit found object of unknown type: %d\n", json_object_get_type(jso));
|
||||
return JSON_C_VISIT_RETURN_ERROR;
|
||||
}
|
||||
|
||||
// Call userfunc for the second type on container types, after all
|
||||
// members of the container have been visited.
|
||||
// Non-container types will have already returned before this point.
|
||||
|
||||
userret = userfunc(jso, JSON_C_VISIT_SECOND, parent_jso, jso_key, jso_index, userarg);
|
||||
switch(userret)
|
||||
{
|
||||
case JSON_C_VISIT_RETURN_SKIP:
|
||||
case JSON_C_VISIT_RETURN_POP:
|
||||
// These are not really sensible during JSON_C_VISIT_SECOND,
|
||||
// but map them to JSON_C_VISIT_CONTINUE anyway.
|
||||
// FALLTHROUGH
|
||||
case JSON_C_VISIT_RETURN_CONTINUE:
|
||||
return JSON_C_VISIT_RETURN_CONTINUE;
|
||||
case JSON_C_VISIT_RETURN_STOP:
|
||||
case JSON_C_VISIT_RETURN_ERROR:
|
||||
return userret;
|
||||
default:
|
||||
fprintf(stderr, "ERROR: invalid return value from json_c_visit userfunc: %d\n", userret);
|
||||
return JSON_C_VISIT_RETURN_ERROR;
|
||||
}
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
|
||||
#ifndef _json_c_json_visit_h_
|
||||
#define _json_c_json_visit_h_
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Methods for walking a tree of objects.
|
||||
*/
|
||||
#include "json_object.h"
|
||||
|
||||
typedef int (json_c_visit_userfunc)(json_object *jso, int flags,
|
||||
json_object *parent_jso, const char *jso_key,
|
||||
size_t *jso_index, void *userarg);
|
||||
|
||||
/**
|
||||
* Visit each object in the JSON hierarchy starting at jso.
|
||||
* For each object, userfunc is called, passing the object and userarg.
|
||||
* If the object has a parent (i.e. anything other than jso itself)
|
||||
* its parent will be passed as parent_jso, and either jso_key or jso_index
|
||||
* will be set, depending on whether the parent is an object or an array.
|
||||
*
|
||||
* Nodes will be visited depth first, but containers (arrays and objects)
|
||||
* will be visited twice, the second time with JSON_C_VISIT_SECOND set in
|
||||
* flags.
|
||||
*
|
||||
* userfunc must return one of the defined return values, to indicate
|
||||
* whether and how to continue visiting nodes, or one of various ways to stop.
|
||||
*
|
||||
* Returns 0 if nodes were visited successfully, even if some were
|
||||
* intentionally skipped due to what userfunc returned.
|
||||
* Returns <0 if an error occurred during iteration, including if
|
||||
* userfunc returned JSON_C_VISIT_RETURN_ERROR.
|
||||
*/
|
||||
int json_c_visit(json_object *jso, int future_flags,
|
||||
json_c_visit_userfunc *userfunc, void *userarg);
|
||||
|
||||
/**
|
||||
* Passed to json_c_visit_userfunc as one of the flags values to indicate
|
||||
* that this is the second time a container (array or object) is being
|
||||
* called, after all of it's members have been iterated over.
|
||||
*/
|
||||
#define JSON_C_VISIT_SECOND 0x02
|
||||
|
||||
/**
|
||||
* This json_c_visit_userfunc return value indicates that iteration
|
||||
* should proceed normally.
|
||||
*/
|
||||
#define JSON_C_VISIT_RETURN_CONTINUE 0
|
||||
|
||||
|
||||
/**
|
||||
* This json_c_visit_userfunc return value indicates that iteration
|
||||
* over the members of the current object should be skipped.
|
||||
* If the current object isn't a container (array or object), this
|
||||
* is no different than JSON_C_VISIT_RETURN_CONTINUE.
|
||||
*/
|
||||
#define JSON_C_VISIT_RETURN_SKIP 7547
|
||||
|
||||
/**
|
||||
* This json_c_visit_userfunc return value indicates that iteration
|
||||
* of the fields/elements of the <b>containing</b> object should stop
|
||||
* and continue "popped up" a level of the object hierarchy.
|
||||
* For example, returning this when handling arg will result in
|
||||
* arg3 and any other fields being skipped. The next call to userfunc
|
||||
* will be the JSON_C_VISIT_SECOND call on "foo", followed by a userfunc
|
||||
* call on "bar".
|
||||
* <pre>
|
||||
* {
|
||||
* "foo": {
|
||||
* "arg1": 1,
|
||||
* "arg2": 2,
|
||||
* "arg3": 3,
|
||||
* ...
|
||||
* },
|
||||
* "bar": {
|
||||
* ...
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
#define JSON_C_VISIT_RETURN_POP 767
|
||||
|
||||
/**
|
||||
* This json_c_visit_userfunc return value indicates that iteration
|
||||
* should stop immediately, and cause json_c_visit to return success.
|
||||
*/
|
||||
#define JSON_C_VISIT_RETURN_STOP 7867
|
||||
|
||||
/**
|
||||
* This json_c_visit_userfunc return value indicates that iteration
|
||||
* should stop immediately, and cause json_c_visit to return an error.
|
||||
*/
|
||||
#define JSON_C_VISIT_RETURN_ERROR -1
|
||||
|
||||
#endif /* _json_c_json_visit_h_ */
|
||||
@@ -1,26 +0,0 @@
|
||||
|
||||
/* dummy source file for compatibility purposes */
|
||||
|
||||
#if defined(HAVE_CDEFS_H)
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
#ifndef __warn_references
|
||||
|
||||
#if defined(__GNUC__) && defined (HAS_GNU_WARNING_LONG)
|
||||
|
||||
#define __warn_references(sym,msg) \
|
||||
__asm__(".section .gnu" #sym ",\n\t.ascii \"" msg "\"\n\t.text");
|
||||
|
||||
#else
|
||||
#define __warn_references(sym,msg) /* nothing */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "json_object.h"
|
||||
|
||||
__warn_references(json_object_get, "Warning: please link against libjson-c instead of libjson");
|
||||
|
||||
/* __asm__(".section .gnu.warning." __STRING(sym) \
|
||||
" ; .ascii \"" msg "\" ; .text") */
|
||||
@@ -1,674 +0,0 @@
|
||||
/*
|
||||
* $Id: linkhash.c,v 1.4 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
* Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config_json_c.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef HAVE_ENDIAN_H
|
||||
# include <endian.h> /* attempt to define endianness */
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h> /* Get InterlockedCompareExchange */
|
||||
#endif
|
||||
|
||||
#include "random_seed.h"
|
||||
#include "linkhash.h"
|
||||
|
||||
/* hash functions */
|
||||
static unsigned long lh_char_hash(const void *k);
|
||||
static unsigned long lh_perllike_str_hash(const void *k);
|
||||
static lh_hash_fn *char_hash_fn = lh_char_hash;
|
||||
|
||||
int
|
||||
json_global_set_string_hash(const int h)
|
||||
{
|
||||
switch(h) {
|
||||
case JSON_C_STR_HASH_DFLT:
|
||||
char_hash_fn = lh_char_hash;
|
||||
break;
|
||||
case JSON_C_STR_HASH_PERLLIKE:
|
||||
char_hash_fn = lh_perllike_str_hash;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned long lh_ptr_hash(const void *k)
|
||||
{
|
||||
/* CAW: refactored to be 64bit nice */
|
||||
return (unsigned long)((((ptrdiff_t)k * LH_PRIME) >> 4) & ULONG_MAX);
|
||||
}
|
||||
|
||||
int lh_ptr_equal(const void *k1, const void *k2)
|
||||
{
|
||||
return (k1 == k2);
|
||||
}
|
||||
|
||||
/*
|
||||
* hashlittle from lookup3.c, by Bob Jenkins, May 2006, Public Domain.
|
||||
* http://burtleburtle.net/bob/c/lookup3.c
|
||||
* minor modifications to make functions static so no symbols are exported
|
||||
* minor mofifications to compile with -Werror
|
||||
*/
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
lookup3.c, by Bob Jenkins, May 2006, Public Domain.
|
||||
|
||||
These are functions for producing 32-bit hashes for hash table lookup.
|
||||
hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
|
||||
are externally useful functions. Routines to test the hash are included
|
||||
if SELF_TEST is defined. You can use this free for any purpose. It's in
|
||||
the public domain. It has no warranty.
|
||||
|
||||
You probably want to use hashlittle(). hashlittle() and hashbig()
|
||||
hash byte arrays. hashlittle() is is faster than hashbig() on
|
||||
little-endian machines. Intel and AMD are little-endian machines.
|
||||
On second thought, you probably want hashlittle2(), which is identical to
|
||||
hashlittle() except it returns two 32-bit hashes for the price of one.
|
||||
You could implement hashbig2() if you wanted but I haven't bothered here.
|
||||
|
||||
If you want to find a hash of, say, exactly 7 integers, do
|
||||
a = i1; b = i2; c = i3;
|
||||
mix(a,b,c);
|
||||
a += i4; b += i5; c += i6;
|
||||
mix(a,b,c);
|
||||
a += i7;
|
||||
final(a,b,c);
|
||||
then use c as the hash value. If you have a variable length array of
|
||||
4-byte integers to hash, use hashword(). If you have a byte array (like
|
||||
a character string), use hashlittle(). If you have several byte arrays, or
|
||||
a mix of things, see the comments above hashlittle().
|
||||
|
||||
Why is this so big? I read 12 bytes at a time into 3 4-byte integers,
|
||||
then mix those integers. This is fast (you can do a lot more thorough
|
||||
mixing with 12*3 instructions on 3 integers than you can with 3 instructions
|
||||
on 1 byte), but shoehorning those bytes into integers efficiently is messy.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* My best guess at if you are big-endian or little-endian. This may
|
||||
* need adjustment.
|
||||
*/
|
||||
#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \
|
||||
__BYTE_ORDER == __LITTLE_ENDIAN) || \
|
||||
(defined(i386) || defined(__i386__) || defined(__i486__) || \
|
||||
defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL))
|
||||
# define HASH_LITTLE_ENDIAN 1
|
||||
# define HASH_BIG_ENDIAN 0
|
||||
#elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \
|
||||
__BYTE_ORDER == __BIG_ENDIAN) || \
|
||||
(defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel))
|
||||
# define HASH_LITTLE_ENDIAN 0
|
||||
# define HASH_BIG_ENDIAN 1
|
||||
#else
|
||||
# define HASH_LITTLE_ENDIAN 0
|
||||
# define HASH_BIG_ENDIAN 0
|
||||
#endif
|
||||
|
||||
#define hashsize(n) ((uint32_t)1<<(n))
|
||||
#define hashmask(n) (hashsize(n)-1)
|
||||
#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
mix -- mix 3 32-bit values reversibly.
|
||||
|
||||
This is reversible, so any information in (a,b,c) before mix() is
|
||||
still in (a,b,c) after mix().
|
||||
|
||||
If four pairs of (a,b,c) inputs are run through mix(), or through
|
||||
mix() in reverse, there are at least 32 bits of the output that
|
||||
are sometimes the same for one pair and different for another pair.
|
||||
This was tested for:
|
||||
* pairs that differed by one bit, by two bits, in any combination
|
||||
of top bits of (a,b,c), or in any combination of bottom bits of
|
||||
(a,b,c).
|
||||
* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
|
||||
the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
|
||||
is commonly produced by subtraction) look like a single 1-bit
|
||||
difference.
|
||||
* the base values were pseudorandom, all zero but one bit set, or
|
||||
all zero plus a counter that starts at zero.
|
||||
|
||||
Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that
|
||||
satisfy this are
|
||||
4 6 8 16 19 4
|
||||
9 15 3 18 27 15
|
||||
14 9 3 7 17 3
|
||||
Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing
|
||||
for "differ" defined as + with a one-bit base and a two-bit delta. I
|
||||
used http://burtleburtle.net/bob/hash/avalanche.html to choose
|
||||
the operations, constants, and arrangements of the variables.
|
||||
|
||||
This does not achieve avalanche. There are input bits of (a,b,c)
|
||||
that fail to affect some output bits of (a,b,c), especially of a. The
|
||||
most thoroughly mixed value is c, but it doesn't really even achieve
|
||||
avalanche in c.
|
||||
|
||||
This allows some parallelism. Read-after-writes are good at doubling
|
||||
the number of bits affected, so the goal of mixing pulls in the opposite
|
||||
direction as the goal of parallelism. I did what I could. Rotates
|
||||
seem to cost as much as shifts on every machine I could lay my hands
|
||||
on, and rotates are much kinder to the top and bottom bits, so I used
|
||||
rotates.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#define mix(a,b,c) \
|
||||
{ \
|
||||
a -= c; a ^= rot(c, 4); c += b; \
|
||||
b -= a; b ^= rot(a, 6); a += c; \
|
||||
c -= b; c ^= rot(b, 8); b += a; \
|
||||
a -= c; a ^= rot(c,16); c += b; \
|
||||
b -= a; b ^= rot(a,19); a += c; \
|
||||
c -= b; c ^= rot(b, 4); b += a; \
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
final -- final mixing of 3 32-bit values (a,b,c) into c
|
||||
|
||||
Pairs of (a,b,c) values differing in only a few bits will usually
|
||||
produce values of c that look totally different. This was tested for
|
||||
* pairs that differed by one bit, by two bits, in any combination
|
||||
of top bits of (a,b,c), or in any combination of bottom bits of
|
||||
(a,b,c).
|
||||
* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
|
||||
the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
|
||||
is commonly produced by subtraction) look like a single 1-bit
|
||||
difference.
|
||||
* the base values were pseudorandom, all zero but one bit set, or
|
||||
all zero plus a counter that starts at zero.
|
||||
|
||||
These constants passed:
|
||||
14 11 25 16 4 14 24
|
||||
12 14 25 16 4 14 24
|
||||
and these came close:
|
||||
4 8 15 26 3 22 24
|
||||
10 8 15 26 3 22 24
|
||||
11 8 15 26 3 22 24
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#define final(a,b,c) \
|
||||
{ \
|
||||
c ^= b; c -= rot(b,14); \
|
||||
a ^= c; a -= rot(c,11); \
|
||||
b ^= a; b -= rot(a,25); \
|
||||
c ^= b; c -= rot(b,16); \
|
||||
a ^= c; a -= rot(c,4); \
|
||||
b ^= a; b -= rot(a,14); \
|
||||
c ^= b; c -= rot(b,24); \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
hashlittle() -- hash a variable-length key into a 32-bit value
|
||||
k : the key (the unaligned variable-length array of bytes)
|
||||
length : the length of the key, counting by bytes
|
||||
initval : can be any 4-byte value
|
||||
Returns a 32-bit value. Every bit of the key affects every bit of
|
||||
the return value. Two keys differing by one or two bits will have
|
||||
totally different hash values.
|
||||
|
||||
The best hash table sizes are powers of 2. There is no need to do
|
||||
mod a prime (mod is sooo slow!). If you need less than 32 bits,
|
||||
use a bitmask. For example, if you need only 10 bits, do
|
||||
h = (h & hashmask(10));
|
||||
In which case, the hash table should have hashsize(10) elements.
|
||||
|
||||
If you are hashing n strings (uint8_t **)k, do it like this:
|
||||
for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h);
|
||||
|
||||
By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this
|
||||
code any way you wish, private, educational, or commercial. It's free.
|
||||
|
||||
Use for hash table lookup, or anything where one collision in 2^^32 is
|
||||
acceptable. Do NOT use for cryptographic purposes.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
|
||||
{
|
||||
uint32_t a,b,c; /* internal state */
|
||||
union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */
|
||||
|
||||
/* Set up the internal state */
|
||||
a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
|
||||
|
||||
u.ptr = key;
|
||||
if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
|
||||
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
|
||||
|
||||
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
|
||||
while (length > 12)
|
||||
{
|
||||
a += k[0];
|
||||
b += k[1];
|
||||
c += k[2];
|
||||
mix(a,b,c);
|
||||
length -= 12;
|
||||
k += 3;
|
||||
}
|
||||
|
||||
/*----------------------------- handle the last (probably partial) block */
|
||||
/*
|
||||
* "k[2]&0xffffff" actually reads beyond the end of the string, but
|
||||
* then masks off the part it's not allowed to read. Because the
|
||||
* string is aligned, the masked-off tail is in the same word as the
|
||||
* rest of the string. Every machine with memory protection I've seen
|
||||
* does it on word boundaries, so is OK with this. But VALGRIND will
|
||||
* still catch it and complain. The masking trick does make the hash
|
||||
* noticably faster for short strings (like English words).
|
||||
* AddressSanitizer is similarly picky about overrunning
|
||||
* the buffer. (http://clang.llvm.org/docs/AddressSanitizer.html
|
||||
*/
|
||||
#ifdef VALGRIND
|
||||
# define PRECISE_MEMORY_ACCESS 1
|
||||
#elif defined(__SANITIZE_ADDRESS__) /* GCC's ASAN */
|
||||
# define PRECISE_MEMORY_ACCESS 1
|
||||
#elif defined(__has_feature)
|
||||
# if __has_feature(address_sanitizer) /* Clang's ASAN */
|
||||
# define PRECISE_MEMORY_ACCESS 1
|
||||
# endif
|
||||
#endif
|
||||
#ifndef PRECISE_MEMORY_ACCESS
|
||||
|
||||
switch(length)
|
||||
{
|
||||
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
|
||||
case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break;
|
||||
case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break;
|
||||
case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break;
|
||||
case 8 : b+=k[1]; a+=k[0]; break;
|
||||
case 7 : b+=k[1]&0xffffff; a+=k[0]; break;
|
||||
case 6 : b+=k[1]&0xffff; a+=k[0]; break;
|
||||
case 5 : b+=k[1]&0xff; a+=k[0]; break;
|
||||
case 4 : a+=k[0]; break;
|
||||
case 3 : a+=k[0]&0xffffff; break;
|
||||
case 2 : a+=k[0]&0xffff; break;
|
||||
case 1 : a+=k[0]&0xff; break;
|
||||
case 0 : return c; /* zero length strings require no mixing */
|
||||
}
|
||||
|
||||
#else /* make valgrind happy */
|
||||
|
||||
const uint8_t *k8 = (const uint8_t *)k;
|
||||
switch(length)
|
||||
{
|
||||
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
|
||||
case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
|
||||
case 10: c+=((uint32_t)k8[9])<<8; /* fall through */
|
||||
case 9 : c+=k8[8]; /* fall through */
|
||||
case 8 : b+=k[1]; a+=k[0]; break;
|
||||
case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
|
||||
case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */
|
||||
case 5 : b+=k8[4]; /* fall through */
|
||||
case 4 : a+=k[0]; break;
|
||||
case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
|
||||
case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */
|
||||
case 1 : a+=k8[0]; break;
|
||||
case 0 : return c;
|
||||
}
|
||||
|
||||
#endif /* !valgrind */
|
||||
|
||||
} else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
|
||||
const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */
|
||||
const uint8_t *k8;
|
||||
|
||||
/*--------------- all but last block: aligned reads and different mixing */
|
||||
while (length > 12)
|
||||
{
|
||||
a += k[0] + (((uint32_t)k[1])<<16);
|
||||
b += k[2] + (((uint32_t)k[3])<<16);
|
||||
c += k[4] + (((uint32_t)k[5])<<16);
|
||||
mix(a,b,c);
|
||||
length -= 12;
|
||||
k += 6;
|
||||
}
|
||||
|
||||
/*----------------------------- handle the last (probably partial) block */
|
||||
k8 = (const uint8_t *)k;
|
||||
switch(length)
|
||||
{
|
||||
case 12: c+=k[4]+(((uint32_t)k[5])<<16);
|
||||
b+=k[2]+(((uint32_t)k[3])<<16);
|
||||
a+=k[0]+(((uint32_t)k[1])<<16);
|
||||
break;
|
||||
case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
|
||||
case 10: c+=k[4];
|
||||
b+=k[2]+(((uint32_t)k[3])<<16);
|
||||
a+=k[0]+(((uint32_t)k[1])<<16);
|
||||
break;
|
||||
case 9 : c+=k8[8]; /* fall through */
|
||||
case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
|
||||
a+=k[0]+(((uint32_t)k[1])<<16);
|
||||
break;
|
||||
case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
|
||||
case 6 : b+=k[2];
|
||||
a+=k[0]+(((uint32_t)k[1])<<16);
|
||||
break;
|
||||
case 5 : b+=k8[4]; /* fall through */
|
||||
case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
|
||||
break;
|
||||
case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
|
||||
case 2 : a+=k[0];
|
||||
break;
|
||||
case 1 : a+=k8[0];
|
||||
break;
|
||||
case 0 : return c; /* zero length requires no mixing */
|
||||
}
|
||||
|
||||
} else { /* need to read the key one byte at a time */
|
||||
const uint8_t *k = (const uint8_t *)key;
|
||||
|
||||
/*--------------- all but the last block: affect some 32 bits of (a,b,c) */
|
||||
while (length > 12)
|
||||
{
|
||||
a += k[0];
|
||||
a += ((uint32_t)k[1])<<8;
|
||||
a += ((uint32_t)k[2])<<16;
|
||||
a += ((uint32_t)k[3])<<24;
|
||||
b += k[4];
|
||||
b += ((uint32_t)k[5])<<8;
|
||||
b += ((uint32_t)k[6])<<16;
|
||||
b += ((uint32_t)k[7])<<24;
|
||||
c += k[8];
|
||||
c += ((uint32_t)k[9])<<8;
|
||||
c += ((uint32_t)k[10])<<16;
|
||||
c += ((uint32_t)k[11])<<24;
|
||||
mix(a,b,c);
|
||||
length -= 12;
|
||||
k += 12;
|
||||
}
|
||||
|
||||
/*-------------------------------- last block: affect all 32 bits of (c) */
|
||||
switch(length) /* all the case statements fall through */
|
||||
{
|
||||
case 12: c+=((uint32_t)k[11])<<24; /* FALLTHRU */
|
||||
case 11: c+=((uint32_t)k[10])<<16; /* FALLTHRU */
|
||||
case 10: c+=((uint32_t)k[9])<<8; /* FALLTHRU */
|
||||
case 9 : c+=k[8]; /* FALLTHRU */
|
||||
case 8 : b+=((uint32_t)k[7])<<24; /* FALLTHRU */
|
||||
case 7 : b+=((uint32_t)k[6])<<16; /* FALLTHRU */
|
||||
case 6 : b+=((uint32_t)k[5])<<8; /* FALLTHRU */
|
||||
case 5 : b+=k[4]; /* FALLTHRU */
|
||||
case 4 : a+=((uint32_t)k[3])<<24; /* FALLTHRU */
|
||||
case 3 : a+=((uint32_t)k[2])<<16; /* FALLTHRU */
|
||||
case 2 : a+=((uint32_t)k[1])<<8; /* FALLTHRU */
|
||||
case 1 : a+=k[0];
|
||||
break;
|
||||
case 0 : return c;
|
||||
}
|
||||
}
|
||||
|
||||
final(a,b,c);
|
||||
return c;
|
||||
}
|
||||
|
||||
/* a simple hash function similiar to what perl does for strings.
|
||||
* for good results, the string should not be excessivly large.
|
||||
*/
|
||||
static unsigned long lh_perllike_str_hash(const void *k)
|
||||
{
|
||||
const char *rkey = (const char *)k;
|
||||
unsigned hashval = 1;
|
||||
|
||||
while (*rkey)
|
||||
hashval = hashval * 33 + *rkey++;
|
||||
|
||||
return hashval;
|
||||
}
|
||||
|
||||
static unsigned long lh_char_hash(const void *k)
|
||||
{
|
||||
#if defined _MSC_VER || defined __MINGW32__
|
||||
#define RANDOM_SEED_TYPE LONG
|
||||
#else
|
||||
#define RANDOM_SEED_TYPE int
|
||||
#endif
|
||||
static volatile RANDOM_SEED_TYPE random_seed = -1;
|
||||
|
||||
if (random_seed == -1) {
|
||||
RANDOM_SEED_TYPE seed;
|
||||
/* we can't use -1 as it is the unitialized sentinel */
|
||||
while ((seed = json_c_get_random_seed()) == -1);
|
||||
#if SIZEOF_INT == 8 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
#define USE_SYNC_COMPARE_AND_SWAP 1
|
||||
#endif
|
||||
#if SIZEOF_INT == 4 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
||||
#define USE_SYNC_COMPARE_AND_SWAP 1
|
||||
#endif
|
||||
#if SIZEOF_INT == 2 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
|
||||
#define USE_SYNC_COMPARE_AND_SWAP 1
|
||||
#endif
|
||||
#if defined USE_SYNC_COMPARE_AND_SWAP
|
||||
(void)__sync_val_compare_and_swap(&random_seed, -1, seed);
|
||||
#elif defined _MSC_VER || defined __MINGW32__
|
||||
InterlockedCompareExchange(&random_seed, seed, -1);
|
||||
#else
|
||||
//#warning "racy random seed initializtion if used by multiple threads"
|
||||
random_seed = seed; /* potentially racy */
|
||||
#endif
|
||||
}
|
||||
|
||||
return hashlittle((const char*)k, strlen((const char*)k), random_seed);
|
||||
}
|
||||
|
||||
int lh_char_equal(const void *k1, const void *k2)
|
||||
{
|
||||
return (strcmp((const char*)k1, (const char*)k2) == 0);
|
||||
}
|
||||
|
||||
struct lh_table* lh_table_new(int size,
|
||||
lh_entry_free_fn *free_fn,
|
||||
lh_hash_fn *hash_fn,
|
||||
lh_equal_fn *equal_fn)
|
||||
{
|
||||
int i;
|
||||
struct lh_table *t;
|
||||
|
||||
t = (struct lh_table*)calloc(1, sizeof(struct lh_table));
|
||||
if (!t)
|
||||
return NULL;
|
||||
|
||||
t->count = 0;
|
||||
t->size = size;
|
||||
t->table = (struct lh_entry*)calloc(size, sizeof(struct lh_entry));
|
||||
if (!t->table)
|
||||
{
|
||||
free(t);
|
||||
return NULL;
|
||||
}
|
||||
t->free_fn = free_fn;
|
||||
t->hash_fn = hash_fn;
|
||||
t->equal_fn = equal_fn;
|
||||
for(i = 0; i < size; i++) t->table[i].k = LH_EMPTY;
|
||||
return t;
|
||||
}
|
||||
|
||||
struct lh_table* lh_kchar_table_new(int size,
|
||||
lh_entry_free_fn *free_fn)
|
||||
{
|
||||
return lh_table_new(size, free_fn, char_hash_fn, lh_char_equal);
|
||||
}
|
||||
|
||||
struct lh_table* lh_kptr_table_new(int size,
|
||||
lh_entry_free_fn *free_fn)
|
||||
{
|
||||
return lh_table_new(size, free_fn, lh_ptr_hash, lh_ptr_equal);
|
||||
}
|
||||
|
||||
int lh_table_resize(struct lh_table *t, int new_size)
|
||||
{
|
||||
struct lh_table *new_t;
|
||||
struct lh_entry *ent;
|
||||
|
||||
new_t = lh_table_new(new_size, NULL, t->hash_fn, t->equal_fn);
|
||||
if (new_t == NULL)
|
||||
return -1;
|
||||
|
||||
for (ent = t->head; ent != NULL; ent = ent->next)
|
||||
{
|
||||
unsigned long h = lh_get_hash(new_t, ent->k);
|
||||
unsigned int opts = 0;
|
||||
if (ent->k_is_constant)
|
||||
opts = JSON_C_OBJECT_KEY_IS_CONSTANT;
|
||||
if (lh_table_insert_w_hash(new_t, ent->k, ent->v, h, opts) != 0)
|
||||
{
|
||||
lh_table_free(new_t);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
free(t->table);
|
||||
t->table = new_t->table;
|
||||
t->size = new_size;
|
||||
t->head = new_t->head;
|
||||
t->tail = new_t->tail;
|
||||
free(new_t);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void lh_table_free(struct lh_table *t)
|
||||
{
|
||||
struct lh_entry *c;
|
||||
if(t->free_fn) {
|
||||
for(c = t->head; c != NULL; c = c->next)
|
||||
t->free_fn(c);
|
||||
}
|
||||
free(t->table);
|
||||
free(t);
|
||||
}
|
||||
|
||||
|
||||
int lh_table_insert_w_hash(struct lh_table *t, const void *k, const void *v, const unsigned long h, const unsigned opts)
|
||||
{
|
||||
unsigned long n;
|
||||
|
||||
if (t->count >= t->size * LH_LOAD_FACTOR)
|
||||
if (lh_table_resize(t, t->size * 2) != 0)
|
||||
return -1;
|
||||
|
||||
n = h % t->size;
|
||||
|
||||
while( 1 ) {
|
||||
if(t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED) break;
|
||||
if ((int)++n == t->size) n = 0;
|
||||
}
|
||||
|
||||
t->table[n].k = k;
|
||||
t->table[n].k_is_constant = (opts & JSON_C_OBJECT_KEY_IS_CONSTANT);
|
||||
t->table[n].v = v;
|
||||
t->count++;
|
||||
|
||||
if(t->head == NULL) {
|
||||
t->head = t->tail = &t->table[n];
|
||||
t->table[n].next = t->table[n].prev = NULL;
|
||||
} else {
|
||||
t->tail->next = &t->table[n];
|
||||
t->table[n].prev = t->tail;
|
||||
t->table[n].next = NULL;
|
||||
t->tail = &t->table[n];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
int lh_table_insert(struct lh_table *t, const void *k, const void *v)
|
||||
{
|
||||
return lh_table_insert_w_hash(t, k, v, lh_get_hash(t, k), 0);
|
||||
}
|
||||
|
||||
|
||||
struct lh_entry* lh_table_lookup_entry_w_hash(struct lh_table *t, const void *k, const unsigned long h)
|
||||
{
|
||||
unsigned long n = h % t->size;
|
||||
int count = 0;
|
||||
|
||||
while( count < t->size ) {
|
||||
if(t->table[n].k == LH_EMPTY) return NULL;
|
||||
if(t->table[n].k != LH_FREED &&
|
||||
t->equal_fn(t->table[n].k, k)) return &t->table[n];
|
||||
if ((int)++n == t->size) n = 0;
|
||||
count++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct lh_entry* lh_table_lookup_entry(struct lh_table *t, const void *k)
|
||||
{
|
||||
return lh_table_lookup_entry_w_hash(t, k, lh_get_hash(t, k));
|
||||
}
|
||||
|
||||
json_bool lh_table_lookup_ex(struct lh_table* t, const void* k, void **v)
|
||||
{
|
||||
struct lh_entry *e = lh_table_lookup_entry(t, k);
|
||||
if (e != NULL) {
|
||||
if (v != NULL) *v = lh_entry_v(e);
|
||||
return 1; /* key found */
|
||||
}
|
||||
if (v != NULL) *v = NULL;
|
||||
return 0; /* key not found */
|
||||
}
|
||||
|
||||
int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e)
|
||||
{
|
||||
ptrdiff_t n = (ptrdiff_t)(e - t->table); /* CAW: fixed to be 64bit nice, still need the crazy negative case... */
|
||||
|
||||
/* CAW: this is bad, really bad, maybe stack goes other direction on this machine... */
|
||||
if(n < 0) { return -2; }
|
||||
|
||||
if(t->table[n].k == LH_EMPTY || t->table[n].k == LH_FREED) return -1;
|
||||
t->count--;
|
||||
if(t->free_fn) t->free_fn(e);
|
||||
t->table[n].v = NULL;
|
||||
t->table[n].k = LH_FREED;
|
||||
if(t->tail == &t->table[n] && t->head == &t->table[n]) {
|
||||
t->head = t->tail = NULL;
|
||||
} else if (t->head == &t->table[n]) {
|
||||
t->head->next->prev = NULL;
|
||||
t->head = t->head->next;
|
||||
} else if (t->tail == &t->table[n]) {
|
||||
t->tail->prev->next = NULL;
|
||||
t->tail = t->tail->prev;
|
||||
} else {
|
||||
t->table[n].prev->next = t->table[n].next;
|
||||
t->table[n].next->prev = t->table[n].prev;
|
||||
}
|
||||
t->table[n].next = t->table[n].prev = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int lh_table_delete(struct lh_table *t, const void *k)
|
||||
{
|
||||
struct lh_entry *e = lh_table_lookup_entry(t, k);
|
||||
if(!e) return -1;
|
||||
return lh_table_delete_entry(t, e);
|
||||
}
|
||||
|
||||
int lh_table_length(struct lh_table *t)
|
||||
{
|
||||
return t->count;
|
||||
}
|
||||
@@ -1,381 +0,0 @@
|
||||
/*
|
||||
* $Id: linkhash.h,v 1.6 2006/01/30 23:07:57 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
* Copyright (c) 2009 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Internal methods for working with json_type_object objects. Although
|
||||
* this is exposed by the json_object_get_object() function and within the
|
||||
* json_object_iter type, it is not recommended for direct use.
|
||||
*/
|
||||
#ifndef _linkhash_h_
|
||||
#define _linkhash_h_
|
||||
|
||||
#include "json_object.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* golden prime used in hash functions
|
||||
*/
|
||||
#define LH_PRIME 0x9e370001UL
|
||||
|
||||
/**
|
||||
* The fraction of filled hash buckets until an insert will cause the table
|
||||
* to be resized.
|
||||
* This can range from just above 0 up to 1.0.
|
||||
*/
|
||||
#define LH_LOAD_FACTOR 0.66
|
||||
|
||||
/**
|
||||
* sentinel pointer value for empty slots
|
||||
*/
|
||||
#define LH_EMPTY (void*)-1
|
||||
|
||||
/**
|
||||
* sentinel pointer value for freed slots
|
||||
*/
|
||||
#define LH_FREED (void*)-2
|
||||
|
||||
/**
|
||||
* default string hash function
|
||||
*/
|
||||
#define JSON_C_STR_HASH_DFLT 0
|
||||
|
||||
/**
|
||||
* perl-like string hash function
|
||||
*/
|
||||
#define JSON_C_STR_HASH_PERLLIKE 1
|
||||
|
||||
/**
|
||||
* This function sets the hash function to be used for strings.
|
||||
* Must be one of the JSON_C_STR_HASH_* values.
|
||||
* @returns 0 - ok, -1 if parameter was invalid
|
||||
*/
|
||||
int json_global_set_string_hash(const int h);
|
||||
|
||||
struct lh_entry;
|
||||
|
||||
/**
|
||||
* callback function prototypes
|
||||
*/
|
||||
typedef void (lh_entry_free_fn) (struct lh_entry *e);
|
||||
/**
|
||||
* callback function prototypes
|
||||
*/
|
||||
typedef unsigned long (lh_hash_fn) (const void *k);
|
||||
/**
|
||||
* callback function prototypes
|
||||
*/
|
||||
typedef int (lh_equal_fn) (const void *k1, const void *k2);
|
||||
|
||||
/**
|
||||
* An entry in the hash table
|
||||
*/
|
||||
struct lh_entry {
|
||||
/**
|
||||
* The key. Use lh_entry_k() instead of accessing this directly.
|
||||
*/
|
||||
const void *k;
|
||||
/**
|
||||
* A flag for users of linkhash to know whether or not they
|
||||
* need to free k.
|
||||
*/
|
||||
int k_is_constant;
|
||||
/**
|
||||
* The value. Use lh_entry_v() instead of accessing this directly.
|
||||
*/
|
||||
const void *v;
|
||||
/**
|
||||
* The next entry
|
||||
*/
|
||||
struct lh_entry *next;
|
||||
/**
|
||||
* The previous entry.
|
||||
*/
|
||||
struct lh_entry *prev;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The hash table structure.
|
||||
*/
|
||||
struct lh_table {
|
||||
/**
|
||||
* Size of our hash.
|
||||
*/
|
||||
int size;
|
||||
/**
|
||||
* Numbers of entries.
|
||||
*/
|
||||
int count;
|
||||
|
||||
/**
|
||||
* The first entry.
|
||||
*/
|
||||
struct lh_entry *head;
|
||||
|
||||
/**
|
||||
* The last entry.
|
||||
*/
|
||||
struct lh_entry *tail;
|
||||
|
||||
struct lh_entry *table;
|
||||
|
||||
/**
|
||||
* A pointer onto the function responsible for freeing an entry.
|
||||
*/
|
||||
lh_entry_free_fn *free_fn;
|
||||
lh_hash_fn *hash_fn;
|
||||
lh_equal_fn *equal_fn;
|
||||
};
|
||||
typedef struct lh_table lh_table;
|
||||
|
||||
|
||||
/**
|
||||
* Convenience list iterator.
|
||||
*/
|
||||
#define lh_foreach(table, entry) \
|
||||
for(entry = table->head; entry; entry = entry->next)
|
||||
|
||||
/**
|
||||
* lh_foreach_safe allows calling of deletion routine while iterating.
|
||||
*
|
||||
* @param table a struct lh_table * to iterate over
|
||||
* @param entry a struct lh_entry * variable to hold each element
|
||||
* @param tmp a struct lh_entry * variable to hold a temporary pointer to the next element
|
||||
*/
|
||||
#define lh_foreach_safe(table, entry, tmp) \
|
||||
for(entry = table->head; entry && ((tmp = entry->next) || 1); entry = tmp)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a new linkhash table.
|
||||
*
|
||||
* @param size initial table size. The table is automatically resized
|
||||
* although this incurs a performance penalty.
|
||||
* @param free_fn callback function used to free memory for entries
|
||||
* when lh_table_free or lh_table_delete is called.
|
||||
* If NULL is provided, then memory for keys and values
|
||||
* must be freed by the caller.
|
||||
* @param hash_fn function used to hash keys. 2 standard ones are defined:
|
||||
* lh_ptr_hash and lh_char_hash for hashing pointer values
|
||||
* and C strings respectively.
|
||||
* @param equal_fn comparison function to compare keys. 2 standard ones defined:
|
||||
* lh_ptr_hash and lh_char_hash for comparing pointer values
|
||||
* and C strings respectively.
|
||||
* @return On success, a pointer to the new linkhash table is returned.
|
||||
* On error, a null pointer is returned.
|
||||
*/
|
||||
extern struct lh_table* lh_table_new(int size,
|
||||
lh_entry_free_fn *free_fn,
|
||||
lh_hash_fn *hash_fn,
|
||||
lh_equal_fn *equal_fn);
|
||||
|
||||
/**
|
||||
* Convenience function to create a new linkhash table with char keys.
|
||||
*
|
||||
* @param size initial table size.
|
||||
* @param free_fn callback function used to free memory for entries.
|
||||
* @return On success, a pointer to the new linkhash table is returned.
|
||||
* On error, a null pointer is returned.
|
||||
*/
|
||||
extern struct lh_table* lh_kchar_table_new(int size,
|
||||
lh_entry_free_fn *free_fn);
|
||||
|
||||
|
||||
/**
|
||||
* Convenience function to create a new linkhash table with ptr keys.
|
||||
*
|
||||
* @param size initial table size.
|
||||
* @param free_fn callback function used to free memory for entries.
|
||||
* @return On success, a pointer to the new linkhash table is returned.
|
||||
* On error, a null pointer is returned.
|
||||
*/
|
||||
extern struct lh_table* lh_kptr_table_new(int size,
|
||||
lh_entry_free_fn *free_fn);
|
||||
|
||||
|
||||
/**
|
||||
* Free a linkhash table.
|
||||
*
|
||||
* If a lh_entry_free_fn callback free function was provided then it is
|
||||
* called for all entries in the table.
|
||||
*
|
||||
* @param t table to free.
|
||||
*/
|
||||
extern void lh_table_free(struct lh_table *t);
|
||||
|
||||
|
||||
/**
|
||||
* Insert a record into the table.
|
||||
*
|
||||
* @param t the table to insert into.
|
||||
* @param k a pointer to the key to insert.
|
||||
* @param v a pointer to the value to insert.
|
||||
*
|
||||
* @return On success, <code>0</code> is returned.
|
||||
* On error, a negative value is returned.
|
||||
*/
|
||||
extern int lh_table_insert(struct lh_table *t, const void *k, const void *v);
|
||||
|
||||
|
||||
/**
|
||||
* Insert a record into the table using a precalculated key hash.
|
||||
*
|
||||
* The hash h, which should be calculated with lh_get_hash() on k, is provided by
|
||||
* the caller, to allow for optimization when multiple operations with the same
|
||||
* key are known to be needed.
|
||||
*
|
||||
* @param t the table to insert into.
|
||||
* @param k a pointer to the key to insert.
|
||||
* @param v a pointer to the value to insert.
|
||||
* @param h hash value of the key to insert
|
||||
* @param opts if set to JSON_C_OBJECT_KEY_IS_CONSTANT, sets lh_entry.k_is_constant
|
||||
* so t's free function knows to avoid freeing the key.
|
||||
*/
|
||||
extern int lh_table_insert_w_hash(struct lh_table *t, const void *k, const void *v, const unsigned long h, const unsigned opts);
|
||||
|
||||
|
||||
/**
|
||||
* Lookup a record in the table.
|
||||
*
|
||||
* @param t the table to lookup
|
||||
* @param k a pointer to the key to lookup
|
||||
* @return a pointer to the record structure of the value or NULL if it does not exist.
|
||||
*/
|
||||
extern struct lh_entry* lh_table_lookup_entry(struct lh_table *t, const void *k);
|
||||
|
||||
/**
|
||||
* Lookup a record in the table using a precalculated key hash.
|
||||
*
|
||||
* The hash h, which should be calculated with lh_get_hash() on k, is provided by
|
||||
* the caller, to allow for optimization when multiple operations with the same
|
||||
* key are known to be needed.
|
||||
*
|
||||
* @param t the table to lookup
|
||||
* @param k a pointer to the key to lookup
|
||||
* @param h hash value of the key to lookup
|
||||
* @return a pointer to the record structure of the value or NULL if it does not exist.
|
||||
*/
|
||||
extern struct lh_entry* lh_table_lookup_entry_w_hash(struct lh_table *t, const void *k, const unsigned long h);
|
||||
|
||||
/**
|
||||
* Lookup a record in the table.
|
||||
*
|
||||
* @param t the table to lookup
|
||||
* @param k a pointer to the key to lookup
|
||||
* @param v a pointer to a where to store the found value (set to NULL if it doesn't exist).
|
||||
* @return whether or not the key was found
|
||||
*/
|
||||
extern json_bool lh_table_lookup_ex(struct lh_table *t, const void *k, void **v);
|
||||
|
||||
/**
|
||||
* Delete a record from the table.
|
||||
*
|
||||
* If a callback free function is provided then it is called for the
|
||||
* for the item being deleted.
|
||||
* @param t the table to delete from.
|
||||
* @param e a pointer to the entry to delete.
|
||||
* @return 0 if the item was deleted.
|
||||
* @return -1 if it was not found.
|
||||
*/
|
||||
extern int lh_table_delete_entry(struct lh_table *t, struct lh_entry *e);
|
||||
|
||||
|
||||
/**
|
||||
* Delete a record from the table.
|
||||
*
|
||||
* If a callback free function is provided then it is called for the
|
||||
* for the item being deleted.
|
||||
* @param t the table to delete from.
|
||||
* @param k a pointer to the key to delete.
|
||||
* @return 0 if the item was deleted.
|
||||
* @return -1 if it was not found.
|
||||
*/
|
||||
extern int lh_table_delete(struct lh_table *t, const void *k);
|
||||
|
||||
extern int lh_table_length(struct lh_table *t);
|
||||
|
||||
/**
|
||||
* Resizes the specified table.
|
||||
*
|
||||
* @param t Pointer to table to resize.
|
||||
* @param new_size New table size. Must be positive.
|
||||
*
|
||||
* @return On success, <code>0</code> is returned.
|
||||
* On error, a negative value is returned.
|
||||
*/
|
||||
int lh_table_resize(struct lh_table *t, int new_size);
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Don't use this outside of linkhash.h:
|
||||
*/
|
||||
#if !defined(_MSC_VER) || (_MSC_VER > 1800)
|
||||
/* VS2010 can't handle inline funcs, so skip it there */
|
||||
#define _LH_INLINE inline
|
||||
#else
|
||||
#define _LH_INLINE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Calculate the hash of a key for a given table.
|
||||
*
|
||||
* This is an exension to support functions that need to calculate
|
||||
* the hash several times and allows them to do it just once and then pass
|
||||
* in the hash to all utility functions. Depending on use case, this can be a
|
||||
* considerable performance improvement.
|
||||
* @param t the table (used to obtain hash function)
|
||||
* @param k a pointer to the key to lookup
|
||||
* @return the key's hash
|
||||
*/
|
||||
static _LH_INLINE unsigned long lh_get_hash(const struct lh_table *t, const void *k)
|
||||
{
|
||||
return t->hash_fn(k);
|
||||
}
|
||||
|
||||
#undef _LH_INLINE
|
||||
|
||||
/**
|
||||
* @deprecated Don't use this outside of linkhash.h:
|
||||
*/
|
||||
#ifdef __UNCONST
|
||||
#define _LH_UNCONST(a) __UNCONST(a)
|
||||
#else
|
||||
#define _LH_UNCONST(a) ((void *)(uintptr_t)(const void *)(a))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return a non-const version of lh_entry.k.
|
||||
*
|
||||
* lh_entry.k is const to indicate and help ensure that linkhash itself doesn't modify
|
||||
* it, but callers are allowed to do what they want with it.
|
||||
* See also lh_entry.k_is_constant
|
||||
*/
|
||||
#define lh_entry_k(entry) _LH_UNCONST((entry)->k)
|
||||
|
||||
/**
|
||||
* Return a non-const version of lh_entry.v.
|
||||
*
|
||||
* v is const to indicate and help ensure that linkhash itself doesn't modify
|
||||
* it, but callers are allowed to do what they want with it.
|
||||
*/
|
||||
#define lh_entry_v(entry) _LH_UNCONST((entry)->v)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifndef __math_compat_h
|
||||
#define __math_compat_h
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
|
||||
/* Define isnan, isinf, infinity and nan on Windows/MSVC */
|
||||
|
||||
#ifndef HAVE_DECL_ISNAN
|
||||
# ifdef HAVE_DECL__ISNAN
|
||||
#include <float.h>
|
||||
#define isnan(x) _isnan(x)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_ISINF
|
||||
# ifdef HAVE_DECL__FINITE
|
||||
#include <float.h>
|
||||
#define isinf(x) (!_finite(x))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_INFINITY
|
||||
#include <float.h>
|
||||
#define INFINITY (DBL_MAX + DBL_MAX)
|
||||
#define HAVE_DECL_INFINITY
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DECL_NAN
|
||||
#define NAN (INFINITY - INFINITY)
|
||||
#define HAVE_DECL_NAN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,155 +0,0 @@
|
||||
/*
|
||||
* $Id: printbuf.c,v 1.5 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
|
||||
* The copyrights to the contents of this file are licensed under the MIT License
|
||||
* (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
#include "config_json_c.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
# include <stdarg.h>
|
||||
#else /* !HAVE_STDARG_H */
|
||||
# error Not enough var arg support!
|
||||
#endif /* HAVE_STDARG_H */
|
||||
|
||||
#include "debug.h"
|
||||
#include "printbuf.h"
|
||||
#include "snprintf_compat.h"
|
||||
#include "vasprintf_compat.h"
|
||||
|
||||
static int printbuf_extend(struct printbuf *p, int min_size);
|
||||
|
||||
struct printbuf* printbuf_new(void)
|
||||
{
|
||||
struct printbuf *p;
|
||||
|
||||
p = (struct printbuf*)calloc(1, sizeof(struct printbuf));
|
||||
if(!p) return NULL;
|
||||
p->size = 32;
|
||||
p->bpos = 0;
|
||||
if(!(p->buf = (char*)malloc(p->size))) {
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
p->buf[0]= '\0';
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extend the buffer p so it has a size of at least min_size.
|
||||
*
|
||||
* If the current size is large enough, nothing is changed.
|
||||
*
|
||||
* Note: this does not check the available space! The caller
|
||||
* is responsible for performing those calculations.
|
||||
*/
|
||||
static int printbuf_extend(struct printbuf *p, int min_size)
|
||||
{
|
||||
char *t;
|
||||
int new_size;
|
||||
|
||||
if (p->size >= min_size)
|
||||
return 0;
|
||||
|
||||
new_size = p->size * 2;
|
||||
if (new_size < min_size + 8)
|
||||
new_size = min_size + 8;
|
||||
#ifdef PRINTBUF_DEBUG
|
||||
MC_DEBUG("printbuf_memappend: realloc "
|
||||
"bpos=%d min_size=%d old_size=%d new_size=%d\n",
|
||||
p->bpos, min_size, p->size, new_size);
|
||||
#endif /* PRINTBUF_DEBUG */
|
||||
if(!(t = (char*)realloc(p->buf, new_size)))
|
||||
return -1;
|
||||
p->size = new_size;
|
||||
p->buf = t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int printbuf_memappend(struct printbuf *p, const char *buf, int size)
|
||||
{
|
||||
if (p->size <= p->bpos + size + 1) {
|
||||
if (printbuf_extend(p, p->bpos + size + 1) < 0)
|
||||
return -1;
|
||||
}
|
||||
memcpy(p->buf + p->bpos, buf, size);
|
||||
p->bpos += size;
|
||||
p->buf[p->bpos]= '\0';
|
||||
return size;
|
||||
}
|
||||
|
||||
int printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len)
|
||||
{
|
||||
int size_needed;
|
||||
|
||||
if (offset == -1)
|
||||
offset = pb->bpos;
|
||||
size_needed = offset + len;
|
||||
if (pb->size < size_needed)
|
||||
{
|
||||
if (printbuf_extend(pb, size_needed) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(pb->buf + offset, charvalue, len);
|
||||
if (pb->bpos < size_needed)
|
||||
pb->bpos = size_needed;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sprintbuf(struct printbuf *p, const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *t;
|
||||
int size;
|
||||
char buf[128];
|
||||
|
||||
/* user stack buffer first */
|
||||
va_start(ap, msg);
|
||||
size = vsnprintf(buf, 128, msg, ap);
|
||||
va_end(ap);
|
||||
/* if string is greater than stack buffer, then use dynamic string
|
||||
with vasprintf. Note: some implementation of vsnprintf return -1
|
||||
if output is truncated whereas some return the number of bytes that
|
||||
would have been written - this code handles both cases. */
|
||||
if(size == -1 || size > 127) {
|
||||
va_start(ap, msg);
|
||||
if((size = vasprintf(&t, msg, ap)) < 0) { va_end(ap); return -1; }
|
||||
va_end(ap);
|
||||
printbuf_memappend(p, t, size);
|
||||
free(t);
|
||||
return size;
|
||||
} else {
|
||||
printbuf_memappend(p, buf, size);
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
void printbuf_reset(struct printbuf *p)
|
||||
{
|
||||
p->buf[0] = '\0';
|
||||
p->bpos = 0;
|
||||
}
|
||||
|
||||
void printbuf_free(struct printbuf *p)
|
||||
{
|
||||
if(p) {
|
||||
free(p->buf);
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* $Id: printbuf.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
|
||||
*
|
||||
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2008-2009 Yahoo! Inc. All rights reserved.
|
||||
* The copyrights to the contents of this file are licensed under the MIT License
|
||||
* (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Internal string buffer handing. Unless you're writing a
|
||||
* json_object_to_json_string_fn implementation for use with
|
||||
* json_object_set_serializer() direct use of this is not
|
||||
* recommended.
|
||||
*/
|
||||
#ifndef _printbuf_h_
|
||||
#define _printbuf_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct printbuf {
|
||||
char *buf;
|
||||
int bpos;
|
||||
int size;
|
||||
};
|
||||
typedef struct printbuf printbuf;
|
||||
|
||||
extern struct printbuf*
|
||||
printbuf_new(void);
|
||||
|
||||
/* As an optimization, printbuf_memappend_fast() is defined as a macro
|
||||
* that handles copying data if the buffer is large enough; otherwise
|
||||
* it invokes printbuf_memappend() which performs the heavy
|
||||
* lifting of realloc()ing the buffer and copying data.
|
||||
*
|
||||
* Your code should not use printbuf_memappend() directly unless it
|
||||
* checks the return code. Use printbuf_memappend_fast() instead.
|
||||
*/
|
||||
extern int
|
||||
printbuf_memappend(struct printbuf *p, const char *buf, int size);
|
||||
|
||||
#define printbuf_memappend_fast(p, bufptr, bufsize) \
|
||||
do { \
|
||||
if ((p->size - p->bpos) > bufsize) { \
|
||||
memcpy(p->buf + p->bpos, (bufptr), bufsize); \
|
||||
p->bpos += bufsize; \
|
||||
p->buf[p->bpos]= '\0'; \
|
||||
} else { printbuf_memappend(p, (bufptr), bufsize); } \
|
||||
} while (0)
|
||||
|
||||
#define printbuf_length(p) ((p)->bpos)
|
||||
|
||||
/**
|
||||
* Results in a compile error if the argument is not a string literal.
|
||||
*/
|
||||
#define _printbuf_check_literal(mystr) ("" mystr)
|
||||
|
||||
/**
|
||||
* This is an optimization wrapper around printbuf_memappend() that is useful
|
||||
* for appending string literals. Since the size of string constants is known
|
||||
* at compile time, using this macro can avoid a costly strlen() call. This is
|
||||
* especially helpful when a constant string must be appended many times. If
|
||||
* you got here because of a compilation error caused by passing something
|
||||
* other than a string literal, use printbuf_memappend_fast() in conjunction
|
||||
* with strlen().
|
||||
*
|
||||
* See also:
|
||||
* printbuf_memappend_fast()
|
||||
* printbuf_memappend()
|
||||
* sprintbuf()
|
||||
*/
|
||||
#define printbuf_strappend(pb, str) \
|
||||
printbuf_memappend ((pb), _printbuf_check_literal(str), sizeof(str) - 1)
|
||||
|
||||
/**
|
||||
* Set len bytes of the buffer to charvalue, starting at offset offset.
|
||||
* Similar to calling memset(x, charvalue, len);
|
||||
*
|
||||
* The memory allocated for the buffer is extended as necessary.
|
||||
*
|
||||
* If offset is -1, this starts at the end of the current data in the buffer.
|
||||
*/
|
||||
extern int
|
||||
printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len);
|
||||
|
||||
/**
|
||||
* Formatted print to printbuf.
|
||||
*
|
||||
* This function is the most expensive of the available functions for appending
|
||||
* string data to a printbuf and should be used only where convenience is more
|
||||
* important than speed. Avoid using this function in high performance code or
|
||||
* tight loops; in these scenarios, consider using snprintf() with a static
|
||||
* buffer in conjunction with one of the printbuf_*append() functions.
|
||||
*
|
||||
* See also:
|
||||
* printbuf_memappend_fast()
|
||||
* printbuf_memappend()
|
||||
* printbuf_strappend()
|
||||
*/
|
||||
extern int
|
||||
sprintbuf(struct printbuf *p, const char *msg, ...);
|
||||
|
||||
extern void
|
||||
printbuf_reset(struct printbuf *p);
|
||||
|
||||
extern void
|
||||
printbuf_free(struct printbuf *p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,238 +0,0 @@
|
||||
/*
|
||||
* random_seed.c
|
||||
*
|
||||
* Copyright (c) 2013 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "strerror_override.h"
|
||||
#include <stdio.h>
|
||||
#include "config_json_c.h"
|
||||
#include "random_seed.h"
|
||||
|
||||
#define DEBUG_SEED(s)
|
||||
|
||||
|
||||
#if defined ENABLE_RDRAND
|
||||
|
||||
/* cpuid */
|
||||
|
||||
#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
|
||||
#define HAS_X86_CPUID 1
|
||||
|
||||
static void do_cpuid(int regs[], int h)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
#if defined __x86_64__
|
||||
"pushq %%rbx;\n"
|
||||
#else
|
||||
"pushl %%ebx;\n"
|
||||
#endif
|
||||
"cpuid;\n"
|
||||
#if defined __x86_64__
|
||||
"popq %%rbx;\n"
|
||||
#else
|
||||
"popl %%ebx;\n"
|
||||
#endif
|
||||
: "=a"(regs[0]), [ebx] "=r"(regs[1]), "=c"(regs[2]), "=d"(regs[3])
|
||||
: "a"(h));
|
||||
}
|
||||
|
||||
#elif defined _MSC_VER
|
||||
|
||||
#define HAS_X86_CPUID 1
|
||||
#define do_cpuid __cpuid
|
||||
|
||||
#endif
|
||||
|
||||
/* has_rdrand */
|
||||
|
||||
#if HAS_X86_CPUID
|
||||
|
||||
static int has_rdrand()
|
||||
{
|
||||
// CPUID.01H:ECX.RDRAND[bit 30] == 1
|
||||
int regs[4];
|
||||
do_cpuid(regs, 1);
|
||||
return (regs[2] & (1 << 30)) != 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* get_rdrand_seed - GCC x86 and X64 */
|
||||
|
||||
#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
|
||||
|
||||
#define HAVE_RDRAND 1
|
||||
|
||||
static int get_rdrand_seed()
|
||||
{
|
||||
DEBUG_SEED("get_rdrand_seed");
|
||||
int _eax;
|
||||
// rdrand eax
|
||||
__asm__ __volatile__("1: .byte 0x0F\n"
|
||||
" .byte 0xC7\n"
|
||||
" .byte 0xF0\n"
|
||||
" jnc 1b;\n"
|
||||
: "=a" (_eax));
|
||||
return _eax;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined _MSC_VER
|
||||
|
||||
#if _MSC_VER >= 1700
|
||||
#define HAVE_RDRAND 1
|
||||
|
||||
/* get_rdrand_seed - Visual Studio 2012 and above */
|
||||
|
||||
static int get_rdrand_seed()
|
||||
{
|
||||
DEBUG_SEED("get_rdrand_seed");
|
||||
int r;
|
||||
while (_rdrand32_step(&r) == 0);
|
||||
return r;
|
||||
}
|
||||
|
||||
#elif defined _M_IX86
|
||||
#define HAVE_RDRAND 1
|
||||
|
||||
/* get_rdrand_seed - Visual Studio 2010 and below - x86 only */
|
||||
|
||||
static int get_rdrand_seed()
|
||||
{
|
||||
DEBUG_SEED("get_rdrand_seed");
|
||||
int _eax;
|
||||
retry:
|
||||
// rdrand eax
|
||||
__asm _emit 0x0F __asm _emit 0xC7 __asm _emit 0xF0
|
||||
__asm jnc retry
|
||||
__asm mov _eax, eax
|
||||
return _eax;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* defined ENABLE_RDRAND */
|
||||
|
||||
|
||||
/* has_dev_urandom */
|
||||
|
||||
#if defined (__APPLE__) || defined(__unix__) || defined(__linux__)
|
||||
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define HAVE_DEV_RANDOM 1
|
||||
|
||||
static const char *dev_random_file = "/dev/urandom";
|
||||
|
||||
static int has_dev_urandom()
|
||||
{
|
||||
struct stat buf;
|
||||
if (stat(dev_random_file, &buf)) {
|
||||
return 0;
|
||||
}
|
||||
return ((buf.st_mode & S_IFCHR) != 0);
|
||||
}
|
||||
|
||||
|
||||
/* get_dev_random_seed */
|
||||
|
||||
static int get_dev_random_seed()
|
||||
{
|
||||
DEBUG_SEED("get_dev_random_seed");
|
||||
|
||||
int fd = open(dev_random_file, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "error opening %s: %s", dev_random_file, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int r;
|
||||
ssize_t nread = read(fd, &r, sizeof(r));
|
||||
if (nread != sizeof(r)) {
|
||||
fprintf(stderr, "error short read %s: %s", dev_random_file, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* get_cryptgenrandom_seed */
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#define HAVE_CRYPTGENRANDOM 1
|
||||
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
#ifndef __GNUC__
|
||||
#pragma comment(lib, "advapi32.lib")
|
||||
#endif
|
||||
|
||||
static int get_cryptgenrandom_seed()
|
||||
{
|
||||
HCRYPTPROV hProvider = 0;
|
||||
int r;
|
||||
|
||||
DEBUG_SEED("get_cryptgenrandom_seed");
|
||||
|
||||
if (!CryptAcquireContextW(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
|
||||
fprintf(stderr, "error CryptAcquireContextW");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!CryptGenRandom(hProvider, sizeof(r), (BYTE*)&r)) {
|
||||
fprintf(stderr, "error CryptGenRandom");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
CryptReleaseContext(hProvider, 0);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* get_time_seed */
|
||||
|
||||
#include <time.h>
|
||||
|
||||
static int get_time_seed()
|
||||
{
|
||||
DEBUG_SEED("get_time_seed");
|
||||
|
||||
return (int)time(NULL) * 433494437;
|
||||
}
|
||||
|
||||
|
||||
/* json_c_get_random_seed */
|
||||
|
||||
int json_c_get_random_seed()
|
||||
{
|
||||
#if HAVE_RDRAND
|
||||
if (has_rdrand()) return get_rdrand_seed();
|
||||
#endif
|
||||
#if HAVE_DEV_RANDOM
|
||||
if (has_dev_urandom()) return get_dev_random_seed();
|
||||
#endif
|
||||
#if HAVE_CRYPTGENRANDOM
|
||||
return get_cryptgenrandom_seed();
|
||||
#endif
|
||||
return get_time_seed();
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* random_seed.h
|
||||
*
|
||||
* Copyright (c) 2013 Metaparadigm Pte. Ltd.
|
||||
* Michael Clark <michael@metaparadigm.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See COPYING for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
#ifndef seed_h
|
||||
#define seed_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int json_c_get_random_seed();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,41 +0,0 @@
|
||||
#ifndef __snprintf_compat_h
|
||||
#define __snprintf_compat_h
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Microsoft's _vsnprintf and _snprint don't always terminate
|
||||
* the string, so use wrappers that ensure that.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(HAVE_SNPRINTF) && defined(_MSC_VER)
|
||||
static int json_c_vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
{
|
||||
int ret;
|
||||
ret = _vsnprintf(str, size, format, ap);
|
||||
str[size - 1] = '\0';
|
||||
return ret;
|
||||
}
|
||||
#define vsnprintf json_c_vsnprintf
|
||||
|
||||
static int json_c_snprintf(char *str, size_t size, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
va_start(ap, format);
|
||||
ret = json_c_vsnprintf(str, size, format, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
#define snprintf json_c_snprintf
|
||||
|
||||
#elif !defined(HAVE_SNPRINTF) /* !HAVE_SNPRINTF */
|
||||
# error Need vsnprintf!
|
||||
#endif /* !HAVE_SNPRINTF && defined(WIN32) */
|
||||
|
||||
#endif /* __snprintf_compat_h */
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef __strdup_compat_h
|
||||
#define __strdup_compat_h
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
|
||||
#if !defined(HAVE_STRDUP) && defined(_MSC_VER)
|
||||
/* MSC has the version as _strdup */
|
||||
# define strdup _strdup
|
||||
#elif !defined(HAVE_STRDUP)
|
||||
# error You do not have strdup on your system.
|
||||
#endif /* HAVE_STRDUP */
|
||||
|
||||
#endif
|
||||
@@ -1,101 +0,0 @@
|
||||
#define STRERROR_OVERRIDE_IMPL 1
|
||||
#include "strerror_override.h"
|
||||
|
||||
/*
|
||||
* Override strerror() to get consistent output across platforms.
|
||||
*/
|
||||
|
||||
static struct {
|
||||
int errno_value;
|
||||
const char *errno_str;
|
||||
} errno_list[] = {
|
||||
#define STRINGIFY(x) #x
|
||||
#define ENTRY(x) {x, &STRINGIFY(undef_ ## x)[6]}
|
||||
ENTRY(EPERM),
|
||||
ENTRY(ENOENT),
|
||||
ENTRY(ESRCH),
|
||||
ENTRY(EINTR),
|
||||
ENTRY(EIO),
|
||||
ENTRY(ENXIO),
|
||||
ENTRY(E2BIG),
|
||||
ENTRY(ENOEXEC),
|
||||
ENTRY(EBADF),
|
||||
ENTRY(ECHILD),
|
||||
ENTRY(EDEADLK),
|
||||
ENTRY(ENOMEM),
|
||||
ENTRY(EACCES),
|
||||
ENTRY(EFAULT),
|
||||
#ifdef ENOTBLK
|
||||
ENTRY(ENOTBLK),
|
||||
#endif
|
||||
ENTRY(EBUSY),
|
||||
ENTRY(EEXIST),
|
||||
ENTRY(EXDEV),
|
||||
ENTRY(ENODEV),
|
||||
ENTRY(ENOTDIR),
|
||||
ENTRY(EISDIR),
|
||||
ENTRY(EINVAL),
|
||||
ENTRY(ENFILE),
|
||||
ENTRY(EMFILE),
|
||||
ENTRY(ENOTTY),
|
||||
#ifdef ETXTBSY
|
||||
ENTRY(ETXTBSY),
|
||||
#endif
|
||||
ENTRY(EFBIG),
|
||||
ENTRY(ENOSPC),
|
||||
ENTRY(ESPIPE),
|
||||
ENTRY(EROFS),
|
||||
ENTRY(EMLINK),
|
||||
ENTRY(EPIPE),
|
||||
ENTRY(EDOM),
|
||||
ENTRY(ERANGE),
|
||||
ENTRY(EAGAIN),
|
||||
{ 0, (char *)0 }
|
||||
};
|
||||
|
||||
// Enabled during tests
|
||||
int _json_c_strerror_enable = 0;
|
||||
|
||||
#define PREFIX "ERRNO="
|
||||
static char errno_buf[128] = PREFIX;
|
||||
char *_json_c_strerror(int errno_in)
|
||||
{
|
||||
int start_idx;
|
||||
char digbuf[20];
|
||||
int ii, jj;
|
||||
|
||||
if (!_json_c_strerror_enable)
|
||||
return strerror(errno_in);
|
||||
|
||||
// Avoid standard functions, so we don't need to include any
|
||||
// headers, or guess at signatures.
|
||||
|
||||
for (ii = 0; errno_list[ii].errno_str != (char *)0; ii++)
|
||||
{
|
||||
const char *errno_str = errno_list[ii].errno_str;
|
||||
if (errno_list[ii].errno_value != errno_in)
|
||||
continue;
|
||||
|
||||
for (start_idx = sizeof(PREFIX) - 1, jj = 0; errno_str[jj] != '\0'; jj++, start_idx++)
|
||||
{
|
||||
errno_buf[start_idx] = errno_str[jj];
|
||||
}
|
||||
errno_buf[start_idx] = '\0';
|
||||
return errno_buf;
|
||||
}
|
||||
|
||||
// It's not one of the known errno values, return the numeric value.
|
||||
for (ii = 0; errno_in > 10; errno_in /= 10, ii++)
|
||||
{
|
||||
digbuf[ii] = "0123456789"[(errno_in % 10)];
|
||||
}
|
||||
digbuf[ii] = "0123456789"[(errno_in % 10)];
|
||||
|
||||
// Reverse the digits
|
||||
for (start_idx = sizeof(PREFIX) - 1 ; ii >= 0; ii--, start_idx++)
|
||||
{
|
||||
errno_buf[start_idx] = digbuf[ii];
|
||||
}
|
||||
return errno_buf;
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#ifndef _json_strerror_override_h_
|
||||
#define _json_strerror_override_h_
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
|
||||
#include "config_json_c.h"
|
||||
#include <errno.h>
|
||||
|
||||
#include "json_object.h" /* for JSON_EXPORT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
JSON_EXPORT char *_json_c_strerror(int errno_in);
|
||||
|
||||
#ifndef STRERROR_OVERRIDE_IMPL
|
||||
#define strerror _json_c_strerror
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _json_strerror_override_h_ */
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef __json_strerror_override_private_h__
|
||||
#define __json_strerror_override_private_h__
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
|
||||
/* Used by tests to get consistent output */
|
||||
extern int _json_c_strerror_enable;
|
||||
|
||||
#endif
|
||||
@@ -1,46 +0,0 @@
|
||||
#ifndef __vasprintf_compat_h
|
||||
#define __vasprintf_compat_h
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
||||
*/
|
||||
|
||||
#include "snprintf_compat.h"
|
||||
|
||||
#if !defined(HAVE_VASPRINTF)
|
||||
/* CAW: compliant version of vasprintf */
|
||||
static int vasprintf(char **buf, const char *fmt, va_list ap)
|
||||
{
|
||||
#ifndef WIN32
|
||||
static char _T_emptybuffer = '\0';
|
||||
#endif /* !defined(WIN32) */
|
||||
int chars;
|
||||
char *b;
|
||||
|
||||
if(!buf) { return -1; }
|
||||
|
||||
#ifdef WIN32
|
||||
chars = _vscprintf(fmt, ap)+1;
|
||||
#else /* !defined(WIN32) */
|
||||
/* CAW: RAWR! We have to hope to god here that vsnprintf doesn't overwrite
|
||||
our buffer like on some 64bit sun systems.... but hey, its time to move on */
|
||||
chars = vsnprintf(&_T_emptybuffer, 0, fmt, ap)+1;
|
||||
if(chars < 0) { chars *= -1; } /* CAW: old glibc versions have this problem */
|
||||
#endif /* defined(WIN32) */
|
||||
|
||||
b = (char*)malloc(sizeof(char)*chars);
|
||||
if(!b) { return -1; }
|
||||
|
||||
if((chars = vsprintf(b, fmt, ap)) < 0)
|
||||
{
|
||||
free(b);
|
||||
} else {
|
||||
*buf = b;
|
||||
}
|
||||
|
||||
return chars;
|
||||
}
|
||||
#endif /* !HAVE_VASPRINTF */
|
||||
|
||||
#endif /* __vasprintf_compat_h */
|
||||
5827
proxy_c/third-lib/libcurl/CHANGES
Normal file
5827
proxy_c/third-lib/libcurl/CHANGES
Normal file
File diff suppressed because it is too large
Load Diff
2
proxy_c/third-lib/libcurl/CMake/CMakeConfigurableFile.in
Normal file
2
proxy_c/third-lib/libcurl/CMake/CMakeConfigurableFile.in
Normal file
@@ -0,0 +1,2 @@
|
||||
@CMAKE_CONFIGURABLE_FILE_CONTENT@
|
||||
|
||||
61
proxy_c/third-lib/libcurl/CMake/CurlSymbolHiding.cmake
Normal file
61
proxy_c/third-lib/libcurl/CMake/CurlSymbolHiding.cmake
Normal file
@@ -0,0 +1,61 @@
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
option(CURL_HIDDEN_SYMBOLS "Set to ON to hide libcurl internal symbols (=hide all symbols that aren't officially external)." ON)
|
||||
mark_as_advanced(CURL_HIDDEN_SYMBOLS)
|
||||
|
||||
if(CURL_HIDDEN_SYMBOLS)
|
||||
set(SUPPORTS_SYMBOL_HIDING FALSE)
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(SUPPORTS_SYMBOL_HIDING TRUE)
|
||||
set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))")
|
||||
set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCC)
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 2.8.10)
|
||||
set(GCC_VERSION ${CMAKE_C_COMPILER_VERSION})
|
||||
else()
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
||||
OUTPUT_VARIABLE GCC_VERSION)
|
||||
endif()
|
||||
if(NOT GCC_VERSION VERSION_LESS 3.4)
|
||||
# note: this is considered buggy prior to 4.0 but the autotools don't care, so let's ignore that fact
|
||||
set(SUPPORTS_SYMBOL_HIDING TRUE)
|
||||
set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))")
|
||||
set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
|
||||
endif()
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0)
|
||||
set(SUPPORTS_SYMBOL_HIDING TRUE)
|
||||
set(_SYMBOL_EXTERN "__global")
|
||||
set(_CFLAG_SYMBOLS_HIDE "-xldscope=hidden")
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
# note: this should probably just check for version 9.1.045 but I'm not 100% sure
|
||||
# so let's to it the same way autotools do.
|
||||
set(SUPPORTS_SYMBOL_HIDING TRUE)
|
||||
set(_SYMBOL_EXTERN "__attribute__ ((__visibility__ (\"default\")))")
|
||||
set(_CFLAG_SYMBOLS_HIDE "-fvisibility=hidden")
|
||||
check_c_source_compiles("#include <stdio.h>
|
||||
int main (void) { printf(\"icc fvisibility bug test\"); return 0; }" _no_bug)
|
||||
if(NOT _no_bug)
|
||||
set(SUPPORTS_SYMBOL_HIDING FALSE)
|
||||
set(_SYMBOL_EXTERN "")
|
||||
set(_CFLAG_SYMBOLS_HIDE "")
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
set(SUPPORTS_SYMBOL_HIDING TRUE)
|
||||
endif()
|
||||
|
||||
set(HIDES_CURL_PRIVATE_SYMBOLS ${SUPPORTS_SYMBOL_HIDING})
|
||||
elseif(MSVC)
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.7)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) #present since 3.4.3 but broken
|
||||
set(HIDES_CURL_PRIVATE_SYMBOLS FALSE)
|
||||
else()
|
||||
message(WARNING "Hiding private symbols regardless CURL_HIDDEN_SYMBOLS being disabled.")
|
||||
set(HIDES_CURL_PRIVATE_SYMBOLS TRUE)
|
||||
endif()
|
||||
elseif()
|
||||
set(HIDES_CURL_PRIVATE_SYMBOLS FALSE)
|
||||
endif()
|
||||
|
||||
set(CURL_CFLAG_SYMBOLS_HIDE ${_CFLAG_SYMBOLS_HIDE})
|
||||
set(CURL_EXTERN_SYMBOL ${_SYMBOL_EXTERN})
|
||||
535
proxy_c/third-lib/libcurl/CMake/CurlTests.c
Normal file
535
proxy_c/third-lib/libcurl/CMake/CurlTests.c
Normal file
@@ -0,0 +1,535 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2014, 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.haxx.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 TIME_WITH_SYS_TIME
|
||||
/* Time with sys/time test */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if ((struct tm *) 0)
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_O_NONBLOCK
|
||||
|
||||
/* headers for FCNTL_O_NONBLOCK test */
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
/* */
|
||||
#if defined(sun) || defined(__sun__) || \
|
||||
defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
# if defined(__SVR4) || defined(__srv4__)
|
||||
# define PLATFORM_SOLARIS
|
||||
# else
|
||||
# define PLATFORM_SUNOS4
|
||||
# endif
|
||||
#endif
|
||||
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
|
||||
# define PLATFORM_AIX_V3
|
||||
#endif
|
||||
/* */
|
||||
#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
|
||||
#error "O_NONBLOCK does not work on this platform"
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
/* O_NONBLOCK source test */
|
||||
int flags = 0;
|
||||
if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* tests for gethostbyaddr_r or gethostbyname_r */
|
||||
#if defined(HAVE_GETHOSTBYADDR_R_5_REENTRANT) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_7_REENTRANT) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_8_REENTRANT) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
|
||||
# define _REENTRANT
|
||||
/* no idea whether _REENTRANT is always set, just invent a new flag */
|
||||
# define TEST_GETHOSTBYFOO_REENTRANT
|
||||
#endif
|
||||
#if defined(HAVE_GETHOSTBYADDR_R_5) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_7) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_8) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_3) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_5) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_6) || \
|
||||
defined(TEST_GETHOSTBYFOO_REENTRANT)
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
int main(void)
|
||||
{
|
||||
char *address = "example.com";
|
||||
int length = 0;
|
||||
int type = 0;
|
||||
struct hostent h;
|
||||
int rc = 0;
|
||||
#if defined(HAVE_GETHOSTBYADDR_R_5) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_5_REENTRANT) || \
|
||||
\
|
||||
defined(HAVE_GETHOSTBYNAME_R_3) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT)
|
||||
struct hostent_data hdata;
|
||||
#elif defined(HAVE_GETHOSTBYADDR_R_7) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_7_REENTRANT) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_8) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_8_REENTRANT) || \
|
||||
\
|
||||
defined(HAVE_GETHOSTBYNAME_R_5) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_6) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
|
||||
char buffer[8192];
|
||||
int h_errnop;
|
||||
struct hostent *hp;
|
||||
#endif
|
||||
|
||||
#ifndef gethostbyaddr_r
|
||||
(void)gethostbyaddr_r;
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GETHOSTBYADDR_R_5) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_5_REENTRANT)
|
||||
rc = gethostbyaddr_r(address, length, type, &h, &hdata);
|
||||
#elif defined(HAVE_GETHOSTBYADDR_R_7) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_7_REENTRANT)
|
||||
hp = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &h_errnop);
|
||||
(void)hp;
|
||||
#elif defined(HAVE_GETHOSTBYADDR_R_8) || \
|
||||
defined(HAVE_GETHOSTBYADDR_R_8_REENTRANT)
|
||||
rc = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &hp, &h_errnop);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GETHOSTBYNAME_R_3) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_3_REENTRANT)
|
||||
rc = gethostbyname_r(address, &h, &hdata);
|
||||
#elif defined(HAVE_GETHOSTBYNAME_R_5) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_5_REENTRANT)
|
||||
rc = gethostbyname_r(address, &h, buffer, 8192, &h_errnop);
|
||||
(void)hp; /* not used for test */
|
||||
#elif defined(HAVE_GETHOSTBYNAME_R_6) || \
|
||||
defined(HAVE_GETHOSTBYNAME_R_6_REENTRANT)
|
||||
rc = gethostbyname_r(address, &h, buffer, 8192, &hp, &h_errnop);
|
||||
#endif
|
||||
|
||||
(void)length;
|
||||
(void)type;
|
||||
(void)rc;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SOCKLEN_T
|
||||
#ifdef _WIN32
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if ((socklen_t *) 0)
|
||||
return 0;
|
||||
if (sizeof (socklen_t))
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_IN_ADDR_T
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if ((in_addr_t *) 0)
|
||||
return 0;
|
||||
if (sizeof (in_addr_t))
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BOOL_T
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDBOOL_H
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if (sizeof (bool *) )
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <float.h>
|
||||
int main() { return 0; }
|
||||
#endif
|
||||
#ifdef RETSIGTYPE_TEST
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#ifdef signal
|
||||
# undef signal
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" void (*signal (int, void (*)(int)))(int);
|
||||
#else
|
||||
void (*signal ()) ();
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_INET_NTOA_R_DECL
|
||||
#include <arpa/inet.h>
|
||||
|
||||
typedef void (*func_type)();
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef inet_ntoa_r
|
||||
func_type func;
|
||||
func = (func_type)inet_ntoa_r;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_INET_NTOA_R_DECL_REENTRANT
|
||||
#define _REENTRANT
|
||||
#include <arpa/inet.h>
|
||||
|
||||
typedef void (*func_type)();
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef inet_ntoa_r
|
||||
func_type func;
|
||||
func = (func_type)&inet_ntoa_r;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
int main(void) {
|
||||
struct addrinfo hints, *ai;
|
||||
int error;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
#ifndef getaddrinfo
|
||||
(void)getaddrinfo;
|
||||
#endif
|
||||
error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
|
||||
if (error) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_FILE_OFFSET_BITS
|
||||
#ifdef _FILE_OFFSET_BITS
|
||||
#undef _FILE_OFFSET_BITS
|
||||
#endif
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#include <sys/types.h>
|
||||
/* Check that off_t can represent 2**63 - 1 correctly.
|
||||
We can't simply define LARGE_OFF_T to be 9223372036854775807,
|
||||
since some C++ compilers masquerading as C compilers
|
||||
incorrectly reject 9223372036854775807. */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
|
||||
&& LARGE_OFF_T % 2147483647 == 1)
|
||||
? 1 : -1];
|
||||
int main () { ; return 0; }
|
||||
#endif
|
||||
#ifdef HAVE_IOCTLSOCKET
|
||||
/* includes start */
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# else
|
||||
# ifdef HAVE_WINSOCK_H
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
/* ioctlsocket source code */
|
||||
int socket;
|
||||
unsigned long flags = ioctlsocket(socket, FIONBIO, &flags);
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef HAVE_IOCTLSOCKET_CAMEL
|
||||
/* includes start */
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# else
|
||||
# ifdef HAVE_WINSOCK_H
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
/* IoctlSocket source code */
|
||||
if(0 != IoctlSocket(0, 0, 0))
|
||||
return 1;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_IOCTLSOCKET_CAMEL_FIONBIO
|
||||
/* includes start */
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# else
|
||||
# ifdef HAVE_WINSOCK_H
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
/* IoctlSocket source code */
|
||||
long flags = 0;
|
||||
if(0 != ioctlsocket(0, FIONBIO, &flags))
|
||||
return 1;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_IOCTLSOCKET_FIONBIO
|
||||
/* includes start */
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# else
|
||||
# ifdef HAVE_WINSOCK_H
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
int flags = 0;
|
||||
if(0 != ioctlsocket(0, FIONBIO, &flags))
|
||||
return 1;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_IOCTL_FIONBIO
|
||||
/* headers for FIONBIO test */
|
||||
/* includes start */
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef HAVE_STROPTS_H
|
||||
# include <stropts.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
int flags = 0;
|
||||
if(0 != ioctl(0, FIONBIO, &flags))
|
||||
return 1;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_IOCTL_SIOCGIFADDR
|
||||
/* headers for FIONBIO test */
|
||||
/* includes start */
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#ifdef HAVE_STROPTS_H
|
||||
# include <stropts.h>
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
struct ifreq ifr;
|
||||
if(0 != ioctl(0, SIOCGIFADDR, &ifr))
|
||||
return 1;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SETSOCKOPT_SO_NONBLOCK
|
||||
/* includes start */
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <windows.h>
|
||||
# ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
# else
|
||||
# ifdef HAVE_WINSOCK_H
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
/* includes start */
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
/* includes end */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0))
|
||||
return 1;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_GLIBC_STRERROR_R
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
int
|
||||
main () {
|
||||
char buffer[1024]; /* big enough to play with */
|
||||
char *string =
|
||||
strerror_r(EACCES, buffer, sizeof(buffer));
|
||||
/* this should've returned a string */
|
||||
if(!string || !string[0])
|
||||
return 99;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_POSIX_STRERROR_R
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
int
|
||||
main () {
|
||||
char buffer[1024]; /* big enough to play with */
|
||||
int error =
|
||||
strerror_r(EACCES, buffer, sizeof(buffer));
|
||||
/* This should've returned zero, and written an error string in the
|
||||
buffer.*/
|
||||
if(!buffer[0] || error)
|
||||
return 99;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
42
proxy_c/third-lib/libcurl/CMake/FindCARES.cmake
Normal file
42
proxy_c/third-lib/libcurl/CMake/FindCARES.cmake
Normal file
@@ -0,0 +1,42 @@
|
||||
# - Find c-ares
|
||||
# Find the c-ares includes and library
|
||||
# This module defines
|
||||
# CARES_INCLUDE_DIR, where to find ares.h, etc.
|
||||
# CARES_LIBRARIES, the libraries needed to use c-ares.
|
||||
# CARES_FOUND, If false, do not try to use c-ares.
|
||||
# also defined, but not for general use are
|
||||
# CARES_LIBRARY, where to find the c-ares library.
|
||||
|
||||
FIND_PATH(CARES_INCLUDE_DIR ares.h
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
)
|
||||
|
||||
SET(CARES_NAMES ${CARES_NAMES} cares)
|
||||
FIND_LIBRARY(CARES_LIBRARY
|
||||
NAMES ${CARES_NAMES}
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
)
|
||||
|
||||
IF (CARES_LIBRARY AND CARES_INCLUDE_DIR)
|
||||
SET(CARES_LIBRARIES ${CARES_LIBRARY})
|
||||
SET(CARES_FOUND "YES")
|
||||
ELSE (CARES_LIBRARY AND CARES_INCLUDE_DIR)
|
||||
SET(CARES_FOUND "NO")
|
||||
ENDIF (CARES_LIBRARY AND CARES_INCLUDE_DIR)
|
||||
|
||||
|
||||
IF (CARES_FOUND)
|
||||
IF (NOT CARES_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found c-ares: ${CARES_LIBRARIES}")
|
||||
ENDIF (NOT CARES_FIND_QUIETLY)
|
||||
ELSE (CARES_FOUND)
|
||||
IF (CARES_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find c-ares library")
|
||||
ENDIF (CARES_FIND_REQUIRED)
|
||||
ENDIF (CARES_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
CARES_LIBRARY
|
||||
CARES_INCLUDE_DIR
|
||||
)
|
||||
289
proxy_c/third-lib/libcurl/CMake/FindGSS.cmake
Normal file
289
proxy_c/third-lib/libcurl/CMake/FindGSS.cmake
Normal file
@@ -0,0 +1,289 @@
|
||||
# - Try to find the GSS Kerberos library
|
||||
# Once done this will define
|
||||
#
|
||||
# GSS_ROOT_DIR - Set this variable to the root installation of GSS
|
||||
#
|
||||
# Read-Only variables:
|
||||
# GSS_FOUND - system has the Heimdal library
|
||||
# GSS_FLAVOUR - "MIT" or "Heimdal" if anything found.
|
||||
# GSS_INCLUDE_DIR - the Heimdal include directory
|
||||
# GSS_LIBRARIES - The libraries needed to use GSS
|
||||
# GSS_LINK_DIRECTORIES - Directories to add to linker search path
|
||||
# GSS_LINKER_FLAGS - Additional linker flags
|
||||
# GSS_COMPILER_FLAGS - Additional compiler flags
|
||||
# GSS_VERSION - This is set to version advertised by pkg-config or read from manifest.
|
||||
# In case the library is found but no version info availabe it'll be set to "unknown"
|
||||
|
||||
set(_MIT_MODNAME mit-krb5-gssapi)
|
||||
set(_HEIMDAL_MODNAME heimdal-gssapi)
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckTypeSize)
|
||||
|
||||
set(_GSS_ROOT_HINTS
|
||||
"${GSS_ROOT_DIR}"
|
||||
"$ENV{GSS_ROOT_DIR}"
|
||||
)
|
||||
|
||||
# try to find library using system pkg-config if user didn't specify root dir
|
||||
if(NOT GSS_ROOT_DIR AND NOT "$ENV{GSS_ROOT_DIR}")
|
||||
if(UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_search_module(_GSS_PKG ${_MIT_MODNAME} ${_HEIMDAL_MODNAME})
|
||||
list(APPEND _GSS_ROOT_HINTS "${_GSS_PKG_PREFIX}")
|
||||
elseif(WIN32)
|
||||
list(APPEND _GSS_ROOT_HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MIT\\Kerberos;InstallDir]")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT _GSS_FOUND) #not found by pkg-config. Let's take more traditional approach.
|
||||
find_file(_GSS_CONFIGURE_SCRIPT
|
||||
NAMES
|
||||
"krb5-config"
|
||||
HINTS
|
||||
${_GSS_ROOT_HINTS}
|
||||
PATH_SUFFIXES
|
||||
bin
|
||||
NO_CMAKE_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
)
|
||||
|
||||
# if not found in user-supplied directories, maybe system knows better
|
||||
find_file(_GSS_CONFIGURE_SCRIPT
|
||||
NAMES
|
||||
"krb5-config"
|
||||
PATH_SUFFIXES
|
||||
bin
|
||||
)
|
||||
|
||||
if(_GSS_CONFIGURE_SCRIPT)
|
||||
execute_process(
|
||||
COMMAND ${_GSS_CONFIGURE_SCRIPT} "--cflags" "gssapi"
|
||||
OUTPUT_VARIABLE _GSS_CFLAGS
|
||||
RESULT_VARIABLE _GSS_CONFIGURE_FAILED
|
||||
)
|
||||
message(STATUS "CFLAGS: ${_GSS_CFLAGS}")
|
||||
if(NOT _GSS_CONFIGURE_FAILED) # 0 means success
|
||||
# should also work in an odd case when multiple directories are given
|
||||
string(STRIP "${_GSS_CFLAGS}" _GSS_CFLAGS)
|
||||
string(REGEX REPLACE " +-I" ";" _GSS_CFLAGS "${_GSS_CFLAGS}")
|
||||
string(REGEX REPLACE " +-([^I][^ \\t;]*)" ";-\\1"_GSS_CFLAGS "${_GSS_CFLAGS}")
|
||||
|
||||
foreach(_flag ${_GSS_CFLAGS})
|
||||
if(_flag MATCHES "^-I.*")
|
||||
string(REGEX REPLACE "^-I" "" _val "${_flag}")
|
||||
list(APPEND _GSS_INCLUDE_DIR "${_val}")
|
||||
else()
|
||||
list(APPEND _GSS_COMPILER_FLAGS "${_flag}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${_GSS_CONFIGURE_SCRIPT} "--libs" "gssapi"
|
||||
OUTPUT_VARIABLE _GSS_LIB_FLAGS
|
||||
RESULT_VARIABLE _GSS_CONFIGURE_FAILED
|
||||
)
|
||||
message(STATUS "LDFLAGS: ${_GSS_LIB_FLAGS}")
|
||||
if(NOT _GSS_CONFIGURE_FAILED) # 0 means success
|
||||
# this script gives us libraries and link directories. Blah. We have to deal with it.
|
||||
string(STRIP "${_GSS_LIB_FLAGS}" _GSS_LIB_FLAGS)
|
||||
string(REGEX REPLACE " +-(L|l)" ";-\\1" _GSS_LIB_FLAGS "${_GSS_LIB_FLAGS}")
|
||||
string(REGEX REPLACE " +-([^Ll][^ \\t;]*)" ";-\\1"_GSS_LIB_FLAGS "${_GSS_LIB_FLAGS}")
|
||||
|
||||
foreach(_flag ${_GSS_LIB_FLAGS})
|
||||
if(_flag MATCHES "^-l.*")
|
||||
string(REGEX REPLACE "^-l" "" _val "${_flag}")
|
||||
list(APPEND _GSS_LIBRARIES "${_val}")
|
||||
elseif(_flag MATCHES "^-L.*")
|
||||
string(REGEX REPLACE "^-L" "" _val "${_flag}")
|
||||
list(APPEND _GSS_LINK_DIRECTORIES "${_val}")
|
||||
else()
|
||||
list(APPEND _GSS_LINKER_FLAGS "${_flag}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
execute_process(
|
||||
COMMAND ${_GSS_CONFIGURE_SCRIPT} "--version"
|
||||
OUTPUT_VARIABLE _GSS_VERSION
|
||||
RESULT_VARIABLE _GSS_CONFIGURE_FAILED
|
||||
)
|
||||
|
||||
# older versions may not have the "--version" parameter. In this case we just don't care.
|
||||
if(_GSS_CONFIGURE_FAILED)
|
||||
set(_GSS_VERSION 0)
|
||||
endif()
|
||||
|
||||
|
||||
execute_process(
|
||||
COMMAND ${_GSS_CONFIGURE_SCRIPT} "--vendor"
|
||||
OUTPUT_VARIABLE _GSS_VENDOR
|
||||
RESULT_VARIABLE _GSS_CONFIGURE_FAILED
|
||||
)
|
||||
|
||||
# older versions may not have the "--vendor" parameter. In this case we just don't care.
|
||||
if(_GSS_CONFIGURE_FAILED)
|
||||
set(GSS_FLAVOUR "Heimdal") # most probably, shouldn't really matter
|
||||
else()
|
||||
if(_GSS_VENDOR MATCHES ".*H|heimdal.*")
|
||||
set(GSS_FLAVOUR "Heimdal")
|
||||
else()
|
||||
set(GSS_FLAVOUR "MIT")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else() # either there is no config script or we are on platform that doesn't provide one (Windows?)
|
||||
|
||||
find_path(_GSS_INCLUDE_DIR
|
||||
NAMES
|
||||
"gssapi/gssapi.h"
|
||||
HINTS
|
||||
${_GSS_ROOT_HINTS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
inc
|
||||
)
|
||||
|
||||
if(_GSS_INCLUDE_DIR) #jay, we've found something
|
||||
set(CMAKE_REQUIRED_INCLUDES "${_GSS_INCLUDE_DIR}")
|
||||
check_include_files( "gssapi/gssapi_generic.h;gssapi/gssapi_krb5.h" _GSS_HAVE_MIT_HEADERS)
|
||||
|
||||
if(_GSS_HAVE_MIT_HEADERS)
|
||||
set(GSS_FLAVOUR "MIT")
|
||||
else()
|
||||
# prevent compiling the header - just check if we can include it
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D__ROKEN_H__")
|
||||
check_include_file( "roken.h" _GSS_HAVE_ROKEN_H)
|
||||
|
||||
check_include_file( "heimdal/roken.h" _GSS_HAVE_HEIMDAL_ROKEN_H)
|
||||
if(_GSS_HAVE_ROKEN_H OR _GSS_HAVE_HEIMDAL_ROKEN_H)
|
||||
set(GSS_FLAVOUR "Heimdal")
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "")
|
||||
endif()
|
||||
else()
|
||||
# I'm not convienced if this is the right way but this is what autotools do at the moment
|
||||
find_path(_GSS_INCLUDE_DIR
|
||||
NAMES
|
||||
"gssapi.h"
|
||||
HINTS
|
||||
${_GSS_ROOT_HINTS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
inc
|
||||
)
|
||||
|
||||
if(_GSS_INCLUDE_DIR)
|
||||
set(GSS_FLAVOUR "Heimdal")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# if we have headers, check if we can link libraries
|
||||
if(GSS_FLAVOUR)
|
||||
set(_GSS_LIBDIR_SUFFIXES "")
|
||||
set(_GSS_LIBDIR_HINTS ${_GSS_ROOT_HINTS})
|
||||
get_filename_component(_GSS_CALCULATED_POTENTIAL_ROOT "${_GSS_INCLUDE_DIR}" PATH)
|
||||
list(APPEND _GSS_LIBDIR_HINTS ${_GSS_CALCULATED_POTENTIAL_ROOT})
|
||||
|
||||
if(WIN32)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
list(APPEND _GSS_LIBDIR_SUFFIXES "lib/AMD64")
|
||||
if(GSS_FLAVOUR STREQUAL "MIT")
|
||||
set(_GSS_LIBNAME "gssapi64")
|
||||
else()
|
||||
set(_GSS_LIBNAME "libgssapi")
|
||||
endif()
|
||||
else()
|
||||
list(APPEND _GSS_LIBDIR_SUFFIXES "lib/i386")
|
||||
if(GSS_FLAVOUR STREQUAL "MIT")
|
||||
set(_GSS_LIBNAME "gssapi32")
|
||||
else()
|
||||
set(_GSS_LIBNAME "libgssapi")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
list(APPEND _GSS_LIBDIR_SUFFIXES "lib;lib64") # those suffixes are not checked for HINTS
|
||||
if(GSS_FLAVOUR STREQUAL "MIT")
|
||||
set(_GSS_LIBNAME "gssapi_krb5")
|
||||
else()
|
||||
set(_GSS_LIBNAME "gssapi")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_library(_GSS_LIBRARIES
|
||||
NAMES
|
||||
${_GSS_LIBNAME}
|
||||
HINTS
|
||||
${_GSS_LIBDIR_HINTS}
|
||||
PATH_SUFFIXES
|
||||
${_GSS_LIBDIR_SUFFIXES}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
endif()
|
||||
else()
|
||||
if(_GSS_PKG_${_MIT_MODNAME}_VERSION)
|
||||
set(GSS_FLAVOUR "MIT")
|
||||
set(_GSS_VERSION _GSS_PKG_${_MIT_MODNAME}_VERSION)
|
||||
else()
|
||||
set(GSS_FLAVOUR "Heimdal")
|
||||
set(_GSS_VERSION _GSS_PKG_${_MIT_HEIMDAL}_VERSION)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(GSS_INCLUDE_DIR ${_GSS_INCLUDE_DIR})
|
||||
set(GSS_LIBRARIES ${_GSS_LIBRARIES})
|
||||
set(GSS_LINK_DIRECTORIES ${_GSS_LINK_DIRECTORIES})
|
||||
set(GSS_LINKER_FLAGS ${_GSS_LINKER_FLAGS})
|
||||
set(GSS_COMPILER_FLAGS ${_GSS_COMPILER_FLAGS})
|
||||
set(GSS_VERSION ${_GSS_VERSION})
|
||||
|
||||
if(GSS_FLAVOUR)
|
||||
|
||||
if(NOT GSS_VERSION AND GSS_FLAVOUR STREQUAL "Heimdal")
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(HEIMDAL_MANIFEST_FILE "Heimdal.Application.amd64.manifest")
|
||||
else()
|
||||
set(HEIMDAL_MANIFEST_FILE "Heimdal.Application.x86.manifest")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${GSS_INCLUDE_DIR}/${HEIMDAL_MANIFEST_FILE}")
|
||||
file(STRINGS "${GSS_INCLUDE_DIR}/${HEIMDAL_MANIFEST_FILE}" heimdal_version_str
|
||||
REGEX "^.*version=\"[0-9]\\.[^\"]+\".*$")
|
||||
|
||||
string(REGEX MATCH "[0-9]\\.[^\"]+"
|
||||
GSS_VERSION "${heimdal_version_str}")
|
||||
endif()
|
||||
|
||||
if(NOT GSS_VERSION)
|
||||
set(GSS_VERSION "Heimdal Unknown")
|
||||
endif()
|
||||
elseif(NOT GSS_VERSION AND GSS_FLAVOUR STREQUAL "MIT")
|
||||
get_filename_component(_MIT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MIT\\Kerberos\\SDK\\CurrentVersion;VersionString]" NAME CACHE)
|
||||
if(WIN32 AND _MIT_VERSION)
|
||||
set(GSS_VERSION "${_MIT_VERSION}")
|
||||
else()
|
||||
set(GSS_VERSION "MIT Unknown")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
set(_GSS_REQUIRED_VARS GSS_LIBRARIES GSS_FLAVOUR)
|
||||
|
||||
find_package_handle_standard_args(GSS
|
||||
REQUIRED_VARS
|
||||
${_GSS_REQUIRED_VARS}
|
||||
VERSION_VAR
|
||||
GSS_VERSION
|
||||
FAIL_MESSAGE
|
||||
"Could NOT find GSS, try to set the path to GSS root folder in the system variable GSS_ROOT_DIR"
|
||||
)
|
||||
|
||||
mark_as_advanced(GSS_INCLUDE_DIR GSS_LIBRARIES)
|
||||
35
proxy_c/third-lib/libcurl/CMake/FindLibSSH2.cmake
Normal file
35
proxy_c/third-lib/libcurl/CMake/FindLibSSH2.cmake
Normal file
@@ -0,0 +1,35 @@
|
||||
# - Try to find the libssh2 library
|
||||
# Once done this will define
|
||||
#
|
||||
# LIBSSH2_FOUND - system has the libssh2 library
|
||||
# LIBSSH2_INCLUDE_DIR - the libssh2 include directory
|
||||
# LIBSSH2_LIBRARY - the libssh2 library name
|
||||
|
||||
if (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
|
||||
set(LibSSH2_FIND_QUIETLY TRUE)
|
||||
endif (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
|
||||
|
||||
FIND_PATH(LIBSSH2_INCLUDE_DIR libssh2.h
|
||||
)
|
||||
|
||||
FIND_LIBRARY(LIBSSH2_LIBRARY NAMES ssh2
|
||||
)
|
||||
|
||||
if(LIBSSH2_INCLUDE_DIR)
|
||||
file(STRINGS "${LIBSSH2_INCLUDE_DIR}/libssh2.h" libssh2_version_str REGEX "^#define[\t ]+LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*")
|
||||
|
||||
string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_MAJOR "${libssh2_version_str}")
|
||||
string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9]([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_MINOR "${libssh2_version_str}")
|
||||
string(REGEX REPLACE "^.*LIBSSH2_VERSION_NUM[\t ]+0x[0-9][0-9][0-9][0-9]([0-9][0-9]).*$" "\\1" LIBSSH2_VERSION_PATCH "${libssh2_version_str}")
|
||||
|
||||
string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_MAJOR "${LIBSSH2_VERSION_MAJOR}")
|
||||
string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_MINOR "${LIBSSH2_VERSION_MINOR}")
|
||||
string(REGEX REPLACE "^0(.+)" "\\1" LIBSSH2_VERSION_PATCH "${LIBSSH2_VERSION_PATCH}")
|
||||
|
||||
set(LIBSSH2_VERSION "${LIBSSH2_VERSION_MAJOR}.${LIBSSH2_VERSION_MINOR}.${LIBSSH2_VERSION_PATCH}")
|
||||
endif(LIBSSH2_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibSSH2 DEFAULT_MSG LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY )
|
||||
|
||||
MARK_AS_ADVANCED(LIBSSH2_INCLUDE_DIR LIBSSH2_LIBRARY LIBSSH2_VERSION_MAJOR LIBSSH2_VERSION_MINOR LIBSSH2_VERSION_PATCH LIBSSH2_VERSION)
|
||||
18
proxy_c/third-lib/libcurl/CMake/FindNGHTTP2.cmake
Normal file
18
proxy_c/third-lib/libcurl/CMake/FindNGHTTP2.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path(NGHTTP2_INCLUDE_DIR "nghttp2/nghttp2.h")
|
||||
|
||||
find_library(NGHTTP2_LIBRARY NAMES nghttp2)
|
||||
|
||||
find_package_handle_standard_args(NGHTTP2
|
||||
FOUND_VAR
|
||||
NGHTTP2_FOUND
|
||||
REQUIRED_VARS
|
||||
NGHTTP2_LIBRARY
|
||||
NGHTTP2_INCLUDE_DIR
|
||||
FAIL_MESSAGE
|
||||
"Could NOT find NGHTTP2"
|
||||
)
|
||||
|
||||
set(NGHTTP2_INCLUDE_DIRS ${NGHTTP2_INCLUDE_DIR} )
|
||||
set(NGHTTP2_LIBRARIES ${NGHTTP2_LIBRARY})
|
||||
95
proxy_c/third-lib/libcurl/CMake/Macros.cmake
Normal file
95
proxy_c/third-lib/libcurl/CMake/Macros.cmake
Normal file
@@ -0,0 +1,95 @@
|
||||
#File defines convenience macros for available feature testing
|
||||
|
||||
# This macro checks if the symbol exists in the library and if it
|
||||
# does, it prepends library to the list. It is intended to be called
|
||||
# multiple times with a sequence of possibly dependent libraries in
|
||||
# order of least-to-most-dependent. Some libraries depend on others
|
||||
# to link correctly.
|
||||
macro(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE)
|
||||
check_library_exists("${LIBRARY};${CURL_LIBS}" ${SYMBOL} "${CMAKE_LIBRARY_PATH}"
|
||||
${VARIABLE})
|
||||
if(${VARIABLE})
|
||||
set(CURL_LIBS ${LIBRARY} ${CURL_LIBS})
|
||||
endif(${VARIABLE})
|
||||
endmacro(CHECK_LIBRARY_EXISTS_CONCAT)
|
||||
|
||||
# Check if header file exists and add it to the list.
|
||||
# This macro is intended to be called multiple times with a sequence of
|
||||
# possibly dependent header files. Some headers depend on others to be
|
||||
# compiled correctly.
|
||||
macro(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
|
||||
check_include_files("${CURL_INCLUDES};${FILE}" ${VARIABLE})
|
||||
if(${VARIABLE})
|
||||
set(CURL_INCLUDES ${CURL_INCLUDES} ${FILE})
|
||||
set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${VARIABLE}")
|
||||
endif(${VARIABLE})
|
||||
endmacro(CHECK_INCLUDE_FILE_CONCAT)
|
||||
|
||||
# For other curl specific tests, use this macro.
|
||||
macro(CURL_INTERNAL_TEST CURL_TEST)
|
||||
if(NOT DEFINED "${CURL_TEST}")
|
||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||
"-D${CURL_TEST} ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS}")
|
||||
if(CMAKE_REQUIRED_LIBRARIES)
|
||||
set(CURL_TEST_ADD_LIBRARIES
|
||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||
endif(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
message(STATUS "Performing Curl Test ${CURL_TEST}")
|
||||
try_compile(${CURL_TEST}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
||||
"${CURL_TEST_ADD_LIBRARIES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
if(${CURL_TEST})
|
||||
set(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}")
|
||||
message(STATUS "Performing Curl Test ${CURL_TEST} - Success")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Performing Curl Test ${CURL_TEST} passed with the following output:\n"
|
||||
"${OUTPUT}\n")
|
||||
else(${CURL_TEST})
|
||||
message(STATUS "Performing Curl Test ${CURL_TEST} - Failed")
|
||||
set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Performing Curl Test ${CURL_TEST} failed with the following output:\n"
|
||||
"${OUTPUT}\n")
|
||||
endif(${CURL_TEST})
|
||||
endif()
|
||||
endmacro(CURL_INTERNAL_TEST)
|
||||
|
||||
macro(CURL_INTERNAL_TEST_RUN CURL_TEST)
|
||||
if(NOT DEFINED "${CURL_TEST}_COMPILE")
|
||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||
"-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}")
|
||||
if(CMAKE_REQUIRED_LIBRARIES)
|
||||
set(CURL_TEST_ADD_LIBRARIES
|
||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||
endif(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
message(STATUS "Performing Curl Test ${CURL_TEST}")
|
||||
try_run(${CURL_TEST} ${CURL_TEST}_COMPILE
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
||||
"${CURL_TEST_ADD_LIBRARIES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
if(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST})
|
||||
set(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}")
|
||||
message(STATUS "Performing Curl Test ${CURL_TEST} - Success")
|
||||
else(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST})
|
||||
message(STATUS "Performing Curl Test ${CURL_TEST} - Failed")
|
||||
set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}")
|
||||
file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
|
||||
"Performing Curl Test ${CURL_TEST} failed with the following output:\n"
|
||||
"${OUTPUT}")
|
||||
if(${CURL_TEST}_COMPILE)
|
||||
file(APPEND
|
||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
|
||||
"There was a problem running this test\n")
|
||||
endif(${CURL_TEST}_COMPILE)
|
||||
file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
|
||||
"\n\n")
|
||||
endif(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST})
|
||||
endif()
|
||||
endmacro(CURL_INTERNAL_TEST_RUN)
|
||||
232
proxy_c/third-lib/libcurl/CMake/OtherTests.cmake
Normal file
232
proxy_c/third-lib/libcurl/CMake/OtherTests.cmake
Normal file
@@ -0,0 +1,232 @@
|
||||
include(CheckCSourceCompiles)
|
||||
# The begin of the sources (macros and includes)
|
||||
set(_source_epilogue "#undef inline")
|
||||
|
||||
macro(add_header_include check header)
|
||||
if(${check})
|
||||
set(_source_epilogue "${_source_epilogue}\n#include <${header}>")
|
||||
endif(${check})
|
||||
endmacro(add_header_include)
|
||||
|
||||
set(signature_call_conv)
|
||||
if(HAVE_WINDOWS_H)
|
||||
add_header_include(HAVE_WINSOCK2_H "winsock2.h")
|
||||
add_header_include(HAVE_WINDOWS_H "windows.h")
|
||||
add_header_include(HAVE_WINSOCK_H "winsock.h")
|
||||
set(_source_epilogue
|
||||
"${_source_epilogue}\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif")
|
||||
set(signature_call_conv "PASCAL")
|
||||
if(HAVE_LIBWS2_32)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ws2_32)
|
||||
endif()
|
||||
else(HAVE_WINDOWS_H)
|
||||
add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
|
||||
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
|
||||
endif(HAVE_WINDOWS_H)
|
||||
|
||||
check_c_source_compiles("${_source_epilogue}
|
||||
int main(void) {
|
||||
recv(0, 0, 0, 0);
|
||||
return 0;
|
||||
}" curl_cv_recv)
|
||||
if(curl_cv_recv)
|
||||
if(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
|
||||
foreach(recv_retv "int" "ssize_t" )
|
||||
foreach(recv_arg1 "int" "ssize_t" "SOCKET")
|
||||
foreach(recv_arg2 "void *" "char *")
|
||||
foreach(recv_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
||||
foreach(recv_arg4 "int" "unsigned int")
|
||||
if(NOT curl_cv_func_recv_done)
|
||||
unset(curl_cv_func_recv_test CACHE)
|
||||
check_c_source_compiles("
|
||||
${_source_epilogue}
|
||||
extern ${recv_retv} ${signature_call_conv}
|
||||
recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4});
|
||||
int main(void) {
|
||||
${recv_arg1} s=0;
|
||||
${recv_arg2} buf=0;
|
||||
${recv_arg3} len=0;
|
||||
${recv_arg4} flags=0;
|
||||
${recv_retv} res = recv(s, buf, len, flags);
|
||||
(void) res;
|
||||
return 0;
|
||||
}"
|
||||
curl_cv_func_recv_test)
|
||||
message(STATUS
|
||||
"Tested: ${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})")
|
||||
if(curl_cv_func_recv_test)
|
||||
set(curl_cv_func_recv_args
|
||||
"${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}")
|
||||
set(RECV_TYPE_ARG1 "${recv_arg1}")
|
||||
set(RECV_TYPE_ARG2 "${recv_arg2}")
|
||||
set(RECV_TYPE_ARG3 "${recv_arg3}")
|
||||
set(RECV_TYPE_ARG4 "${recv_arg4}")
|
||||
set(RECV_TYPE_RETV "${recv_retv}")
|
||||
set(HAVE_RECV 1)
|
||||
set(curl_cv_func_recv_done 1)
|
||||
endif(curl_cv_func_recv_test)
|
||||
endif(NOT curl_cv_func_recv_done)
|
||||
endforeach(recv_arg4)
|
||||
endforeach(recv_arg3)
|
||||
endforeach(recv_arg2)
|
||||
endforeach(recv_arg1)
|
||||
endforeach(recv_retv)
|
||||
else()
|
||||
string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG1 "${curl_cv_func_recv_args}")
|
||||
string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG2 "${curl_cv_func_recv_args}")
|
||||
string(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG3 "${curl_cv_func_recv_args}")
|
||||
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" RECV_TYPE_ARG4 "${curl_cv_func_recv_args}")
|
||||
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" RECV_TYPE_RETV "${curl_cv_func_recv_args}")
|
||||
endif()
|
||||
|
||||
if("${curl_cv_func_recv_args}" STREQUAL "unknown")
|
||||
message(FATAL_ERROR "Cannot find proper types to use for recv args")
|
||||
endif("${curl_cv_func_recv_args}" STREQUAL "unknown")
|
||||
else(curl_cv_recv)
|
||||
message(FATAL_ERROR "Unable to link function recv")
|
||||
endif(curl_cv_recv)
|
||||
set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv")
|
||||
set(HAVE_RECV 1)
|
||||
|
||||
check_c_source_compiles("${_source_epilogue}
|
||||
int main(void) {
|
||||
send(0, 0, 0, 0);
|
||||
return 0;
|
||||
}" curl_cv_send)
|
||||
if(curl_cv_send)
|
||||
if(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
|
||||
foreach(send_retv "int" "ssize_t" )
|
||||
foreach(send_arg1 "int" "ssize_t" "SOCKET")
|
||||
foreach(send_arg2 "const void *" "void *" "char *" "const char *")
|
||||
foreach(send_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
||||
foreach(send_arg4 "int" "unsigned int")
|
||||
if(NOT curl_cv_func_send_done)
|
||||
unset(curl_cv_func_send_test CACHE)
|
||||
check_c_source_compiles("
|
||||
${_source_epilogue}
|
||||
extern ${send_retv} ${signature_call_conv}
|
||||
send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4});
|
||||
int main(void) {
|
||||
${send_arg1} s=0;
|
||||
${send_arg2} buf=0;
|
||||
${send_arg3} len=0;
|
||||
${send_arg4} flags=0;
|
||||
${send_retv} res = send(s, buf, len, flags);
|
||||
(void) res;
|
||||
return 0;
|
||||
}"
|
||||
curl_cv_func_send_test)
|
||||
message(STATUS
|
||||
"Tested: ${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})")
|
||||
if(curl_cv_func_send_test)
|
||||
string(REGEX REPLACE "(const) .*" "\\1" send_qual_arg2 "${send_arg2}")
|
||||
string(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}")
|
||||
set(curl_cv_func_send_args
|
||||
"${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}")
|
||||
set(SEND_TYPE_ARG1 "${send_arg1}")
|
||||
set(SEND_TYPE_ARG2 "${send_arg2}")
|
||||
set(SEND_TYPE_ARG3 "${send_arg3}")
|
||||
set(SEND_TYPE_ARG4 "${send_arg4}")
|
||||
set(SEND_TYPE_RETV "${send_retv}")
|
||||
set(HAVE_SEND 1)
|
||||
set(curl_cv_func_send_done 1)
|
||||
endif(curl_cv_func_send_test)
|
||||
endif(NOT curl_cv_func_send_done)
|
||||
endforeach(send_arg4)
|
||||
endforeach(send_arg3)
|
||||
endforeach(send_arg2)
|
||||
endforeach(send_arg1)
|
||||
endforeach(send_retv)
|
||||
else()
|
||||
string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG1 "${curl_cv_func_send_args}")
|
||||
string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG2 "${curl_cv_func_send_args}")
|
||||
string(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG3 "${curl_cv_func_send_args}")
|
||||
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG4 "${curl_cv_func_send_args}")
|
||||
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" SEND_TYPE_RETV "${curl_cv_func_send_args}")
|
||||
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" SEND_QUAL_ARG2 "${curl_cv_func_send_args}")
|
||||
endif()
|
||||
|
||||
if("${curl_cv_func_send_args}" STREQUAL "unknown")
|
||||
message(FATAL_ERROR "Cannot find proper types to use for send args")
|
||||
endif("${curl_cv_func_send_args}" STREQUAL "unknown")
|
||||
set(SEND_QUAL_ARG2 "const")
|
||||
else(curl_cv_send)
|
||||
message(FATAL_ERROR "Unable to link function send")
|
||||
endif(curl_cv_send)
|
||||
set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send")
|
||||
set(HAVE_SEND 1)
|
||||
|
||||
check_c_source_compiles("${_source_epilogue}
|
||||
int main(void) {
|
||||
int flag = MSG_NOSIGNAL;
|
||||
(void)flag;
|
||||
return 0;
|
||||
}" HAVE_MSG_NOSIGNAL)
|
||||
|
||||
if(NOT HAVE_WINDOWS_H)
|
||||
add_header_include(HAVE_SYS_TIME_H "sys/time.h")
|
||||
add_header_include(TIME_WITH_SYS_TIME "time.h")
|
||||
add_header_include(HAVE_TIME_H "time.h")
|
||||
endif()
|
||||
check_c_source_compiles("${_source_epilogue}
|
||||
int main(void) {
|
||||
struct timeval ts;
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_usec = 0;
|
||||
(void)ts;
|
||||
return 0;
|
||||
}" HAVE_STRUCT_TIMEVAL)
|
||||
|
||||
|
||||
include(CheckCSourceRuns)
|
||||
# See HAVE_POLL in CMakeLists.txt for why poll is disabled on macOS
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_REQUIRED_FLAGS)
|
||||
if(HAVE_SYS_POLL_H)
|
||||
set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H")
|
||||
endif(HAVE_SYS_POLL_H)
|
||||
check_c_source_runs("
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
#endif
|
||||
int main(void) {
|
||||
return poll((void *)0, 0, 10 /*ms*/);
|
||||
}" HAVE_POLL_FINE)
|
||||
endif()
|
||||
|
||||
set(HAVE_SIG_ATOMIC_T 1)
|
||||
set(CMAKE_REQUIRED_FLAGS)
|
||||
if(HAVE_SIGNAL_H)
|
||||
set(CMAKE_REQUIRED_FLAGS "-DHAVE_SIGNAL_H")
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES "signal.h")
|
||||
endif(HAVE_SIGNAL_H)
|
||||
check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T)
|
||||
if(HAVE_SIZEOF_SIG_ATOMIC_T)
|
||||
check_c_source_compiles("
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
# include <signal.h>
|
||||
#endif
|
||||
int main(void) {
|
||||
static volatile sig_atomic_t dummy = 0;
|
||||
(void)dummy;
|
||||
return 0;
|
||||
}" HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
||||
if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
||||
set(HAVE_SIG_ATOMIC_T_VOLATILE 1)
|
||||
endif(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
||||
endif(HAVE_SIZEOF_SIG_ATOMIC_T)
|
||||
|
||||
if(HAVE_WINDOWS_H)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h)
|
||||
else()
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
if(HAVE_SYS_SOCKET_H)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
|
||||
endif(HAVE_SYS_SOCKET_H)
|
||||
endif()
|
||||
|
||||
check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
||||
if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
||||
set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
|
||||
endif(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
||||
|
||||
125
proxy_c/third-lib/libcurl/CMake/Platforms/WindowsCache.cmake
Normal file
125
proxy_c/third-lib/libcurl/CMake/Platforms/WindowsCache.cmake
Normal file
@@ -0,0 +1,125 @@
|
||||
if(NOT UNIX)
|
||||
if(WIN32)
|
||||
set(HAVE_LIBDL 0)
|
||||
set(HAVE_LIBUCB 0)
|
||||
set(HAVE_LIBSOCKET 0)
|
||||
set(NOT_NEED_LIBNSL 0)
|
||||
set(HAVE_LIBNSL 0)
|
||||
set(HAVE_GETHOSTNAME 1)
|
||||
set(HAVE_LIBZ 0)
|
||||
set(HAVE_LIBCRYPTO 0)
|
||||
|
||||
set(HAVE_DLOPEN 0)
|
||||
|
||||
set(HAVE_ALLOCA_H 0)
|
||||
set(HAVE_ARPA_INET_H 0)
|
||||
set(HAVE_DLFCN_H 0)
|
||||
set(HAVE_FCNTL_H 1)
|
||||
set(HAVE_INTTYPES_H 0)
|
||||
set(HAVE_IO_H 1)
|
||||
set(HAVE_MALLOC_H 1)
|
||||
set(HAVE_MEMORY_H 1)
|
||||
set(HAVE_NETDB_H 0)
|
||||
set(HAVE_NETINET_IF_ETHER_H 0)
|
||||
set(HAVE_NETINET_IN_H 0)
|
||||
set(HAVE_NET_IF_H 0)
|
||||
set(HAVE_PROCESS_H 1)
|
||||
set(HAVE_PWD_H 0)
|
||||
set(HAVE_SETJMP_H 1)
|
||||
set(HAVE_SGTTY_H 0)
|
||||
set(HAVE_SIGNAL_H 1)
|
||||
set(HAVE_SOCKIO_H 0)
|
||||
set(HAVE_STDINT_H 0)
|
||||
set(HAVE_STDLIB_H 1)
|
||||
set(HAVE_STRINGS_H 0)
|
||||
set(HAVE_STRING_H 1)
|
||||
set(HAVE_SYS_PARAM_H 0)
|
||||
set(HAVE_SYS_POLL_H 0)
|
||||
set(HAVE_SYS_SELECT_H 0)
|
||||
set(HAVE_SYS_SOCKET_H 0)
|
||||
set(HAVE_SYS_SOCKIO_H 0)
|
||||
set(HAVE_SYS_STAT_H 1)
|
||||
set(HAVE_SYS_TIME_H 0)
|
||||
set(HAVE_SYS_TYPES_H 1)
|
||||
set(HAVE_SYS_UTIME_H 1)
|
||||
set(HAVE_TERMIOS_H 0)
|
||||
set(HAVE_TERMIO_H 0)
|
||||
set(HAVE_TIME_H 1)
|
||||
set(HAVE_UNISTD_H 0)
|
||||
set(HAVE_UTIME_H 0)
|
||||
set(HAVE_X509_H 0)
|
||||
set(HAVE_ZLIB_H 0)
|
||||
|
||||
set(HAVE_SIZEOF_LONG_DOUBLE 1)
|
||||
set(SIZEOF_LONG_DOUBLE 8)
|
||||
|
||||
set(HAVE_SOCKET 1)
|
||||
set(HAVE_POLL 0)
|
||||
set(HAVE_SELECT 1)
|
||||
set(HAVE_STRDUP 1)
|
||||
set(HAVE_STRSTR 1)
|
||||
set(HAVE_STRTOK_R 0)
|
||||
set(HAVE_STRFTIME 1)
|
||||
set(HAVE_UNAME 0)
|
||||
set(HAVE_STRCASECMP 0)
|
||||
set(HAVE_STRICMP 1)
|
||||
set(HAVE_STRCMPI 1)
|
||||
set(HAVE_GETHOSTBYADDR 1)
|
||||
set(HAVE_GETTIMEOFDAY 0)
|
||||
set(HAVE_INET_ADDR 1)
|
||||
set(HAVE_INET_NTOA 1)
|
||||
set(HAVE_INET_NTOA_R 0)
|
||||
set(HAVE_TCGETATTR 0)
|
||||
set(HAVE_TCSETATTR 0)
|
||||
set(HAVE_PERROR 1)
|
||||
set(HAVE_CLOSESOCKET 1)
|
||||
set(HAVE_SETVBUF 0)
|
||||
set(HAVE_SIGSETJMP 0)
|
||||
set(HAVE_GETPASS_R 0)
|
||||
set(HAVE_STRLCAT 0)
|
||||
set(HAVE_GETPWUID 0)
|
||||
set(HAVE_GETEUID 0)
|
||||
set(HAVE_UTIME 1)
|
||||
set(HAVE_RAND_EGD 0)
|
||||
set(HAVE_RAND_SCREEN 0)
|
||||
set(HAVE_RAND_STATUS 0)
|
||||
set(HAVE_GMTIME_R 0)
|
||||
set(HAVE_LOCALTIME_R 0)
|
||||
set(HAVE_GETHOSTBYADDR_R 0)
|
||||
set(HAVE_GETHOSTBYNAME_R 0)
|
||||
set(HAVE_SIGNAL_FUNC 1)
|
||||
set(HAVE_SIGNAL_MACRO 0)
|
||||
|
||||
set(HAVE_GETHOSTBYADDR_R_5 0)
|
||||
set(HAVE_GETHOSTBYADDR_R_5_REENTRANT 0)
|
||||
set(HAVE_GETHOSTBYADDR_R_7 0)
|
||||
set(HAVE_GETHOSTBYADDR_R_7_REENTRANT 0)
|
||||
set(HAVE_GETHOSTBYADDR_R_8 0)
|
||||
set(HAVE_GETHOSTBYADDR_R_8_REENTRANT 0)
|
||||
set(HAVE_GETHOSTBYNAME_R_3 0)
|
||||
set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0)
|
||||
set(HAVE_GETHOSTBYNAME_R_5 0)
|
||||
set(HAVE_GETHOSTBYNAME_R_5_REENTRANT 0)
|
||||
set(HAVE_GETHOSTBYNAME_R_6 0)
|
||||
set(HAVE_GETHOSTBYNAME_R_6_REENTRANT 0)
|
||||
|
||||
set(TIME_WITH_SYS_TIME 0)
|
||||
set(HAVE_O_NONBLOCK 0)
|
||||
set(HAVE_IN_ADDR_T 0)
|
||||
set(HAVE_INET_NTOA_R_DECL 0)
|
||||
set(HAVE_INET_NTOA_R_DECL_REENTRANT 0)
|
||||
if(ENABLE_IPV6)
|
||||
set(HAVE_GETADDRINFO 1)
|
||||
else()
|
||||
set(HAVE_GETADDRINFO 0)
|
||||
endif()
|
||||
set(STDC_HEADERS 1)
|
||||
set(RETSIGTYPE_TEST 1)
|
||||
|
||||
set(HAVE_SIGACTION 0)
|
||||
set(HAVE_MACRO_SIGSETJMP 0)
|
||||
else(WIN32)
|
||||
message("This file should be included on Windows platform only")
|
||||
endif(WIN32)
|
||||
endif(NOT UNIX)
|
||||
|
||||
31
proxy_c/third-lib/libcurl/CMake/Utilities.cmake
Normal file
31
proxy_c/third-lib/libcurl/CMake/Utilities.cmake
Normal file
@@ -0,0 +1,31 @@
|
||||
# File containing various utilities
|
||||
|
||||
# Converts a CMake list to a string containing elements separated by spaces
|
||||
function(TO_LIST_SPACES _LIST_NAME OUTPUT_VAR)
|
||||
set(NEW_LIST_SPACE)
|
||||
foreach(ITEM ${${_LIST_NAME}})
|
||||
set(NEW_LIST_SPACE "${NEW_LIST_SPACE} ${ITEM}")
|
||||
endforeach()
|
||||
string(STRIP ${NEW_LIST_SPACE} NEW_LIST_SPACE)
|
||||
set(${OUTPUT_VAR} "${NEW_LIST_SPACE}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Appends a lis of item to a string which is a space-separated list, if they don't already exist.
|
||||
function(LIST_SPACES_APPEND_ONCE LIST_NAME)
|
||||
string(REPLACE " " ";" _LIST ${${LIST_NAME}})
|
||||
list(APPEND _LIST ${ARGN})
|
||||
list(REMOVE_DUPLICATES _LIST)
|
||||
to_list_spaces(_LIST NEW_LIST_SPACE)
|
||||
set(${LIST_NAME} "${NEW_LIST_SPACE}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Convinience function that does the same as LIST(FIND ...) but with a TRUE/FALSE return value.
|
||||
# Ex: IN_STR_LIST(MY_LIST "Searched item" WAS_FOUND)
|
||||
function(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL)
|
||||
list(FIND ${LIST_NAME} ${ITEM_SEARCHED} FIND_POS)
|
||||
if(${FIND_POS} EQUAL -1)
|
||||
set(${RETVAL} FALSE PARENT_SCOPE)
|
||||
else()
|
||||
set(${RETVAL} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
1210
proxy_c/third-lib/libcurl/CMakeLists.txt
Normal file
1210
proxy_c/third-lib/libcurl/CMakeLists.txt
Normal file
File diff suppressed because it is too large
Load Diff
22
proxy_c/third-lib/libcurl/COPYING
Normal file
22
proxy_c/third-lib/libcurl/COPYING
Normal file
@@ -0,0 +1,22 @@
|
||||
COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 1996 - 2016, Daniel Stenberg, <daniel@haxx.se>, and many
|
||||
contributors, see the THANKS file.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright
|
||||
notice and this permission notice appear in all copies.
|
||||
|
||||
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 OF THIRD PARTY RIGHTS. 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.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization of the copyright holder.
|
||||
146
proxy_c/third-lib/libcurl/MacOSX-Framework
Executable file
146
proxy_c/third-lib/libcurl/MacOSX-Framework
Executable file
@@ -0,0 +1,146 @@
|
||||
#!/bin/bash
|
||||
# This script performs all of the steps needed to build a
|
||||
# universal binary libcurl.framework for Mac OS X 10.4 or greater.
|
||||
#
|
||||
# Hendrik Visage:
|
||||
# Generalizations added since Snowleopard (10.6) do not include
|
||||
# the 10.4u SDK.
|
||||
#
|
||||
# Also note:
|
||||
# 10.5 is the *ONLY* SDK that support PPC64 :( -- 10.6 do not have ppc64 support
|
||||
#If you need to have PPC64 support then change below to 1
|
||||
PPC64_NEEDED=0
|
||||
# Apple does not support building for PPC anymore in Xcode 4 and later.
|
||||
# If you're using Xcode 3 or earlier and need PPC support, then change
|
||||
# the setting below to 1
|
||||
PPC_NEEDED=0
|
||||
|
||||
# For me the default is to develop for the platform I am on, and if you
|
||||
#desire compatibility with older versions then change USE_OLD to 1 :)
|
||||
USE_OLD=0
|
||||
|
||||
VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h`
|
||||
FRAMEWORK_VERSION=Versions/Release-$VERSION
|
||||
|
||||
#I also wanted to "copy over" the system, and thus the reason I added the
|
||||
# version to Versions/Release-7.20.1 etc.
|
||||
# now a simple rsync -vaP libcurl.framework /Library/Frameworks will install it
|
||||
# and setup the right paths to this version, leaving the system version
|
||||
# "intact", so you can "fix" it later with the links to Versions/A/...
|
||||
|
||||
DEVELOPER_PATH=`xcode-select --print-path`
|
||||
# Around Xcode 4.3, SDKs were moved from the Developer folder into the
|
||||
# MacOSX.platform folder
|
||||
if test -d "$DEVELOPER_PATH/Platforms/MacOSX.platform/Developer/SDKs"; then
|
||||
SDK_PATH="$DEVELOPER_PATH/Platforms/MacOSX.platform/Developer/SDKs"
|
||||
else
|
||||
SDK_PATH="$DEVELOPER_PATH/SDKs";
|
||||
fi
|
||||
OLD_SDK=`ls $SDK_PATH|head -1`
|
||||
NEW_SDK=`ls -r $SDK_PATH|head -1`
|
||||
|
||||
if test "0"$USE_OLD -gt 0
|
||||
then
|
||||
SDK32=$OLD_SDK
|
||||
else
|
||||
SDK32=$NEW_SDK
|
||||
fi
|
||||
|
||||
MACVER=`echo $SDK32|sed -e s/[a-zA-Z]//g -e s/.\$//`
|
||||
|
||||
SDK32_DIR=$SDK_PATH/$SDK32
|
||||
MINVER32='-mmacosx-version-min='$MACVER
|
||||
if test $PPC_NEEDED -gt 0; then
|
||||
ARCHES32='-arch i386 -arch ppc'
|
||||
else
|
||||
ARCHES32='-arch i386'
|
||||
fi
|
||||
|
||||
if test $PPC64_NEEDED -gt 0
|
||||
then
|
||||
SDK64=10.5
|
||||
ARCHES64='-arch x86_64 -arch ppc64'
|
||||
SDK64=`ls $SDK_PATH|grep 10.5|head -1`
|
||||
else
|
||||
ARCHES64='-arch x86_64'
|
||||
#We "know" that 10.4 and earlier do not support 64bit
|
||||
OLD_SDK64=`ls $SDK_PATH|egrep -v "10.[0-4]"|head -1`
|
||||
NEW_SDK64=`ls -r $SDK_PATH|egrep -v "10.[0-4][^0-9]" | head -1`
|
||||
if test $USE_OLD -gt 0
|
||||
then
|
||||
SDK64=$OLD_SDK64
|
||||
else
|
||||
SDK64=$NEW_SDK64
|
||||
fi
|
||||
fi
|
||||
|
||||
SDK64_DIR=$SDK_PATH/$SDK64
|
||||
MACVER64=`echo $SDK64|sed -e s/[a-zA-Z]//g -e s/.\$//`
|
||||
|
||||
MINVER64='-mmacosx-version-min='$MACVER64
|
||||
|
||||
if test ! -z $SDK32; then
|
||||
echo "----Configuring libcurl for 32 bit universal framework..."
|
||||
make clean
|
||||
./configure --disable-dependency-tracking --disable-static --with-gssapi --with-darwinssl \
|
||||
CFLAGS="-Os -isysroot $SDK32_DIR $ARCHES32" \
|
||||
LDFLAGS="-Wl,-syslibroot,$SDK32_DIR $ARCHES32 -Wl,-headerpad_max_install_names" \
|
||||
CC=$CC
|
||||
|
||||
echo "----Building 32 bit libcurl..."
|
||||
make -j `sysctl -n hw.logicalcpu_max`
|
||||
|
||||
echo "----Creating 32 bit framework..."
|
||||
rm -r libcurl.framework
|
||||
mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Resources
|
||||
cp lib/.libs/libcurl.dylib libcurl.framework/${FRAMEWORK_VERSION}/libcurl
|
||||
install_name_tool -id @rpath/libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl
|
||||
/usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/${FRAMEWORK_VERSION}/Resources/Info.plist
|
||||
mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl
|
||||
cp include/curl/*.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl
|
||||
pushd libcurl.framework
|
||||
ln -fs ${FRAMEWORK_VERSION}/libcurl libcurl
|
||||
ln -fs ${FRAMEWORK_VERSION}/Resources Resources
|
||||
ln -fs ${FRAMEWORK_VERSION}/Headers Headers
|
||||
cd Versions
|
||||
ln -fs $(basename "${FRAMEWORK_VERSION}") Current
|
||||
|
||||
echo Testing for SDK64
|
||||
if test -d $SDK64_DIR; then
|
||||
echo entering...
|
||||
popd
|
||||
make clean
|
||||
echo "----Configuring libcurl for 64 bit universal framework..."
|
||||
./configure --disable-dependency-tracking --disable-static --with-gssapi --with-darwinssl \
|
||||
CFLAGS="-Os -isysroot $SDK64_DIR $ARCHES64" \
|
||||
LDFLAGS="-Wl,-syslibroot,$SDK64_DIR $ARCHES64 -Wl,-headerpad_max_install_names" \
|
||||
CC=$CC
|
||||
|
||||
echo "----Building 64 bit libcurl..."
|
||||
make -j `sysctl -n hw.logicalcpu_max`
|
||||
|
||||
echo "----Appending 64 bit framework to 32 bit framework..."
|
||||
cp lib/.libs/libcurl.dylib libcurl.framework/${FRAMEWORK_VERSION}/libcurl64
|
||||
install_name_tool -id @rpath/libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl64
|
||||
cp libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl32
|
||||
pwd
|
||||
lipo libcurl.framework/${FRAMEWORK_VERSION}/libcurl32 libcurl.framework/${FRAMEWORK_VERSION}/libcurl64 -create -output libcurl.framework/${FRAMEWORK_VERSION}/libcurl
|
||||
rm libcurl.framework/${FRAMEWORK_VERSION}/libcurl32 libcurl.framework/${FRAMEWORK_VERSION}/libcurl64
|
||||
cp libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild32.h
|
||||
cp include/curl/curlbuild.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild64.h
|
||||
cat >libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild.h <<EOF
|
||||
#ifdef __LP64__
|
||||
#include "curl/curlbuild64.h"
|
||||
#else
|
||||
#include "curl/curlbuild32.h"
|
||||
#endif
|
||||
EOF
|
||||
fi
|
||||
|
||||
pwd
|
||||
lipo -info libcurl.framework/${FRAMEWORK_VERSION}/libcurl
|
||||
echo "libcurl.framework is built and can now be included in other projects."
|
||||
echo "Copy libcurl.framework to your bundle's Contents/Frameworks folder, ~/Library/Frameworks or /Library/Frameworks."
|
||||
else
|
||||
echo "Building libcurl.framework requires Mac OS X 10.4 or later with the MacOSX10.4/5/6 SDK installed."
|
||||
fi
|
||||
1761
proxy_c/third-lib/libcurl/Makefile
Normal file
1761
proxy_c/third-lib/libcurl/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
609
proxy_c/third-lib/libcurl/Makefile.am
Normal file
609
proxy_c/third-lib/libcurl/Makefile.am
Normal file
@@ -0,0 +1,609 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2016, 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.haxx.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.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
CMAKE_DIST = CMakeLists.txt CMake/CMakeConfigurableFile.in \
|
||||
CMake/CurlTests.c CMake/FindGSS.cmake CMake/OtherTests.cmake \
|
||||
CMake/Platforms/WindowsCache.cmake CMake/Utilities.cmake \
|
||||
include/curl/curlbuild.h.cmake CMake/Macros.cmake \
|
||||
CMake/CurlSymbolHiding.cmake CMake/FindCARES.cmake \
|
||||
CMake/FindLibSSH2.cmake CMake/FindNGHTTP2.cmake
|
||||
|
||||
|
||||
VC6_LIBTMPL = projects/Windows/VC6/lib/libcurl.tmpl
|
||||
VC6_LIBDSP = projects/Windows/VC6/lib/libcurl.dsp.dist
|
||||
VC6_LIBDSP_DEPS = $(VC6_LIBTMPL) Makefile.am lib/Makefile.inc
|
||||
VC6_SRCTMPL = projects/Windows/VC6/src/curl.tmpl
|
||||
VC6_SRCDSP = projects/Windows/VC6/src/curl.dsp.dist
|
||||
VC6_SRCDSP_DEPS = $(VC6_SRCTMPL) Makefile.am src/Makefile.inc
|
||||
|
||||
VC7_LIBTMPL = projects/Windows/VC7/lib/libcurl.tmpl
|
||||
VC7_LIBVCPROJ = projects/Windows/VC7/lib/libcurl.vcproj.dist
|
||||
VC7_LIBVCPROJ_DEPS = $(VC7_LIBTMPL) Makefile.am lib/Makefile.inc
|
||||
VC7_SRCTMPL = projects/Windows/VC7/src/curl.tmpl
|
||||
VC7_SRCVCPROJ = projects/Windows/VC7/src/curl.vcproj.dist
|
||||
VC7_SRCVCPROJ_DEPS = $(VC7_SRCTMPL) Makefile.am src/Makefile.inc
|
||||
|
||||
VC71_LIBTMPL = projects/Windows/VC7.1/lib/libcurl.tmpl
|
||||
VC71_LIBVCPROJ = projects/Windows/VC7.1/lib/libcurl.vcproj.dist
|
||||
VC71_LIBVCPROJ_DEPS = $(VC71_LIBTMPL) Makefile.am lib/Makefile.inc
|
||||
VC71_SRCTMPL = projects/Windows/VC7.1/src/curl.tmpl
|
||||
VC71_SRCVCPROJ = projects/Windows/VC7.1/src/curl.vcproj.dist
|
||||
VC71_SRCVCPROJ_DEPS = $(VC71_SRCTMPL) Makefile.am src/Makefile.inc
|
||||
|
||||
VC8_LIBTMPL = projects/Windows/VC8/lib/libcurl.tmpl
|
||||
VC8_LIBVCPROJ = projects/Windows/VC8/lib/libcurl.vcproj.dist
|
||||
VC8_LIBVCPROJ_DEPS = $(VC8_LIBTMPL) Makefile.am lib/Makefile.inc
|
||||
VC8_SRCTMPL = projects/Windows/VC8/src/curl.tmpl
|
||||
VC8_SRCVCPROJ = projects/Windows/VC8/src/curl.vcproj.dist
|
||||
VC8_SRCVCPROJ_DEPS = $(VC8_SRCTMPL) Makefile.am src/Makefile.inc
|
||||
|
||||
VC9_LIBTMPL = projects/Windows/VC9/lib/libcurl.tmpl
|
||||
VC9_LIBVCPROJ = projects/Windows/VC9/lib/libcurl.vcproj.dist
|
||||
VC9_LIBVCPROJ_DEPS = $(VC9_LIBTMPL) Makefile.am lib/Makefile.inc
|
||||
VC9_SRCTMPL = projects/Windows/VC9/src/curl.tmpl
|
||||
VC9_SRCVCPROJ = projects/Windows/VC9/src/curl.vcproj.dist
|
||||
VC9_SRCVCPROJ_DEPS = $(VC9_SRCTMPL) Makefile.am src/Makefile.inc
|
||||
|
||||
VC10_LIBTMPL = projects/Windows/VC10/lib/libcurl.tmpl
|
||||
VC10_LIBVCXPROJ = projects/Windows/VC10/lib/libcurl.vcxproj.dist
|
||||
VC10_LIBVCXPROJ_DEPS = $(VC10_LIBTMPL) Makefile.am lib/Makefile.inc
|
||||
VC10_SRCTMPL = projects/Windows/VC10/src/curl.tmpl
|
||||
VC10_SRCVCXPROJ = projects/Windows/VC10/src/curl.vcxproj.dist
|
||||
VC10_SRCVCXPROJ_DEPS = $(VC10_SRCTMPL) Makefile.am src/Makefile.inc
|
||||
|
||||
VC11_LIBTMPL = projects/Windows/VC11/lib/libcurl.tmpl
|
||||
VC11_LIBVCXPROJ = projects/Windows/VC11/lib/libcurl.vcxproj.dist
|
||||
VC11_LIBVCXPROJ_DEPS = $(VC11_LIBTMPL) Makefile.am lib/Makefile.inc
|
||||
VC11_SRCTMPL = projects/Windows/VC11/src/curl.tmpl
|
||||
VC11_SRCVCXPROJ = projects/Windows/VC11/src/curl.vcxproj.dist
|
||||
VC11_SRCVCXPROJ_DEPS = $(VC11_SRCTMPL) Makefile.am src/Makefile.inc
|
||||
|
||||
VC12_LIBTMPL = projects/Windows/VC12/lib/libcurl.tmpl
|
||||
VC12_LIBVCXPROJ = projects/Windows/VC12/lib/libcurl.vcxproj.dist
|
||||
VC12_LIBVCXPROJ_DEPS = $(VC12_LIBTMPL) Makefile.am lib/Makefile.inc
|
||||
VC12_SRCTMPL = projects/Windows/VC12/src/curl.tmpl
|
||||
VC12_SRCVCXPROJ = projects/Windows/VC12/src/curl.vcxproj.dist
|
||||
VC12_SRCVCXPROJ_DEPS = $(VC12_SRCTMPL) Makefile.am src/Makefile.inc
|
||||
|
||||
VC14_LIBTMPL = projects/Windows/VC14/lib/libcurl.tmpl
|
||||
VC14_LIBVCXPROJ = projects/Windows/VC14/lib/libcurl.vcxproj.dist
|
||||
VC14_LIBVCXPROJ_DEPS = $(VC14_LIBTMPL) Makefile.am lib/Makefile.inc
|
||||
VC14_SRCTMPL = projects/Windows/VC14/src/curl.tmpl
|
||||
VC14_SRCVCXPROJ = projects/Windows/VC14/src/curl.vcxproj.dist
|
||||
VC14_SRCVCXPROJ_DEPS = $(VC14_SRCTMPL) Makefile.am src/Makefile.inc
|
||||
|
||||
VC_DIST = projects/README \
|
||||
projects/build-openssl.bat \
|
||||
projects/build-wolfssl.bat \
|
||||
projects/checksrc.bat \
|
||||
projects/Windows/VC6/curl-all.dsw \
|
||||
projects/Windows/VC6/lib/libcurl.dsw \
|
||||
projects/Windows/VC6/src/curl.dsw \
|
||||
projects/Windows/VC7/curl-all.sln \
|
||||
projects/Windows/VC7/lib/libcurl.sln \
|
||||
projects/Windows/VC7/src/curl.sln \
|
||||
projects/Windows/VC7.1/curl-all.sln \
|
||||
projects/Windows/VC7.1/lib/libcurl.sln \
|
||||
projects/Windows/VC7.1/src/curl.sln \
|
||||
projects/Windows/VC8/curl-all.sln \
|
||||
projects/Windows/VC8/lib/libcurl.sln \
|
||||
projects/Windows/VC8/src/curl.sln \
|
||||
projects/Windows/VC9/curl-all.sln \
|
||||
projects/Windows/VC9/lib/libcurl.sln \
|
||||
projects/Windows/VC9/src/curl.sln \
|
||||
projects/Windows/VC10/curl-all.sln \
|
||||
projects/Windows/VC10/lib/libcurl.sln \
|
||||
projects/Windows/VC10/lib/libcurl.vcxproj.filters \
|
||||
projects/Windows/VC10/src/curl.sln \
|
||||
projects/Windows/VC10/src/curl.vcxproj.filters \
|
||||
projects/Windows/VC11/curl-all.sln \
|
||||
projects/Windows/VC11/lib/libcurl.sln \
|
||||
projects/Windows/VC11/lib/libcurl.vcxproj.filters \
|
||||
projects/Windows/VC11/src/curl.sln \
|
||||
projects/Windows/VC11/src/curl.vcxproj.filters \
|
||||
projects/Windows/VC12/curl-all.sln \
|
||||
projects/Windows/VC12/lib/libcurl.sln \
|
||||
projects/Windows/VC12/lib/libcurl.vcxproj.filters \
|
||||
projects/Windows/VC12/src/curl.sln \
|
||||
projects/Windows/VC12/src/curl.vcxproj.filters \
|
||||
projects/Windows/VC14/curl-all.sln \
|
||||
projects/Windows/VC14/lib/libcurl.sln \
|
||||
projects/Windows/VC14/lib/libcurl.vcxproj.filters \
|
||||
projects/Windows/VC14/src/curl.sln \
|
||||
projects/Windows/VC14/src/curl.vcxproj.filters
|
||||
|
||||
WINBUILD_DIST = winbuild/BUILD.WINDOWS.txt winbuild/gen_resp_file.bat \
|
||||
winbuild/MakefileBuild.vc winbuild/Makefile.vc \
|
||||
winbuild/Makefile.msvc.names
|
||||
|
||||
EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in \
|
||||
RELEASE-NOTES buildconf libcurl.pc.in MacOSX-Framework scripts/zsh.pl \
|
||||
$(CMAKE_DIST) $(VC_DIST) $(WINBUILD_DIST) lib/libcurl.vers.in \
|
||||
buildconf.bat
|
||||
|
||||
CLEANFILES = $(VC6_LIBDSP) $(VC6_SRCDSP) $(VC7_LIBVCPROJ) $(VC7_SRCVCPROJ) \
|
||||
$(VC71_LIBVCPROJ) $(VC71_SRCVCPROJ) $(VC8_LIBVCPROJ) $(VC8_SRCVCPROJ) \
|
||||
$(VC9_LIBVCPROJ) $(VC9_SRCVCPROJ) $(VC10_LIBVCXPROJ) $(VC10_SRCVCXPROJ) \
|
||||
$(VC11_LIBVCXPROJ) $(VC11_SRCVCXPROJ) $(VC12_LIBVCXPROJ) $(VC12_SRCVCXPROJ) \
|
||||
$(VC14_LIBVCXPROJ) $(VC14_SRCVCXPROJ)
|
||||
|
||||
bin_SCRIPTS = curl-config
|
||||
|
||||
SUBDIRS = lib src include
|
||||
DIST_SUBDIRS = $(SUBDIRS) tests packages docs scripts
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libcurl.pc
|
||||
|
||||
# List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files
|
||||
include lib/Makefile.inc
|
||||
include src/Makefile.inc
|
||||
|
||||
dist-hook:
|
||||
rm -rf $(top_builddir)/tests/log
|
||||
find $(distdir) -name "*.dist" -exec rm {} \;
|
||||
(distit=`find $(srcdir) -name "*.dist" | grep -v ./ares/`; \
|
||||
for file in $$distit; do \
|
||||
strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
|
||||
cp $$file $(distdir)$$strip; \
|
||||
done)
|
||||
|
||||
html:
|
||||
cd docs && make html
|
||||
|
||||
pdf:
|
||||
cd docs && make pdf
|
||||
|
||||
check: test examples check-docs
|
||||
|
||||
if CROSSCOMPILING
|
||||
test-full: test
|
||||
test-torture: test
|
||||
|
||||
test:
|
||||
@echo "NOTICE: we can't run the tests when cross-compiling!"
|
||||
|
||||
else
|
||||
|
||||
test:
|
||||
@(cd tests; $(MAKE) all quiet-test)
|
||||
|
||||
test-full:
|
||||
@(cd tests; $(MAKE) all full-test)
|
||||
|
||||
test-torture:
|
||||
@(cd tests; $(MAKE) all torture-test)
|
||||
|
||||
test-am:
|
||||
@(cd tests; $(MAKE) all am-test)
|
||||
|
||||
endif
|
||||
|
||||
examples:
|
||||
@(cd docs/examples; $(MAKE) check)
|
||||
|
||||
check-docs:
|
||||
@(cd docs/libcurl; $(MAKE) check)
|
||||
|
||||
# This is a hook to have 'make clean' also clean up the docs and the tests
|
||||
# dir. The extra check for the Makefiles being present is necessary because
|
||||
# 'make distcheck' will make clean first in these directories _before_ it runs
|
||||
# this hook.
|
||||
clean-local:
|
||||
@(if test -f tests/Makefile; then cd tests; $(MAKE) clean; fi)
|
||||
@(if test -f docs/Makefile; then cd docs; $(MAKE) clean; fi)
|
||||
|
||||
#
|
||||
# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
|
||||
# must contain the following line:
|
||||
# %_topdir /home/loic/local/rpm
|
||||
# and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc.
|
||||
#
|
||||
# cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS
|
||||
#
|
||||
# If additional configure flags are needed to build the package, add the
|
||||
# following in ~/.rpmmacros
|
||||
# %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS}
|
||||
# and run make rpm in the following way:
|
||||
# AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm
|
||||
#
|
||||
|
||||
rpms:
|
||||
$(MAKE) RPMDIST=curl rpm
|
||||
$(MAKE) RPMDIST=curl-ssl rpm
|
||||
|
||||
rpm:
|
||||
RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \
|
||||
cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \
|
||||
cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \
|
||||
rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \
|
||||
mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \
|
||||
mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm .
|
||||
|
||||
#
|
||||
# Build a Solaris pkgadd format file
|
||||
# run 'make pkgadd' once you've done './configure' and 'make' to make a Solaris pkgadd format
|
||||
# file (which ends up back in this directory).
|
||||
# The pkgadd file is in 'pkgtrans' format, so to install on Solaris, do
|
||||
# pkgadd -d ./HAXXcurl-*
|
||||
#
|
||||
|
||||
# gak - libtool requires an absoulte directory, hence the pwd below...
|
||||
pkgadd:
|
||||
umask 022 ; \
|
||||
make install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \
|
||||
cat COPYING > $(srcdir)/packages/Solaris/copyright ; \
|
||||
cd $(srcdir)/packages/Solaris && $(MAKE) package
|
||||
|
||||
#
|
||||
# Build a cygwin binary tarball installation file
|
||||
# resulting .tar.bz2 file will end up at packages/Win32/cygwin
|
||||
cygwinbin:
|
||||
$(MAKE) -C packages/Win32/cygwin cygwinbin
|
||||
|
||||
# We extend the standard install with a custom hook:
|
||||
install-data-hook:
|
||||
cd include && $(MAKE) install
|
||||
cd docs && $(MAKE) install
|
||||
|
||||
# We extend the standard uninstall with a custom hook:
|
||||
uninstall-hook:
|
||||
cd include && $(MAKE) uninstall
|
||||
cd docs && $(MAKE) uninstall
|
||||
|
||||
ca-bundle: lib/mk-ca-bundle.pl
|
||||
@echo "generating a fresh ca-bundle.crt"
|
||||
@perl $< -b -l -u lib/ca-bundle.crt
|
||||
|
||||
ca-firefox: lib/firefox-db2pem.sh
|
||||
@echo "generating a fresh ca-bundle.crt"
|
||||
./lib/firefox-db2pem.sh lib/ca-bundle.crt
|
||||
|
||||
checksrc:
|
||||
cd lib && $(MAKE) checksrc
|
||||
cd src && $(MAKE) checksrc
|
||||
cd tests && $(MAKE) checksrc
|
||||
cd include/curl && $(MAKE) checksrc
|
||||
cd docs/examples && $(MAKE) checksrc
|
||||
|
||||
.PHONY: vc-ide
|
||||
|
||||
vc-ide: $(VC6_LIBDSP_DEPS) $(VC6_SRCDSP_DEPS) $(VC7_LIBVCPROJ_DEPS) \
|
||||
$(VC7_SRCVCPROJ_DEPS) $(VC71_LIBVCPROJ_DEPS) $(VC71_SRCVCPROJ_DEPS) \
|
||||
$(VC8_LIBVCPROJ_DEPS) $(VC8_SRCVCPROJ_DEPS) $(VC9_LIBVCPROJ_DEPS) \
|
||||
$(VC9_SRCVCPROJ_DEPS) $(VC10_LIBVCXPROJ_DEPS) $(VC10_SRCVCXPROJ_DEPS) \
|
||||
$(VC11_LIBVCXPROJ_DEPS) $(VC11_SRCVCXPROJ_DEPS) $(VC12_LIBVCXPROJ_DEPS) \
|
||||
$(VC12_SRCVCXPROJ_DEPS) $(VC14_LIBVCXPROJ_DEPS) $(VC14_SRCVCXPROJ_DEPS)
|
||||
@(win32_lib_srcs='$(LIB_CFILES)'; \
|
||||
win32_lib_hdrs='$(LIB_HFILES) config-win32.h'; \
|
||||
win32_lib_rc='$(LIB_RCFILES)'; \
|
||||
win32_lib_vauth_srcs='$(LIB_VAUTH_CFILES)'; \
|
||||
win32_lib_vauth_hdrs='$(LIB_VAUTH_HFILES)'; \
|
||||
win32_lib_vtls_srcs='$(LIB_VTLS_CFILES)'; \
|
||||
win32_lib_vtls_hdrs='$(LIB_VTLS_HFILES)'; \
|
||||
win32_src_srcs='$(CURL_CFILES)'; \
|
||||
win32_src_hdrs='$(CURL_HFILES)'; \
|
||||
win32_src_rc='$(CURL_RCFILES)'; \
|
||||
win32_src_x_srcs='$(CURLX_CFILES)'; \
|
||||
win32_src_x_hdrs='$(CURLX_HFILES) ../lib/config-win32.h'; \
|
||||
\
|
||||
sorted_lib_srcs=`for file in $$win32_lib_srcs; do echo $$file; done | sort`; \
|
||||
sorted_lib_hdrs=`for file in $$win32_lib_hdrs; do echo $$file; done | sort`; \
|
||||
sorted_lib_vauth_srcs=`for file in $$win32_lib_vauth_srcs; do echo $$file; done | sort`; \
|
||||
sorted_lib_vauth_hdrs=`for file in $$win32_lib_vauth_hdrs; do echo $$file; done | sort`; \
|
||||
sorted_lib_vtls_srcs=`for file in $$win32_lib_vtls_srcs; do echo $$file; done | sort`; \
|
||||
sorted_lib_vtls_hdrs=`for file in $$win32_lib_vtls_hdrs; do echo $$file; done | sort`; \
|
||||
sorted_src_srcs=`for file in $$win32_src_srcs; do echo $$file; done | sort`; \
|
||||
sorted_src_hdrs=`for file in $$win32_src_hdrs; do echo $$file; done | sort`; \
|
||||
sorted_src_x_srcs=`for file in $$win32_src_x_srcs; do echo $$file; done | sort`; \
|
||||
sorted_src_x_hdrs=`for file in $$win32_src_x_hdrs; do echo $$file; done | sort`; \
|
||||
\
|
||||
awk_code='\
|
||||
function gen_element(type, dir, file)\
|
||||
{\
|
||||
sub(/vauth\//, "", file);\
|
||||
sub(/vtls\//, "", file);\
|
||||
\
|
||||
spaces=" ";\
|
||||
if(dir == "lib\\vauth" || dir == "lib\\vtls")\
|
||||
tabs=" ";\
|
||||
else\
|
||||
tabs=" ";\
|
||||
\
|
||||
if(type == "dsp") {\
|
||||
printf("# Begin Source File\r\n");\
|
||||
printf("\r\n");\
|
||||
printf("SOURCE=..\\..\\..\\..\\%s\\%s\r\n", dir, file);\
|
||||
printf("# End Source File\r\n");\
|
||||
}\
|
||||
else if(type == "vcproj1") {\
|
||||
printf("%s<File\r\n", tabs);\
|
||||
printf("%s RelativePath=\"..\\..\\..\\..\\%s\\%s\">\r\n",\
|
||||
tabs, dir, file);\
|
||||
printf("%s</File>\r\n", tabs);\
|
||||
}\
|
||||
else if(type == "vcproj2") {\
|
||||
printf("%s<File\r\n", tabs);\
|
||||
printf("%s RelativePath=\"..\\..\\..\\..\\%s\\%s\"\r\n",\
|
||||
tabs, dir, file);\
|
||||
printf("%s>\r\n", tabs);\
|
||||
printf("%s</File>\r\n", tabs);\
|
||||
}\
|
||||
else if(type == "vcxproj") {\
|
||||
i = index(file, ".");\
|
||||
ext = substr(file, i == 0 ? 0 : i + 1);\
|
||||
\
|
||||
if(ext == "c")\
|
||||
printf("%s<ClCompile Include=\"..\\..\\..\\..\\%s\\%s\" />\r\n",\
|
||||
spaces, dir, file);\
|
||||
else if(ext == "h")\
|
||||
printf("%s<ClInclude Include=\"..\\..\\..\\..\\%s\\%s\" />\r\n",\
|
||||
spaces, dir, file);\
|
||||
else if(ext == "rc")\
|
||||
printf("%s<ResourceCompile Include=\"..\\..\\..\\..\\%s\\%s\" />\r\n",\
|
||||
spaces, dir, file);\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
{\
|
||||
\
|
||||
if($$0 == "CURL_LIB_C_FILES") {\
|
||||
split(lib_srcs, arr);\
|
||||
for(val in arr) gen_element(proj_type, "lib", arr[val]);\
|
||||
}\
|
||||
else if($$0 == "CURL_LIB_H_FILES") {\
|
||||
split(lib_hdrs, arr);\
|
||||
for(val in arr) gen_element(proj_type, "lib", arr[val]);\
|
||||
}\
|
||||
else if($$0 == "CURL_LIB_RC_FILES") {\
|
||||
split(lib_rc, arr);\
|
||||
for(val in arr) gen_element(proj_type, "lib", arr[val]);\
|
||||
}\
|
||||
else if($$0 == "CURL_LIB_VAUTH_C_FILES") {\
|
||||
split(lib_vauth_srcs, arr);\
|
||||
for(val in arr) gen_element(proj_type, "lib\\vauth", arr[val]);\
|
||||
}\
|
||||
else if($$0 == "CURL_LIB_VAUTH_H_FILES") {\
|
||||
split(lib_vauth_hdrs, arr);\
|
||||
for(val in arr) gen_element(proj_type, "lib\\vauth", arr[val]);\
|
||||
}\
|
||||
else if($$0 == "CURL_LIB_VTLS_C_FILES") {\
|
||||
split(lib_vtls_srcs, arr);\
|
||||
for(val in arr) gen_element(proj_type, "lib\\vtls", arr[val]);\
|
||||
}\
|
||||
else if($$0 == "CURL_LIB_VTLS_H_FILES") {\
|
||||
split(lib_vtls_hdrs, arr);\
|
||||
for(val in arr) gen_element(proj_type, "lib\\vtls", arr[val]);\
|
||||
}\
|
||||
else if($$0 == "CURL_SRC_C_FILES") {\
|
||||
split(src_srcs, arr);\
|
||||
for(val in arr) gen_element(proj_type, "src", arr[val]);\
|
||||
}\
|
||||
else if($$0 == "CURL_SRC_H_FILES") {\
|
||||
split(src_hdrs, arr);\
|
||||
for(val in arr) gen_element(proj_type, "src", arr[val]);\
|
||||
}\
|
||||
else if($$0 == "CURL_SRC_RC_FILES") {\
|
||||
split(src_rc, arr);\
|
||||
for(val in arr) gen_element(proj_type, "src", arr[val]);\
|
||||
}\
|
||||
else if($$0 == "CURL_SRC_X_C_FILES") {\
|
||||
split(src_x_srcs, arr);\
|
||||
for(val in arr) {\
|
||||
sub(/..\/lib\//, "", arr[val]);\
|
||||
gen_element(proj_type, "lib", arr[val]);\
|
||||
}\
|
||||
}\
|
||||
else if($$0 == "CURL_SRC_X_H_FILES") {\
|
||||
split(src_x_hdrs, arr);\
|
||||
for(val in arr) {\
|
||||
sub(/..\/lib\//, "", arr[val]);\
|
||||
gen_element(proj_type, "lib", arr[val]);\
|
||||
}\
|
||||
}\
|
||||
else\
|
||||
printf("%s\r\n", $$0);\
|
||||
}';\
|
||||
\
|
||||
echo "generating '$(VC6_LIBDSP)'"; \
|
||||
awk -v proj_type=dsp \
|
||||
-v lib_srcs="$$sorted_lib_srcs" \
|
||||
-v lib_hdrs="$$sorted_lib_hdrs" \
|
||||
-v lib_rc="$$win32_lib_rc" \
|
||||
-v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \
|
||||
-v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \
|
||||
-v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \
|
||||
-v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC6_LIBTMPL) > $(VC6_LIBDSP) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC6_SRCDSP)'"; \
|
||||
awk -v proj_type=dsp \
|
||||
-v src_srcs="$$sorted_src_srcs" \
|
||||
-v src_hdrs="$$sorted_src_hdrs" \
|
||||
-v src_rc="$$win32_src_rc" \
|
||||
-v src_x_srcs="$$sorted_src_x_srcs" \
|
||||
-v src_x_hdrs="$$sorted_src_x_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC6_SRCTMPL) > $(VC6_SRCDSP) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC7_LIBVCPROJ)'"; \
|
||||
awk -v proj_type=vcproj1 \
|
||||
-v lib_srcs="$$sorted_lib_srcs" \
|
||||
-v lib_hdrs="$$sorted_lib_hdrs" \
|
||||
-v lib_rc="$$win32_lib_rc" \
|
||||
-v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \
|
||||
-v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \
|
||||
-v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \
|
||||
-v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC7_LIBTMPL) > $(VC7_LIBVCPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC7_SRCVCPROJ)'"; \
|
||||
awk -v proj_type=vcproj1 \
|
||||
-v src_srcs="$$sorted_src_srcs" \
|
||||
-v src_hdrs="$$sorted_src_hdrs" \
|
||||
-v src_rc="$$win32_src_rc" \
|
||||
-v src_x_srcs="$$sorted_src_x_srcs" \
|
||||
-v src_x_hdrs="$$sorted_src_x_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC7_SRCTMPL) > $(VC7_SRCVCPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC71_LIBVCPROJ)'"; \
|
||||
awk -v proj_type=vcproj1 \
|
||||
-v lib_srcs="$$sorted_lib_srcs" \
|
||||
-v lib_hdrs="$$sorted_lib_hdrs" \
|
||||
-v lib_rc="$$win32_lib_rc" \
|
||||
-v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \
|
||||
-v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \
|
||||
-v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \
|
||||
-v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC71_LIBTMPL) > $(VC71_LIBVCPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC71_SRCVCPROJ)'"; \
|
||||
awk -v proj_type=vcproj1 \
|
||||
-v src_srcs="$$sorted_src_srcs" \
|
||||
-v src_hdrs="$$sorted_src_hdrs" \
|
||||
-v src_rc="$$win32_src_rc" \
|
||||
-v src_x_srcs="$$sorted_src_x_srcs" \
|
||||
-v src_x_hdrs="$$sorted_src_x_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC71_SRCTMPL) > $(VC71_SRCVCPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC8_LIBVCPROJ)'"; \
|
||||
awk -v proj_type=vcproj2 \
|
||||
-v lib_srcs="$$sorted_lib_srcs" \
|
||||
-v lib_hdrs="$$sorted_lib_hdrs" \
|
||||
-v lib_rc="$$win32_lib_rc" \
|
||||
-v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \
|
||||
-v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \
|
||||
-v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \
|
||||
-v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC8_LIBTMPL) > $(VC8_LIBVCPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC8_SRCVCPROJ)'"; \
|
||||
awk -v proj_type=vcproj2 \
|
||||
-v src_srcs="$$sorted_src_srcs" \
|
||||
-v src_hdrs="$$sorted_src_hdrs" \
|
||||
-v src_rc="$$win32_src_rc" \
|
||||
-v src_x_srcs="$$sorted_src_x_srcs" \
|
||||
-v src_x_hdrs="$$sorted_src_x_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC8_SRCTMPL) > $(VC8_SRCVCPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC9_LIBVCPROJ)'"; \
|
||||
awk -v proj_type=vcproj2 \
|
||||
-v lib_srcs="$$sorted_lib_srcs" \
|
||||
-v lib_hdrs="$$sorted_lib_hdrs" \
|
||||
-v lib_rc="$$win32_lib_rc" \
|
||||
-v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \
|
||||
-v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \
|
||||
-v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \
|
||||
-v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC9_LIBTMPL) > $(VC9_LIBVCPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC9_SRCVCPROJ)'"; \
|
||||
awk -v proj_type=vcproj2 \
|
||||
-v src_srcs="$$sorted_src_srcs" \
|
||||
-v src_hdrs="$$sorted_src_hdrs" \
|
||||
-v src_rc="$$win32_src_rc" \
|
||||
-v src_x_srcs="$$sorted_src_x_srcs" \
|
||||
-v src_x_hdrs="$$sorted_src_x_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC9_SRCTMPL) > $(VC9_SRCVCPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC10_LIBVCXPROJ)'"; \
|
||||
awk -v proj_type=vcxproj \
|
||||
-v lib_srcs="$$sorted_lib_srcs" \
|
||||
-v lib_hdrs="$$sorted_lib_hdrs" \
|
||||
-v lib_rc="$$win32_lib_rc" \
|
||||
-v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \
|
||||
-v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \
|
||||
-v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \
|
||||
-v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC10_LIBTMPL) > $(VC10_LIBVCXPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC10_SRCVCXPROJ)'"; \
|
||||
awk -v proj_type=vcxproj \
|
||||
-v src_srcs="$$sorted_src_srcs" \
|
||||
-v src_hdrs="$$sorted_src_hdrs" \
|
||||
-v src_rc="$$win32_src_rc" \
|
||||
-v src_x_srcs="$$sorted_src_x_srcs" \
|
||||
-v src_x_hdrs="$$sorted_src_x_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC10_SRCTMPL) > $(VC10_SRCVCXPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC11_LIBVCXPROJ)'"; \
|
||||
awk -v proj_type=vcxproj \
|
||||
-v lib_srcs="$$sorted_lib_srcs" \
|
||||
-v lib_hdrs="$$sorted_lib_hdrs" \
|
||||
-v lib_rc="$$win32_lib_rc" \
|
||||
-v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \
|
||||
-v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \
|
||||
-v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \
|
||||
-v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC11_LIBTMPL) > $(VC11_LIBVCXPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC11_SRCVCXPROJ)'"; \
|
||||
awk -v proj_type=vcxproj \
|
||||
-v src_srcs="$$sorted_src_srcs" \
|
||||
-v src_hdrs="$$sorted_src_hdrs" \
|
||||
-v src_rc="$$win32_src_rc" \
|
||||
-v src_x_srcs="$$sorted_src_x_srcs" \
|
||||
-v src_x_hdrs="$$sorted_src_x_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC11_SRCTMPL) > $(VC11_SRCVCXPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC12_LIBVCXPROJ)'"; \
|
||||
awk -v proj_type=vcxproj \
|
||||
-v lib_srcs="$$sorted_lib_srcs" \
|
||||
-v lib_hdrs="$$sorted_lib_hdrs" \
|
||||
-v lib_rc="$$win32_lib_rc" \
|
||||
-v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \
|
||||
-v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \
|
||||
-v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \
|
||||
-v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC12_LIBTMPL) > $(VC12_LIBVCXPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC12_SRCVCXPROJ)'"; \
|
||||
awk -v proj_type=vcxproj \
|
||||
-v src_srcs="$$sorted_src_srcs" \
|
||||
-v src_hdrs="$$sorted_src_hdrs" \
|
||||
-v src_rc="$$win32_src_rc" \
|
||||
-v src_x_srcs="$$sorted_src_x_srcs" \
|
||||
-v src_x_hdrs="$$sorted_src_x_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC12_SRCTMPL) > $(VC12_SRCVCXPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC14_LIBVCXPROJ)'"; \
|
||||
awk -v proj_type=vcxproj \
|
||||
-v lib_srcs="$$sorted_lib_srcs" \
|
||||
-v lib_hdrs="$$sorted_lib_hdrs" \
|
||||
-v lib_rc="$$win32_lib_rc" \
|
||||
-v lib_vauth_srcs="$$sorted_lib_vauth_srcs" \
|
||||
-v lib_vauth_hdrs="$$sorted_lib_vauth_hdrs" \
|
||||
-v lib_vtls_srcs="$$sorted_lib_vtls_srcs" \
|
||||
-v lib_vtls_hdrs="$$sorted_lib_vtls_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC14_LIBTMPL) > $(VC14_LIBVCXPROJ) || { exit 1; }; \
|
||||
\
|
||||
echo "generating '$(VC14_SRCVCXPROJ)'"; \
|
||||
awk -v proj_type=vcxproj \
|
||||
-v src_srcs="$$sorted_src_srcs" \
|
||||
-v src_hdrs="$$sorted_src_hdrs" \
|
||||
-v src_rc="$$win32_src_rc" \
|
||||
-v src_x_srcs="$$sorted_src_x_srcs" \
|
||||
-v src_x_hdrs="$$sorted_src_x_hdrs" \
|
||||
"$$awk_code" $(srcdir)/$(VC14_SRCTMPL) > $(VC14_SRCVCXPROJ) || { exit 1; };)
|
||||
1761
proxy_c/third-lib/libcurl/Makefile.in
Normal file
1761
proxy_c/third-lib/libcurl/Makefile.in
Normal file
File diff suppressed because it is too large
Load Diff
49
proxy_c/third-lib/libcurl/README
Normal file
49
proxy_c/third-lib/libcurl/README
Normal file
@@ -0,0 +1,49 @@
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
| (__| |_| | _ <| |___
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
README
|
||||
|
||||
Curl is a command line tool for transferring data specified with URL
|
||||
syntax. Find out how to use curl by reading the curl.1 man page or the
|
||||
MANUAL document. Find out how to install Curl by reading the INSTALL
|
||||
document.
|
||||
|
||||
libcurl is the library curl is using to do its job. It is readily
|
||||
available to be used by your software. Read the libcurl.3 man page to
|
||||
learn how!
|
||||
|
||||
You find answers to the most frequent questions we get in the FAQ document.
|
||||
|
||||
Study the COPYING file for distribution terms and similar. If you distribute
|
||||
curl binaries or other binaries that involve libcurl, you might enjoy the
|
||||
LICENSE-MIXING document.
|
||||
|
||||
CONTACT
|
||||
|
||||
If you have problems, questions, ideas or suggestions, please contact us
|
||||
by posting to a suitable mailing list. See https://curl.haxx.se/mail/
|
||||
|
||||
All contributors to the project are listed in the THANKS document.
|
||||
|
||||
WEB SITE
|
||||
|
||||
Visit the curl web site for the latest news and downloads:
|
||||
|
||||
https://curl.haxx.se/
|
||||
|
||||
GIT
|
||||
|
||||
To download the very latest source off the GIT server do this:
|
||||
|
||||
git clone https://github.com/curl/curl.git
|
||||
|
||||
(you'll get a directory named curl created, filled with the source code)
|
||||
|
||||
NOTICE
|
||||
|
||||
Curl contains pieces of source code that is Copyright (c) 1998, 1999
|
||||
Kungliga Tekniska Högskolan. This notice is included here to comply with the
|
||||
distribution terms.
|
||||
32
proxy_c/third-lib/libcurl/RELEASE-NOTES
Normal file
32
proxy_c/third-lib/libcurl/RELEASE-NOTES
Normal file
@@ -0,0 +1,32 @@
|
||||
Curl and libcurl 7.52.1
|
||||
|
||||
Public curl releases: 162
|
||||
Command line options: 204
|
||||
curl_easy_setopt() options: 243
|
||||
Public functions in libcurl: 61
|
||||
Contributors: 1480
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
o CVE-2016-9594: unititialized random [1]
|
||||
o lib557: fix checksrc warnings
|
||||
o lib: fix MSVC compiler warnings
|
||||
o lib557.c: use a shorter MAXIMIZE representation [2]
|
||||
o tests: run checksrc on debug builds
|
||||
|
||||
This release includes the following known bugs:
|
||||
|
||||
o see docs/KNOWN_BUGS (https://curl.haxx.se/docs/knownbugs.html)
|
||||
|
||||
This release would not have looked like this without help, code, reports and
|
||||
advice from friends like these:
|
||||
|
||||
Daniel Stenberg, Kamil Dudka, Marcel Raad, Ray Satiro,
|
||||
(4 contributors)
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
||||
References to bug reports and discussions on issues:
|
||||
|
||||
[1] = https://curl.haxx.se/docs/adv_20161223.html
|
||||
[2] = https://curl.haxx.se/mail/lib-2016-12/0098.html
|
||||
3245
proxy_c/third-lib/libcurl/acinclude.m4
Normal file
3245
proxy_c/third-lib/libcurl/acinclude.m4
Normal file
File diff suppressed because it is too large
Load Diff
1208
proxy_c/third-lib/libcurl/aclocal.m4
vendored
Normal file
1208
proxy_c/third-lib/libcurl/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
449
proxy_c/third-lib/libcurl/buildconf
Executable file
449
proxy_c/third-lib/libcurl/buildconf
Executable file
@@ -0,0 +1,449 @@
|
||||
#!/bin/sh
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2014, 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.haxx.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.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# die prints argument string to stdout and exits this shell script.
|
||||
#
|
||||
die(){
|
||||
echo "buildconf: $@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# findtool works as 'which' but we use a different name to make it more
|
||||
# obvious we aren't using 'which'! ;-)
|
||||
# Unlike 'which' does, the current directory is ignored.
|
||||
#
|
||||
findtool(){
|
||||
file="$1"
|
||||
|
||||
if { echo "$file" | grep "/" >/dev/null 2>&1; } then
|
||||
# when file is given with a path check it first
|
||||
if test -f "$file"; then
|
||||
echo "$file"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
old_IFS=$IFS; IFS=':'
|
||||
for path in $PATH
|
||||
do
|
||||
IFS=$old_IFS
|
||||
# echo "checks for $file in $path" >&2
|
||||
if test "$path" -a "$path" != '.' -a -f "$path/$file"; then
|
||||
echo "$path/$file"
|
||||
return
|
||||
fi
|
||||
done
|
||||
IFS=$old_IFS
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# removethis() removes all files and subdirectories with the given name,
|
||||
# inside and below the current subdirectory at invocation time.
|
||||
#
|
||||
removethis(){
|
||||
if test "$#" = "1"; then
|
||||
find . -depth -name $1 -print > buildconf.tmp.$$
|
||||
while read fdname
|
||||
do
|
||||
if test -f "$fdname"; then
|
||||
rm -f "$fdname"
|
||||
elif test -d "$fdname"; then
|
||||
rm -f -r "$fdname"
|
||||
fi
|
||||
done < buildconf.tmp.$$
|
||||
rm -f buildconf.tmp.$$
|
||||
fi
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Ensure that buildconf runs from the subdirectory where configure.ac lives
|
||||
#
|
||||
if test ! -f configure.ac ||
|
||||
test ! -f src/tool_main.c ||
|
||||
test ! -f lib/urldata.h ||
|
||||
test ! -f include/curl/curl.h ||
|
||||
test ! -f m4/curl-functions.m4; then
|
||||
echo "Can not run buildconf from outside of curl's source subdirectory!"
|
||||
echo "Change to the subdirectory where buildconf is found, and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# autoconf 2.57 or newer. Unpatched version 2.67 does not generate proper
|
||||
# configure script. Unpatched version 2.68 is simply unusable, we should
|
||||
# disallow 2.68 usage.
|
||||
#
|
||||
need_autoconf="2.57"
|
||||
ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
if test -z "$ac_version"; then
|
||||
echo "buildconf: autoconf not found."
|
||||
echo " You need autoconf version $need_autoconf or newer installed."
|
||||
exit 1
|
||||
fi
|
||||
old_IFS=$IFS; IFS='.'; set $ac_version; IFS=$old_IFS
|
||||
if test "$1" = "2" -a "$2" -lt "57" || test "$1" -lt "2"; then
|
||||
echo "buildconf: autoconf version $ac_version found."
|
||||
echo " You need autoconf version $need_autoconf or newer installed."
|
||||
echo " If you have a sufficient autoconf installed, but it"
|
||||
echo " is not named 'autoconf', then try setting the"
|
||||
echo " AUTOCONF environment variable."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "$1" = "2" -a "$2" -eq "67"; then
|
||||
echo "buildconf: autoconf version $ac_version (BAD)"
|
||||
echo " Unpatched version generates broken configure script."
|
||||
elif test "$1" = "2" -a "$2" -eq "68"; then
|
||||
echo "buildconf: autoconf version $ac_version (BAD)"
|
||||
echo " Unpatched version generates unusable configure script."
|
||||
else
|
||||
echo "buildconf: autoconf version $ac_version (ok)"
|
||||
fi
|
||||
|
||||
am4te_version=`${AUTOM4TE:-autom4te} --version 2>/dev/null|head -n 1| sed -e 's/autom4te\(.*\)/\1/' -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
if test -z "$am4te_version"; then
|
||||
echo "buildconf: autom4te not found. Weird autoconf installation!"
|
||||
exit 1
|
||||
fi
|
||||
if test "$am4te_version" = "$ac_version"; then
|
||||
echo "buildconf: autom4te version $am4te_version (ok)"
|
||||
else
|
||||
echo "buildconf: autom4te version $am4te_version (ERROR: does not match autoconf version)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# autoheader 2.50 or newer
|
||||
#
|
||||
ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
|
||||
if test -z "$ah_version"; then
|
||||
echo "buildconf: autoheader not found."
|
||||
echo " You need autoheader version 2.50 or newer installed."
|
||||
exit 1
|
||||
fi
|
||||
old_IFS=$IFS; IFS='.'; set $ah_version; IFS=$old_IFS
|
||||
if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
|
||||
echo "buildconf: autoheader version $ah_version found."
|
||||
echo " You need autoheader version 2.50 or newer installed."
|
||||
echo " If you have a sufficient autoheader installed, but it"
|
||||
echo " is not named 'autoheader', then try setting the"
|
||||
echo " AUTOHEADER environment variable."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "buildconf: autoheader version $ah_version (ok)"
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# automake 1.7 or newer
|
||||
#
|
||||
need_automake="1.7"
|
||||
am_version=`${AUTOMAKE:-automake} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'`
|
||||
if test -z "$am_version"; then
|
||||
echo "buildconf: automake not found."
|
||||
echo " You need automake version $need_automake or newer installed."
|
||||
exit 1
|
||||
fi
|
||||
old_IFS=$IFS; IFS='.'; set $am_version; IFS=$old_IFS
|
||||
if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then
|
||||
echo "buildconf: automake version $am_version found."
|
||||
echo " You need automake version $need_automake or newer installed."
|
||||
echo " If you have a sufficient automake installed, but it"
|
||||
echo " is not named 'automake', then try setting the"
|
||||
echo " AUTOMAKE environment variable."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "buildconf: automake version $am_version (ok)"
|
||||
|
||||
acloc_version=`${ACLOCAL:-aclocal} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'`
|
||||
if test -z "$acloc_version"; then
|
||||
echo "buildconf: aclocal not found. Weird automake installation!"
|
||||
exit 1
|
||||
fi
|
||||
if test "$acloc_version" = "$am_version"; then
|
||||
echo "buildconf: aclocal version $acloc_version (ok)"
|
||||
else
|
||||
echo "buildconf: aclocal version $acloc_version (ERROR: does not match automake version)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# GNU libtoolize preliminary check
|
||||
#
|
||||
want_lt_major=1
|
||||
want_lt_minor=4
|
||||
want_lt_patch=2
|
||||
want_lt_version=1.4.2
|
||||
|
||||
# This approach that tries 'glibtoolize' first is intended for systems that
|
||||
# have GNU libtool named as 'glibtoolize' and libtoolize not being GNU's.
|
||||
|
||||
libtoolize=`findtool glibtoolize 2>/dev/null`
|
||||
if test ! -x "$libtoolize"; then
|
||||
libtoolize=`findtool ${LIBTOOLIZE:-libtoolize}`
|
||||
fi
|
||||
if test -z "$libtoolize"; then
|
||||
echo "buildconf: libtoolize not found."
|
||||
echo " You need GNU libtoolize $want_lt_version or newer installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
lt_pver=`$libtoolize --version 2>/dev/null|head -n 1`
|
||||
lt_qver=`echo $lt_pver|sed -e "s/([^)]*)//g" -e "s/^[^0-9]*//g"`
|
||||
lt_version=`echo $lt_qver|sed -e "s/[- ].*//" -e "s/\([a-z]*\)$//"`
|
||||
if test -z "$lt_version"; then
|
||||
echo "buildconf: libtoolize not found."
|
||||
echo " You need GNU libtoolize $want_lt_version or newer installed."
|
||||
exit 1
|
||||
fi
|
||||
old_IFS=$IFS; IFS='.'; set $lt_version; IFS=$old_IFS
|
||||
lt_major=$1
|
||||
lt_minor=$2
|
||||
lt_patch=$3
|
||||
|
||||
if test -z "$lt_major"; then
|
||||
lt_status="bad"
|
||||
elif test "$lt_major" -gt "$want_lt_major"; then
|
||||
lt_status="good"
|
||||
elif test "$lt_major" -lt "$want_lt_major"; then
|
||||
lt_status="bad"
|
||||
elif test -z "$lt_minor"; then
|
||||
lt_status="bad"
|
||||
elif test "$lt_minor" -gt "$want_lt_minor"; then
|
||||
lt_status="good"
|
||||
elif test "$lt_minor" -lt "$want_lt_minor"; then
|
||||
lt_status="bad"
|
||||
elif test -z "$lt_patch"; then
|
||||
lt_status="bad"
|
||||
elif test "$lt_patch" -gt "$want_lt_patch"; then
|
||||
lt_status="good"
|
||||
elif test "$lt_patch" -lt "$want_lt_patch"; then
|
||||
lt_status="bad"
|
||||
else
|
||||
lt_status="good"
|
||||
fi
|
||||
if test "$lt_status" != "good"; then
|
||||
echo "buildconf: libtoolize version $lt_version found."
|
||||
echo " You need GNU libtoolize $want_lt_version or newer installed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "buildconf: libtoolize version $lt_version (ok)"
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# m4 check
|
||||
#
|
||||
m4=`(${M4:-m4} --version || ${M4:-gm4} --version) 2>/dev/null | head -n 1`;
|
||||
m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
|
||||
|
||||
if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
|
||||
echo "buildconf: GNU m4 version $m4_version (ok)"
|
||||
else
|
||||
if test -z "$m4"; then
|
||||
echo "buildconf: m4 version not recognized. You need a GNU m4 installed!"
|
||||
else
|
||||
echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# perl check
|
||||
#
|
||||
PERL=`findtool ${PERL:-perl}`
|
||||
if test -z "$PERL"; then
|
||||
echo "buildconf: perl not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Remove files generated on previous buildconf/configure run.
|
||||
#
|
||||
for fname in .deps \
|
||||
.libs \
|
||||
*.la \
|
||||
*.lo \
|
||||
*.a \
|
||||
*.o \
|
||||
Makefile \
|
||||
Makefile.in \
|
||||
aclocal.m4 \
|
||||
aclocal.m4.bak \
|
||||
ares_build.h \
|
||||
ares_config.h \
|
||||
ares_config.h.in \
|
||||
autom4te.cache \
|
||||
compile \
|
||||
config.guess \
|
||||
curl_config.h \
|
||||
curl_config.h.in \
|
||||
config.log \
|
||||
config.lt \
|
||||
config.status \
|
||||
config.sub \
|
||||
configure \
|
||||
configurehelp.pm \
|
||||
curl-config \
|
||||
curlbuild.h \
|
||||
depcomp \
|
||||
libcares.pc \
|
||||
libcurl.pc \
|
||||
libtool \
|
||||
libtool.m4 \
|
||||
libtool.m4.tmp \
|
||||
ltmain.sh \
|
||||
ltoptions.m4 \
|
||||
ltsugar.m4 \
|
||||
ltversion.m4 \
|
||||
lt~obsolete.m4 \
|
||||
missing \
|
||||
install-sh \
|
||||
stamp-h1 \
|
||||
stamp-h2 \
|
||||
stamp-h3 ; do
|
||||
removethis "$fname"
|
||||
done
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# run the correct scripts now
|
||||
#
|
||||
|
||||
echo "buildconf: running libtoolize"
|
||||
${libtoolize} --copy --force || die "libtoolize command failed"
|
||||
|
||||
# When using libtool 1.5.X (X < 26) we copy libtool.m4 to our local m4
|
||||
# subdirectory and this local copy is patched to fix some warnings that
|
||||
# are triggered when running aclocal and using autoconf 2.62 or later.
|
||||
|
||||
if test "$lt_major" = "1" && test "$lt_minor" = "5"; then
|
||||
if test -z "$lt_patch" || test "$lt_patch" -lt "26"; then
|
||||
echo "buildconf: copying libtool.m4 to local m4 subdir"
|
||||
ac_dir=`${ACLOCAL:-aclocal} --print-ac-dir`
|
||||
if test -f $ac_dir/libtool.m4; then
|
||||
cp -f $ac_dir/libtool.m4 m4/libtool.m4
|
||||
else
|
||||
echo "buildconf: $ac_dir/libtool.m4 not found"
|
||||
fi
|
||||
if test -f m4/libtool.m4; then
|
||||
echo "buildconf: renaming some variables in local m4/libtool.m4"
|
||||
$PERL -i.tmp -pe \
|
||||
's/lt_prog_compiler_pic_works/lt_cv_prog_compiler_pic_works/g; \
|
||||
s/lt_prog_compiler_static_works/lt_cv_prog_compiler_static_works/g;' \
|
||||
m4/libtool.m4
|
||||
rm -f m4/libtool.m4.tmp
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -f m4/libtool.m4; then
|
||||
echo "buildconf: converting all mv to mv -f in local m4/libtool.m4"
|
||||
$PERL -i.tmp -pe 's/\bmv +([^-\s])/mv -f $1/g' m4/libtool.m4
|
||||
rm -f m4/libtool.m4.tmp
|
||||
fi
|
||||
|
||||
echo "buildconf: running aclocal"
|
||||
${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS || die "aclocal command failed"
|
||||
|
||||
echo "buildconf: converting all mv to mv -f in local aclocal.m4"
|
||||
$PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
|
||||
|
||||
echo "buildconf: running autoheader"
|
||||
${AUTOHEADER:-autoheader} || die "autoheader command failed"
|
||||
|
||||
echo "buildconf: running autoconf"
|
||||
${AUTOCONF:-autoconf} || die "autoconf command failed"
|
||||
|
||||
if test -d ares; then
|
||||
cd ares
|
||||
echo "buildconf: running in ares"
|
||||
./buildconf
|
||||
cd ..
|
||||
fi
|
||||
|
||||
echo "buildconf: running automake"
|
||||
${AUTOMAKE:-automake} --add-missing --copy || die "automake command failed"
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# GNU libtool complementary check
|
||||
#
|
||||
# Depending on the libtool and automake versions being used, config.guess
|
||||
# might not be installed in the subdirectory until automake has finished.
|
||||
# So we can not attempt to use it until this very last buildconf stage.
|
||||
#
|
||||
if test ! -f ./config.guess; then
|
||||
echo "buildconf: config.guess not found"
|
||||
else
|
||||
buildhost=`./config.guess 2>/dev/null|head -n 1`
|
||||
case $buildhost in
|
||||
*-*-darwin*)
|
||||
need_lt_major=1
|
||||
need_lt_minor=5
|
||||
need_lt_patch=26
|
||||
need_lt_check="yes"
|
||||
;;
|
||||
*-*-hpux*)
|
||||
need_lt_major=1
|
||||
need_lt_minor=5
|
||||
need_lt_patch=24
|
||||
need_lt_check="yes"
|
||||
;;
|
||||
esac
|
||||
if test ! -z "$need_lt_check"; then
|
||||
if test -z "$lt_major"; then
|
||||
lt_status="bad"
|
||||
elif test "$lt_major" -gt "$need_lt_major"; then
|
||||
lt_status="good"
|
||||
elif test "$lt_major" -lt "$need_lt_major"; then
|
||||
lt_status="bad"
|
||||
elif test -z "$lt_minor"; then
|
||||
lt_status="bad"
|
||||
elif test "$lt_minor" -gt "$need_lt_minor"; then
|
||||
lt_status="good"
|
||||
elif test "$lt_minor" -lt "$need_lt_minor"; then
|
||||
lt_status="bad"
|
||||
elif test -z "$lt_patch"; then
|
||||
lt_status="bad"
|
||||
elif test "$lt_patch" -gt "$need_lt_patch"; then
|
||||
lt_status="good"
|
||||
elif test "$lt_patch" -lt "$need_lt_patch"; then
|
||||
lt_status="bad"
|
||||
else
|
||||
lt_status="good"
|
||||
fi
|
||||
if test "$lt_status" != "good"; then
|
||||
need_lt_version="$need_lt_major.$need_lt_minor.$need_lt_patch"
|
||||
echo "buildconf: libtool version $lt_version found."
|
||||
echo " $buildhost requires GNU libtool $need_lt_version or newer installed."
|
||||
rm -f configure
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Finished successfully.
|
||||
#
|
||||
echo "buildconf: OK"
|
||||
exit 0
|
||||
350
proxy_c/third-lib/libcurl/buildconf.bat
Normal file
350
proxy_c/third-lib/libcurl/buildconf.bat
Normal file
@@ -0,0 +1,350 @@
|
||||
@echo off
|
||||
rem ***************************************************************************
|
||||
rem * _ _ ____ _
|
||||
rem * Project ___| | | | _ \| |
|
||||
rem * / __| | | | |_) | |
|
||||
rem * | (__| |_| | _ <| |___
|
||||
rem * \___|\___/|_| \_\_____|
|
||||
rem *
|
||||
rem * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
rem *
|
||||
rem * This software is licensed as described in the file COPYING, which
|
||||
rem * you should have received as part of this distribution. The terms
|
||||
rem * are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
rem *
|
||||
rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
rem * copies of the Software, and permit persons to whom the Software is
|
||||
rem * furnished to do so, under the terms of the COPYING file.
|
||||
rem *
|
||||
rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
rem * KIND, either express or implied.
|
||||
rem *
|
||||
rem ***************************************************************************
|
||||
|
||||
rem NOTES
|
||||
rem
|
||||
rem This batch file must be used to set up a git tree to build on systems where
|
||||
rem there is no autotools support (i.e. DOS and Windows).
|
||||
rem
|
||||
|
||||
:begin
|
||||
rem Set our variables
|
||||
if "%OS%" == "Windows_NT" setlocal
|
||||
set MODE=GENERATE
|
||||
|
||||
rem Switch to this batch file's directory
|
||||
cd /d "%~0\.." 1>NUL 2>&1
|
||||
|
||||
rem Check we are running from a curl git repository
|
||||
if not exist GIT-INFO goto norepo
|
||||
|
||||
rem Detect programs. HAVE_<PROGNAME>
|
||||
rem When not found the variable is set undefined. The undefined pattern
|
||||
rem allows for statements like "if not defined HAVE_PERL (command)"
|
||||
groff --version <NUL 1>NUL 2>&1
|
||||
if errorlevel 1 (set HAVE_GROFF=) else (set HAVE_GROFF=Y)
|
||||
nroff --version <NUL 1>NUL 2>&1
|
||||
if errorlevel 1 (set HAVE_NROFF=) else (set HAVE_NROFF=Y)
|
||||
perl --version <NUL 1>NUL 2>&1
|
||||
if errorlevel 1 (set HAVE_PERL=) else (set HAVE_PERL=Y)
|
||||
gzip --version <NUL 1>NUL 2>&1
|
||||
if errorlevel 1 (set HAVE_GZIP=) else (set HAVE_GZIP=Y)
|
||||
|
||||
:parseArgs
|
||||
if "%~1" == "" goto start
|
||||
|
||||
if /i "%~1" == "-clean" (
|
||||
set MODE=CLEAN
|
||||
) else if /i "%~1" == "-?" (
|
||||
goto syntax
|
||||
) else if /i "%~1" == "-h" (
|
||||
goto syntax
|
||||
) else if /i "%~1" == "-help" (
|
||||
goto syntax
|
||||
) else (
|
||||
goto unknown
|
||||
)
|
||||
|
||||
shift & goto parseArgs
|
||||
|
||||
:start
|
||||
if "%MODE%" == "GENERATE" (
|
||||
echo.
|
||||
echo Generating prerequisite files
|
||||
|
||||
call :generate
|
||||
if errorlevel 4 goto nogencurlbuild
|
||||
if errorlevel 3 goto nogenhugehelp
|
||||
if errorlevel 2 goto nogenmakefile
|
||||
if errorlevel 1 goto warning
|
||||
|
||||
) else (
|
||||
echo.
|
||||
echo Removing prerequisite files
|
||||
|
||||
call :clean
|
||||
if errorlevel 3 goto nocleancurlbuild
|
||||
if errorlevel 2 goto nocleanhugehelp
|
||||
if errorlevel 1 goto nocleanmakefile
|
||||
)
|
||||
|
||||
goto success
|
||||
|
||||
rem Main generate function.
|
||||
rem
|
||||
rem Returns:
|
||||
rem
|
||||
rem 0 - success
|
||||
rem 1 - success with simplified tool_hugehelp.c
|
||||
rem 2 - failed to generate Makefile
|
||||
rem 3 - failed to generate tool_hugehelp.c
|
||||
rem 4 - failed to generate curlbuild.h
|
||||
rem
|
||||
:generate
|
||||
if "%OS%" == "Windows_NT" setlocal
|
||||
set BASIC_HUGEHELP=0
|
||||
|
||||
rem Create Makefile
|
||||
echo * %CD%\Makefile
|
||||
if exist Makefile.dist (
|
||||
copy /Y Makefile.dist Makefile 1>NUL 2>&1
|
||||
if errorlevel 1 (
|
||||
if "%OS%" == "Windows_NT" endlocal
|
||||
exit /B 2
|
||||
)
|
||||
)
|
||||
|
||||
rem Create tool_hugehelp.c
|
||||
echo * %CD%\src\tool_hugehelp.c
|
||||
call :genHugeHelp
|
||||
if errorlevel 2 (
|
||||
if "%OS%" == "Windows_NT" endlocal
|
||||
exit /B 3
|
||||
)
|
||||
if errorlevel 1 (
|
||||
set BASIC_HUGEHELP=1
|
||||
)
|
||||
cmd /c exit 0
|
||||
|
||||
rem Create curlbuild.h
|
||||
echo * %CD%\include\curl\curlbuild.h
|
||||
if exist include\curl\curlbuild.h.dist (
|
||||
copy /Y include\curl\curlbuild.h.dist include\curl\curlbuild.h 1>NUL 2>&1
|
||||
if errorlevel 1 (
|
||||
if "%OS%" == "Windows_NT" endlocal
|
||||
exit /B 4
|
||||
)
|
||||
)
|
||||
|
||||
rem Setup c-ares git tree
|
||||
if exist ares\buildconf.bat (
|
||||
echo.
|
||||
echo Configuring c-ares build environment
|
||||
cd ares
|
||||
call buildconf.bat
|
||||
cd ..
|
||||
)
|
||||
|
||||
if "%BASIC_HUGEHELP%" == "1" (
|
||||
if "%OS%" == "Windows_NT" endlocal
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
if "%OS%" == "Windows_NT" endlocal
|
||||
exit /B 0
|
||||
|
||||
rem Main clean function.
|
||||
rem
|
||||
rem Returns:
|
||||
rem
|
||||
rem 0 - success
|
||||
rem 1 - failed to clean Makefile
|
||||
rem 2 - failed to clean tool_hugehelp.c
|
||||
rem 3 - failed to clean curlbuild.h
|
||||
rem
|
||||
:clean
|
||||
rem Remove Makefile
|
||||
echo * %CD%\Makefile
|
||||
if exist Makefile (
|
||||
del Makefile 2>NUL
|
||||
if exist Makefile (
|
||||
exit /B 1
|
||||
)
|
||||
)
|
||||
|
||||
rem Remove tool_hugehelp.c
|
||||
echo * %CD%\src\tool_hugehelp.c
|
||||
if exist src\tool_hugehelp.c (
|
||||
del src\tool_hugehelp.c 2>NUL
|
||||
if exist src\tool_hugehelp.c (
|
||||
exit /B 2
|
||||
)
|
||||
)
|
||||
|
||||
rem Remove curlbuild.h
|
||||
echo * %CD%\include\curl\curlbuild.h
|
||||
if exist include\curl\curlbuild.h (
|
||||
del include\curl\curlbuild.h 2>NUL
|
||||
if exist include\curl\curlbuild.h (
|
||||
exit /B 3
|
||||
)
|
||||
)
|
||||
|
||||
exit /B
|
||||
|
||||
rem Function to generate src\tool_hugehelp.c
|
||||
rem
|
||||
rem Returns:
|
||||
rem
|
||||
rem 0 - full tool_hugehelp.c generated
|
||||
rem 1 - simplified tool_hugehelp.c
|
||||
rem 2 - failure
|
||||
rem
|
||||
:genHugeHelp
|
||||
if "%OS%" == "Windows_NT" setlocal
|
||||
set LC_ALL=C
|
||||
set ROFFCMD=
|
||||
set BASIC=1
|
||||
|
||||
if defined HAVE_PERL (
|
||||
if defined HAVE_GROFF (
|
||||
set ROFFCMD=groff -mtty-char -Tascii -P-c -man
|
||||
) else if defined HAVE_NROFF (
|
||||
set ROFFCMD=nroff -c -Tascii -man
|
||||
)
|
||||
)
|
||||
|
||||
if defined ROFFCMD (
|
||||
echo #include "tool_setup.h"> src\tool_hugehelp.c
|
||||
echo #include "tool_hugehelp.h">> src\tool_hugehelp.c
|
||||
|
||||
if defined HAVE_GZIP (
|
||||
echo #ifndef HAVE_LIBZ>> src\tool_hugehelp.c
|
||||
)
|
||||
|
||||
%ROFFCMD% docs\curl.1 2>NUL | perl src\mkhelp.pl docs\MANUAL >> src\tool_hugehelp.c
|
||||
if defined HAVE_GZIP (
|
||||
echo #else>> src\tool_hugehelp.c
|
||||
%ROFFCMD% docs\curl.1 2>NUL | perl src\mkhelp.pl -c docs\MANUAL >> src\tool_hugehelp.c
|
||||
echo #endif /^* HAVE_LIBZ ^*/>> src\tool_hugehelp.c
|
||||
)
|
||||
|
||||
set BASIC=0
|
||||
) else (
|
||||
if exist src\tool_hugehelp.c.cvs (
|
||||
copy /Y src\tool_hugehelp.c.cvs src\tool_hugehelp.c 1>NUL 2>&1
|
||||
) else (
|
||||
echo #include "tool_setup.h"> src\tool_hugehelp.c
|
||||
echo #include "tool_hugehelp.hd">> src\tool_hugehelp.c
|
||||
echo.>> src\tool_hugehelp.c
|
||||
echo void hugehelp(void^)>> src\tool_hugehelp.c
|
||||
echo {>> src\tool_hugehelp.c
|
||||
echo #ifdef USE_MANUAL>> src\tool_hugehelp.c
|
||||
echo fputs("Built-in manual not included\n", stdout^);>> src\tool_hugehelp.c
|
||||
echo #endif>> src\tool_hugehelp.c
|
||||
echo }>> src\tool_hugehelp.c
|
||||
)
|
||||
)
|
||||
|
||||
findstr "/C:void hugehelp(void)" src\tool_hugehelp.c 1>NUL 2>&1
|
||||
if errorlevel 1 (
|
||||
if "%OS%" == "Windows_NT" endlocal
|
||||
exit /B 2
|
||||
)
|
||||
|
||||
if "%BASIC%" == "1" (
|
||||
if "%OS%" == "Windows_NT" endlocal
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
if "%OS%" == "Windows_NT" endlocal
|
||||
exit /B 0
|
||||
|
||||
rem Function to clean-up local variables under DOS, Windows 3.x and
|
||||
rem Windows 9x as setlocal isn't available until Windows NT
|
||||
rem
|
||||
:dosCleanup
|
||||
set MODE=
|
||||
set HAVE_GROFF=
|
||||
set HAVE_NROFF=
|
||||
set HAVE_PERL=
|
||||
set HAVE_GZIP=
|
||||
set BASIC_HUGEHELP=
|
||||
set LC_ALL
|
||||
set ROFFCMD=
|
||||
set BASIC=
|
||||
|
||||
exit /B
|
||||
|
||||
:syntax
|
||||
rem Display the help
|
||||
echo.
|
||||
echo Usage: buildconf [-clean]
|
||||
echo.
|
||||
echo -clean - Removes the files
|
||||
goto error
|
||||
|
||||
:unknown
|
||||
echo.
|
||||
echo Error: Unknown argument '%1'
|
||||
goto error
|
||||
|
||||
:norepo
|
||||
echo.
|
||||
echo Error: This batch file should only be used with a curl git repository
|
||||
goto error
|
||||
|
||||
:nogenmakefile
|
||||
echo.
|
||||
echo Error: Unable to generate Makefile
|
||||
goto error
|
||||
|
||||
:nogenhugehelp
|
||||
echo.
|
||||
echo Error: Unable to generate src\tool_hugehelp.c
|
||||
goto error
|
||||
|
||||
:nogencurlbuild
|
||||
echo.
|
||||
echo Error: Unable to generate include\curl\curlbuild.h
|
||||
goto error
|
||||
|
||||
:nocleanmakefile
|
||||
echo.
|
||||
echo Error: Unable to clean Makefile
|
||||
goto error
|
||||
|
||||
:nocleanhugehelp
|
||||
echo.
|
||||
echo Error: Unable to clean src\tool_hugehelp.c
|
||||
goto error
|
||||
|
||||
:nocleancurlbuild
|
||||
echo.
|
||||
echo Error: Unable to clean include\curl\curlbuild.h
|
||||
goto error
|
||||
|
||||
:warning
|
||||
echo.
|
||||
echo Warning: The curl manual could not be integrated in the source. This means when
|
||||
echo you build curl the manual will not be available (curl --man^). Integration of
|
||||
echo the manual is not required and a summary of the options will still be available
|
||||
echo (curl --help^). To integrate the manual your PATH is required to have
|
||||
echo groff/nroff, perl and optionally gzip for compression.
|
||||
goto success
|
||||
|
||||
:error
|
||||
if "%OS%" == "Windows_NT" (
|
||||
endlocal
|
||||
) else (
|
||||
call :dosCleanup
|
||||
)
|
||||
exit /B 1
|
||||
|
||||
:success
|
||||
if "%OS%" == "Windows_NT" (
|
||||
endlocal
|
||||
) else (
|
||||
call :dosCleanup
|
||||
)
|
||||
exit /B 0
|
||||
347
proxy_c/third-lib/libcurl/compile
Executable file
347
proxy_c/third-lib/libcurl/compile
Executable file
@@ -0,0 +1,347 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2012-10-14.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
1462
proxy_c/third-lib/libcurl/config.guess
vendored
Executable file
1462
proxy_c/third-lib/libcurl/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load Diff
63819
proxy_c/third-lib/libcurl/config.log
Normal file
63819
proxy_c/third-lib/libcurl/config.log
Normal file
File diff suppressed because it is too large
Load Diff
2376
proxy_c/third-lib/libcurl/config.status
Executable file
2376
proxy_c/third-lib/libcurl/config.status
Executable file
File diff suppressed because it is too large
Load Diff
1825
proxy_c/third-lib/libcurl/config.sub
vendored
Executable file
1825
proxy_c/third-lib/libcurl/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load Diff
43682
proxy_c/third-lib/libcurl/configure
vendored
Executable file
43682
proxy_c/third-lib/libcurl/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
3909
proxy_c/third-lib/libcurl/configure.ac
Normal file
3909
proxy_c/third-lib/libcurl/configure.ac
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user