diff options
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/init.cc | 2 | ||||
-rw-r--r-- | src/sim/process.cc | 4 | ||||
-rw-r--r-- | src/sim/process_impl.hh | 2 | ||||
-rw-r--r-- | src/sim/pseudo_inst.cc | 2 | ||||
-rw-r--r-- | src/sim/serialize.cc | 20 | ||||
-rw-r--r-- | src/sim/serialize.hh | 4 | ||||
-rw-r--r-- | src/sim/syscall_emul.hh | 7 | ||||
-rw-r--r-- | src/sim/system.hh | 2 |
8 files changed, 19 insertions, 24 deletions
diff --git a/src/sim/init.cc b/src/sim/init.cc index 1e90f1568..8057c9369 100644 --- a/src/sim/init.cc +++ b/src/sim/init.cc @@ -118,7 +118,7 @@ getCode(const EmbeddedPyModule *pymod) pymod->zlen); if (ret != Z_OK) panic("Could not uncompress code: %s\n", zError(ret)); - assert(unzlen == pymod->mlen); + assert(unzlen == (uLongf)pymod->mlen); return PyMarshal_ReadObjectFromString((char *)marshalled, pymod->mlen); } diff --git a/src/sim/process.cc b/src/sim/process.cc index c45844a51..c12101069 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -575,11 +575,11 @@ LiveProcess::argsInit(int intSize, int pageSize) int argv_array_size = intSize * (argv.size() + 1); int envp_array_size = intSize * (envp.size() + 1); int arg_data_size = 0; - for (int i = 0; i < argv.size(); ++i) { + for (vector<string>::size_type i = 0; i < argv.size(); ++i) { arg_data_size += argv[i].size() + 1; } int env_data_size = 0; - for (int i = 0; i < envp.size(); ++i) { + for (vector<string>::size_type i = 0; i < envp.size(); ++i) { env_data_size += envp[i].size() + 1; } diff --git a/src/sim/process_impl.hh b/src/sim/process_impl.hh index a3519fe39..9d12113d0 100644 --- a/src/sim/process_impl.hh +++ b/src/sim/process_impl.hh @@ -55,7 +55,7 @@ copyStringArray(std::vector<std::string> &strings, TranslatingPort* memPort) { AddrType data_ptr_swap; - for (int i = 0; i < strings.size(); ++i) { + for (std::vector<std::string>::size_type i = 0; i < strings.size(); ++i) { data_ptr_swap = htog(data_ptr); memPort->writeBlob(array_ptr, (uint8_t*)&data_ptr_swap, sizeof(AddrType)); diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc index b5582578a..6182150d4 100644 --- a/src/sim/pseudo_inst.cc +++ b/src/sim/pseudo_inst.cc @@ -178,7 +178,7 @@ loadsymbol(ThreadContext *tc) if (buffer.empty()) continue; - int idx = buffer.find(' '); + string::size_type idx = buffer.find(' '); if (idx == string::npos) continue; 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 <class T> void arrayParamOut(ostream &os, const string &name, const vector<T> ¶m) { - int size = param.size(); + typename vector<T>::size_type size = param.size(); os << name << "="; if (size > 0) showParam(os, param[0]); - for (int i = 1; i < size; ++i) { + for (typename vector<T>::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 <class T> 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 <class T> 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<string>::size_type i = 0; i < tokens.size(); i++) { // need to parse into local variable to handle vector<bool>, // 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<string>::size_type i = 0; i < tokens.size(); i++) { // need to parse into local variable to handle vector<bool>, // 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<type> ¶m); \ diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh index 0069f5614..08240c0c0 100644 --- a/src/sim/serialize.hh +++ b/src/sim/serialize.hh @@ -59,7 +59,7 @@ void paramIn(Checkpoint *cp, const std::string §ion, template <class T> void arrayParamOut(std::ostream &os, const std::string &name, - const T *param, int size); + const T *param, unsigned size); template <class T> void arrayParamOut(std::ostream &os, const std::string &name, @@ -67,7 +67,7 @@ void arrayParamOut(std::ostream &os, const std::string &name, template <class T> void arrayParamIn(Checkpoint *cp, const std::string §ion, - const std::string &name, T *param, int size); + const std::string &name, T *param, unsigned size); template <class T> void arrayParamIn(Checkpoint *cp, const std::string §ion, diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 0d5bf1723..5f2ebd428 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -899,8 +899,7 @@ writevFunc(SyscallDesc *desc, int callnum, LiveProcess *process, uint64_t tiov_base = process->getSyscallArg(tc, 1); size_t count = process->getSyscallArg(tc, 2); struct iovec hiov[count]; - for (int i = 0; i < count; ++i) - { + for (size_t i = 0; i < count; ++i) { typename OS::tgt_iovec tiov; p->readBlob(tiov_base + i*sizeof(typename OS::tgt_iovec), @@ -913,10 +912,8 @@ writevFunc(SyscallDesc *desc, int callnum, LiveProcess *process, int result = writev(process->sim_fd(fd), hiov, count); - for (int i = 0; i < count; ++i) - { + for (size_t i = 0; i < count; ++i) delete [] (char *)hiov[i].iov_base; - } if (result < 0) return -errno; diff --git a/src/sim/system.hh b/src/sim/system.hh index ab88160e2..aa89866bd 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -96,7 +96,7 @@ class System : public SimObject int numContexts() { - assert(_numContexts == threadContexts.size()); + assert(_numContexts == (int)threadContexts.size()); return _numContexts; } |