fixed some warnings about mixing signed & unsigned integers

This commit is contained in:
Vern Paxson 2023-11-05 13:06:03 -08:00 committed by Arne Welzel
parent 23c08a05de
commit c49918ba8b
6 changed files with 9 additions and 9 deletions

View file

@ -471,7 +471,7 @@ protected:
std::vector<StmtPtr> stmts; std::vector<StmtPtr> stmts;
// Optimization-related: // Optimization-related:
bool ReduceStmt(int& s_i, std::vector<StmtPtr>& f_stmts, Reducer* c); bool ReduceStmt(unsigned int& s_i, std::vector<StmtPtr>& f_stmts, Reducer* c);
void ResetStmts(std::vector<StmtPtr> new_stmts) { stmts = std::move(new_stmts); } void ResetStmts(std::vector<StmtPtr> new_stmts) { stmts = std::move(new_stmts); }
}; };

View file

@ -114,7 +114,7 @@ const char* CPPCompile::TypeName(const TypePtr& t) {
case TYPE_BOOL: return "bool"; case TYPE_BOOL: return "bool";
case TYPE_COUNT: return "zeek_uint_t"; case TYPE_COUNT: return "zeek_uint_t";
case TYPE_DOUBLE: return "double"; case TYPE_DOUBLE: return "double";
case TYPE_ENUM: return "int"; case TYPE_ENUM: return "zeek_int_t";
case TYPE_INT: return "zeek_int_t"; case TYPE_INT: return "zeek_int_t";
case TYPE_INTERVAL: return "double"; case TYPE_INTERVAL: return "double";
case TYPE_PORT: return "zeek_uint_t"; case TYPE_PORT: return "zeek_uint_t";

View file

@ -632,7 +632,7 @@ void StmtList::Inline(Inliner* inl) {
bool StmtList::IsReduced(Reducer* c) const { bool StmtList::IsReduced(Reducer* c) const {
auto n = stmts.size(); auto n = stmts.size();
for ( auto i = 0; i < n; ++i ) { for ( auto i = 0U; i < n; ++i ) {
auto& s_i = stmts[i]; auto& s_i = stmts[i];
if ( ! s_i->IsReduced(c) ) if ( ! s_i->IsReduced(c) )
return false; return false;
@ -650,7 +650,7 @@ StmtPtr StmtList::DoReduce(Reducer* c) {
auto n = stmts.size(); auto n = stmts.size();
for ( auto i = 0; i < n; ++i ) { for ( auto i = 0U; i < n; ++i ) {
if ( ReduceStmt(i, f_stmts, c) ) if ( ReduceStmt(i, f_stmts, c) )
did_change = true; did_change = true;
@ -677,7 +677,7 @@ StmtPtr StmtList::DoReduce(Reducer* c) {
return ThisPtr(); return ThisPtr();
} }
bool StmtList::ReduceStmt(int& s_i, std::vector<StmtPtr>& f_stmts, Reducer* c) { bool StmtList::ReduceStmt(unsigned int& s_i, std::vector<StmtPtr>& f_stmts, Reducer* c) {
bool did_change = false; bool did_change = false;
auto& stmt_i = stmts[s_i]; auto& stmt_i = stmts[s_i];
auto old_stmt = stmt_i.get(); auto old_stmt = stmt_i.get();

View file

@ -182,7 +182,7 @@ UDs UseDefs::PropagateUDs(const Stmt* s, UDs succ_UDs, const Stmt* succ_stmt, bo
const Stmt* succ; const Stmt* succ;
if ( i == stmts.size() - 1 ) { // Very last statement. if ( i == int(stmts.size()) - 1 ) { // Very last statement.
succ = succ_stmt; succ = succ_stmt;
if ( successor2.find(s) != successor2.end() ) if ( successor2.find(s) != successor2.end() )
successor2[s_i] = successor2[s]; successor2[s_i] = successor2[s];

View file

@ -981,7 +981,7 @@ macro EvalIndexVec(index)
zeek_int_t ind = index; zeek_int_t ind = index;
if ( ind < 0 ) if ( ind < 0 )
ind += vv.size(); ind += vv.size();
if ( ind < 0 || ind >= vv.size() ) if ( ind < 0 || ind >= int(vv.size()) )
ZAM_run_time_error(z.loc, "no such index"); ZAM_run_time_error(z.loc, "no such index");
AssignV1(CopyVal(*vec[ind])) AssignV1(CopyVal(*vec[ind]))
@ -998,7 +998,7 @@ macro EvalIndexAnyVec(index)
zeek_int_t ind = index; zeek_int_t ind = index;
if ( ind < 0 ) if ( ind < 0 )
ind += vv->Size(); ind += vv->Size();
if ( ind < 0 || ind >= vv->Size() ) if ( ind < 0 || ind >= int(vv->Size()) )
ZAM_run_time_error(z.loc, "no such index"); ZAM_run_time_error(z.loc, "no such index");
AssignV1(ZVal(vv->ValAt(ind).release())) AssignV1(ZVal(vv->ValAt(ind).release()))

View file

@ -233,7 +233,7 @@ ValPtr ZBody::Exec(Frame* f, StmtFlowType& flow) {
} }
ValPtr ZBody::DoExec(Frame* f, StmtFlowType& flow) { ValPtr ZBody::DoExec(Frame* f, StmtFlowType& flow) {
int pc = 0; unsigned int pc = 0;
// Return value, or nil if none. // Return value, or nil if none.
const ZVal* ret_u = nullptr; const ZVal* ret_u = nullptr;