From 6faf377b5305f9dcc3c7b013c4d67f5accb92617 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 4 Jun 2009 23:21:12 -0700 Subject: types: clean up types, especially signed vs unsigned --- src/sim/serialize.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/sim/serialize.cc') diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc index f73fc93a3..5ae9128e5 100644 --- a/src/sim/serialize.cc +++ b/src/sim/serialize.cc @@ -182,11 +182,11 @@ template void arrayParamOut(ostream &os, const string &name, const vector ¶m) { - int size = param.size(); + typename vector::size_type size = param.size(); os << name << "="; if (size > 0) showParam(os, param[0]); - for (int i = 1; i < size; ++i) { + for (typename vector::size_type i = 1; i < size; ++i) { os << " "; showParam(os, param[i]); } @@ -207,12 +207,12 @@ paramIn(Checkpoint *cp, const string §ion, const string &name, T ¶m) template void -arrayParamOut(ostream &os, const string &name, const T *param, int size) +arrayParamOut(ostream &os, const string &name, const T *param, unsigned size) { os << name << "="; if (size > 0) showParam(os, param[0]); - for (int i = 1; i < size; ++i) { + for (unsigned i = 1; i < size; ++i) { os << " "; showParam(os, param[i]); } @@ -223,7 +223,7 @@ arrayParamOut(ostream &os, const string &name, const T *param, int size) template void arrayParamIn(Checkpoint *cp, const string §ion, const string &name, - T *param, int size) + T *param, unsigned size) { string str; if (!cp->find(section, name, str)) { @@ -244,7 +244,7 @@ arrayParamIn(Checkpoint *cp, const string §ion, const string &name, fatal("Array size mismatch on %s:%s'\n", section, name); } - for (int i = 0; i < tokens.size(); i++) { + for (vector::size_type i = 0; i < tokens.size(); i++) { // need to parse into local variable to handle vector, // for which operator[] returns a special reference class // that's not the same as 'bool&', (since it's a packed @@ -286,7 +286,7 @@ arrayParamIn(Checkpoint *cp, const string §ion, param.resize(tokens.size()); - for (int i = 0; i < tokens.size(); i++) { + for (vector::size_type i = 0; i < tokens.size(); i++) { // need to parse into local variable to handle vector, // for which operator[] returns a special reference class // that's not the same as 'bool&', (since it's a packed @@ -306,8 +306,6 @@ arrayParamIn(Checkpoint *cp, const string §ion, } } - - void objParamIn(Checkpoint *cp, const string §ion, const string &name, SimObject * ¶m) @@ -326,10 +324,10 @@ paramIn(Checkpoint *cp, const string §ion, \ const string &name, type & param); \ template void \ arrayParamOut(ostream &os, const string &name, \ - type const *param, int size); \ + type const *param, unsigned size); \ template void \ arrayParamIn(Checkpoint *cp, const string §ion, \ - const string &name, type *param, int size); \ + const string &name, type *param, unsigned size); \ template void \ arrayParamOut(ostream &os, const string &name, \ const vector ¶m); \ -- cgit v1.2.3