diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/ppl_lcdd/ppl_lcdd.cc | 6 | ||||
-rw-r--r-- | demos/ppl_pips/ppl_pips.cc | 16 |
2 files changed, 13 insertions, 9 deletions
diff --git a/demos/ppl_lcdd/ppl_lcdd.cc b/demos/ppl_lcdd/ppl_lcdd.cc index 744c69669..0ce9dce0a 100644 --- a/demos/ppl_lcdd/ppl_lcdd.cc +++ b/demos/ppl_lcdd/ppl_lcdd.cc @@ -409,21 +409,21 @@ process_options(int argc, char* argv[]) { if (*endptr || l < 0) fatal("a non-negative integer must follow `-C'"); else - max_seconds_of_cpu_time = l; + max_seconds_of_cpu_time = static_cast<unsigned long>(l); break; #endif // defined(PPL_LCDD_SUPPORTS_LIMIT_ON_CPU_TIME) case 'R': { - const int MEGA = 1024*1024; + const unsigned long MEGA = 1024U*1024U; l = strtol(optarg, &endptr, 10); if (*endptr || l < 0) fatal("a non-negative integer must follow `-R'"); else if (static_cast<unsigned long>(l) > ULONG_MAX/MEGA) max_bytes_of_virtual_memory = ULONG_MAX; else - max_bytes_of_virtual_memory = l*MEGA; + max_bytes_of_virtual_memory = static_cast<unsigned long>(l)*MEGA; } break; diff --git a/demos/ppl_pips/ppl_pips.cc b/demos/ppl_pips/ppl_pips.cc index b60d2cead..f5854df0a 100644 --- a/demos/ppl_pips/ppl_pips.cc +++ b/demos/ppl_pips/ppl_pips.cc @@ -282,6 +282,7 @@ public: std::istringstream iss(line); iss >> bignum_column_coding; } + PPL_ASSERT(bignum_column_coding >= -1); PPL::dimension_type num_constraints; PPL::dimension_type constraint_width; @@ -305,9 +306,10 @@ public: } } - PPL::dimension_type bignum_column = (bignum_column_coding == -1) + PPL::dimension_type bignum_column + = (bignum_column_coding == -1) ? PPL::not_a_dimension() - : (num_vars + (bignum_column_coding - 1)); + : (num_vars + PPL::dimension_type(bignum_column_coding - 1)); bool result = update_pip(num_vars, num_params, num_constraints, num_ctx_rows, @@ -349,9 +351,11 @@ public: int bignum_column_coding; in >> bignum_column_coding; - PPL::dimension_type bignum_column = (bignum_column_coding == -1) + PPL_ASSERT(bignum_column_coding >= -1); + PPL::dimension_type bignum_column + = (bignum_column_coding == -1) ? PPL::not_a_dimension() - : (bignum_column_coding - 1); + : PPL::dimension_type(bignum_column_coding - 1); int solve_integer; in >> solve_integer; @@ -647,14 +651,14 @@ process_options(int argc, char* argv[]) { case 'R': { - const int MEGA = 1024*1024; + const unsigned long MEGA = 1024U*1024U; long l = strtol(optarg, &endptr, 10); if (*endptr || l < 0) fatal("a non-negative integer must follow `-R'"); else if (static_cast<unsigned long>(l) > ULONG_MAX/MEGA) max_bytes_of_virtual_memory = ULONG_MAX; else - max_bytes_of_virtual_memory = l*MEGA; + max_bytes_of_virtual_memory = static_cast<unsigned long>(l)*MEGA; } break; |