aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-10-19 19:17:13 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-10-19 19:17:13 +0200
commita3a477870cdbdb4b9c4c8b403c09b13502291234 (patch)
treedb26bc921e48ea8c919f19aa05395f100b854fec /src
parentb80b1b78901154240bc5d2ab6f5ea4465bf7fa67 (diff)
downloadnissy-core-a3a477870cdbdb4b9c4c8b403c09b13502291234.tar.gz
nissy-core-a3a477870cdbdb4b9c4c8b403c09b13502291234.zip
Finished Python module
Diffstat (limited to 'src')
-rw-r--r--src/nissy.c13
-rw-r--r--src/solvers/tables.h3
2 files changed, 11 insertions, 5 deletions
diff --git a/src/nissy.c b/src/nissy.c
index c5cf1d5..793d659 100644
--- a/src/nissy.c
+++ b/src/nissy.c
@@ -71,7 +71,10 @@ checkdata(const char *buf, const tableinfo_t *info)
71{ 71{
72 uint64_t distr[INFO_DISTRIBUTION_LEN]; 72 uint64_t distr[INFO_DISTRIBUTION_LEN];
73 73
74 if (!strncmp(info->solver, "cocsep", 6)) { 74 if (info == NULL) {
75 LOG("checkdata: error reading table info\n");
76 return false;
77 } else if (!strncmp(info->solver, "cocsep", 6)) {
75 getdistribution_cocsep( 78 getdistribution_cocsep(
76 (uint32_t *)((char *)buf + INFOSIZE), distr); 79 (uint32_t *)((char *)buf + INFOSIZE), distr);
77 } else if (!strncmp(info->solver, "h48", 3)) { 80 } else if (!strncmp(info->solver, "h48", 3)) {
@@ -442,21 +445,23 @@ nissy_checkdata(
442{ 445{
443 char *buf; 446 char *buf;
444 tableinfo_t info; 447 tableinfo_t info;
448 int64_t err;
445 449
446 for (buf = (char *)data; 450 for (buf = (char *)data;
447 readtableinfo(data_size, buf, &info); 451 (err = readtableinfo(data_size, buf, &info)) == NISSY_OK;
448 buf += info.next, data_size -= info.next) 452 buf += info.next, data_size -= info.next)
449 { 453 {
450 if (!checkdata(buf, &info)) { 454 if (!checkdata(buf, &info)) {
451 LOG("Error: data for %s is inconsistent with info!\n", 455 LOG("Error: data for solver '%s' is corrupted!\n",
452 info.solver); 456 info.solver);
453 return NISSY_ERROR_DATA; 457 return NISSY_ERROR_DATA;
454 } 458 }
459
455 if (info.next == 0) 460 if (info.next == 0)
456 break; 461 break;
457 } 462 }
458 463
459 return NISSY_OK; 464 return err;
460} 465}
461 466
462long long 467long long
diff --git a/src/solvers/tables.h b/src/solvers/tables.h
index 060b018..3147416 100644
--- a/src/solvers/tables.h
+++ b/src/solvers/tables.h
@@ -35,7 +35,8 @@ readtableinfo(uint64_t buf_size, const char *buf, tableinfo_t *info)
35 35
36 if (buf_size < INFOSIZE) { 36 if (buf_size < INFOSIZE) {
37 LOG("Error reading table: buffer size is too small " 37 LOG("Error reading table: buffer size is too small "
38 "(smaller than INFOSIZE = %" PRId64 ")\n", INFOSIZE); 38 "(given size %" PRIu64 " is smaller than INFOSIZE = %"
39 PRId64 ")\n", buf_size, INFOSIZE);
39 return NISSY_ERROR_BUFFER_SIZE; 40 return NISSY_ERROR_BUFFER_SIZE;
40 } 41 }
41 42

Generated with cgit - Back to sebastiano.tronto.net