From 743c701a4ebede9c819d2172d0c0deccf6fab6ed Mon Sep 17 00:00:00 2001 From: wannesm Date: Wed, 11 Oct 2023 16:29:42 +0200 Subject: [PATCH] cross-platform compatibility --- pysdd/lib/libsdd-2.0/src/basic/memory.c | 4 ++-- pysdd/lib/libsdd-2.0/src/manager/interface.c | 8 ++++---- pysdd/lib/libsdd-2.0/src/util.c | 4 ++-- pysdd/lib/libsdd-2.0/src/vtrees/static.c | 2 +- pysdd/lib/sdd-2.0/src/fnf/io.c | 4 ++-- setup.py | 3 ++- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/pysdd/lib/libsdd-2.0/src/basic/memory.c b/pysdd/lib/libsdd-2.0/src/basic/memory.c index e634d88..5f1949c 100644 --- a/pysdd/lib/libsdd-2.0/src/basic/memory.c +++ b/pysdd/lib/libsdd-2.0/src/basic/memory.c @@ -84,7 +84,7 @@ SddNode* new_sdd_node(SddNodeType type, SddNodeSize size, Vtree* vtree, SddManag else { //allocate decomposition assert(size > 0); //allocate decomposition node - int bucket = (size < GC_BUCKETS_COUNT? size: 0); + size_t bucket = (size < GC_BUCKETS_COUNT? size: 0); node = manager->gc_node_lists[bucket]; if(node != NULL) { //allocating from gc list --manager->gc_node_count; @@ -156,7 +156,7 @@ void gc_sdd_node(SddNode* node, SddManager* manager) { ++manager->gc_node_count; manager->gc_element_count += node->size; //no change for literal sdds - int bucket = (node->size < GC_BUCKETS_COUNT? node->size: 0); //literal sdds go into bucket 0 + size_t bucket = (node->size < GC_BUCKETS_COUNT? node->size: 0); //literal sdds go into bucket 0 node->next = manager->gc_node_lists[bucket]; manager->gc_node_lists[bucket] = node; //add node to corresponding bucket diff --git a/pysdd/lib/libsdd-2.0/src/manager/interface.c b/pysdd/lib/libsdd-2.0/src/manager/interface.c index a213186..95582fb 100644 --- a/pysdd/lib/libsdd-2.0/src/manager/interface.c +++ b/pysdd/lib/libsdd-2.0/src/manager/interface.c @@ -268,16 +268,16 @@ void sdd_manager_minimize_limited(SddManager* manager) { // these are checked by exceeded_limits(), invoked by l_apply -void sdd_manager_set_vtree_search_time_limit(float time_limit, SddManager* manager) { +void sdd_manager_set_vtree_search_time_limit(clock_t time_limit, SddManager* manager) { manager->vtree_ops.search_time_limit = time_limit*CLOCKS_PER_SEC; } -void sdd_manager_set_vtree_fragment_time_limit(float time_limit, SddManager* manager) { +void sdd_manager_set_vtree_fragment_time_limit(clock_t time_limit, SddManager* manager) { manager->vtree_ops.fragment_time_limit = time_limit*CLOCKS_PER_SEC; } -void sdd_manager_set_vtree_operation_time_limit(float time_limit, SddManager* manager) { +void sdd_manager_set_vtree_operation_time_limit(clock_t time_limit, SddManager* manager) { manager->vtree_ops.op_time_limit = time_limit*CLOCKS_PER_SEC; } -void sdd_manager_set_vtree_apply_time_limit(float time_limit, SddManager* manager) { +void sdd_manager_set_vtree_apply_time_limit(clock_t time_limit, SddManager* manager) { manager->vtree_ops.apply_time_limit = time_limit*CLOCKS_PER_SEC; } void sdd_manager_set_vtree_operation_memory_limit(float memory_limit, SddManager* manager) { diff --git a/pysdd/lib/libsdd-2.0/src/util.c b/pysdd/lib/libsdd-2.0/src/util.c index 978365f..14c3a4b 100644 --- a/pysdd/lib/libsdd-2.0/src/util.c +++ b/pysdd/lib/libsdd-2.0/src/util.c @@ -186,7 +186,7 @@ char* read_file(const char* filename) { // lookup file size // AC: I don't think this is the best way to do this fseek(file,0,SEEK_END); - unsigned int file_size = ftell(file); + size_t file_size = ftell(file); rewind(file); // allocate memory @@ -194,7 +194,7 @@ char* read_file(const char* filename) { CALLOC(buffer,char,file_size+1,"read_file"); // read the whole file - unsigned int result = fread(buffer,sizeof(char),file_size,file); + size_t result = fread(buffer,sizeof(char),file_size,file); if (result != file_size) { printf("Could not read the file %s\n",filename); exit(1); diff --git a/pysdd/lib/libsdd-2.0/src/vtrees/static.c b/pysdd/lib/libsdd-2.0/src/vtrees/static.c index f7b45c6..f2e63a7 100644 --- a/pysdd/lib/libsdd-2.0/src/vtrees/static.c +++ b/pysdd/lib/libsdd-2.0/src/vtrees/static.c @@ -158,7 +158,7 @@ Vtree* new_random_vtree(SddLiteral var_count) { SddLiteral* labels = (SddLiteral*) calloc(var_count,sizeof(SddLiteral)); for(SddLiteral i=0; i