aboutsummaryrefslogtreecommitdiff
path: root/src/nissy.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/nissy.c13
1 files changed, 9 insertions, 4 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

Generated with cgit - Back to sebastiano.tronto.net