Skip to content
Snippets Groups Projects
Commit 7e1fb01a authored by anta999's avatar anta999
Browse files
parents b26e3cdc 94d4a28d
No related branches found
No related tags found
2 merge requests!2Master,!11.1 12 win
...@@ -4,9 +4,27 @@ project (dap_chain_global_db) ...@@ -4,9 +4,27 @@ project (dap_chain_global_db)
file(GLOB DAP_CHAIN_GLOBAL_DB_SRC *.c) file(GLOB DAP_CHAIN_GLOBAL_DB_SRC *.c)
file(GLOB DAP_CHAIN_GLOBAL_DB_HDR *.h) file(GLOB DAP_CHAIN_GLOBAL_DB_HDR *.h)
if(WIN32)
include_directories(../libdap/src/win32/)
include_directories(../3rdparty/libmemcached/)
include_directories(../3rdparty/libmemcached/win32/)
include_directories(../3rdparty/wepoll/include/)
include_directories(../3rdparty/uthash/src/)
include_directories(../3rdparty/libjson-c/)
include_directories(../3rdparty/libmagic/src/)
include_directories(../3rdparty/curl/include/)
include_directories(../3rdparty/libsqlite3/)
endif()
add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_GLOBAL_DB_SRC} ${DAP_CHAIN_GLOBAL_DB_HDR}) add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_GLOBAL_DB_SRC} ${DAP_CHAIN_GLOBAL_DB_HDR})
target_link_libraries(dap_chain_global_db dap_core dap_crypto dap_chain dap_chain_crypto ldb talloc tevent sqlite3 ${CMAKE_CURRENT_SOURCE_DIR}/libcuttdb.a) if(WIN32)
target_link_libraries(dap_chain_global_db dap_core dap_crypto dap_chain dap_chain_crypto)
endif()
if(UNIX)
target_link_libraries(dap_chain_global_db dap_core dap_crypto dap_chain dap_chain_crypto ldb talloc tevent sqlite3 ${CMAKE_CURRENT_SOURCE_DIR}/libcuttdb.a)
endif()
target_include_directories(dap_chain_global_db INTERFACE .) target_include_directories(dap_chain_global_db INTERFACE .)
set(${PROJECT_NAME}_DEFINITIONS CACHE INTERNAL "${PROJECT_NAME}: Definitions" FORCE) set(${PROJECT_NAME}_DEFINITIONS CACHE INTERNAL "${PROJECT_NAME}: Definitions" FORCE)
......
...@@ -77,7 +77,10 @@ char * extract_group_prefix(const char * a_group) ...@@ -77,7 +77,10 @@ char * extract_group_prefix(const char * a_group)
{ {
char * l_group_prefix = NULL, *l_delimeter; char * l_group_prefix = NULL, *l_delimeter;
size_t l_group_prefix_size; size_t l_group_prefix_size;
l_delimeter = index(a_group, '.');
// l_delimeter = index(a_group, '.');
l_delimeter = strchr(a_group, '.');
if(l_delimeter == NULL) { if(l_delimeter == NULL) {
l_group_prefix = dap_strdup(a_group); l_group_prefix = dap_strdup(a_group);
l_group_prefix_size = dap_strlen(l_group_prefix) + 1; l_group_prefix_size = dap_strlen(l_group_prefix) + 1;
......
...@@ -187,7 +187,13 @@ int dap_db_driver_cdb_init(const char *a_cdb_path, dap_db_driver_callbacks_t *a_ ...@@ -187,7 +187,13 @@ int dap_db_driver_cdb_init(const char *a_cdb_path, dap_db_driver_callbacks_t *a_
if(s_cdb_path[strlen(s_cdb_path)] == '/') { if(s_cdb_path[strlen(s_cdb_path)] == '/') {
s_cdb_path[strlen(s_cdb_path)] = '\0'; s_cdb_path[strlen(s_cdb_path)] = '\0';
} }
#ifdef _WIN32
mkdir(s_cdb_path);
#else
mkdir(s_cdb_path, 0755); mkdir(s_cdb_path, 0755);
#endif
struct dirent *d; struct dirent *d;
DIR *dir = opendir(s_cdb_path); DIR *dir = opendir(s_cdb_path);
if (!dir) { if (!dir) {
...@@ -229,7 +235,13 @@ int dap_cdb_add_group(const char *a_group) { ...@@ -229,7 +235,13 @@ int dap_cdb_add_group(const char *a_group) {
strcat(l_cdb_path, s_cdb_path); strcat(l_cdb_path, s_cdb_path);
strcat(l_cdb_path, "/"); strcat(l_cdb_path, "/");
strcat(l_cdb_path, a_group); strcat(l_cdb_path, a_group);
#ifdef _WIN32
mkdir(l_cdb_path);
#else
mkdir(l_cdb_path, 0755); mkdir(l_cdb_path, 0755);
#endif
return 0; return 0;
} }
...@@ -312,7 +324,7 @@ dap_store_obj_t *dap_db_driver_cdb_read_store_obj(const char *a_group, const cha ...@@ -312,7 +324,7 @@ dap_store_obj_t *dap_db_driver_cdb_read_store_obj(const char *a_group, const cha
if(a_count_out) { if(a_count_out) {
*a_count_out = l_count_out; *a_count_out = l_count_out;
} }
for (ulong i = 0; i < l_count_out; ++i) { for (uint64_t i = 0; i < l_count_out; ++i) {
l_arg.o[i].group = dap_strdup(a_group); l_arg.o[i].group = dap_strdup(a_group);
} }
l_obj = l_arg.o; l_obj = l_arg.o;
...@@ -360,7 +372,7 @@ dap_store_obj_t* dap_db_driver_cdb_read_cond_store_obj(const char *a_group, uint ...@@ -360,7 +372,7 @@ dap_store_obj_t* dap_db_driver_cdb_read_cond_store_obj(const char *a_group, uint
if(a_count_out) { if(a_count_out) {
*a_count_out = l_count_out; *a_count_out = l_count_out;
} }
for (ulong i = 0; i < l_count_out; ++i) { for (uint64_t i = 0; i < l_count_out; ++i) {
l_arg.o[i].group = dap_strdup(a_group); l_arg.o[i].group = dap_strdup(a_group);
} }
return l_arg.o; return l_arg.o;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment