Skip to content
Snippets Groups Projects
Commit 36d850f8 authored by Constantin Papizh's avatar Constantin Papizh
Browse files

windows build fixed

parent e9845194
No related branches found
No related tags found
1 merge request!336windows build fixed
Pipeline #8231 passed with stage
in 9 seconds
...@@ -16,14 +16,7 @@ ...@@ -16,14 +16,7 @@
#include "cdb_bgtask.h" #include "cdb_bgtask.h"
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#if defined(DAP_OS_DARWIN)
#include <signal.h> #include <signal.h>
#elif defined(_WIN32)
#include <sys/signal.h>
#else
#include <signal.h>
#endif
/* where thread begins */ /* where thread begins */
static void *_cdb_bgtask_func(void *arg); static void *_cdb_bgtask_func(void *arg);
......
...@@ -115,14 +115,13 @@ void dap_chain_cell_delete(dap_chain_cell_t *a_cell) ...@@ -115,14 +115,13 @@ void dap_chain_cell_delete(dap_chain_cell_t *a_cell)
int dap_chain_cell_load(dap_chain_t * a_chain, const char * a_cell_file_path) int dap_chain_cell_load(dap_chain_t * a_chain, const char * a_cell_file_path)
{ {
dap_chain_cell_t * l_cell = dap_chain_cell_create(); dap_chain_cell_t * l_cell = dap_chain_cell_create();
l_cell->file_storage_path = dap_strdup( a_cell_file_path ); l_cell->file_storage_path = dap_strdup( a_cell_file_path );
{
char *l_file_path = dap_strdup_printf("%s/%s", DAP_CHAIN_PVT (a_chain)->file_storage_dir, char l_file_path[MAX_PATH] = {'\0'};
l_cell->file_storage_path); dap_snprintf(l_file_path, MAX_PATH, "%s/%s", DAP_CHAIN_PVT(a_chain)->file_storage_dir,
l_cell->file_storage_path);
l_cell->file_storage = fopen(l_file_path,"rb"); l_cell->file_storage = fopen(l_file_path,"rb");
DAP_DELETE(l_file_path); }
if ( l_cell->file_storage ){ if ( l_cell->file_storage ){
dap_chain_cell_file_header_t l_hdr = {0}; dap_chain_cell_file_header_t l_hdr = {0};
if ( fread( &l_hdr,1,sizeof(l_hdr),l_cell->file_storage ) == sizeof (l_hdr) ) { if ( fread( &l_hdr,1,sizeof(l_hdr),l_cell->file_storage ) == sizeof (l_hdr) ) {
...@@ -186,12 +185,12 @@ int dap_chain_cell_file_append( dap_chain_cell_t * a_cell, const void* a_atom, s ...@@ -186,12 +185,12 @@ int dap_chain_cell_file_append( dap_chain_cell_t * a_cell, const void* a_atom, s
size_t l_total_wrote_bytes = 0; size_t l_total_wrote_bytes = 0;
// file need to be opened or created // file need to be opened or created
if(a_cell->file_storage == NULL) { if(a_cell->file_storage == NULL) {
char *l_file_path = dap_strdup_printf("%s/%s", DAP_CHAIN_PVT ( a_cell->chain)->file_storage_dir, char l_file_path[MAX_PATH] = {'\0'};
a_cell->file_storage_path); dap_snprintf(l_file_path, MAX_PATH, "%s/%s", DAP_CHAIN_PVT(a_cell->chain)->file_storage_dir,
a_cell->file_storage_path);
a_cell->file_storage = fopen(l_file_path, "ab"); a_cell->file_storage = fopen(l_file_path, "ab");
if(a_cell->file_storage == NULL) if(a_cell->file_storage == NULL)
a_cell->file_storage = fopen(l_file_path, "wb"); a_cell->file_storage = fopen(l_file_path, "wb");
DAP_DELETE(l_file_path);
} }
if(!a_cell->file_storage) { if(!a_cell->file_storage) {
log_it(L_ERROR, "File \"%s\" not opened for write cell 0x%016X", log_it(L_ERROR, "File \"%s\" not opened for write cell 0x%016X",
...@@ -255,10 +254,10 @@ int dap_chain_cell_file_update( dap_chain_cell_t * a_cell) ...@@ -255,10 +254,10 @@ int dap_chain_cell_file_update( dap_chain_cell_t * a_cell)
return -1; return -1;
} }
if(a_cell->file_storage == NULL ){ // File need to be created if(a_cell->file_storage == NULL ){ // File need to be created
char *l_file_path = dap_strdup_printf("%s/%s", DAP_CHAIN_PVT ( a_cell->chain)->file_storage_dir, char l_file_path[MAX_PATH] = {'\0'};
a_cell->file_storage_path); dap_snprintf(l_file_path, MAX_PATH, "%s/%s", DAP_CHAIN_PVT(a_cell->chain)->file_storage_dir,
a_cell->file_storage_path);
a_cell->file_storage = fopen(l_file_path, "wb"); a_cell->file_storage = fopen(l_file_path, "wb");
DAP_DELETE(l_file_path);
if(a_cell->file_storage) { if(a_cell->file_storage) {
dap_chain_cell_file_header_t l_hdr = { dap_chain_cell_file_header_t l_hdr = {
.signature = DAP_CHAIN_CELL_FILE_SIGNATURE, .signature = DAP_CHAIN_CELL_FILE_SIGNATURE,
......
...@@ -1040,8 +1040,8 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg) ...@@ -1040,8 +1040,8 @@ void s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg)
// Response with atom hashes and sizes // Response with atom hashes and sizes
case DAP_STREAM_CH_CHAIN_PKT_TYPE_UPDATE_CHAINS :{ case DAP_STREAM_CH_CHAIN_PKT_TYPE_UPDATE_CHAINS :{
uint l_count_added=0; unsigned int l_count_added=0;
uint l_count_total=0; unsigned int l_count_total=0;
dap_chain_t * l_chain = dap_chain_find_by_id(l_chain_pkt->hdr.net_id, l_chain_pkt->hdr.chain_id); dap_chain_t * l_chain = dap_chain_find_by_id(l_chain_pkt->hdr.net_id, l_chain_pkt->hdr.chain_id);
if (! l_chain){ if (! l_chain){
......
...@@ -37,7 +37,7 @@ endif() ...@@ -37,7 +37,7 @@ endif()
add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_NET_SRCS} ${DAP_CHAIN_NET_HEADERS} ${IPUTILS_SRCS} ${IPUTILS_HEADERS}) add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_NET_SRCS} ${DAP_CHAIN_NET_HEADERS} ${IPUTILS_SRCS} ${IPUTILS_HEADERS})
if(WIN32) if(WIN32)
target_link_libraries(dap_core dap_chain_net dap_crypto dap_client dap_server_core dap_stream_ch_chain dap_stream_ch_chain_net dap_stream_ch_chain_net_srv dap_chain dap_chain_wallet dap_chain_net_srv target_link_libraries(${PROJECT_NAME} dap_core dap_crypto dap_client dap_server_core dap_notify_srv dap_stream_ch_chain dap_stream_ch_chain_net dap_stream_ch_chain_net_srv dap_chain dap_chain_wallet dap_chain_net_srv
dap_chain_mempool dap_chain_global_db dap_chain_cs_none) dap_chain_mempool dap_chain_global_db dap_chain_cs_none)
endif() endif()
......
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