OCT 1. 更新格式化代码
This commit is contained in:
parent
f82cb95c05
commit
abd393322d
|
@ -2,6 +2,7 @@
|
|||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
InsertBraces: true
|
||||
AlignArrayOfStructures: Left
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: Consecutive
|
||||
AlignConsecutiveAssignments: Consecutive
|
||||
|
@ -26,8 +27,9 @@ AlwaysBreakBeforeMultilineStrings: true
|
|||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
- __unused
|
||||
BinPackArguments: false
|
||||
BinPackParameters: true
|
||||
BinPackParameters: false
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
|
@ -57,7 +59,7 @@ BreakConstructorInitializersBeforeComma: false
|
|||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 140
|
||||
ColumnLimit: 120
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: true
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
|
@ -174,7 +176,7 @@ SpaceAroundPointerQualifiers: Default
|
|||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 0
|
||||
SpacesBeforeTrailingComments: 4
|
||||
SpacesInAngles: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
|
@ -199,3 +201,6 @@ WhitespaceSensitiveMacros:
|
|||
- BOOST_PP_STRINGIZE
|
||||
- NS_SWIFT_NAME
|
||||
- CF_SWIFT_NAME
|
||||
TypenameMacros:
|
||||
- CONFIG_ITEM
|
||||
- PCONFIG_ITEM
|
||||
|
|
|
@ -47,7 +47,7 @@ IF (USED_SQLITE)
|
|||
-DSQLITE_HAVE_ZLIB=1 -DSQLITE_TEMP_STORE=2")
|
||||
ENDIF ()
|
||||
|
||||
ADD_DEFINITIONS(-DBUILD_VERSION="${GIT_VERSION}" ${COMMON_DEFINE})
|
||||
ADD_DEFINITIONS(-DBUILD_VERSION= "${GIT_VERSION}" ${COMMON_DEFINE})
|
||||
|
||||
LINK_LIBRARIES(${COMMON_LIBS})
|
||||
ADD_LIBRARY(${LIB_PROJECT_TARGET} ${C_SRC} ${C_HEADS})
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -188,50 +188,110 @@ ARG_EXTERN struct arg_rem *arg_rem(const char *datatype, const char *glossary);
|
|||
|
||||
ARG_EXTERN struct arg_lit *arg_lit0(const char *shortopts, const char *longopts, const char *glossary);
|
||||
ARG_EXTERN struct arg_lit *arg_lit1(const char *shortopts, const char *longopts, const char *glossary);
|
||||
ARG_EXTERN struct arg_lit *arg_litn(const char *shortopts, const char *longopts, int mincount, int maxcount,
|
||||
ARG_EXTERN struct arg_lit *arg_litn(const char *shortopts,
|
||||
const char *longopts,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
ARG_EXTERN struct arg_int *arg_int0(const char *shortopts, const char *longopts, const char *datatype,
|
||||
ARG_EXTERN struct arg_int *arg_int0(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_int *arg_int1(const char *shortopts, const char *longopts, const char *datatype,
|
||||
ARG_EXTERN struct arg_int *arg_int1(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_int *arg_intn(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_int *arg_intn(const char *shortopts, const char *longopts, const char *datatype, int mincount,
|
||||
int maxcount, const char *glossary);
|
||||
|
||||
ARG_EXTERN struct arg_dbl *arg_dbl0(const char *shortopts, const char *longopts, const char *datatype,
|
||||
ARG_EXTERN struct arg_dbl *arg_dbl0(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_dbl *arg_dbl1(const char *shortopts, const char *longopts, const char *datatype,
|
||||
ARG_EXTERN struct arg_dbl *arg_dbl1(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_dbl *arg_dbln(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_dbl *arg_dbln(const char *shortopts, const char *longopts, const char *datatype, int mincount,
|
||||
int maxcount, const char *glossary);
|
||||
|
||||
ARG_EXTERN struct arg_str *arg_str0(const char *shortopts, const char *longopts, const char *datatype,
|
||||
ARG_EXTERN struct arg_str *arg_str0(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_str *arg_str1(const char *shortopts, const char *longopts, const char *datatype,
|
||||
ARG_EXTERN struct arg_str *arg_str1(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_str *arg_strn(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_str *arg_strn(const char *shortopts, const char *longopts, const char *datatype, int mincount,
|
||||
int maxcount, const char *glossary);
|
||||
|
||||
ARG_EXTERN struct arg_rex *arg_rex0(const char *shortopts, const char *longopts, const char *pattern,
|
||||
const char *datatype, int flags, const char *glossary);
|
||||
ARG_EXTERN struct arg_rex *arg_rex1(const char *shortopts, const char *longopts, const char *pattern,
|
||||
const char *datatype, int flags, const char *glossary);
|
||||
ARG_EXTERN struct arg_rex *arg_rexn(const char *shortopts, const char *longopts, const char *pattern,
|
||||
const char *datatype, int mincount, int maxcount, int flags, const char *glossary);
|
||||
|
||||
ARG_EXTERN struct arg_file *arg_file0(const char *shortopts, const char *longopts, const char *datatype,
|
||||
ARG_EXTERN struct arg_rex *arg_rex0(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *pattern,
|
||||
const char *datatype,
|
||||
int flags,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_file *arg_file1(const char *shortopts, const char *longopts, const char *datatype,
|
||||
ARG_EXTERN struct arg_rex *arg_rex1(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *pattern,
|
||||
const char *datatype,
|
||||
int flags,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_rex *arg_rexn(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *pattern,
|
||||
const char *datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
int flags,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_file *arg_filen(const char *shortopts, const char *longopts, const char *datatype, int mincount,
|
||||
int maxcount, const char *glossary);
|
||||
|
||||
ARG_EXTERN struct arg_date *arg_date0(const char *shortopts, const char *longopts, const char *format,
|
||||
const char *datatype, const char *glossary);
|
||||
ARG_EXTERN struct arg_date *arg_date1(const char *shortopts, const char *longopts, const char *format,
|
||||
const char *datatype, const char *glossary);
|
||||
ARG_EXTERN struct arg_date *arg_daten(const char *shortopts, const char *longopts, const char *format,
|
||||
const char *datatype, int mincount, int maxcount, const char *glossary);
|
||||
ARG_EXTERN struct arg_file *arg_file0(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_file *arg_file1(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_file *arg_filen(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
ARG_EXTERN struct arg_date *arg_date0(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *format,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_date *arg_date1(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *format,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
ARG_EXTERN struct arg_date *arg_daten(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *format,
|
||||
const char *datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
ARG_EXTERN struct arg_end *arg_end(int maxerrors);
|
||||
|
||||
|
@ -242,14 +302,20 @@ ARG_EXTERN struct arg_end *arg_end(int maxerrors);
|
|||
/**** other functions *******************************************/
|
||||
ARG_EXTERN int arg_nullcheck(void **argtable);
|
||||
ARG_EXTERN int arg_parse(int argc, char **argv, void **argtable);
|
||||
ARG_EXTERN void arg_print_option(FILE *fp, const char *shortopts, const char *longopts, const char *datatype,
|
||||
ARG_EXTERN void arg_print_option(FILE *fp,
|
||||
const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *suffix);
|
||||
ARG_EXTERN void arg_print_syntax(FILE *fp, void **argtable, const char *suffix);
|
||||
ARG_EXTERN void arg_print_syntaxv(FILE *fp, void **argtable, const char *suffix);
|
||||
ARG_EXTERN void arg_print_glossary(FILE *fp, void **argtable, const char *format);
|
||||
ARG_EXTERN void arg_print_glossary_gnu(FILE *fp, void **argtable);
|
||||
ARG_EXTERN void arg_print_errors(FILE *fp, struct arg_end *end, const char *progname);
|
||||
ARG_EXTERN void arg_print_option_ds(arg_dstr_t ds, const char *shortopts, const char *longopts, const char *datatype,
|
||||
ARG_EXTERN void arg_print_option_ds(arg_dstr_t ds,
|
||||
const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *suffix);
|
||||
ARG_EXTERN void arg_print_syntax_ds(arg_dstr_t ds, void **argtable, const char *suffix);
|
||||
ARG_EXTERN void arg_print_syntaxv_ds(arg_dstr_t ds, void **argtable, const char *suffix);
|
||||
|
@ -285,8 +351,13 @@ ARG_EXTERN void arg_mgsort(void *data, int size, int esize, int i, in
|
|||
ARG_EXTERN void arg_make_get_help_msg(arg_dstr_t res);
|
||||
ARG_EXTERN void arg_make_help_msg(arg_dstr_t ds, char *cmd_name, void **argtable);
|
||||
ARG_EXTERN void arg_make_syntax_err_msg(arg_dstr_t ds, void **argtable, struct arg_end *end);
|
||||
ARG_EXTERN int arg_make_syntax_err_help_msg(arg_dstr_t ds, char *name, int help, int nerrors, void **argtable,
|
||||
struct arg_end *end, int *exitcode);
|
||||
ARG_EXTERN int arg_make_syntax_err_help_msg(arg_dstr_t ds,
|
||||
char *name,
|
||||
int help,
|
||||
int nerrors,
|
||||
void **argtable,
|
||||
struct arg_end *end,
|
||||
int *exitcode);
|
||||
ARG_EXTERN void arg_set_module_name(const char *name);
|
||||
ARG_EXTERN void arg_set_module_version(int major, int minor, int patch, const char *tag);
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@ typedef struct __ARG_TBL_INFO {
|
|||
static PARG_TBL_INFO g_pArgTbl = NULL;
|
||||
static unsigned int g_nArgTbl = 0;
|
||||
static const char *g_toolsKey[][2] = {
|
||||
{"cfg_all", "get all configuration information"},
|
||||
{"mem_info", "show the memory alloc information"},
|
||||
{"cfg_all", "get all configuration information" },
|
||||
{"mem_info", "show the memory alloc information" },
|
||||
{"sys_info", "show the system and hardware information"},
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ const vector config_get_dhcp_replication_svr() {
|
|||
}
|
||||
#endif
|
||||
|
||||
const char* config_get_http_server_addr() {
|
||||
const char *config_get_http_server_addr() {
|
||||
return cfg_get_string_value(CFG_HTTP_SVR_ADDR);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,11 @@ static void onEVPWorkCb(uv_work_t *pWork) {
|
|||
}
|
||||
}
|
||||
|
||||
int evp_add_crypto_task(CRYPTO_TYPE type, unsigned char *pInBuf, unsigned int iSize, unsigned char *pOutBuf, char *pKey,
|
||||
int evp_add_crypto_task(CRYPTO_TYPE type,
|
||||
unsigned char *pInBuf,
|
||||
unsigned int iSize,
|
||||
unsigned char *pOutBuf,
|
||||
char *pKey,
|
||||
on_evp_crypto onEvpCryptCb) {
|
||||
uv_work_t *puvWork = NULL;
|
||||
PCRYPT_TASK_PARAMS pTask = NULL;
|
||||
|
|
|
@ -92,7 +92,10 @@ int hash_digest_file(HASH_TYPE hashType, const char *pFileName, char **pHashValu
|
|||
* @param pHashValue
|
||||
* @return
|
||||
*/
|
||||
int hash_digest_mem(HASH_TYPE hashType, const unsigned char *pBuf, unsigned int iBufLen, unsigned char **pHashValue,
|
||||
int hash_digest_mem(HASH_TYPE hashType,
|
||||
const unsigned char *pBuf,
|
||||
unsigned int iBufLen,
|
||||
unsigned char **pHashValue,
|
||||
unsigned int *pOutSize) {
|
||||
EVP_MD_CTX *pCtx;
|
||||
|
||||
|
|
|
@ -110,8 +110,12 @@ static int sha1prng_for_aes_key(const char *pKey, unsigned char *pShaPrng16) {
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
int symmetric_decrypto(AES_TYPE algorithmType, unsigned char *pInBuf, unsigned int inSize, unsigned char **pOutBuf,
|
||||
int *pOutSize, const char *pKey) {
|
||||
int symmetric_decrypto(AES_TYPE algorithmType,
|
||||
unsigned char *pInBuf,
|
||||
unsigned int inSize,
|
||||
unsigned char **pOutBuf,
|
||||
int *pOutSize,
|
||||
const char *pKey) {
|
||||
int enBytes = 0;
|
||||
EVP_CIPHER_CTX *pCtx;
|
||||
unsigned char *pAesBuf;
|
||||
|
@ -180,8 +184,12 @@ int symmetric_decrypto(AES_TYPE algorithmType, unsigned char *pInBuf, unsigned i
|
|||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
int symmetric_encrypto(AES_TYPE algorithmType, unsigned char *pInBuf, unsigned int inSize, unsigned char **pOutBuf,
|
||||
int *pOutSize, const char *pKey) {
|
||||
int symmetric_encrypto(AES_TYPE algorithmType,
|
||||
unsigned char *pInBuf,
|
||||
unsigned int inSize,
|
||||
unsigned char **pOutBuf,
|
||||
int *pOutSize,
|
||||
const char *pKey) {
|
||||
int enBytes = 0;
|
||||
unsigned char *pAesBuf;
|
||||
EVP_CIPHER_CTX *pCtx;
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
|
||||
/* Enable large inode numbers on Mac OS X 10.5. */
|
||||
#ifndef _DARWIN_USE_64_BIT_INODE
|
||||
# define _DARWIN_USE_64_BIT_INODE 1
|
||||
#define _DARWIN_USE_64_BIT_INODE 1
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
|
|
|
@ -137,4 +137,4 @@ const vector config_get_dhcp_replication_svr();
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif//DAEMON_AGENT_INCLUDE_CONFIG_H
|
||||
#endif //DAEMON_AGENT_INCLUDE_CONFIG_H
|
||||
|
|
|
@ -38,16 +38,27 @@ typedef enum {
|
|||
HASH_TYPE_SHA256 = 2,
|
||||
} HASH_TYPE;
|
||||
|
||||
typedef void (*on_evp_crypto)(CRYPTO_TYPE type, const unsigned char *pData, unsigned int iSize,
|
||||
const unsigned char *pSrcData, int iError);
|
||||
typedef void (*on_evp_crypto)(CRYPTO_TYPE type,
|
||||
const unsigned char *pData,
|
||||
unsigned int iSize,
|
||||
const unsigned char *pSrcData,
|
||||
int iError);
|
||||
|
||||
//*****************************************************
|
||||
// AES
|
||||
//*****************************************************
|
||||
int symmetric_encrypto(AES_TYPE algorithmType, unsigned char *pInBuf, unsigned int inSize, unsigned char **pOutBuf,
|
||||
int *pOutSize, const char *pKey);
|
||||
int symmetric_decrypto(AES_TYPE algorithmType, unsigned char *pInBuf, unsigned int inSize, unsigned char **pOutBuf,
|
||||
int *pOutSize, const char *pKey);
|
||||
int symmetric_encrypto(AES_TYPE algorithmType,
|
||||
unsigned char *pInBuf,
|
||||
unsigned int inSize,
|
||||
unsigned char **pOutBuf,
|
||||
int *pOutSize,
|
||||
const char *pKey);
|
||||
int symmetric_decrypto(AES_TYPE algorithmType,
|
||||
unsigned char *pInBuf,
|
||||
unsigned int inSize,
|
||||
unsigned char **pOutBuf,
|
||||
int *pOutSize,
|
||||
const char *pKey);
|
||||
//*****************************************************
|
||||
// BASE64
|
||||
//*****************************************************
|
||||
|
@ -62,13 +73,20 @@ unsigned char *base64_decode(const char *pBase64, unsigned int *pOutSize);
|
|||
// MD5
|
||||
//*****************************************************
|
||||
int hash_digest_file(HASH_TYPE hashType, const char *pFileName, char **pHashValue);
|
||||
int hash_digest_mem(HASH_TYPE hashType, const unsigned char *pBuf, unsigned int iBufLen, unsigned char **pHashValue,
|
||||
int hash_digest_mem(HASH_TYPE hashType,
|
||||
const unsigned char *pBuf,
|
||||
unsigned int iBufLen,
|
||||
unsigned char **pHashValue,
|
||||
unsigned int *pOutSize);
|
||||
|
||||
//*****************************************************
|
||||
// Async Engine
|
||||
//*****************************************************
|
||||
int evp_add_crypto_task(CRYPTO_TYPE type, unsigned char *pInBuf, unsigned int iSize, unsigned char *pOutBuf, char *pKey,
|
||||
int evp_add_crypto_task(CRYPTO_TYPE type,
|
||||
unsigned char *pInBuf,
|
||||
unsigned int iSize,
|
||||
unsigned char *pOutBuf,
|
||||
char *pKey,
|
||||
on_evp_crypto onEvpCryptCb);
|
||||
|
||||
void evp_system_init(void);
|
||||
|
@ -76,4 +94,4 @@ void evp_system_init(void);
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif//DAEMON_AGENT_CRYPTO_CRYPTO_H
|
||||
#endif //DAEMON_AGENT_CRYPTO_CRYPTO_H
|
||||
|
|
|
@ -10,15 +10,25 @@ extern "C" {
|
|||
|
||||
int inet_api_init(void);
|
||||
|
||||
typedef void (*on_http_response)(void *pData, unsigned int size, const char *pReqUrl, const char *pDlPath,
|
||||
const char *pTaskUuid, int iFinished, void *pUserData);
|
||||
typedef void (*on_progress_changed)(const char *pReqUrl, const char *pTaskUuid, unsigned char uPercent,
|
||||
typedef void (*on_http_response)(void *pData,
|
||||
unsigned int size,
|
||||
const char *pReqUrl,
|
||||
const char *pDlPath,
|
||||
const char *pTaskUuid,
|
||||
int iFinished,
|
||||
void *pUserData);
|
||||
typedef void (*on_progress_changed)(const char *pReqUrl,
|
||||
const char *pTaskUuid,
|
||||
unsigned char uPercent,
|
||||
void *pUserData);
|
||||
|
||||
const char *inet_download_file_async(const char *pURL, const char *pPath, on_http_response onRespCb,
|
||||
on_progress_changed onProgressCb, void *pData);
|
||||
const char *inet_download_file_async(const char *pURL,
|
||||
const char *pPath,
|
||||
on_http_response onRespCb,
|
||||
on_progress_changed onProgressCb,
|
||||
void *pData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif//DAEMON_AGENT_NETWORD_INET_MISC_H
|
||||
#endif //DAEMON_AGENT_NETWORD_INET_MISC_H
|
||||
|
|
|
@ -50,10 +50,13 @@ int copy_file(const char *pSrc, const char *pDest);
|
|||
char *bin2hex(char *p, const unsigned char *cp, unsigned int count);
|
||||
int shell_with_output(const char *pCmd, char **pResult);
|
||||
int str_to_mac(const char *str, unsigned char mac[6]);
|
||||
int get_nic_info(const char *pName, unsigned int *pIp, unsigned int *pNetmask, unsigned int *pGateway,
|
||||
int get_nic_info(const char *pName,
|
||||
unsigned int *pIp,
|
||||
unsigned int *pNetmask,
|
||||
unsigned int *pGateway,
|
||||
unsigned char *pMac);
|
||||
int str_to_ipaddr(const char *pIp, unsigned int *ipAddr);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif//DAEMON_AGENT_MISC_MISC_H
|
||||
#endif //DAEMON_AGENT_MISC_MISC_H
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
#define cJSON__h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||
|
@ -71,7 +70,7 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ
|
|||
#define CJSON_CDECL
|
||||
#define CJSON_STDCALL
|
||||
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||
#else
|
||||
#define CJSON_PUBLIC(type) type
|
||||
|
@ -100,8 +99,7 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ
|
|||
#define cJSON_StringIsConst 512
|
||||
|
||||
/* The cJSON structure: */
|
||||
typedef struct cJSON
|
||||
{
|
||||
typedef struct cJSON {
|
||||
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
struct cJSON *next;
|
||||
struct cJSON *prev;
|
||||
|
@ -122,11 +120,10 @@ typedef struct cJSON
|
|||
char *string;
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks
|
||||
{
|
||||
typedef struct cJSON_Hooks {
|
||||
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
|
||||
void *(CJSON_CDECL *malloc_fn)(size_t sz);
|
||||
void (CJSON_CDECL *free_fn)(void *ptr);
|
||||
void(CJSON_CDECL *free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
|
||||
typedef int cJSON_bool;
|
||||
|
@ -138,10 +135,10 @@ typedef int cJSON_bool;
|
|||
#endif
|
||||
|
||||
/* returns the version of cJSON as a string */
|
||||
CJSON_PUBLIC(const char*) cJSON_Version(void);
|
||||
CJSON_PUBLIC(const char *) cJSON_Version(void);
|
||||
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks *hooks);
|
||||
|
||||
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
|
||||
|
@ -149,8 +146,13 @@ CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
|
|||
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length);
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||
CJSON_PUBLIC(cJSON *)
|
||||
cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||
CJSON_PUBLIC(cJSON *)
|
||||
cJSON_ParseWithLengthOpts(const char *value,
|
||||
size_t buffer_length,
|
||||
const char **return_parse_end,
|
||||
cJSON_bool require_null_terminated);
|
||||
|
||||
/* Render a cJSON entity to text for transfer/storage. */
|
||||
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
|
||||
|
@ -160,7 +162,8 @@ CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
|
|||
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
|
||||
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
|
||||
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||
CJSON_PUBLIC(cJSON_bool)
|
||||
cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
CJSON_PUBLIC(void) cJSON_Delete(cJSON *item);
|
||||
|
||||
|
@ -169,27 +172,27 @@ CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
|||
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON *const object, const char *const string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON *const object, const char *const string);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
|
||||
|
||||
/* Check item type and return its value */
|
||||
CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item);
|
||||
CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item);
|
||||
CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON *const item);
|
||||
CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON *const item);
|
||||
|
||||
/* These functions check the type of an item */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON *const item);
|
||||
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
|
||||
|
@ -230,7 +233,7 @@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item
|
|||
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||
|
||||
/* Remove/Detach items from Arrays/Objects. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON *const item);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||
|
@ -239,11 +242,12 @@ CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string)
|
|||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
|
||||
/* Update array items. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
|
||||
CJSON_PUBLIC(cJSON_bool)
|
||||
cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON *const parent, cJSON *const item, cJSON *replacement);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem);
|
||||
|
||||
/* Duplicate a cJSON item */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
||||
|
@ -252,7 +256,7 @@ CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
|||
* The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
|
||||
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON *const a, const cJSON *const b, const cJSON_bool case_sensitive);
|
||||
|
||||
/* Minify a strings, remove blank characters(such as ' ', '\t', '\r', '\n') from strings.
|
||||
* The input pointer json cannot point to a read-only address area, such as a string constant,
|
||||
|
@ -261,26 +265,29 @@ CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
|||
|
||||
/* Helper functions for creating and adding items to an object at the same time.
|
||||
* They return the added item or NULL on failure. */
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_AddNullToObject(cJSON *const object, const char *const name);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_AddTrueToObject(cJSON *const object, const char *const name);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_AddFalseToObject(cJSON *const object, const char *const name);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_AddBoolToObject(cJSON *const object, const char *const name, const cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_AddNumberToObject(cJSON *const object, const char *const name, const double number);
|
||||
CJSON_PUBLIC(cJSON *)
|
||||
cJSON_AddStringToObject(cJSON *const object, const char *const name, const char *const string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_AddRawToObject(cJSON *const object, const char *const name, const char *const raw);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_AddObjectToObject(cJSON *const object, const char *const name);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_AddArrayToObject(cJSON *const object, const char *const name);
|
||||
|
||||
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
|
||||
/* helper for the cJSON_SetNumberValue macro */
|
||||
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
||||
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||
#define cJSON_SetNumberValue(object, number) \
|
||||
((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||
/* Change the valuestring of a cJSON_String object, only takes effect when type of object is cJSON_String */
|
||||
CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring);
|
||||
CJSON_PUBLIC(char *) cJSON_SetValuestring(cJSON *object, const char *valuestring);
|
||||
|
||||
/* Macro for iterating over an array or object */
|
||||
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||
#define cJSON_ArrayForEach(element, array) \
|
||||
for (element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||
|
||||
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
|
||||
|
|
|
@ -220,22 +220,14 @@ typedef struct {
|
|||
for (; index_##_element < realsize_##_element && index_##_element < size; index_##_element++) { \
|
||||
array_item_##_element = cJSON_GetArrayItem(array_##_element, index_##_element); \
|
||||
if (array_item_##_element) { \
|
||||
S2J_STRUCT_ARRAY_GET_ELEMENT_EX(to_struct, \
|
||||
array_item_##_element, \
|
||||
type, \
|
||||
_element, \
|
||||
index_##_element, \
|
||||
_defval); \
|
||||
S2J_STRUCT_ARRAY_GET_ELEMENT_EX( \
|
||||
to_struct, array_item_##_element, type, _element, index_##_element, _defval); \
|
||||
} \
|
||||
} \
|
||||
} else { \
|
||||
for (; index_##_element < realsize_##_element && index_##_element < size; index_##_element++) { \
|
||||
S2J_STRUCT_ARRAY_GET_ELEMENT_EX(to_struct, \
|
||||
array_##_element, \
|
||||
type, \
|
||||
_element, \
|
||||
index_##_element, \
|
||||
_defval); \
|
||||
S2J_STRUCT_ARRAY_GET_ELEMENT_EX( \
|
||||
to_struct, array_##_element, type, _element, index_##_element, _defval); \
|
||||
} \
|
||||
} \
|
||||
} else { \
|
||||
|
|
|
@ -40,10 +40,10 @@ extern "C" {
|
|||
/* Structure pointing to our actually configured allocators */
|
||||
typedef struct hiredisAllocFuncs {
|
||||
void *(*mallocFn)(size_t);
|
||||
void *(*callocFn)(size_t,size_t);
|
||||
void *(*reallocFn)(void*,size_t);
|
||||
char *(*strdupFn)(const char*);
|
||||
void (*freeFn)(void*);
|
||||
void *(*callocFn)(size_t, size_t);
|
||||
void *(*reallocFn)(void *, size_t);
|
||||
char *(*strdupFn)(const char *);
|
||||
void (*freeFn)(void *);
|
||||
} hiredisAllocFuncs;
|
||||
|
||||
hiredisAllocFuncs hiredisSetAllocators(hiredisAllocFuncs *ha);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#ifndef __SDS_H
|
||||
#define __SDS_H
|
||||
|
||||
#define SDS_MAX_PREALLOC (1024*1024)
|
||||
#define SDS_MAX_PREALLOC (1024 * 1024)
|
||||
#ifdef _MSC_VER
|
||||
#define __attribute__(x)
|
||||
typedef long long ssize_t;
|
||||
|
@ -48,29 +48,29 @@ typedef char *sds;
|
|||
|
||||
/* Note: sdshdr5 is never used, we just access the flags byte directly.
|
||||
* However is here to document the layout of type 5 SDS strings. */
|
||||
struct __attribute__ ((__packed__)) sdshdr5 {
|
||||
struct __attribute__((__packed__)) sdshdr5 {
|
||||
unsigned char flags; /* 3 lsb of type, and 5 msb of string length */
|
||||
char buf[];
|
||||
};
|
||||
struct __attribute__ ((__packed__)) sdshdr8 {
|
||||
struct __attribute__((__packed__)) sdshdr8 {
|
||||
uint8_t len; /* used */
|
||||
uint8_t alloc; /* excluding the header and null terminator */
|
||||
unsigned char flags; /* 3 lsb of type, 5 unused bits */
|
||||
char buf[];
|
||||
};
|
||||
struct __attribute__ ((__packed__)) sdshdr16 {
|
||||
struct __attribute__((__packed__)) sdshdr16 {
|
||||
uint16_t len; /* used */
|
||||
uint16_t alloc; /* excluding the header and null terminator */
|
||||
unsigned char flags; /* 3 lsb of type, 5 unused bits */
|
||||
char buf[];
|
||||
};
|
||||
struct __attribute__ ((__packed__)) sdshdr32 {
|
||||
struct __attribute__((__packed__)) sdshdr32 {
|
||||
uint32_t len; /* used */
|
||||
uint32_t alloc; /* excluding the header and null terminator */
|
||||
unsigned char flags; /* 3 lsb of type, 5 unused bits */
|
||||
char buf[];
|
||||
};
|
||||
struct __attribute__ ((__packed__)) sdshdr64 {
|
||||
struct __attribute__((__packed__)) sdshdr64 {
|
||||
uint64_t len; /* used */
|
||||
uint64_t alloc; /* excluding the header and null terminator */
|
||||
unsigned char flags; /* 3 lsb of type, 5 unused bits */
|
||||
|
@ -84,47 +84,47 @@ struct __attribute__ ((__packed__)) sdshdr64 {
|
|||
#define SDS_TYPE_64 4
|
||||
#define SDS_TYPE_MASK 7
|
||||
#define SDS_TYPE_BITS 3
|
||||
#define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T)));
|
||||
#define SDS_HDR(T,s) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T))))
|
||||
#define SDS_TYPE_5_LEN(f) ((f)>>SDS_TYPE_BITS)
|
||||
#define SDS_HDR_VAR(T, s) struct sdshdr##T *sh = (struct sdshdr##T *)((s) - (sizeof(struct sdshdr##T)));
|
||||
#define SDS_HDR(T, s) ((struct sdshdr##T *)((s) - (sizeof(struct sdshdr##T))))
|
||||
#define SDS_TYPE_5_LEN(f) ((f) >> SDS_TYPE_BITS)
|
||||
|
||||
static inline size_t sdslen(const sds s) {
|
||||
unsigned char flags = s[-1];
|
||||
switch(flags&SDS_TYPE_MASK) {
|
||||
switch (flags & SDS_TYPE_MASK) {
|
||||
case SDS_TYPE_5:
|
||||
return SDS_TYPE_5_LEN(flags);
|
||||
case SDS_TYPE_8:
|
||||
return SDS_HDR(8,s)->len;
|
||||
return SDS_HDR(8, s)->len;
|
||||
case SDS_TYPE_16:
|
||||
return SDS_HDR(16,s)->len;
|
||||
return SDS_HDR(16, s)->len;
|
||||
case SDS_TYPE_32:
|
||||
return SDS_HDR(32,s)->len;
|
||||
return SDS_HDR(32, s)->len;
|
||||
case SDS_TYPE_64:
|
||||
return SDS_HDR(64,s)->len;
|
||||
return SDS_HDR(64, s)->len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline size_t sdsavail(const sds s) {
|
||||
unsigned char flags = s[-1];
|
||||
switch(flags&SDS_TYPE_MASK) {
|
||||
switch (flags & SDS_TYPE_MASK) {
|
||||
case SDS_TYPE_5: {
|
||||
return 0;
|
||||
}
|
||||
case SDS_TYPE_8: {
|
||||
SDS_HDR_VAR(8,s);
|
||||
SDS_HDR_VAR(8, s);
|
||||
return sh->alloc - sh->len;
|
||||
}
|
||||
case SDS_TYPE_16: {
|
||||
SDS_HDR_VAR(16,s);
|
||||
SDS_HDR_VAR(16, s);
|
||||
return sh->alloc - sh->len;
|
||||
}
|
||||
case SDS_TYPE_32: {
|
||||
SDS_HDR_VAR(32,s);
|
||||
SDS_HDR_VAR(32, s);
|
||||
return sh->alloc - sh->len;
|
||||
}
|
||||
case SDS_TYPE_64: {
|
||||
SDS_HDR_VAR(64,s);
|
||||
SDS_HDR_VAR(64, s);
|
||||
return sh->alloc - sh->len;
|
||||
}
|
||||
}
|
||||
|
@ -133,49 +133,45 @@ static inline size_t sdsavail(const sds s) {
|
|||
|
||||
static inline void sdssetlen(sds s, size_t newlen) {
|
||||
unsigned char flags = s[-1];
|
||||
switch(flags&SDS_TYPE_MASK) {
|
||||
case SDS_TYPE_5:
|
||||
{
|
||||
unsigned char *fp = ((unsigned char*)s)-1;
|
||||
switch (flags & SDS_TYPE_MASK) {
|
||||
case SDS_TYPE_5: {
|
||||
unsigned char *fp = ((unsigned char *)s) - 1;
|
||||
*fp = (unsigned char)(SDS_TYPE_5 | (newlen << SDS_TYPE_BITS));
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
case SDS_TYPE_8:
|
||||
SDS_HDR(8,s)->len = (uint8_t)newlen;
|
||||
SDS_HDR(8, s)->len = (uint8_t)newlen;
|
||||
break;
|
||||
case SDS_TYPE_16:
|
||||
SDS_HDR(16,s)->len = (uint16_t)newlen;
|
||||
SDS_HDR(16, s)->len = (uint16_t)newlen;
|
||||
break;
|
||||
case SDS_TYPE_32:
|
||||
SDS_HDR(32,s)->len = (uint32_t)newlen;
|
||||
SDS_HDR(32, s)->len = (uint32_t)newlen;
|
||||
break;
|
||||
case SDS_TYPE_64:
|
||||
SDS_HDR(64,s)->len = (uint64_t)newlen;
|
||||
SDS_HDR(64, s)->len = (uint64_t)newlen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void sdsinclen(sds s, size_t inc) {
|
||||
unsigned char flags = s[-1];
|
||||
switch(flags&SDS_TYPE_MASK) {
|
||||
case SDS_TYPE_5:
|
||||
{
|
||||
unsigned char *fp = ((unsigned char*)s)-1;
|
||||
unsigned char newlen = SDS_TYPE_5_LEN(flags)+(unsigned char)inc;
|
||||
switch (flags & SDS_TYPE_MASK) {
|
||||
case SDS_TYPE_5: {
|
||||
unsigned char *fp = ((unsigned char *)s) - 1;
|
||||
unsigned char newlen = SDS_TYPE_5_LEN(flags) + (unsigned char)inc;
|
||||
*fp = SDS_TYPE_5 | (newlen << SDS_TYPE_BITS);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
case SDS_TYPE_8:
|
||||
SDS_HDR(8,s)->len += (uint8_t)inc;
|
||||
SDS_HDR(8, s)->len += (uint8_t)inc;
|
||||
break;
|
||||
case SDS_TYPE_16:
|
||||
SDS_HDR(16,s)->len += (uint16_t)inc;
|
||||
SDS_HDR(16, s)->len += (uint16_t)inc;
|
||||
break;
|
||||
case SDS_TYPE_32:
|
||||
SDS_HDR(32,s)->len += (uint32_t)inc;
|
||||
SDS_HDR(32, s)->len += (uint32_t)inc;
|
||||
break;
|
||||
case SDS_TYPE_64:
|
||||
SDS_HDR(64,s)->len += (uint64_t)inc;
|
||||
SDS_HDR(64, s)->len += (uint64_t)inc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -183,38 +179,38 @@ static inline void sdsinclen(sds s, size_t inc) {
|
|||
/* sdsalloc() = sdsavail() + sdslen() */
|
||||
static inline size_t sdsalloc(const sds s) {
|
||||
unsigned char flags = s[-1];
|
||||
switch(flags&SDS_TYPE_MASK) {
|
||||
switch (flags & SDS_TYPE_MASK) {
|
||||
case SDS_TYPE_5:
|
||||
return SDS_TYPE_5_LEN(flags);
|
||||
case SDS_TYPE_8:
|
||||
return SDS_HDR(8,s)->alloc;
|
||||
return SDS_HDR(8, s)->alloc;
|
||||
case SDS_TYPE_16:
|
||||
return SDS_HDR(16,s)->alloc;
|
||||
return SDS_HDR(16, s)->alloc;
|
||||
case SDS_TYPE_32:
|
||||
return SDS_HDR(32,s)->alloc;
|
||||
return SDS_HDR(32, s)->alloc;
|
||||
case SDS_TYPE_64:
|
||||
return SDS_HDR(64,s)->alloc;
|
||||
return SDS_HDR(64, s)->alloc;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void sdssetalloc(sds s, size_t newlen) {
|
||||
unsigned char flags = s[-1];
|
||||
switch(flags&SDS_TYPE_MASK) {
|
||||
switch (flags & SDS_TYPE_MASK) {
|
||||
case SDS_TYPE_5:
|
||||
/* Nothing to do, this type has no total allocation info. */
|
||||
break;
|
||||
case SDS_TYPE_8:
|
||||
SDS_HDR(8,s)->alloc = (uint8_t)newlen;
|
||||
SDS_HDR(8, s)->alloc = (uint8_t)newlen;
|
||||
break;
|
||||
case SDS_TYPE_16:
|
||||
SDS_HDR(16,s)->alloc = (uint16_t)newlen;
|
||||
SDS_HDR(16, s)->alloc = (uint16_t)newlen;
|
||||
break;
|
||||
case SDS_TYPE_32:
|
||||
SDS_HDR(32,s)->alloc = (uint32_t)newlen;
|
||||
SDS_HDR(32, s)->alloc = (uint32_t)newlen;
|
||||
break;
|
||||
case SDS_TYPE_64:
|
||||
SDS_HDR(64,s)->alloc = (uint64_t)newlen;
|
||||
SDS_HDR(64, s)->alloc = (uint64_t)newlen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -233,8 +229,7 @@ sds sdscpy(sds s, const char *t);
|
|||
|
||||
sds sdscatvprintf(sds s, const char *fmt, va_list ap);
|
||||
#ifdef __GNUC__
|
||||
sds sdscatprintf(sds s, const char *fmt, ...)
|
||||
__attribute__((format(printf, 2, 3)));
|
||||
sds sdscatprintf(sds s, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
#else
|
||||
sds sdscatprintf(sds s, const char *fmt, ...);
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,341 +30,357 @@
|
|||
** libraries!
|
||||
*/
|
||||
struct sqlite3_api_routines {
|
||||
void * (*aggregate_context)(sqlite3_context*,int nBytes);
|
||||
int (*aggregate_count)(sqlite3_context*);
|
||||
int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
|
||||
int (*bind_double)(sqlite3_stmt*,int,double);
|
||||
int (*bind_int)(sqlite3_stmt*,int,int);
|
||||
int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
|
||||
int (*bind_null)(sqlite3_stmt*,int);
|
||||
int (*bind_parameter_count)(sqlite3_stmt*);
|
||||
int (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
|
||||
const char * (*bind_parameter_name)(sqlite3_stmt*,int);
|
||||
int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
|
||||
int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
|
||||
int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
|
||||
int (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
|
||||
int (*busy_timeout)(sqlite3*,int ms);
|
||||
int (*changes)(sqlite3*);
|
||||
int (*close)(sqlite3*);
|
||||
int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,
|
||||
int eTextRep,const char*));
|
||||
int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,
|
||||
int eTextRep,const void*));
|
||||
const void * (*column_blob)(sqlite3_stmt*,int iCol);
|
||||
int (*column_bytes)(sqlite3_stmt*,int iCol);
|
||||
int (*column_bytes16)(sqlite3_stmt*,int iCol);
|
||||
int (*column_count)(sqlite3_stmt*pStmt);
|
||||
const char * (*column_database_name)(sqlite3_stmt*,int);
|
||||
const void * (*column_database_name16)(sqlite3_stmt*,int);
|
||||
const char * (*column_decltype)(sqlite3_stmt*,int i);
|
||||
const void * (*column_decltype16)(sqlite3_stmt*,int);
|
||||
double (*column_double)(sqlite3_stmt*,int iCol);
|
||||
int (*column_int)(sqlite3_stmt*,int iCol);
|
||||
sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol);
|
||||
const char * (*column_name)(sqlite3_stmt*,int);
|
||||
const void * (*column_name16)(sqlite3_stmt*,int);
|
||||
const char * (*column_origin_name)(sqlite3_stmt*,int);
|
||||
const void * (*column_origin_name16)(sqlite3_stmt*,int);
|
||||
const char * (*column_table_name)(sqlite3_stmt*,int);
|
||||
const void * (*column_table_name16)(sqlite3_stmt*,int);
|
||||
const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
|
||||
const void * (*column_text16)(sqlite3_stmt*,int iCol);
|
||||
int (*column_type)(sqlite3_stmt*,int iCol);
|
||||
sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
|
||||
void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
|
||||
int (*complete)(const char*sql);
|
||||
int (*complete16)(const void*sql);
|
||||
int (*create_collation)(sqlite3*,const char*,int,void*,
|
||||
int(*)(void*,int,const void*,int,const void*));
|
||||
int (*create_collation16)(sqlite3*,const void*,int,void*,
|
||||
int(*)(void*,int,const void*,int,const void*));
|
||||
int (*create_function)(sqlite3*,const char*,int,int,void*,
|
||||
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
|
||||
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
|
||||
void (*xFinal)(sqlite3_context*));
|
||||
int (*create_function16)(sqlite3*,const void*,int,int,void*,
|
||||
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
|
||||
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
|
||||
void (*xFinal)(sqlite3_context*));
|
||||
int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
|
||||
int (*data_count)(sqlite3_stmt*pStmt);
|
||||
sqlite3 * (*db_handle)(sqlite3_stmt*);
|
||||
int (*declare_vtab)(sqlite3*,const char*);
|
||||
void *(*aggregate_context)(sqlite3_context *, int nBytes);
|
||||
int (*aggregate_count)(sqlite3_context *);
|
||||
int (*bind_blob)(sqlite3_stmt *, int, const void *, int n, void (*)(void *));
|
||||
int (*bind_double)(sqlite3_stmt *, int, double);
|
||||
int (*bind_int)(sqlite3_stmt *, int, int);
|
||||
int (*bind_int64)(sqlite3_stmt *, int, sqlite_int64);
|
||||
int (*bind_null)(sqlite3_stmt *, int);
|
||||
int (*bind_parameter_count)(sqlite3_stmt *);
|
||||
int (*bind_parameter_index)(sqlite3_stmt *, const char *zName);
|
||||
const char *(*bind_parameter_name)(sqlite3_stmt *, int);
|
||||
int (*bind_text)(sqlite3_stmt *, int, const char *, int n, void (*)(void *));
|
||||
int (*bind_text16)(sqlite3_stmt *, int, const void *, int, void (*)(void *));
|
||||
int (*bind_value)(sqlite3_stmt *, int, const sqlite3_value *);
|
||||
int (*busy_handler)(sqlite3 *, int (*)(void *, int), void *);
|
||||
int (*busy_timeout)(sqlite3 *, int ms);
|
||||
int (*changes)(sqlite3 *);
|
||||
int (*close)(sqlite3 *);
|
||||
int (*collation_needed)(sqlite3 *, void *, void (*)(void *, sqlite3 *, int eTextRep, const char *));
|
||||
int (*collation_needed16)(sqlite3 *, void *, void (*)(void *, sqlite3 *, int eTextRep, const void *));
|
||||
const void *(*column_blob)(sqlite3_stmt *, int iCol);
|
||||
int (*column_bytes)(sqlite3_stmt *, int iCol);
|
||||
int (*column_bytes16)(sqlite3_stmt *, int iCol);
|
||||
int (*column_count)(sqlite3_stmt *pStmt);
|
||||
const char *(*column_database_name)(sqlite3_stmt *, int);
|
||||
const void *(*column_database_name16)(sqlite3_stmt *, int);
|
||||
const char *(*column_decltype)(sqlite3_stmt *, int i);
|
||||
const void *(*column_decltype16)(sqlite3_stmt *, int);
|
||||
double (*column_double)(sqlite3_stmt *, int iCol);
|
||||
int (*column_int)(sqlite3_stmt *, int iCol);
|
||||
sqlite_int64 (*column_int64)(sqlite3_stmt *, int iCol);
|
||||
const char *(*column_name)(sqlite3_stmt *, int);
|
||||
const void *(*column_name16)(sqlite3_stmt *, int);
|
||||
const char *(*column_origin_name)(sqlite3_stmt *, int);
|
||||
const void *(*column_origin_name16)(sqlite3_stmt *, int);
|
||||
const char *(*column_table_name)(sqlite3_stmt *, int);
|
||||
const void *(*column_table_name16)(sqlite3_stmt *, int);
|
||||
const unsigned char *(*column_text)(sqlite3_stmt *, int iCol);
|
||||
const void *(*column_text16)(sqlite3_stmt *, int iCol);
|
||||
int (*column_type)(sqlite3_stmt *, int iCol);
|
||||
sqlite3_value *(*column_value)(sqlite3_stmt *, int iCol);
|
||||
void *(*commit_hook)(sqlite3 *, int (*)(void *), void *);
|
||||
int (*complete)(const char *sql);
|
||||
int (*complete16)(const void *sql);
|
||||
int (
|
||||
*create_collation)(sqlite3 *, const char *, int, void *, int (*)(void *, int, const void *, int, const void *));
|
||||
int (*create_collation16)(sqlite3 *,
|
||||
const void *,
|
||||
int,
|
||||
void *,
|
||||
int (*)(void *, int, const void *, int, const void *));
|
||||
int (*create_function)(sqlite3 *,
|
||||
const char *,
|
||||
int,
|
||||
int,
|
||||
void *,
|
||||
void (*xFunc)(sqlite3_context *, int, sqlite3_value **),
|
||||
void (*xStep)(sqlite3_context *, int, sqlite3_value **),
|
||||
void (*xFinal)(sqlite3_context *));
|
||||
int (*create_function16)(sqlite3 *,
|
||||
const void *,
|
||||
int,
|
||||
int,
|
||||
void *,
|
||||
void (*xFunc)(sqlite3_context *, int, sqlite3_value **),
|
||||
void (*xStep)(sqlite3_context *, int, sqlite3_value **),
|
||||
void (*xFinal)(sqlite3_context *));
|
||||
int (*create_module)(sqlite3 *, const char *, const sqlite3_module *, void *);
|
||||
int (*data_count)(sqlite3_stmt *pStmt);
|
||||
sqlite3 *(*db_handle)(sqlite3_stmt *);
|
||||
int (*declare_vtab)(sqlite3 *, const char *);
|
||||
int (*enable_shared_cache)(int);
|
||||
int (*errcode)(sqlite3*db);
|
||||
const char * (*errmsg)(sqlite3*);
|
||||
const void * (*errmsg16)(sqlite3*);
|
||||
int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
|
||||
int (*expired)(sqlite3_stmt*);
|
||||
int (*finalize)(sqlite3_stmt*pStmt);
|
||||
void (*free)(void*);
|
||||
void (*free_table)(char**result);
|
||||
int (*get_autocommit)(sqlite3*);
|
||||
void * (*get_auxdata)(sqlite3_context*,int);
|
||||
int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
|
||||
int (*errcode)(sqlite3 *db);
|
||||
const char *(*errmsg)(sqlite3 *);
|
||||
const void *(*errmsg16)(sqlite3 *);
|
||||
int (*exec)(sqlite3 *, const char *, sqlite3_callback, void *, char **);
|
||||
int (*expired)(sqlite3_stmt *);
|
||||
int (*finalize)(sqlite3_stmt *pStmt);
|
||||
void (*free)(void *);
|
||||
void (*free_table)(char **result);
|
||||
int (*get_autocommit)(sqlite3 *);
|
||||
void *(*get_auxdata)(sqlite3_context *, int);
|
||||
int (*get_table)(sqlite3 *, const char *, char ***, int *, int *, char **);
|
||||
int (*global_recover)(void);
|
||||
void (*interruptx)(sqlite3*);
|
||||
sqlite_int64 (*last_insert_rowid)(sqlite3*);
|
||||
const char * (*libversion)(void);
|
||||
void (*interruptx)(sqlite3 *);
|
||||
sqlite_int64 (*last_insert_rowid)(sqlite3 *);
|
||||
const char *(*libversion)(void);
|
||||
int (*libversion_number)(void);
|
||||
void *(*malloc)(int);
|
||||
char * (*mprintf)(const char*,...);
|
||||
int (*open)(const char*,sqlite3**);
|
||||
int (*open16)(const void*,sqlite3**);
|
||||
int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
|
||||
int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
|
||||
void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
|
||||
void (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
|
||||
void *(*realloc)(void*,int);
|
||||
int (*reset)(sqlite3_stmt*pStmt);
|
||||
void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
|
||||
void (*result_double)(sqlite3_context*,double);
|
||||
void (*result_error)(sqlite3_context*,const char*,int);
|
||||
void (*result_error16)(sqlite3_context*,const void*,int);
|
||||
void (*result_int)(sqlite3_context*,int);
|
||||
void (*result_int64)(sqlite3_context*,sqlite_int64);
|
||||
void (*result_null)(sqlite3_context*);
|
||||
void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
|
||||
void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
|
||||
void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
|
||||
void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
|
||||
void (*result_value)(sqlite3_context*,sqlite3_value*);
|
||||
void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
|
||||
int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
|
||||
const char*,const char*),void*);
|
||||
void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
|
||||
char * (*xsnprintf)(int,char*,const char*,...);
|
||||
int (*step)(sqlite3_stmt*);
|
||||
int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
|
||||
char const**,char const**,int*,int*,int*);
|
||||
char *(*mprintf)(const char *, ...);
|
||||
int (*open)(const char *, sqlite3 **);
|
||||
int (*open16)(const void *, sqlite3 **);
|
||||
int (*prepare)(sqlite3 *, const char *, int, sqlite3_stmt **, const char **);
|
||||
int (*prepare16)(sqlite3 *, const void *, int, sqlite3_stmt **, const void **);
|
||||
void *(*profile)(sqlite3 *, void (*)(void *, const char *, sqlite_uint64), void *);
|
||||
void (*progress_handler)(sqlite3 *, int, int (*)(void *), void *);
|
||||
void *(*realloc)(void *, int);
|
||||
int (*reset)(sqlite3_stmt *pStmt);
|
||||
void (*result_blob)(sqlite3_context *, const void *, int, void (*)(void *));
|
||||
void (*result_double)(sqlite3_context *, double);
|
||||
void (*result_error)(sqlite3_context *, const char *, int);
|
||||
void (*result_error16)(sqlite3_context *, const void *, int);
|
||||
void (*result_int)(sqlite3_context *, int);
|
||||
void (*result_int64)(sqlite3_context *, sqlite_int64);
|
||||
void (*result_null)(sqlite3_context *);
|
||||
void (*result_text)(sqlite3_context *, const char *, int, void (*)(void *));
|
||||
void (*result_text16)(sqlite3_context *, const void *, int, void (*)(void *));
|
||||
void (*result_text16be)(sqlite3_context *, const void *, int, void (*)(void *));
|
||||
void (*result_text16le)(sqlite3_context *, const void *, int, void (*)(void *));
|
||||
void (*result_value)(sqlite3_context *, sqlite3_value *);
|
||||
void *(*rollback_hook)(sqlite3 *, void (*)(void *), void *);
|
||||
int (*set_authorizer)(sqlite3 *,
|
||||
int (*)(void *, int, const char *, const char *, const char *, const char *),
|
||||
void *);
|
||||
void (*set_auxdata)(sqlite3_context *, int, void *, void (*)(void *));
|
||||
char *(*xsnprintf)(int, char *, const char *, ...);
|
||||
int (*step)(sqlite3_stmt *);
|
||||
int (*table_column_metadata)(sqlite3 *,
|
||||
const char *,
|
||||
const char *,
|
||||
const char *,
|
||||
char const **,
|
||||
char const **,
|
||||
int *,
|
||||
int *,
|
||||
int *);
|
||||
void (*thread_cleanup)(void);
|
||||
int (*total_changes)(sqlite3*);
|
||||
void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
|
||||
int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
|
||||
void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,
|
||||
sqlite_int64),void*);
|
||||
void * (*user_data)(sqlite3_context*);
|
||||
const void * (*value_blob)(sqlite3_value*);
|
||||
int (*value_bytes)(sqlite3_value*);
|
||||
int (*value_bytes16)(sqlite3_value*);
|
||||
double (*value_double)(sqlite3_value*);
|
||||
int (*value_int)(sqlite3_value*);
|
||||
sqlite_int64 (*value_int64)(sqlite3_value*);
|
||||
int (*value_numeric_type)(sqlite3_value*);
|
||||
const unsigned char * (*value_text)(sqlite3_value*);
|
||||
const void * (*value_text16)(sqlite3_value*);
|
||||
const void * (*value_text16be)(sqlite3_value*);
|
||||
const void * (*value_text16le)(sqlite3_value*);
|
||||
int (*value_type)(sqlite3_value*);
|
||||
char *(*vmprintf)(const char*,va_list);
|
||||
int (*total_changes)(sqlite3 *);
|
||||
void *(*trace)(sqlite3 *, void (*xTrace)(void *, const char *), void *);
|
||||
int (*transfer_bindings)(sqlite3_stmt *, sqlite3_stmt *);
|
||||
void *(*update_hook)(sqlite3 *, void (*)(void *, int, char const *, char const *, sqlite_int64), void *);
|
||||
void *(*user_data)(sqlite3_context *);
|
||||
const void *(*value_blob)(sqlite3_value *);
|
||||
int (*value_bytes)(sqlite3_value *);
|
||||
int (*value_bytes16)(sqlite3_value *);
|
||||
double (*value_double)(sqlite3_value *);
|
||||
int (*value_int)(sqlite3_value *);
|
||||
sqlite_int64 (*value_int64)(sqlite3_value *);
|
||||
int (*value_numeric_type)(sqlite3_value *);
|
||||
const unsigned char *(*value_text)(sqlite3_value *);
|
||||
const void *(*value_text16)(sqlite3_value *);
|
||||
const void *(*value_text16be)(sqlite3_value *);
|
||||
const void *(*value_text16le)(sqlite3_value *);
|
||||
int (*value_type)(sqlite3_value *);
|
||||
char *(*vmprintf)(const char *, va_list);
|
||||
/* Added ??? */
|
||||
int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
|
||||
int (*overload_function)(sqlite3 *, const char *zFuncName, int nArg);
|
||||
/* Added by 3.3.13 */
|
||||
int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
|
||||
int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
|
||||
int (*clear_bindings)(sqlite3_stmt*);
|
||||
int (*prepare_v2)(sqlite3 *, const char *, int, sqlite3_stmt **, const char **);
|
||||
int (*prepare16_v2)(sqlite3 *, const void *, int, sqlite3_stmt **, const void **);
|
||||
int (*clear_bindings)(sqlite3_stmt *);
|
||||
/* Added by 3.4.1 */
|
||||
int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,
|
||||
void (*xDestroy)(void *));
|
||||
int (*create_module_v2)(sqlite3 *, const char *, const sqlite3_module *, void *, void (*xDestroy)(void *));
|
||||
/* Added by 3.5.0 */
|
||||
int (*bind_zeroblob)(sqlite3_stmt*,int,int);
|
||||
int (*blob_bytes)(sqlite3_blob*);
|
||||
int (*blob_close)(sqlite3_blob*);
|
||||
int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,
|
||||
int,sqlite3_blob**);
|
||||
int (*blob_read)(sqlite3_blob*,void*,int,int);
|
||||
int (*blob_write)(sqlite3_blob*,const void*,int,int);
|
||||
int (*create_collation_v2)(sqlite3*,const char*,int,void*,
|
||||
int(*)(void*,int,const void*,int,const void*),
|
||||
void(*)(void*));
|
||||
int (*file_control)(sqlite3*,const char*,int,void*);
|
||||
int (*bind_zeroblob)(sqlite3_stmt *, int, int);
|
||||
int (*blob_bytes)(sqlite3_blob *);
|
||||
int (*blob_close)(sqlite3_blob *);
|
||||
int (*blob_open)(sqlite3 *, const char *, const char *, const char *, sqlite3_int64, int, sqlite3_blob **);
|
||||
int (*blob_read)(sqlite3_blob *, void *, int, int);
|
||||
int (*blob_write)(sqlite3_blob *, const void *, int, int);
|
||||
int (*create_collation_v2)(sqlite3 *,
|
||||
const char *,
|
||||
int,
|
||||
void *,
|
||||
int (*)(void *, int, const void *, int, const void *),
|
||||
void (*)(void *));
|
||||
int (*file_control)(sqlite3 *, const char *, int, void *);
|
||||
sqlite3_int64 (*memory_highwater)(int);
|
||||
sqlite3_int64 (*memory_used)(void);
|
||||
sqlite3_mutex *(*mutex_alloc)(int);
|
||||
void (*mutex_enter)(sqlite3_mutex*);
|
||||
void (*mutex_free)(sqlite3_mutex*);
|
||||
void (*mutex_leave)(sqlite3_mutex*);
|
||||
int (*mutex_try)(sqlite3_mutex*);
|
||||
int (*open_v2)(const char*,sqlite3**,int,const char*);
|
||||
void (*mutex_enter)(sqlite3_mutex *);
|
||||
void (*mutex_free)(sqlite3_mutex *);
|
||||
void (*mutex_leave)(sqlite3_mutex *);
|
||||
int (*mutex_try)(sqlite3_mutex *);
|
||||
int (*open_v2)(const char *, sqlite3 **, int, const char *);
|
||||
int (*release_memory)(int);
|
||||
void (*result_error_nomem)(sqlite3_context*);
|
||||
void (*result_error_toobig)(sqlite3_context*);
|
||||
void (*result_error_nomem)(sqlite3_context *);
|
||||
void (*result_error_toobig)(sqlite3_context *);
|
||||
int (*sleep)(int);
|
||||
void (*soft_heap_limit)(int);
|
||||
sqlite3_vfs *(*vfs_find)(const char*);
|
||||
int (*vfs_register)(sqlite3_vfs*,int);
|
||||
int (*vfs_unregister)(sqlite3_vfs*);
|
||||
sqlite3_vfs *(*vfs_find)(const char *);
|
||||
int (*vfs_register)(sqlite3_vfs *, int);
|
||||
int (*vfs_unregister)(sqlite3_vfs *);
|
||||
int (*xthreadsafe)(void);
|
||||
void (*result_zeroblob)(sqlite3_context*,int);
|
||||
void (*result_error_code)(sqlite3_context*,int);
|
||||
void (*result_zeroblob)(sqlite3_context *, int);
|
||||
void (*result_error_code)(sqlite3_context *, int);
|
||||
int (*test_control)(int, ...);
|
||||
void (*randomness)(int,void*);
|
||||
sqlite3 *(*context_db_handle)(sqlite3_context*);
|
||||
int (*extended_result_codes)(sqlite3*,int);
|
||||
int (*limit)(sqlite3*,int,int);
|
||||
sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
|
||||
const char *(*sql)(sqlite3_stmt*);
|
||||
int (*status)(int,int*,int*,int);
|
||||
int (*backup_finish)(sqlite3_backup*);
|
||||
sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);
|
||||
int (*backup_pagecount)(sqlite3_backup*);
|
||||
int (*backup_remaining)(sqlite3_backup*);
|
||||
int (*backup_step)(sqlite3_backup*,int);
|
||||
void (*randomness)(int, void *);
|
||||
sqlite3 *(*context_db_handle)(sqlite3_context *);
|
||||
int (*extended_result_codes)(sqlite3 *, int);
|
||||
int (*limit)(sqlite3 *, int, int);
|
||||
sqlite3_stmt *(*next_stmt)(sqlite3 *, sqlite3_stmt *);
|
||||
const char *(*sql)(sqlite3_stmt *);
|
||||
int (*status)(int, int *, int *, int);
|
||||
int (*backup_finish)(sqlite3_backup *);
|
||||
sqlite3_backup *(*backup_init)(sqlite3 *, const char *, sqlite3 *, const char *);
|
||||
int (*backup_pagecount)(sqlite3_backup *);
|
||||
int (*backup_remaining)(sqlite3_backup *);
|
||||
int (*backup_step)(sqlite3_backup *, int);
|
||||
const char *(*compileoption_get)(int);
|
||||
int (*compileoption_used)(const char*);
|
||||
int (*create_function_v2)(sqlite3*,const char*,int,int,void*,
|
||||
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
|
||||
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
|
||||
void (*xFinal)(sqlite3_context*),
|
||||
void(*xDestroy)(void*));
|
||||
int (*db_config)(sqlite3*,int,...);
|
||||
sqlite3_mutex *(*db_mutex)(sqlite3*);
|
||||
int (*db_status)(sqlite3*,int,int*,int*,int);
|
||||
int (*extended_errcode)(sqlite3*);
|
||||
void (*log)(int,const char*,...);
|
||||
int (*compileoption_used)(const char *);
|
||||
int (*create_function_v2)(sqlite3 *,
|
||||
const char *,
|
||||
int,
|
||||
int,
|
||||
void *,
|
||||
void (*xFunc)(sqlite3_context *, int, sqlite3_value **),
|
||||
void (*xStep)(sqlite3_context *, int, sqlite3_value **),
|
||||
void (*xFinal)(sqlite3_context *),
|
||||
void (*xDestroy)(void *));
|
||||
int (*db_config)(sqlite3 *, int, ...);
|
||||
sqlite3_mutex *(*db_mutex)(sqlite3 *);
|
||||
int (*db_status)(sqlite3 *, int, int *, int *, int);
|
||||
int (*extended_errcode)(sqlite3 *);
|
||||
void (*log)(int, const char *, ...);
|
||||
sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);
|
||||
const char *(*sourceid)(void);
|
||||
int (*stmt_status)(sqlite3_stmt*,int,int);
|
||||
int (*strnicmp)(const char*,const char*,int);
|
||||
int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);
|
||||
int (*wal_autocheckpoint)(sqlite3*,int);
|
||||
int (*wal_checkpoint)(sqlite3*,const char*);
|
||||
void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
|
||||
int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
|
||||
int (*vtab_config)(sqlite3*,int op,...);
|
||||
int (*vtab_on_conflict)(sqlite3*);
|
||||
int (*stmt_status)(sqlite3_stmt *, int, int);
|
||||
int (*strnicmp)(const char *, const char *, int);
|
||||
int (*unlock_notify)(sqlite3 *, void (*)(void **, int), void *);
|
||||
int (*wal_autocheckpoint)(sqlite3 *, int);
|
||||
int (*wal_checkpoint)(sqlite3 *, const char *);
|
||||
void *(*wal_hook)(sqlite3 *, int (*)(void *, sqlite3 *, const char *, int), void *);
|
||||
int (*blob_reopen)(sqlite3_blob *, sqlite3_int64);
|
||||
int (*vtab_config)(sqlite3 *, int op, ...);
|
||||
int (*vtab_on_conflict)(sqlite3 *);
|
||||
/* Version 3.7.16 and later */
|
||||
int (*close_v2)(sqlite3*);
|
||||
const char *(*db_filename)(sqlite3*,const char*);
|
||||
int (*db_readonly)(sqlite3*,const char*);
|
||||
int (*db_release_memory)(sqlite3*);
|
||||
int (*close_v2)(sqlite3 *);
|
||||
const char *(*db_filename)(sqlite3 *, const char *);
|
||||
int (*db_readonly)(sqlite3 *, const char *);
|
||||
int (*db_release_memory)(sqlite3 *);
|
||||
const char *(*errstr)(int);
|
||||
int (*stmt_busy)(sqlite3_stmt*);
|
||||
int (*stmt_readonly)(sqlite3_stmt*);
|
||||
int (*stricmp)(const char*,const char*);
|
||||
int (*uri_boolean)(const char*,const char*,int);
|
||||
sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
|
||||
const char *(*uri_parameter)(const char*,const char*);
|
||||
char *(*xvsnprintf)(int,char*,const char*,va_list);
|
||||
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
|
||||
int (*stmt_busy)(sqlite3_stmt *);
|
||||
int (*stmt_readonly)(sqlite3_stmt *);
|
||||
int (*stricmp)(const char *, const char *);
|
||||
int (*uri_boolean)(const char *, const char *, int);
|
||||
sqlite3_int64 (*uri_int64)(const char *, const char *, sqlite3_int64);
|
||||
const char *(*uri_parameter)(const char *, const char *);
|
||||
char *(*xvsnprintf)(int, char *, const char *, va_list);
|
||||
int (*wal_checkpoint_v2)(sqlite3 *, const char *, int, int *, int *);
|
||||
/* Version 3.8.7 and later */
|
||||
int (*auto_extension)(void(*)(void));
|
||||
int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
|
||||
void(*)(void*));
|
||||
int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
|
||||
void(*)(void*),unsigned char);
|
||||
int (*cancel_auto_extension)(void(*)(void));
|
||||
int (*load_extension)(sqlite3*,const char*,const char*,char**);
|
||||
int (*auto_extension)(void (*)(void));
|
||||
int (*bind_blob64)(sqlite3_stmt *, int, const void *, sqlite3_uint64, void (*)(void *));
|
||||
int (*bind_text64)(sqlite3_stmt *, int, const char *, sqlite3_uint64, void (*)(void *), unsigned char);
|
||||
int (*cancel_auto_extension)(void (*)(void));
|
||||
int (*load_extension)(sqlite3 *, const char *, const char *, char **);
|
||||
void *(*malloc64)(sqlite3_uint64);
|
||||
sqlite3_uint64 (*msize)(void*);
|
||||
void *(*realloc64)(void*,sqlite3_uint64);
|
||||
sqlite3_uint64 (*msize)(void *);
|
||||
void *(*realloc64)(void *, sqlite3_uint64);
|
||||
void (*reset_auto_extension)(void);
|
||||
void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
|
||||
void(*)(void*));
|
||||
void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
|
||||
void(*)(void*), unsigned char);
|
||||
int (*strglob)(const char*,const char*);
|
||||
void (*result_blob64)(sqlite3_context *, const void *, sqlite3_uint64, void (*)(void *));
|
||||
void (*result_text64)(sqlite3_context *, const char *, sqlite3_uint64, void (*)(void *), unsigned char);
|
||||
int (*strglob)(const char *, const char *);
|
||||
/* Version 3.8.11 and later */
|
||||
sqlite3_value *(*value_dup)(const sqlite3_value*);
|
||||
void (*value_free)(sqlite3_value*);
|
||||
int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64);
|
||||
int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64);
|
||||
sqlite3_value *(*value_dup)(const sqlite3_value *);
|
||||
void (*value_free)(sqlite3_value *);
|
||||
int (*result_zeroblob64)(sqlite3_context *, sqlite3_uint64);
|
||||
int (*bind_zeroblob64)(sqlite3_stmt *, int, sqlite3_uint64);
|
||||
/* Version 3.9.0 and later */
|
||||
unsigned int (*value_subtype)(sqlite3_value*);
|
||||
void (*result_subtype)(sqlite3_context*,unsigned int);
|
||||
unsigned int (*value_subtype)(sqlite3_value *);
|
||||
void (*result_subtype)(sqlite3_context *, unsigned int);
|
||||
/* Version 3.10.0 and later */
|
||||
int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int);
|
||||
int (*strlike)(const char*,const char*,unsigned int);
|
||||
int (*db_cacheflush)(sqlite3*);
|
||||
int (*status64)(int, sqlite3_int64 *, sqlite3_int64 *, int);
|
||||
int (*strlike)(const char *, const char *, unsigned int);
|
||||
int (*db_cacheflush)(sqlite3 *);
|
||||
/* Version 3.12.0 and later */
|
||||
int (*system_errno)(sqlite3*);
|
||||
int (*system_errno)(sqlite3 *);
|
||||
/* Version 3.14.0 and later */
|
||||
int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
|
||||
char *(*expanded_sql)(sqlite3_stmt*);
|
||||
int (*trace_v2)(sqlite3 *, unsigned, int (*)(unsigned, void *, void *, void *), void *);
|
||||
char *(*expanded_sql)(sqlite3_stmt *);
|
||||
/* Version 3.18.0 and later */
|
||||
void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
|
||||
void (*set_last_insert_rowid)(sqlite3 *, sqlite3_int64);
|
||||
/* Version 3.20.0 and later */
|
||||
int (*prepare_v3)(sqlite3*,const char*,int,unsigned int,
|
||||
sqlite3_stmt**,const char**);
|
||||
int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int,
|
||||
sqlite3_stmt**,const void**);
|
||||
int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*));
|
||||
void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*));
|
||||
void *(*value_pointer)(sqlite3_value*,const char*);
|
||||
int (*vtab_nochange)(sqlite3_context*);
|
||||
int (*value_nochange)(sqlite3_value*);
|
||||
const char *(*vtab_collation)(sqlite3_index_info*,int);
|
||||
int (*prepare_v3)(sqlite3 *, const char *, int, unsigned int, sqlite3_stmt **, const char **);
|
||||
int (*prepare16_v3)(sqlite3 *, const void *, int, unsigned int, sqlite3_stmt **, const void **);
|
||||
int (*bind_pointer)(sqlite3_stmt *, int, void *, const char *, void (*)(void *));
|
||||
void (*result_pointer)(sqlite3_context *, void *, const char *, void (*)(void *));
|
||||
void *(*value_pointer)(sqlite3_value *, const char *);
|
||||
int (*vtab_nochange)(sqlite3_context *);
|
||||
int (*value_nochange)(sqlite3_value *);
|
||||
const char *(*vtab_collation)(sqlite3_index_info *, int);
|
||||
/* Version 3.24.0 and later */
|
||||
int (*keyword_count)(void);
|
||||
int (*keyword_name)(int,const char**,int*);
|
||||
int (*keyword_check)(const char*,int);
|
||||
sqlite3_str *(*str_new)(sqlite3*);
|
||||
char *(*str_finish)(sqlite3_str*);
|
||||
void (*str_appendf)(sqlite3_str*, const char *zFormat, ...);
|
||||
void (*str_vappendf)(sqlite3_str*, const char *zFormat, va_list);
|
||||
void (*str_append)(sqlite3_str*, const char *zIn, int N);
|
||||
void (*str_appendall)(sqlite3_str*, const char *zIn);
|
||||
void (*str_appendchar)(sqlite3_str*, int N, char C);
|
||||
void (*str_reset)(sqlite3_str*);
|
||||
int (*str_errcode)(sqlite3_str*);
|
||||
int (*str_length)(sqlite3_str*);
|
||||
char *(*str_value)(sqlite3_str*);
|
||||
int (*keyword_name)(int, const char **, int *);
|
||||
int (*keyword_check)(const char *, int);
|
||||
sqlite3_str *(*str_new)(sqlite3 *);
|
||||
char *(*str_finish)(sqlite3_str *);
|
||||
void (*str_appendf)(sqlite3_str *, const char *zFormat, ...);
|
||||
void (*str_vappendf)(sqlite3_str *, const char *zFormat, va_list);
|
||||
void (*str_append)(sqlite3_str *, const char *zIn, int N);
|
||||
void (*str_appendall)(sqlite3_str *, const char *zIn);
|
||||
void (*str_appendchar)(sqlite3_str *, int N, char C);
|
||||
void (*str_reset)(sqlite3_str *);
|
||||
int (*str_errcode)(sqlite3_str *);
|
||||
int (*str_length)(sqlite3_str *);
|
||||
char *(*str_value)(sqlite3_str *);
|
||||
/* Version 3.25.0 and later */
|
||||
int (*create_window_function)(sqlite3*,const char*,int,int,void*,
|
||||
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
|
||||
void (*xFinal)(sqlite3_context*),
|
||||
void (*xValue)(sqlite3_context*),
|
||||
void (*xInv)(sqlite3_context*,int,sqlite3_value**),
|
||||
void(*xDestroy)(void*));
|
||||
int (*create_window_function)(sqlite3 *,
|
||||
const char *,
|
||||
int,
|
||||
int,
|
||||
void *,
|
||||
void (*xStep)(sqlite3_context *, int, sqlite3_value **),
|
||||
void (*xFinal)(sqlite3_context *),
|
||||
void (*xValue)(sqlite3_context *),
|
||||
void (*xInv)(sqlite3_context *, int, sqlite3_value **),
|
||||
void (*xDestroy)(void *));
|
||||
/* Version 3.26.0 and later */
|
||||
const char *(*normalized_sql)(sqlite3_stmt*);
|
||||
const char *(*normalized_sql)(sqlite3_stmt *);
|
||||
/* Version 3.28.0 and later */
|
||||
int (*stmt_isexplain)(sqlite3_stmt*);
|
||||
int (*value_frombind)(sqlite3_value*);
|
||||
int (*stmt_isexplain)(sqlite3_stmt *);
|
||||
int (*value_frombind)(sqlite3_value *);
|
||||
/* Version 3.30.0 and later */
|
||||
int (*drop_modules)(sqlite3*,const char**);
|
||||
int (*drop_modules)(sqlite3 *, const char **);
|
||||
/* Version 3.31.0 and later */
|
||||
sqlite3_int64 (*hard_heap_limit64)(sqlite3_int64);
|
||||
const char *(*uri_key)(const char*,int);
|
||||
const char *(*filename_database)(const char*);
|
||||
const char *(*filename_journal)(const char*);
|
||||
const char *(*filename_wal)(const char*);
|
||||
const char *(*uri_key)(const char *, int);
|
||||
const char *(*filename_database)(const char *);
|
||||
const char *(*filename_journal)(const char *);
|
||||
const char *(*filename_wal)(const char *);
|
||||
/* Version 3.32.0 and later */
|
||||
char *(*create_filename)(const char*,const char*,const char*,
|
||||
int,const char**);
|
||||
void (*free_filename)(char*);
|
||||
sqlite3_file *(*database_file_object)(const char*);
|
||||
char *(*create_filename)(const char *, const char *, const char *, int, const char **);
|
||||
void (*free_filename)(char *);
|
||||
sqlite3_file *(*database_file_object)(const char *);
|
||||
/* Version 3.34.0 and later */
|
||||
int (*txn_state)(sqlite3*,const char*);
|
||||
int (*txn_state)(sqlite3 *, const char *);
|
||||
/* Version 3.36.1 and later */
|
||||
sqlite3_int64 (*changes64)(sqlite3*);
|
||||
sqlite3_int64 (*total_changes64)(sqlite3*);
|
||||
sqlite3_int64 (*changes64)(sqlite3 *);
|
||||
sqlite3_int64 (*total_changes64)(sqlite3 *);
|
||||
/* Version 3.37.0 and later */
|
||||
int (*autovacuum_pages)(sqlite3*,
|
||||
unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
|
||||
void*, void(*)(void*));
|
||||
int (*autovacuum_pages)(sqlite3 *,
|
||||
unsigned int (*)(void *, const char *, unsigned int, unsigned int, unsigned int),
|
||||
void *,
|
||||
void (*)(void *));
|
||||
/* Version 3.38.0 and later */
|
||||
int (*error_offset)(sqlite3*);
|
||||
int (*vtab_rhs_value)(sqlite3_index_info*,int,sqlite3_value**);
|
||||
int (*vtab_distinct)(sqlite3_index_info*);
|
||||
int (*vtab_in)(sqlite3_index_info*,int,int);
|
||||
int (*vtab_in_first)(sqlite3_value*,sqlite3_value**);
|
||||
int (*vtab_in_next)(sqlite3_value*,sqlite3_value**);
|
||||
int (*error_offset)(sqlite3 *);
|
||||
int (*vtab_rhs_value)(sqlite3_index_info *, int, sqlite3_value **);
|
||||
int (*vtab_distinct)(sqlite3_index_info *);
|
||||
int (*vtab_in)(sqlite3_index_info *, int, int);
|
||||
int (*vtab_in_first)(sqlite3_value *, sqlite3_value **);
|
||||
int (*vtab_in_next)(sqlite3_value *, sqlite3_value **);
|
||||
/* Version 3.39.0 and later */
|
||||
int (*deserialize)(sqlite3*,const char*,unsigned char*,
|
||||
sqlite3_int64,sqlite3_int64,unsigned);
|
||||
unsigned char *(*serialize)(sqlite3*,const char *,sqlite3_int64*,
|
||||
unsigned int);
|
||||
const char *(*db_name)(sqlite3*,int);
|
||||
int (*deserialize)(sqlite3 *, const char *, unsigned char *, sqlite3_int64, sqlite3_int64, unsigned);
|
||||
unsigned char *(*serialize)(sqlite3 *, const char *, sqlite3_int64 *, unsigned int);
|
||||
const char *(*db_name)(sqlite3 *, int);
|
||||
};
|
||||
|
||||
/*
|
||||
** This is the function signature used for all extension entry points. It
|
||||
** is also defined in the file "loadext.c".
|
||||
*/
|
||||
typedef int (*sqlite3_loadext_entry)(
|
||||
sqlite3 *db, /* Handle to the sqlitecipher. */
|
||||
typedef int (*sqlite3_loadext_entry)(sqlite3 *db, /* Handle to the sqlitecipher. */
|
||||
char **pzErrMsg, /* Used to set error string on failure. */
|
||||
const sqlite3_api_routines *pThunk /* Extension API function pointers. */
|
||||
);
|
||||
|
@ -684,18 +700,17 @@ typedef int (*sqlite3_loadext_entry)(
|
|||
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
|
||||
|
||||
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
||||
/* This case when the file really is being compiled as a loadable
|
||||
/* This case when the file really is being compiled as a loadable
|
||||
** extension */
|
||||
# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0;
|
||||
# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v;
|
||||
# define SQLITE_EXTENSION_INIT3 \
|
||||
extern const sqlite3_api_routines *sqlite3_api;
|
||||
#define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api = 0;
|
||||
#define SQLITE_EXTENSION_INIT2(v) sqlite3_api = v;
|
||||
#define SQLITE_EXTENSION_INIT3 extern const sqlite3_api_routines *sqlite3_api;
|
||||
#else
|
||||
/* This case when the file is being statically linked into the
|
||||
/* This case when the file is being statically linked into the
|
||||
** application */
|
||||
# define SQLITE_EXTENSION_INIT1 /*no-op*/
|
||||
# define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */
|
||||
# define SQLITE_EXTENSION_INIT3 /*no-op*/
|
||||
#define SQLITE_EXTENSION_INIT1 /*no-op*/
|
||||
#define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */
|
||||
#define SQLITE_EXTENSION_INIT3 /*no-op*/
|
||||
#endif
|
||||
|
||||
#endif /* SQLITE3EXT_H */
|
||||
|
|
|
@ -221,9 +221,8 @@ typedef struct {
|
|||
} \
|
||||
} \
|
||||
if ((a)->i > ((pos) + (len))) { \
|
||||
memmove(_utarray_eltptr(a, pos), \
|
||||
_utarray_eltptr(a, (pos) + (len)), \
|
||||
((a)->i - ((pos) + (len))) * (a)->icd.sz); \
|
||||
memmove( \
|
||||
_utarray_eltptr(a, pos), _utarray_eltptr(a, (pos) + (len)), ((a)->i - ((pos) + (len))) * (a)->icd.sz); \
|
||||
} \
|
||||
(a)->i -= (len); \
|
||||
} while (0)
|
||||
|
@ -274,8 +273,9 @@ static void utarray_str_cpy(void *dst, const void *src) {
|
|||
}
|
||||
static void utarray_str_dtor(void *elt) {
|
||||
char **eltc = (char **)elt;
|
||||
if (*eltc != NULL)
|
||||
if (*eltc != NULL) {
|
||||
free(*eltc);
|
||||
}
|
||||
}
|
||||
static const UT_icd ut_str_icd UTARRAY_UNUSED = {sizeof(char *), NULL, utarray_str_cpy, utarray_str_dtor};
|
||||
static const UT_icd ut_int_icd UTARRAY_UNUSED = {sizeof(int), NULL, NULL, NULL};
|
||||
|
|
|
@ -226,8 +226,8 @@ typedef unsigned char uint8_t;
|
|||
(head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \
|
||||
(head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \
|
||||
(head)->hh.tbl->hho = (char *)(&(head)->hh) - (char *)(head); \
|
||||
(head)->hh.tbl->buckets = \
|
||||
(UT_hash_bucket *)uthash_malloc(HASH_INITIAL_NUM_BUCKETS * sizeof(struct UT_hash_bucket)); \
|
||||
(head)->hh.tbl->buckets = (UT_hash_bucket *)uthash_malloc(HASH_INITIAL_NUM_BUCKETS \
|
||||
* sizeof(struct UT_hash_bucket)); \
|
||||
(head)->hh.tbl->signature = HASH_SIGNATURE; \
|
||||
if (!(head)->hh.tbl->buckets) { \
|
||||
HASH_RECORD_OOM(oomed); \
|
||||
|
@ -523,10 +523,8 @@ typedef unsigned char uint8_t;
|
|||
_prev = NULL; \
|
||||
while (_thh) { \
|
||||
if (_prev != (char *)(_thh->hh_prev)) { \
|
||||
HASH_OOPS("%s: invalid hh_prev %p, actual %p\n", \
|
||||
(where), \
|
||||
(void *)_thh->hh_prev, \
|
||||
(void *)_prev); \
|
||||
HASH_OOPS( \
|
||||
"%s: invalid hh_prev %p, actual %p\n", (where), (void *)_thh->hh_prev, (void *)_prev); \
|
||||
} \
|
||||
_bkt_count++; \
|
||||
_prev = (char *)(_thh); \
|
||||
|
@ -888,8 +886,8 @@ typedef unsigned char uint8_t;
|
|||
(tbl)->num_buckets *= 2U; \
|
||||
(tbl)->log2_num_buckets++; \
|
||||
(tbl)->buckets = _he_new_buckets; \
|
||||
(tbl)->ineff_expands = \
|
||||
((tbl)->nonideal_items > ((tbl)->num_items >> 1)) ? ((tbl)->ineff_expands + 1U) : 0U; \
|
||||
(tbl)->ineff_expands = ((tbl)->nonideal_items > ((tbl)->num_items >> 1)) ? ((tbl)->ineff_expands + 1U) \
|
||||
: 0U; \
|
||||
if ((tbl)->ineff_expands > 1U) { \
|
||||
(tbl)->noexpand = 1; \
|
||||
uthash_noexpand_fyi(tbl); \
|
||||
|
|
|
@ -152,11 +152,12 @@ UTSTRING_UNUSED static void utstring_printf_va(UT_string *s, const char *fmt, va
|
|||
}
|
||||
|
||||
/* Else try again with more space. */
|
||||
if (n > -1)
|
||||
if (n > -1) {
|
||||
utstring_reserve(s, n + 1); /* exact */
|
||||
else
|
||||
} else {
|
||||
utstring_reserve(s, (s->n) * 2); /* 2x */
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef __GNUC__
|
||||
/* support printf format checking (2=the format string, 3=start of varargs) */
|
||||
|
@ -227,8 +228,11 @@ UTSTRING_UNUSED static void _utstring_BuildTableR(const char *P_Needle, size_t P
|
|||
}
|
||||
|
||||
/* Search data from left to right. ( Multiple search mode. ) */
|
||||
UTSTRING_UNUSED static long _utstring_find(const char *P_Haystack, size_t P_HaystackLen, const char *P_Needle,
|
||||
size_t P_NeedleLen, long *P_KMP_Table) {
|
||||
UTSTRING_UNUSED static long _utstring_find(const char *P_Haystack,
|
||||
size_t P_HaystackLen,
|
||||
const char *P_Needle,
|
||||
size_t P_NeedleLen,
|
||||
long *P_KMP_Table) {
|
||||
long i, j;
|
||||
long V_FindPosition = -1;
|
||||
|
||||
|
@ -251,8 +255,11 @@ UTSTRING_UNUSED static long _utstring_find(const char *P_Haystack, size_t P_Hays
|
|||
}
|
||||
|
||||
/* Search data from right to left. ( Multiple search mode. ) */
|
||||
UTSTRING_UNUSED static long _utstring_findR(const char *P_Haystack, size_t P_HaystackLen, const char *P_Needle,
|
||||
size_t P_NeedleLen, long *P_KMP_Table) {
|
||||
UTSTRING_UNUSED static long _utstring_findR(const char *P_Haystack,
|
||||
size_t P_HaystackLen,
|
||||
const char *P_Needle,
|
||||
size_t P_NeedleLen,
|
||||
long *P_KMP_Table) {
|
||||
long i, j;
|
||||
long V_FindPosition = -1;
|
||||
|
||||
|
@ -278,7 +285,8 @@ UTSTRING_UNUSED static long _utstring_findR(const char *P_Haystack, size_t P_Hay
|
|||
/* Search data from left to right. ( One time search mode. ) */
|
||||
UTSTRING_UNUSED static long utstring_find(UT_string *s,
|
||||
long P_StartPosition, /* Start from 0. -1 means last position. */
|
||||
const char *P_Needle, size_t P_NeedleLen) {
|
||||
const char *P_Needle,
|
||||
size_t P_NeedleLen) {
|
||||
long V_StartPosition;
|
||||
long V_HaystackLen;
|
||||
long *V_KMP_Table;
|
||||
|
@ -310,7 +318,8 @@ UTSTRING_UNUSED static long utstring_find(UT_string *s,
|
|||
/* Search data from right to left. ( One time search mode. ) */
|
||||
UTSTRING_UNUSED static long utstring_findR(UT_string *s,
|
||||
long P_StartPosition, /* Start from 0. -1 means last position. */
|
||||
const char *P_Needle, size_t P_NeedleLen) {
|
||||
const char *P_Needle,
|
||||
size_t P_NeedleLen) {
|
||||
long V_StartPosition;
|
||||
long V_HaystackLen;
|
||||
long *V_KMP_Table;
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
#define SRC_ZVECTOR_H_
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Requires standard C libraries:
|
||||
|
@ -32,7 +32,7 @@ extern "C"{
|
|||
#include "zvector_config.h"
|
||||
|
||||
// Declare required structs:
|
||||
typedef struct p_vector * vector;
|
||||
typedef struct p_vector *vector;
|
||||
|
||||
// Declare required enums:
|
||||
|
||||
|
@ -55,7 +55,8 @@ enum ZVECT_PROPERTIES {
|
|||
ZV_NONE = 0, // Sets or Resets all vector's properties to 0.
|
||||
ZV_SEC_WIPE = 1 << 0, // Sets the vector for automatic Secure Wipe of items.
|
||||
ZV_BYREF = 1 << 1, // Sets the vector to store items by reference instead of copying them as per default.
|
||||
ZV_CIRCULAR = 1 << 2, // Sets the vector to be a circular vector (so it will not grow in capacity automatically). Elements will be overwritten as in typical circular buffers!
|
||||
ZV_CIRCULAR = 1
|
||||
<< 2, // Sets the vector to be a circular vector (so it will not grow in capacity automatically). Elements will be overwritten as in typical circular buffers!
|
||||
ZV_NOLOCKING = 1 << 3, // This Property means the vector will not use mutexes, be careful using it!
|
||||
};
|
||||
|
||||
|
@ -137,7 +138,7 @@ bool vect_set_status(const vector v, zvect_index flag_id);
|
|||
|
||||
bool vect_clear_status(const vector v, zvect_index flag_id);
|
||||
|
||||
#if ( ZVECT_THREAD_SAFE == 1 )
|
||||
#if (ZVECT_THREAD_SAFE == 1)
|
||||
// Vector Thread Safe functions:
|
||||
|
||||
/*
|
||||
|
@ -201,7 +202,8 @@ zvect_retval vect_unlock(vector const v);
|
|||
* zvect_retval vect_lock_after_signal(const vector v);
|
||||
*/
|
||||
|
||||
zvect_retval vect_move_on_signal(vector const v1, vector v2,
|
||||
zvect_retval vect_move_on_signal(vector const v1,
|
||||
vector v2,
|
||||
const zvect_index s2,
|
||||
const zvect_index e2,
|
||||
zvect_retval (*f2)(void *, void *));
|
||||
|
@ -229,7 +231,7 @@ zvect_retval vect_sem_post(const vector v);
|
|||
* corresponds to the top of a
|
||||
* Stack.
|
||||
*/
|
||||
void vect_push(vector const v, const void *item);
|
||||
void vect_push(vector const v, const void *item);
|
||||
|
||||
/*
|
||||
* vect_pop(v) "pops" (returns) the element
|
||||
|
@ -458,7 +460,7 @@ void vect_rotate_right(vector const v, const zvect_index i);
|
|||
* pointers to your datastructures stored in the vector.
|
||||
*
|
||||
*/
|
||||
void vect_qsort(vector const v, int (*compare_func)(const void *, const void*));
|
||||
void vect_qsort(vector const v, int (*compare_func)(const void *, const void *));
|
||||
|
||||
/*
|
||||
* vect_bsearch is a function that allows to perform
|
||||
|
@ -479,11 +481,11 @@ void vect_qsort(vector const v, int (*compare_func)(const void *, const void*));
|
|||
* vect_bsearch(v, &i, my_compare);
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
extern "C" {
|
||||
#endif
|
||||
bool vect_bsearch(vector const v, const void *key, int (*f1)(const void *, const void *), zvect_index *item_index);
|
||||
bool vect_bsearch(vector const v, const void *key, int (*f1)(const void *, const void *), zvect_index *item_index);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* vect_add_ordered allows the insertion of new items in
|
||||
|
@ -591,8 +593,7 @@ void vect_copy(vector const v1, vector const v2, zvect_index start, zvect_index
|
|||
* you'll have such items "inserted"
|
||||
* inside v1.
|
||||
*/
|
||||
void vect_insert(vector const v1, vector const v2, const zvect_index s2,
|
||||
const zvect_index e2, const zvect_index s1);
|
||||
void vect_insert(vector const v1, vector const v2, const zvect_index s2, const zvect_index e2, const zvect_index s1);
|
||||
|
||||
/*
|
||||
* vect_move is a function that allows to move a specified
|
||||
|
@ -623,8 +624,11 @@ void vect_move(vector const v1, vector const v2, zvect_index start, zvect_index
|
|||
* the end of v1 if check_data returns
|
||||
* true.
|
||||
*/
|
||||
zvect_retval vect_move_if(vector const v1, vector v2, const zvect_index s2,
|
||||
const zvect_index e2, zvect_retval (*f2)(void *, void *));
|
||||
zvect_retval vect_move_if(vector const v1,
|
||||
vector v2,
|
||||
const zvect_index s2,
|
||||
const zvect_index e2,
|
||||
zvect_retval (*f2)(void *, void *));
|
||||
|
||||
/*
|
||||
* vect_merge is a function that merges together 2 vectors of
|
||||
|
|
|
@ -17,128 +17,122 @@
|
|||
|
||||
// Try to determine the Operating System being used:
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
# define macOS
|
||||
#define macOS
|
||||
#endif
|
||||
|
||||
#if ( defined(__GNU__) || defined(__gnu_linux__) || \
|
||||
defined(__linux__) || defined(macOS) )
|
||||
# define OS_TYPE 1
|
||||
#elif ( defined(__WIN32__) || defined(WIN32) || defined(_WIN32) )
|
||||
# define OS_TYPE 2
|
||||
#if (defined(__GNU__) || defined(__gnu_linux__) || defined(__linux__) || defined(macOS))
|
||||
#define OS_TYPE 1
|
||||
#elif (defined(__WIN32__) || defined(WIN32) || defined(_WIN32))
|
||||
#define OS_TYPE 2
|
||||
#else
|
||||
# define OS_TYPE 0
|
||||
#define OS_TYPE 0
|
||||
#endif
|
||||
|
||||
// Try to determine compiler being used:
|
||||
#if defined(__GNUC__)
|
||||
# define compiler gcc
|
||||
# define ZVECT_COMPTYPE 1
|
||||
# define COMP_MAJRELEASE (__GNUC__)
|
||||
# define COMP_MINRELEASE (__GNUC_MINOR__)
|
||||
# define COMP_PATRELEASE (__GNUC_PATCHLEVEL__)
|
||||
#define compiler gcc
|
||||
#define ZVECT_COMPTYPE 1
|
||||
#define COMP_MAJRELEASE (__GNUC__)
|
||||
#define COMP_MINRELEASE (__GNUC_MINOR__)
|
||||
#define COMP_PATRELEASE (__GNUC_PATCHLEVEL__)
|
||||
#elif defined(_MSC_VER)
|
||||
# define compiler msc
|
||||
# define ZVECT_COMPTYPE 2
|
||||
# define COMP_MAJRELEASE (_MSC_VER)
|
||||
# define COMP_MINRELEASE 0
|
||||
# define COMP_PATRELEASE 0
|
||||
#define compiler msc
|
||||
#define ZVECT_COMPTYPE 2
|
||||
#define COMP_MAJRELEASE (_MSC_VER)
|
||||
#define COMP_MINRELEASE 0
|
||||
#define COMP_PATRELEASE 0
|
||||
#elif defined(__clang__)
|
||||
# define compiler clang
|
||||
# define ZVECT_COMPTYPE 3
|
||||
# define COMP_MAJRELEASE (__clang_major__)
|
||||
# define COMP_MINRELEASE (__clang_minor__)
|
||||
# define COMP_PATRELEASE (__clang_patchlevel__)
|
||||
#elif defined(__INTEL_COMPILER) || defined(__ICC) || \
|
||||
defined(__ECC) || defined(__ICL)
|
||||
#define compiler clang
|
||||
#define ZVECT_COMPTYPE 3
|
||||
#define COMP_MAJRELEASE (__clang_major__)
|
||||
#define COMP_MINRELEASE (__clang_minor__)
|
||||
#define COMP_PATRELEASE (__clang_patchlevel__)
|
||||
#elif defined(__INTEL_COMPILER) || defined(__ICC) || defined(__ECC) || defined(__ICL)
|
||||
// For intel c compiler please remember to specify:
|
||||
// /Qstd=c99 (on Windows)
|
||||
// -std=c99 on Linux and/or macOS
|
||||
# define compiler intelc
|
||||
# define ZVECT_COMPTYPE 4
|
||||
# define COMP_MAJRELEASE (__INTEL_COMPILER)
|
||||
# define COMP_MINRELEASE 0
|
||||
# define COMP_PATRELEASE 0
|
||||
#elif defined (__LCC__)
|
||||
# define compiler lcc
|
||||
# define ZVECT_COMPTYPE 5
|
||||
# define COMP_MAJRELEASE (__LCC)
|
||||
# define COMP_MINRELEASE 0
|
||||
# define COMP_PATRELEASE 0
|
||||
#elif defined(__NORCROFT_C__) || defined(__CC_NORCROFT) || \
|
||||
defined(__ARMCC_VERSION)
|
||||
#define compiler intelc
|
||||
#define ZVECT_COMPTYPE 4
|
||||
#define COMP_MAJRELEASE (__INTEL_COMPILER)
|
||||
#define COMP_MINRELEASE 0
|
||||
#define COMP_PATRELEASE 0
|
||||
#elif defined(__LCC__)
|
||||
#define compiler lcc
|
||||
#define ZVECT_COMPTYPE 5
|
||||
#define COMP_MAJRELEASE (__LCC)
|
||||
#define COMP_MINRELEASE 0
|
||||
#define COMP_PATRELEASE 0
|
||||
#elif defined(__NORCROFT_C__) || defined(__CC_NORCROFT) || defined(__ARMCC_VERSION)
|
||||
// For Norcroft C please remember to specify:
|
||||
// -c99
|
||||
# define compiler norcroftc
|
||||
# define ZVECT_COMPTYPE 6
|
||||
# define COMP_MAJRELEASE (__ARMCC_VERSION)
|
||||
#define compiler norcroftc
|
||||
#define ZVECT_COMPTYPE 6
|
||||
#define COMP_MAJRELEASE (__ARMCC_VERSION)
|
||||
#elif defined(_CRAYC)
|
||||
// For Cray C please remember to specify:
|
||||
// -hc99
|
||||
# define compiler crayc
|
||||
# define ZVECT_COMPTYPE 10
|
||||
# define COMP_MAJRELEASE (_RELEASE)
|
||||
# define COMP_MINRELEASE (_RELEASE_MINOR)
|
||||
# define COMP_PATRELEASE 0
|
||||
#define compiler crayc
|
||||
#define ZVECT_COMPTYPE 10
|
||||
#define COMP_MAJRELEASE (_RELEASE)
|
||||
#define COMP_MINRELEASE (_RELEASE_MINOR)
|
||||
#define COMP_PATRELEASE 0
|
||||
#elif defined(__HP_cc)
|
||||
// For HP CC please remember to specify:
|
||||
// -ansi -std=c99
|
||||
# define compiler hpc
|
||||
# define ZVECT_COMPTYPE 11
|
||||
# define COMP_MAJRELEASE 1
|
||||
# define COMP_MINRELEASE 21
|
||||
# define COMP_PATRELEASE 0
|
||||
#define compiler hpc
|
||||
#define ZVECT_COMPTYPE 11
|
||||
#define COMP_MAJRELEASE 1
|
||||
#define COMP_MINRELEASE 21
|
||||
#define COMP_PATRELEASE 0
|
||||
#elif defined(__IBMC__)
|
||||
// For IBM C please remember to specify:
|
||||
// C99 flags
|
||||
# define compiler ibmc
|
||||
# define ZVECT_COMPTYPE 12
|
||||
#define compiler ibmc
|
||||
#define ZVECT_COMPTYPE 12
|
||||
#elif defined(__TINYC__)
|
||||
# define compiler tinyc
|
||||
# define ZVECT_COMPTYPE 6
|
||||
# define COMP_MAJRELEASE 0
|
||||
# define COMP_MINRELEASE 0
|
||||
# define COMP_PATRELEASE 0
|
||||
#define compiler tinyc
|
||||
#define ZVECT_COMPTYPE 6
|
||||
#define COMP_MAJRELEASE 0
|
||||
#define COMP_MINRELEASE 0
|
||||
#define COMP_PATRELEASE 0
|
||||
#else
|
||||
# define compiler unknown
|
||||
# define ZVECT_COMPTYPE 0
|
||||
#define compiler unknown
|
||||
#define ZVECT_COMPTYPE 0
|
||||
#endif
|
||||
|
||||
// Try to determine CPU Architecture:
|
||||
#if defined(__aarch64__)
|
||||
# define CPU_TYPE ARM64
|
||||
# define Arch64
|
||||
#define CPU_TYPE ARM64
|
||||
#define Arch64
|
||||
#elif defined(__aarch32__)
|
||||
# define CPU_TYPE ARM32
|
||||
# define Arch32
|
||||
#elif defined(__amd64__) || defined(__x86_64__) || \
|
||||
defined(__ia64__) || defined(_M_IA64) || \
|
||||
defined(_M_AMD64) || defined(_M_X64)
|
||||
# define CPU_TYPE x86_64
|
||||
# define Arch64
|
||||
#define CPU_TYPE ARM32
|
||||
#define Arch32
|
||||
#elif defined(__amd64__) || defined(__x86_64__) || defined(__ia64__) || defined(_M_IA64) || defined(_M_AMD64) \
|
||||
|| defined(_M_X64)
|
||||
#define CPU_TYPE x86_64
|
||||
#define Arch64
|
||||
#else
|
||||
# define CPU_TYPE unknown
|
||||
# define Arch32
|
||||
#define CPU_TYPE unknown
|
||||
#define Arch32
|
||||
#endif
|
||||
|
||||
// Start setting up macros based on the platform we detected
|
||||
// above.
|
||||
|
||||
#if ( OS_TYPE == 1 )
|
||||
// We are on a Unix-like OS so we can use pthreads!
|
||||
# define MUTEX_TYPE 1
|
||||
# elif ( OS_TYPE == 2 ) && ( defined(__CYGWIN__) || \
|
||||
defined(__MINGW32__) || defined(__MINGW64__) )
|
||||
// We are on MS Windows using CIGWIN so we can use pthreads!
|
||||
# define MUTEX_TYPE 1
|
||||
# elif ( OS_TYPE == 2 ) && ( !defined(__CYGWIN__) && \
|
||||
!defined(__MINGW32__) && !defined(__MINGW64__) )
|
||||
// We are on MS Windows, so we need to use
|
||||
// Windows stuff:
|
||||
# define MUTEX_TYPE 2
|
||||
#if (OS_TYPE == 1)
|
||||
// We are on a Unix-like OS so we can use pthreads!
|
||||
#define MUTEX_TYPE 1
|
||||
#elif (OS_TYPE == 2) && (defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__))
|
||||
// We are on MS Windows using CIGWIN so we can use pthreads!
|
||||
#define MUTEX_TYPE 1
|
||||
#elif (OS_TYPE == 2) && (!defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__))
|
||||
// We are on MS Windows, so we need to use
|
||||
// Windows stuff:
|
||||
#define MUTEX_TYPE 2
|
||||
#else
|
||||
// I have no idea on which platform are we,
|
||||
// hence I have to use fake mutexes and go with the flow!
|
||||
# define MUTEX_TYPE 0
|
||||
// I have no idea on which platform are we,
|
||||
// hence I have to use fake mutexes and go with the flow!
|
||||
#define MUTEX_TYPE 0
|
||||
#endif
|
||||
|
||||
#endif // SRC_ZVECTOR_CHECKS_H_
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
// Data alignment configuration
|
||||
#if ( ZVECT_COMPTYPE == 1 )
|
||||
#if (ZVECT_COMPTYPE == 1)
|
||||
#define ZVECT_DATAALIGN __attribute__((aligned))
|
||||
#define ZVECT_PACKING __attribute__((__packed__))
|
||||
#define ZVECT_ALWAYSINLINE __attribute__ ((__always_inline__))
|
||||
#define ZVECT_ALWAYSINLINE __attribute__((__always_inline__))
|
||||
#else
|
||||
#define ZVECT_DATAALIGN
|
||||
#define ZVECT_PACKING
|
||||
|
@ -36,7 +36,8 @@
|
|||
// If you want a larger index you can
|
||||
// change it to, for example, uint64_t
|
||||
typedef uint32_t zvect_index;
|
||||
#define zvect_index_max 4294967295 // If you change zvect_index type make sure you update this value
|
||||
#define zvect_index_max \
|
||||
4294967295 // If you change zvect_index type make sure you update this value \
|
||||
// it's the maximum number that can be stored in a zvect_index.
|
||||
|
||||
// Default vector return type for
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -183,7 +183,10 @@ int str_to_ipaddr(const char *pIp, unsigned int *ipAddr) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int get_nic_info(const char *pName, unsigned int *pIp, unsigned int *pNetmask, unsigned int *pGateway,
|
||||
int get_nic_info(const char *pName,
|
||||
unsigned int *pIp,
|
||||
unsigned int *pNetmask,
|
||||
unsigned int *pGateway,
|
||||
unsigned char *pMac) {
|
||||
int sock;
|
||||
struct ifreq ifr;
|
||||
|
@ -234,7 +237,7 @@ int get_nic_info(const char *pName, unsigned int *pIp, unsigned int *pNetmask, u
|
|||
return err;
|
||||
}
|
||||
|
||||
const char*get_cur_process_name() {
|
||||
const char *get_cur_process_name() {
|
||||
static char g_exeName[1024];
|
||||
|
||||
memset(g_exeName, 0, 1024);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -105,7 +105,7 @@ int mq_init(void) {
|
|||
return ERR_SUCCESS;
|
||||
}
|
||||
|
||||
void* get_mq_context() {
|
||||
void *get_mq_context() {
|
||||
return g_pContext;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
int http_svr_init() {
|
||||
configuration config;
|
||||
config.http_listen_address = (char*)config_get_http_server_addr();
|
||||
config.http_listen_address = (char *)config_get_http_server_addr();
|
||||
config.http_listen_port = config_get_http_server_port();
|
||||
config.thread_count = 0;
|
||||
config.parser = "http_parser";
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef struct {
|
|||
unsigned int uRetryTimes;
|
||||
PHTTP_REQ_PARAMS pCurlItem;
|
||||
|
||||
UT_hash_handle hh;///< UT Hash handle
|
||||
UT_hash_handle hh; ///< UT Hash handle
|
||||
} CURL_HANDLE_TBL, *PCURL_HANDLE_TBL;
|
||||
|
||||
static uv_timer_t g_uvCurlTm;
|
||||
|
@ -229,10 +229,8 @@ static void checkMultiInfo(void) {
|
|||
pReq->errCode = 0;
|
||||
}
|
||||
|
||||
uv_fs_fdatasync(get_task_manager(),
|
||||
&pReq->uvFsDataSync,
|
||||
(uv_file)pReq->uvFsOpen.result,
|
||||
uvFsDataSyncCb);
|
||||
uv_fs_fdatasync(
|
||||
get_task_manager(), &pReq->uvFsDataSync, (uv_file)pReq->uvFsOpen.result, uvFsDataSyncCb);
|
||||
} else if (pReq->type == INET_HTTP_WEBSERVICE_POST) {
|
||||
if (pMsg->data.result != CURLE_OK) {
|
||||
if (pReq->onRspCb && pReq->isCancel == FALSE) {
|
||||
|
@ -402,13 +400,8 @@ static size_t writeDataCb(void *pData, size_t size, size_t nmemb, void *pParams)
|
|||
|
||||
pReq->uvFsBuf = uv_buf_init(pData, iMemSize);
|
||||
|
||||
wr = uv_fs_write(get_task_manager(),
|
||||
&pReq->uvFsWrite,
|
||||
(uv_file)pReq->uvFsOpen.result,
|
||||
&pReq->uvFsBuf,
|
||||
1,
|
||||
-1,
|
||||
NULL);
|
||||
wr = uv_fs_write(
|
||||
get_task_manager(), &pReq->uvFsWrite, (uv_file)pReq->uvFsOpen.result, &pReq->uvFsBuf, 1, -1, NULL);
|
||||
|
||||
if (wr > 0) {
|
||||
pReq->dlSize += wr;
|
||||
|
@ -440,10 +433,8 @@ static int progressCb(void *pData, double total, double now, double UNUSED(ulTot
|
|||
|
||||
if (pParams->onPrgCb) {
|
||||
if (pParams->type == INET_HTTP_DOWNLOAD_FILE) {
|
||||
pParams->onPrgCb(pParams->pReqUrl,
|
||||
pParams->pTaskUuid,
|
||||
(unsigned char)(now * 100.0 / total),
|
||||
pParams->pData);
|
||||
pParams->onPrgCb(
|
||||
pParams->pReqUrl, pParams->pTaskUuid, (unsigned char)(now * 100.0 / total), pParams->pData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -554,8 +545,11 @@ static void onDlTimeoutCb(uv_timer_t *UNUSED(pufTimer)) {
|
|||
}
|
||||
}
|
||||
|
||||
const char *inet_download_file_async(const char *pURL, const char *pPath, on_http_response onRespCb,
|
||||
on_progress_changed onProgressCb, void *pData) {
|
||||
const char *inet_download_file_async(const char *pURL,
|
||||
const char *pPath,
|
||||
on_http_response onRespCb,
|
||||
on_progress_changed onProgressCb,
|
||||
void *pData) {
|
||||
CURLMcode ret;
|
||||
uuid_t msgId;
|
||||
char strMsgId[64];
|
||||
|
@ -614,12 +608,8 @@ const char *inet_download_file_async(const char *pURL, const char *pPath, on_htt
|
|||
|
||||
dzlog_debug("[%s]: File %s used temp path %s\n", pParams->pTaskUuid, pParams->sPath, pParams->sDlPath);
|
||||
|
||||
uv_fs_open(get_task_manager(),
|
||||
&pParams->uvFsOpen,
|
||||
pParams->sDlPath,
|
||||
O_RDWR | O_CREAT | O_TRUNC,
|
||||
S_IRUSR | S_IWUSR,
|
||||
NULL);
|
||||
uv_fs_open(
|
||||
get_task_manager(), &pParams->uvFsOpen, pParams->sDlPath, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR, NULL);
|
||||
|
||||
curl_easy_setopt(pCurl, CURLOPT_WRITEFUNCTION, writeDataCb);
|
||||
curl_easy_setopt(pCurl, CURLOPT_WRITEDATA, pParams);
|
||||
|
@ -631,7 +621,7 @@ const char *inet_download_file_async(const char *pURL, const char *pPath, on_htt
|
|||
curl_easy_setopt(pCurl, CURLOPT_PROGRESSDATA, pParams);
|
||||
|
||||
//curl_easy_setopt(pCurl, CURLOPT_TIMEOUT, 1800L); // Max download times (30 minutes)1800s
|
||||
curl_easy_setopt(pCurl, CURLOPT_LOW_SPEED_LIMIT, 10000L);// 10K bytes
|
||||
curl_easy_setopt(pCurl, CURLOPT_LOW_SPEED_LIMIT, 10000L); // 10K bytes
|
||||
curl_easy_setopt(pCurl, CURLOPT_LOW_SPEED_TIME, 10L); // 30 seconds
|
||||
|
||||
curl_easy_setopt(pCurl, CURLOPT_CONNECTTIMEOUT, 10L);
|
||||
|
|
Loading…
Reference in New Issue